]> git.mjollnir.org Git - moodle.git/commitdiff
datalib:get_courses_wmanagers() handle empty $CFG->coursemanager more gracefully
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:54:23 +0000 (07:54 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:54:23 +0000 (07:54 +0000)
Having no roles set as coursemanager is a valid setting.
get_courses_wmanagers() should not produce invalid SQL on it...
actually, it should not even try to get the course managers.

lib/datalib.php

index 4601662ee818b9159fe0df0e95f8a514e7cae004..87da06debdf841c197d1a6403b4fdbc0fea8c8ae 100644 (file)
@@ -698,6 +698,11 @@ function get_courses_wmanagers($categoryid=0, $sort="c.sortorder ASC", $fields=a
         return array(); // no courses!
     }
 
+    $CFG->coursemanager = trim($CFG->coursemanager);
+    if (empty($CFG->coursemanager)) {
+        return $courses;
+    }
+
     $managerroles = split(',', $CFG->coursemanager);
     $catctxids = '';
     if (count($managerroles)) {