* @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;
"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);
}
/**
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);