]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13642 - re-added the proper query limits
authorscyrma <scyrma>
Tue, 26 Feb 2008 05:08:53 +0000 (05:08 +0000)
committerscyrma <scyrma>
Tue, 26 Feb 2008 05:08:53 +0000 (05:08 +0000)
tag/lib.php
tag/locallib.php

index d6c256751f2f4d0e26337bc708746a298bad86a8..b6994dafc5390723fc8ead5b4a3baf576ef6f726 100644 (file)
@@ -130,9 +130,11 @@ function tag_display_name($tag_object) {
  * @param string $tag tag to look for
  * @param string $type type to restrict search to.  If null, every matching
  *     record will be returned
+ * @param int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set).
+ * @param int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set).
  * @return array of matching objects, indexed by record id, from the table containing the type requested
  */
-function tag_find_records($tag, $type) {
+function tag_find_records($tag, $type, $limitfrom='', $limitnum='') {
     
     global $CFG;
 
@@ -146,7 +148,7 @@ function tag_find_records($tag, $type) {
         "FROM {$CFG->prefix}{$type} it INNER JOIN {$CFG->prefix}tag_instance tt ON it.id = tt.itemid ".
         "WHERE tt.itemtype = '{$type}' AND tt.tagid = '{$tagid}'";
     
-    return get_records_sql($query); 
+    return get_records_sql($query, $limitfrom, $limitnum); 
 }
 
 /**
index 8cd195a70b70d5f0f6b182b5fe34f018af4bc177..0ceea95c86d52d9df21fd0dfd8bf68180484b1ea 100644 (file)
@@ -286,7 +286,7 @@ function tag_print_search_results($query,  $page, $perpage, $return=false) {
 function tag_print_tagged_users_table($tag_object, $limitfrom='' , $limitnum='', $return=false) {
 
     //List of users with this tag
-    $userlist = tag_find_records($tag_object->name, 'user');
+    $userlist = tag_find_records($tag_object->name, 'user', $limitfrom, $limitnum);
 
     $output = tag_print_user_list($userlist, true);