From 3cb9ee3949a0636c83579ee204b59bf4387cc6a3 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 24 May 2004 01:28:28 +0000 Subject: [PATCH] Fix for bug 1442 - notices - course is now properly passed to calendar_filter_controls from block --- blocks/calendar_month/block_calendar_month.php | 16 ++++++++-------- calendar/lib.php | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/blocks/calendar_month/block_calendar_month.php b/blocks/calendar_month/block_calendar_month.php index f8997f0f37..be2a99a0b1 100644 --- a/blocks/calendar_month/block_calendar_month.php +++ b/blocks/calendar_month/block_calendar_month.php @@ -15,7 +15,7 @@ class CourseBlock_calendar_month extends MoodleBlock { require_once($CFG->dirroot.'/calendar/lib.php'); - if($this->content !== NULL) { + if ($this->content !== NULL) { return $this->content; } @@ -23,12 +23,12 @@ class CourseBlock_calendar_month extends MoodleBlock { $this->content->text = ''; $this->content->footer = ''; - if($this->course === NULL) { + if ($this->course === NULL) { // Overrides: use no course at all $courseshown = false; $filtercourse = array(); - } - else { + + } else { $courseshown = $this->course->id; $filtercourse = array($courseshown => 1); } @@ -55,19 +55,19 @@ class CourseBlock_calendar_month extends MoodleBlock { calendar_set_filters($courses, $group, $user, $filtercourse, $filtercourse); - if($courseshown == 1) { + if ($courseshown == 1) { // For the front page $this->content->text .= calendar_overlib_html(); $this->content->text .= calendar_top_controls('frontpage', array('m' => $_GET['cal_m'], 'y' => $_GET['cal_y'])); $this->content->text .= calendar_get_mini($courses, $group, $user, $_GET['cal_m'], $_GET['cal_y']); // No filters for now - } - else { + + } else { // For any other course $this->content->text .= calendar_overlib_html(); $this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $_GET['cal_m'], 'y' => $_GET['cal_y'])); $this->content->text .= calendar_get_mini($courses, $group, $user, $_GET['cal_m'], $_GET['cal_y']); - $this->content->text .= calendar_filter_controls('course'); + $this->content->text .= calendar_filter_controls('course', '', $this->course); } return $this->content; diff --git a/calendar/lib.php b/calendar/lib.php index 27810e821d..b5e47c5f8c 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -559,10 +559,11 @@ function calendar_top_controls($type, $data) { return $content; } -function calendar_filter_controls($type, $vars = NULL) { +function calendar_filter_controls($type, $vars = NULL, $course = NULL) { global $CFG, $SESSION, $USER; $groupevents = true; + $getvars = ''; switch($type) { case 'upcoming': @@ -573,13 +574,13 @@ function calendar_filter_controls($type, $vars = NULL) { break; case 'course': $getvars = '&from=course&id='.$_GET['id']; - if($course->groupmode == NOGROUPS && $course->groupmodeforce) { + if (isset($course->groupmode) and !$course->groupmode and $course->groupmodeforce) { $groupevents = false; } break; } - if(!empty($vars)) { + if (!empty($vars)) { $getvars .= '&'.$vars; } -- 2.39.5