From ef618501bb12e54dff00ea6b587bf6a044052daf Mon Sep 17 00:00:00 2001 From: defacer Date: Fri, 9 Jul 2004 13:39:34 +0000 Subject: [PATCH] Fix for bug 1624: Events that span more than one month now have their duration shown correctly in each day of all subsequent months. For some reason I didn't quite figure out, this happened till now only on events that spanned at least THREE months. Whatever... Also, removed a small unused part of a global statement in view.php. --- calendar/lib.php | 4 ++-- calendar/view.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index 9a39aa5858..cf48e484bb 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -843,7 +843,7 @@ function calendar_events_by_day($events, $month, $year, &$eventsbyday, &$duratio $enddate = usergetdate($event->timestart + $event->timeduration); // Simple arithmetic: $year * 13 + $month is a distinct integer for each distinct ($year, $month) pair - if(!($startdate['year'] * 13 + $startdate['mon'] >= $year * 13 + $month) && ($enddate['year'] * 13 + $enddate['mon'] <= $year * 13 + $month)) { + if(!($startdate['year'] * 13 + $startdate['mon'] <= $year * 13 + $month) && ($enddate['year'] * 13 + $enddate['mon'] >= $year * 13 + $month)) { // Out of bounds continue; } @@ -875,7 +875,7 @@ function calendar_events_by_day($events, $month, $year, &$eventsbyday, &$duratio } // The event starts on $month $year or before. So... - $lowerbound = $startdate['mon'] == $month && $startdate['year'] == $year ? intval($startdate['mday']) : 1; + $lowerbound = $startdate['mon'] == $month && $startdate['year'] == $year ? intval($startdate['mday']) : 0; // Also, it ends on $month $year or later... $upperbound = $enddate['mon'] == $month && $enddate['year'] == $year ? intval($enddate['mday']) : calendar_days_in_month($month, $year); diff --git a/calendar/view.php b/calendar/view.php index 0e475cd207..c420a04644 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -183,7 +183,7 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) { - global $CFG, $THEME, $USER, $db; + global $CFG, $THEME, $USER; if (!checkdate($m, $d, $y)) { $now = usergetdate(time()); -- 2.39.5