Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 03-15-2006, 03:58 PM
RobinPriestley RobinPriestley is offline
 
Join Date: Mar 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do I put calendar events in chronological order?

Hello All,

Sorry to duplicate, this is in another place too, but this seems to be the best forum for it.

I would like to know how to make my calendar events appear in chronological order within a day. At the moment they seem to turn up in the order that I input them, as opposed to the order they happen. For example today I have:

Wednesday 15
19:45 King Kong
14:40 The New World
17:45 Wallace & Grommet Curse of the Ware Rabbit
13:00 Corpse Bride

I guess that an "ORDER by dateline_from" bit in the MySQL query that makes today's events would sort it out, but I don't know where (or how) to do this.

If anyone could help it would be really really appreciated.

Thanks in advance.
Reply With Quote
  #2  
Old 07-12-2006, 09:25 AM
Thoki Thoki is offline
 
Join Date: Feb 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Found it:
Open ./includes/functions_calendar.php and search:
PHP Code:
    $events $vbulletin->db->query_read("
        SELECT event.*,
        user.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,
        IF(dateline_to = 0, 1, 0) AS singleday
        " 
iif($vbulletin->userinfo['userid'], ", subscribeevent.eventid AS subscribed") . "
        FROM " 
TABLE_PREFIX "event AS event
        LEFT JOIN " 
TABLE_PREFIX "user AS user ON (user.userid = event.userid)
        " 
iif($vbulletin->userinfo['userid'], "LEFT JOIN " TABLE_PREFIX "subscribeevent AS subscribeevent ON (subscribeevent.eventid = event.eventid AND subscribeevent.userid = " $vbulletin->userinfo['userid'] . ")") . "
        WHERE calendarid = 
$calendarinfo[calendarid] AND
            ((dateline_to >= 
$beginday AND dateline_from < $endday) OR (dateline_to = 0 AND dateline_from >= $beginday AND dateline_from <= $endday ))    AND
            visible = 1
    "
);
    
// Cache Events 
?ndert das in:
PHP Code:
    $events $vbulletin->db->query_read("
        SELECT event.*,
        user.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,
        IF(dateline_to = 0, 1, 0) AS singleday
        " 
iif($vbulletin->userinfo['userid'], ", subscribeevent.eventid AS subscribed") . "
        FROM " 
TABLE_PREFIX "event AS event
        LEFT JOIN " 
TABLE_PREFIX "user AS user ON (user.userid = event.userid)
        " 
iif($vbulletin->userinfo['userid'], "LEFT JOIN " TABLE_PREFIX "subscribeevent AS subscribeevent ON (subscribeevent.eventid = event.eventid AND subscribeevent.userid = " $vbulletin->userinfo['userid'] . ")") . "
        WHERE calendarid = 
$calendarinfo[calendarid] AND
            ((dateline_to >= 
$beginday AND dateline_from < $endday) OR (dateline_to = 0 AND dateline_from >= $beginday AND dateline_from <= $endday ))    AND
            visible = 1
            ORDER BY dateline_from
    "
);
    
// Cache Events 
HP! :-)

--
Thoki
Reply With Quote
  #3  
Old 07-13-2006, 02:10 PM
RobinPriestley RobinPriestley is offline
 
Join Date: Mar 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a bunch that is perfect, it works a treat!
Reply With Quote
  #4  
Old 07-15-2006, 08:02 AM
hardfm hardfm is offline
 
Join Date: May 2006
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i also had this problem, only this code does not work perfect for me
this is becouse we have Recurring Event that start/end with different
dates. so
event1 is from jan 10th till feb 10th - 6pm till 8pm
event2 is from jan 20th till feb 20th - 4pm till 5pm
event3 is from jan 5th till march 30th - 5pm till 6pm

on this way it shows always event3 first, then event1 and as last event1 (when the events are recurring every x day)

so the question is actualy if its possible to sort the events by the time/hour on the day of the event.
Reply With Quote
  #5  
Old 07-16-2006, 06:26 AM
Thoki Thoki is offline
 
Join Date: Feb 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hardfm,
you´re right. With recurring events this "quick hack" doesn´t work.
But I´m not the expert.
May somebody help us with this problem?

--
Thoki
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:36 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.12726 seconds
  • Memory Usage 2,209KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete