MDL-13642 - re-added the proper query limits

This commit is contained in:
scyrma
2008-02-26 05:08:53 +00:00
parent 2f9ba531bf
commit 2dc038ffb5
2 changed files with 5 additions and 3 deletions
+4 -2
View 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);
}
/**
+1 -1
View 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);