]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from MOODLE_14_STABLE: Fix for calendar set filters to not query the database...
authormjollnir_ <mjollnir_>
Mon, 22 Nov 2004 03:17:49 +0000 (03:17 +0000)
committermjollnir_ <mjollnir_>
Mon, 22 Nov 2004 03:17:49 +0000 (03:17 +0000)
calendar/lib.php

index 0c1fc168fc31a535a7c0121f0665c7c16105ab3e..e563c1a1512e2e78432978fa0e86dae8751c9342 100644 (file)
@@ -999,9 +999,14 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU
         foreach($groupcourses as $courseid) {
             // If the user is an editing teacher in there,
             if(!empty($USER->id) && isteacheredit($courseid, $USER->id)) {
-                // Show events from all groups
-                if(($grouprecords = get_groups($courseid)) !== false) {
-                    $grouparray = array_merge($grouparray, array_keys($grouprecords));
+                if (isset($courses[$courseid])) {
+                    $checkcourse = $courses[$courseid];
+                    if (!empty($checkcourse->groupmode)) {
+                        // Show events from all groups
+                        if(($grouprecords = get_groups($courseid)) !== false) {
+                            $grouparray = array_merge($grouparray, array_keys($grouprecords));
+                        }
+                    }
                 }
             }
             // Otherwise show events from the group he is a member of