]> git.mjollnir.org Git - moodle.git/commitdiff
Merged fox for bug 1991 to head
authormoodler <moodler>
Sat, 25 Sep 2004 15:19:40 +0000 (15:19 +0000)
committermoodler <moodler>
Sat, 25 Sep 2004 15:19:40 +0000 (15:19 +0000)
lib/datalib.php

index 8f962f7729dc5885a9a82b57b21c8dadfb9b79a0..f21a833ebfec8e97a34b22922af15592d4a9eeee 100644 (file)
@@ -1456,9 +1456,11 @@ function get_course_teachers($courseid, $sort='t.authority ASC', $exceptions='')
     global $CFG;
 
     if (!empty($exceptions)) {
-        $except = ' AND u.id NOT IN ('. $exceptions .') ';
-    } else {
-        $except = '';
+        $exceptions = ' AND u.id NOT IN ('. $exceptions .') ';
+    }
+
+    if (!empty($sort)) {
+        $sort = ' ORDER by '.$sort;
     }
 
     return get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.maildisplay, u.mailformat, u.maildigest,
@@ -1467,8 +1469,7 @@ function get_course_teachers($courseid, $sort='t.authority ASC', $exceptions='')
                             FROM {$CFG->prefix}user u,
                                  {$CFG->prefix}user_teachers t
                             WHERE t.course = '$courseid' AND t.userid = u.id
-                              AND u.deleted = '0' AND u.confirmed = '1' $except
-                            ORDER BY $sort");
+                              AND u.deleted = '0' AND u.confirmed = '1' $exceptions $sort");
 }
 
 /**
@@ -2675,4 +2676,4 @@ function print_object($object) {
 
 
 // vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
-?>
\ No newline at end of file
+?>