]> git.mjollnir.org Git - moodle.git/commitdiff
calendar: fixed group event display when only one course being viewed
authormartinlanghoff <martinlanghoff>
Sun, 6 May 2007 04:38:24 +0000 (04:38 +0000)
committermartinlanghoff <martinlanghoff>
Sun, 6 May 2007 04:38:24 +0000 (04:38 +0000)
Author: Matt Clarkson <mattc@catalyst.net.nz>

calendar/lib.php

index 08565a562b1882a09af7cb6f62d5cfd107a87799..5c43b3b020dee661fe39cf4fc5b03a73f903d21e 100644 (file)
@@ -1145,7 +1145,13 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU
                 // If the user is an editing teacher in there,
                 if(!empty($USER->id) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, $courseid))) {
                     // If this course has groups, show events from all of them
-                    if(isset($SESSION->cal_courses_shown[$courseid]) && ($SESSION->cal_courses_shown[$courseid]->groupmode != NOGROUPS || !$SESSION->cal_courses_shown[$courseid]->groupmodeforce)) {
+                    if(is_int($groupeventsfrom)) {
+                        $courserecord = get_record('course', 'id', $courseid);
+                        if ($courserecord->groupmode != NOGROUPS || !$courserecord->groupmodeforce) {
+                            $groupids[] = $courseid;
+                        }
+                    }
+                    else if(isset($SESSION->cal_courses_shown[$courseid]) && ($SESSION->cal_courses_shown[$courseid]->groupmode != NOGROUPS || !$SESSION->cal_courses_shown[$courseid]->groupmodeforce)) {
                         $groupids[] = $courseid;
                     }
                 }