diff --git a/calendar/classes/external/footer_options_exporter.php b/calendar/classes/external/footer_options_exporter.php index 9cce687012b..5d7f198fecb 100644 --- a/calendar/classes/external/footer_options_exporter.php +++ b/calendar/classes/external/footer_options_exporter.php @@ -72,8 +72,8 @@ class footer_options_exporter extends exporter { * @return \single_button The export calendar button html. */ protected function get_export_calendar_button() { - $exportcalendarurl = new moodle_url('/calendar/export.php', ['course' => $this->calendar->course->id]); - return new \single_button($exportcalendarurl, get_string('exportcalendar', 'calendar')); + $exportcalendarurl = new moodle_url('/calendar/export.php', $this->get_link_params()); + return new \single_button($exportcalendarurl, get_string('exportcalendar', 'calendar'), 'get'); } /** @@ -83,13 +83,30 @@ class footer_options_exporter extends exporter { */ protected function get_manage_subscriptions_button() { if (calendar_user_can_add_event($this->calendar->course)) { - $managesubscriptionurl = new moodle_url('/calendar/managesubscriptions.php', - ['course' => $this->calendar->course->id]); + $managesubscriptionurl = new moodle_url('/calendar/managesubscriptions.php', $this->get_link_params()); return new \single_button($managesubscriptionurl, - get_string('managesubscriptions', 'calendar')); + get_string('managesubscriptions', 'calendar'), 'get'); } } + /** + * Get the list of URL parameters for calendar links. + * + * @return array + */ + protected function get_link_params() { + $params = []; + if (SITEID !== $this->calendar->course->id) { + $params['course'] = $this->calendar->course->id; + } else if (null !== $this->calendar->categoryid && $this->calendar->categoryid > 0) { + $params['category'] = $this->calendar->categoryid; + } else { + $params['course'] = SITEID; + } + + return $params; + } + /** * Get the additional values to inject while exporting. * diff --git a/version.php b/version.php index 4857adba0ca..94372c09108 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2017110200.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2017110200.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes.