From 02d5eba3f8f8e115756e680c6b36e60d1d2c72cf Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Tue, 16 Oct 2007 03:47:41 +0000 Subject: [PATCH] MDL-9059, admins can't see group events in calendar --- blocks/calendar_month/block_calendar_month.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/blocks/calendar_month/block_calendar_month.php b/blocks/calendar_month/block_calendar_month.php index c7dae668fa..ebfa4c0df1 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); @@ -64,6 +70,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; } -- 2.39.5