MDL-46517 calendar: adjust display for DST

Thanks to Jo Matthews for providing a patch
This commit is contained in:
Marina Glancy 2014-10-29 10:30:54 +08:00
parent 91465b5095
commit a0ef87de1f
2 changed files with 6 additions and 6 deletions

View file

@ -932,8 +932,8 @@ function calendar_top_controls($type, $data) {
case 'day': case 'day':
$days = calendar_get_days(); $days = calendar_get_days();
$prevtimestamp = $time - DAYSECS; $prevtimestamp = strtotime('-1 day', $time);
$nexttimestamp = $time + DAYSECS; $nexttimestamp = strtotime('+1 day', $time);
$prevdate = $calendartype->timestamp_to_date_array($prevtimestamp); $prevdate = $calendartype->timestamp_to_date_array($prevtimestamp);
$nextdate = $calendartype->timestamp_to_date_array($nexttimestamp); $nextdate = $calendartype->timestamp_to_date_array($nexttimestamp);
@ -1679,7 +1679,7 @@ function calendar_format_event_time($event, $now, $linkparams = null, $usecommon
$timeend = calendar_time_representation($event->timestart + $event->timeduration); $timeend = calendar_time_representation($event->timestart + $event->timeduration);
// Set printable representation. // Set printable representation.
if ($now >= $usermidnightstart && $now < ($usermidnightstart + DAYSECS)) { if ($now >= $usermidnightstart && $now < strtotime('+1 day', $usermidnightstart)) {
$url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), 0, 0, 0, $endtime); $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), 0, 0, 0, $endtime);
$eventtime = $timestart . ' <strong>&raquo;</strong> ' . html_writer::link($url, $dayend) . $timeend; $eventtime = $timestart . ' <strong>&raquo;</strong> ' . html_writer::link($url, $dayend) . $timeend;
} else { } else {
@ -2775,7 +2775,7 @@ class calendar_information {
* @return int tomorrow timestamp * @return int tomorrow timestamp
*/ */
public function timestamp_tomorrow() { public function timestamp_tomorrow() {
return $this->time + DAYSECS; return strtotime('+1 day', $this->time);
} }
/** /**
* Adds the pretend blocks for the calendar * Adds the pretend blocks for the calendar

View file

@ -498,9 +498,9 @@ class core_calendar_renderer extends plugin_renderer_base {
$weekend = intval($CFG->calendar_weekend); $weekend = intval($CFG->calendar_weekend);
} }
$daytime = $display->tstart - DAYSECS; $daytime = strtotime('-1 day', $display->tstart);
for ($day = 1; $day <= $display->maxdays; ++$day, ++$dayweek) { for ($day = 1; $day <= $display->maxdays; ++$day, ++$dayweek) {
$daytime = $daytime + DAYSECS; $daytime = strtotime('+1 day', $daytime);
if($dayweek > $display->maxwday) { if($dayweek > $display->maxwday) {
// We need to change week (table row) // We need to change week (table row)
$table->data[] = $row; $table->data[] = $row;