]> git.mjollnir.org Git - moodle.git/commitdiff
lib/deprecatedlib: use sort_by_roleassignment_authority() to sort RAs
authormartinlanghoff <martinlanghoff>
Sun, 6 Jan 2008 23:25:51 +0000 (23:25 +0000)
committermartinlanghoff <martinlanghoff>
Sun, 6 Jan 2008 23:25:51 +0000 (23:25 +0000)
After calling get_users_by_capability(), use
sort_by_roleassignment_authority() to mimic what older versions of
Moodle did.

Affects: get_teacher(), get_course_teachers()

    MDL-12452

lib/deprecatedlib.php

index 75cd1e50e66527298388f0a7695e1284c2a5f98b..b723804519c236f00e4251a85081fbc038243ece 100644 (file)
@@ -518,6 +518,7 @@ function get_teacher($courseid) {
     // Pass $view=true to filter hidden caps if the user cannot see them
     if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC',
                                          '', '', '', '', false, true)) {
+        $users = sort_by_roleassignment_authority($users, $context);
         return array_shift($users);
     }
 
@@ -743,7 +744,11 @@ function get_course_teachers($courseid, $sort='t.authority ASC', $exceptions='')
         }
     }
 
-    return get_users_by_capability($context, 'moodle/course:update', 'u.*, ul.timeaccess as lastaccess', $sort, '','','',$exceptions, false);
+    $users = get_users_by_capability($context, 'moodle/course:update',
+                                     'u.*, ul.timeaccess as lastaccess',
+                                     $sort, '','','',$exceptions, false);
+    return sort_by_roleassignment_authority($users, $context);
+
     /// some fields will be missing, like authority, editall
     /*
     return get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.maildisplay, u.mailformat, u.maildigest,