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

This commit is contained in:
mjollnir_
2004-11-22 03:17:49 +00:00
parent 911378628f
commit da862d410f
+8 -3
View 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