diff --git a/blocks/calendar_month/block_calendar_month.php b/blocks/calendar_month/block_calendar_month.php index dd5debbc8a1..b43cae392da 100644 --- a/blocks/calendar_month/block_calendar_month.php +++ b/blocks/calendar_month/block_calendar_month.php @@ -45,6 +45,12 @@ class block_calendar_month extends block_base { // We 'll need this later calendar_set_referring_course($courseshown); + // MDL-9059, set to show this course when admins go into a course, then unset it. + if ($COURSE->id != SITEID && !isset($SESSION->cal_courses_shown[$COURSE->id]) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) { + $courseset = true; + $SESSION->cal_courses_shown[$COURSE->id] = $COURSE; + } + // Be VERY careful with the format for default courses arguments! // Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions. calendar_set_filters($courses, $group, $user, $filtercourse, $filtercourse); @@ -63,6 +69,11 @@ class block_calendar_month extends block_base { $this->content->text .= '
'.calendar_filter_controls('course', '', $COURSE).'
'; } + + // MDL-9059, unset this so that it doesn't stay in session + if ($courseset) { + unset($SESSION->cal_courses_shown[$COURSE->id]); + } return $this->content; }