From dab9f47075503e409c60ea219e14fdffb32de333 Mon Sep 17 00:00:00 2001 From: defacer Date: Tue, 11 May 2004 07:01:17 +0000 Subject: [PATCH] Fix for bug 1363: Now clicking on an event time in the "upcoming" block always takes you to the correct date in the calendar. Martin, you were right. Too much was going on. Once too much! ;-) --- calendar/lib.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index 5aab0ff14f..ae9cf75377 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -275,17 +275,9 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve foreach($events as $event) { if($processed >= $display->maxevents) break; - // Important note: these timestamps will receive an offset before being converted - // to human-readable form in the calendar_get_XXX_representation() functions. $startdate = usergetdate($event->timestart); $enddate = usergetdate($event->timestart + $event->timeduration); - // It is equally important that we offset them manually to get the correct dates - // for the link URL parameters before creating the links! - $tzfix = calendar_get_tz_offset(); - $linkstartdate = usergetdate($event->timestart + $tzfix); - $linkenddate = usergetdate($event->timestart + $event->timeduration + $tzfix); - $starttimesecs = $event->timestart % SECS_IN_DAY; // Seconds after that day's midnight $starttimedays = $event->timestart - $starttimesecs; // Timestamp of midnight of that day @@ -310,7 +302,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve // This var always has the printable time representation $eventtime = ''.get_string('expired', 'calendar').' '. - calendar_get_link_tag($day, CALENDAR_URL.'view.php?view=day&', $linkenddate['mday'], $linkenddate['mon'], $linkenddate['year']).' ('.$time.')'; + calendar_get_link_tag($day, CALENDAR_URL.'view.php?view=day&', $enddate['mday'], $enddate['mon'], $enddate['year']).' ('.$time.')'; } else if($event->timeduration) { // It has a duration @@ -321,7 +313,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve $timeend = calendar_time_representation($event->timestart + $event->timeduration); // Set printable representation - $eventtime = calendar_get_link_tag($day, CALENDAR_URL.'view.php?view=day&', $linkenddate['mday'], $linkenddate['mon'], $linkenddate['year']). + $eventtime = calendar_get_link_tag($day, CALENDAR_URL.'view.php?view=day&', $enddate['mday'], $enddate['mon'], $enddate['year']). ' ('.$timestart.' - '.$timeend.')'; } else { @@ -332,8 +324,8 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve $timeend = calendar_time_representation($event->timestart + $event->timeduration); // Set printable representation - $eventtime = calendar_get_link_tag($daystart, CALENDAR_URL.'view.php?view=day&', $linkstartdate['mday'], $linkstartdate['mon'], $linkstartdate['year']). - ' ('.$timestart.') - '.calendar_get_link_tag($dayend, CALENDAR_URL.'view.php?view=day&', $linkenddate['mday'], $linkenddate['mon'], $linkenddate['year']). + $eventtime = calendar_get_link_tag($daystart, CALENDAR_URL.'view.php?view=day&', $startdate['mday'], $startdate['mon'], $startdate['year']). + ' ('.$timestart.') - '.calendar_get_link_tag($dayend, CALENDAR_URL.'view.php?view=day&', $enddate['mday'], $enddate['mon'], $enddate['year']). ' ('.$timeend.')'; } } @@ -343,7 +335,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve $time = calendar_time_representation($event->timestart); // Set printable representation - $eventtime = calendar_get_link_tag($day, CALENDAR_URL.'view.php?view=day&', $linkstartdate['mday'], $linkstartdate['mon'], $linkstartdate['year']).' ('.$time.')'; + $eventtime = calendar_get_link_tag($day, CALENDAR_URL.'view.php?view=day&', $startdate['mday'], $startdate['mon'], $startdate['year']).' ('.$time.')'; } $outkey = count($output); -- 2.39.5