From: mjollnir_ Date: Mon, 22 Nov 2004 03:17:49 +0000 (+0000) Subject: Merged from MOODLE_14_STABLE: Fix for calendar set filters to not query the database... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=da862d410fb26fa2664f4db474400945f4898207;p=moodle.git Merged from MOODLE_14_STABLE: Fix for calendar set filters to not query the database for groups of a course if it doesn't use groups --- diff --git a/calendar/lib.php b/calendar/lib.php index 0c1fc168fc..e563c1a151 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -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