Fix for bug 1442
authormoodler <moodler>
Mon, 24 May 2004 01:28:28 +0000 (01:28 +0000)
committermoodler <moodler>
Mon, 24 May 2004 01:28:28 +0000 (01:28 +0000)
   - notices
   - course is now properly passed to calendar_filter_controls from block

blocks/calendar_month/block_calendar_month.php
calendar/lib.php

index f8997f0f37ddfb35850f8c621a93375489003d67..be2a99a0b17f7f696c0edb4a4412b5afd7c291b1 100644 (file)
@@ -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;
index 27810e821de292b73836ad897abce71e19ba8839..b5e47c5f8ca498b33702e6a14a2da8665e956a36 100644 (file)
@@ -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 = '&amp;from=course&amp;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 .= '&amp;'.$vars;
     }