vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I put calendar events in chronological order? (https://vborg.vbsupport.ru/showthread.php?t=110460)

RobinPriestley 03-15-2006 03:58 PM

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.

Thoki 07-12-2006 09:25 AM

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

RobinPriestley 07-13-2006 02:10 PM

Thanks a bunch that is perfect, it works a treat! :)

hardfm 07-15-2006 08:02 AM

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.

Thoki 07-16-2006 06:26 AM

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


All times are GMT. The time now is 05:04 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00965 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete