]> git.mjollnir.org Git - moodle.git/commitdiff
Merging from MOODLE_16_STABLE:
authordefacer <defacer>
Tue, 27 Feb 2007 13:59:43 +0000 (13:59 +0000)
committerdefacer <defacer>
Tue, 27 Feb 2007 13:59:43 +0000 (13:59 +0000)
Bugfix: skodak's fix for MDL-5991 is needed here as well.

calendar/view.php

index 7576aa446bddf1cd2ce77b23237a93567fe4fcdd..2f83fe30c3026ed32946ff3eb270ed7afd7964ea 100644 (file)
@@ -325,9 +325,15 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
     list($d, $m, $y) = array($date['mday'], $date['mon'], $date['year']); // This is what we want to display
     $display->maxdays = calendar_days_in_month($m, $y);
 
-    // We 'll keep these values as GMT here, and offset them when the time comes to query the db
-    $display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
-    $display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
+    if (get_user_timezone_offset() < 99) {
+        // We 'll keep these values as GMT here, and offset them when the time comes to query the db
+        $display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
+        $display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
+    } else {
+        // no timezone info specified
+        $display->tstart = mktime(0, 0, 0, $m, 1, $y);
+        $display->tend = mktime(23, 59, 59, $m, $display->maxdays, $y);
+    }
 
     $startwday = gmdate('w', $display->tstart); // $display->tstart is already GMT, so don't use date(): messes with server's TZ