From: scyrma Date: Tue, 26 Feb 2008 05:08:53 +0000 (+0000) Subject: MDL-13642 - re-added the proper query limits X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2dc038ffb5a1d047bb7ab1e621490e5418d2c84b;p=moodle.git MDL-13642 - re-added the proper query limits --- diff --git a/tag/lib.php b/tag/lib.php index d6c256751f..b6994dafc5 100644 --- a/tag/lib.php +++ b/tag/lib.php @@ -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); } /** diff --git a/tag/locallib.php b/tag/locallib.php index 8cd195a70b..0ceea95c86 100644 --- a/tag/locallib.php +++ b/tag/locallib.php @@ -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);