From: defacer Date: Tue, 7 Sep 2004 10:31:18 +0000 (+0000) Subject: Merging patch for improved calendar block behavior from MOODLE_14_STABLE. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=de79ec4550c881b092fa3a1bd362d3e5b0a41616;p=moodle.git Merging patch for improved calendar block behavior from MOODLE_14_STABLE. --- diff --git a/blocks/calendar_month/block_calendar_month.php b/blocks/calendar_month/block_calendar_month.php index 667ede4ff6..130409f209 100644 --- a/blocks/calendar_month/block_calendar_month.php +++ b/blocks/calendar_month/block_calendar_month.php @@ -24,11 +24,23 @@ class CourseBlock_calendar_month extends MoodleBlock { $this->content->footer = ''; if (empty($this->course)) { // Overrides: use no course at all + $courseshown = false; $filtercourse = array(); + } else { + $courseshown = $this->course->id; - $filtercourse = array($courseshown => 1); + + if($this->course->id == SITEID) { + // Being displayed at site level. This will cause the filter to fall back to auto-detecting + // the list of courses it will be grabbing events from. + $filtercourse = NULL; + } + else { + // Forcibly filter events to include only those from the particular course we are in. + $filtercourse = array($courseshown => 1); + } } // We 'll need this later diff --git a/blocks/calendar_upcoming/block_calendar_upcoming.php b/blocks/calendar_upcoming/block_calendar_upcoming.php index bcfcccc62d..752888762f 100644 --- a/blocks/calendar_upcoming/block_calendar_upcoming.php +++ b/blocks/calendar_upcoming/block_calendar_upcoming.php @@ -22,19 +22,31 @@ class CourseBlock_calendar_upcoming extends MoodleBlock { $this->content = New object; $this->content->text = ''; - if (empty($this->course)) { // Overrides: use no course at all + if (empty($this->course)) { // Overrides: use no course at all + $courseshown = false; $filtercourse = array(); $this->content->footer = ''; + } else { + $courseshown = $this->course->id; - $filtercourse = array($courseshown => 1); $this->content->footer = '
'. get_string('gotocalendar', 'calendar').'...'; $this->content->footer .= '
'. get_string('newevent', 'calendar').'...'; + + if($this->course->id == SITEID) { + // Being displayed at site level. This will cause the filter to fall back to auto-detecting + // the list of courses it will be grabbing events from. + $filtercourse = NULL; + } + else { + // Forcibly filter events to include only those from the particular course we are in. + $filtercourse = array($courseshown => 1); + } } // We 'll need this later