From 7287834c1183d44097bc193d2f934452da80223a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Sat, 25 Jan 2020 00:56:33 +0100 Subject: [PATCH] MDL-66875 calendar: allow the use of day, mon and year again. --- calendar/view.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/calendar/view.php b/calendar/view.php index 33deb9ada3a..0b9adfc8c01 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -52,11 +52,23 @@ require_once($CFG->dirroot.'/calendar/lib.php'); $categoryid = optional_param('category', null, PARAM_INT); $courseid = optional_param('course', SITEID, PARAM_INT); $view = optional_param('view', 'upcoming', PARAM_ALPHA); +$day = optional_param('cal_d', 0, PARAM_INT); +$mon = optional_param('cal_m', 0, PARAM_INT); +$year = optional_param('cal_y', 0, PARAM_INT); $time = optional_param('time', 0, PARAM_INT); $lookahead = optional_param('lookahead', null, PARAM_INT); $url = new moodle_url('/calendar/view.php'); +// If a day, month and year were passed then convert it to a timestamp. If these were passed +// then we can assume the day, month and year are passed as Gregorian, as no where in core +// should we be passing these values rather than the time. This is done for BC. +if (!empty($day) && !empty($mon) && !empty($year)) { + if (checkdate($mon, $day, $year)) { + $time = make_timestamp($year, $mon, $day); + } +} + if (empty($time)) { $time = time(); }