]> git.mjollnir.org Git - moodle.git/commitdiff
Changed the get_users_by_capability() function to work with
authorstronk7 <stronk7>
Tue, 5 Sep 2006 18:55:16 +0000 (18:55 +0000)
committerstronk7 <stronk7>
Tue, 5 Sep 2006 18:55:16 +0000 (18:55 +0000)
1.7 DB compatible limit sentences.

lib/accesslib.php

index 71a88dcfb29260f2ef2acee72dc80121a124491f..fb533b37d3f4871f13511e733ee72ddb1b11b68f 100755 (executable)
@@ -2000,8 +2000,10 @@ function get_overridable_roles ($context) {
  * @param $capability - string capability
  * @param $fields - fields to be pulled
  * @param $sort - the sort order
+ * @param $limitfrom - number of records to skip (offset)
+ * @param $limitnum - number of records to fetch 
  */
-function get_users_by_capability($context, $capability, $fields='distinct u.*', $sort='', $limit='') {
+function get_users_by_capability($context, $capability, $fields='distinct u.*', $sort='', $limitfrom='', $limitnum='') {
     
     global $CFG;
     
@@ -2028,7 +2030,7 @@ function get_users_by_capability($context, $capability, $fields='distinct u.*',
     $from   = ' FROM '.$CFG->prefix.'user u LEFT JOIN '.$CFG->prefix.'role_assignments ra ON ra.userid = u.id ';
     $where  = ' WHERE (ra.contextid = '.$context->id.' OR ra.contextid in '.$listofcontexts.') AND u.deleted = 0 AND ra.roleid in '.$roleids.' ';    
 
-    return get_records_sql($select.$from.$where.$sort.$limit);  
+    return get_records_sql($select.$from.$where.$sort, $limitfrom, $limitnum);  
 
 }