MDL-25708 recordsets - tag and user directory

This commit is contained in:
Eloy Lafuente (stronk7) 2011-01-22 13:34:28 +01:00
parent cfd62f13a1
commit cd5fdfd87a
2 changed files with 11 additions and 13 deletions

View File

@ -409,16 +409,15 @@ function tag_get_id($tags, $return_value=null) {
list($tag_string, $params) = $DB->get_in_or_equal($tags);
if ($rs = $DB->get_recordset_sql("SELECT * FROM {tag} WHERE name $tag_string ORDER BY name", $params)) {
foreach ($rs as $record) {
if ($return_value == TAG_RETURN_OBJECT) {
$result[$record->name] = $record;
} else { // TAG_RETURN_ARRAY
$result[$record->name] = $record->id;
}
$rs = $DB->get_recordset_sql("SELECT * FROM {tag} WHERE name $tag_string ORDER BY name", $params);
foreach ($rs as $record) {
if ($return_value == TAG_RETURN_OBJECT) {
$result[$record->name] = $record;
} else { // TAG_RETURN_ARRAY
$result[$record->name] = $record->id;
}
$rs->close();
}
$rs->close();
if ($return_an_int) {
return array_pop($result);

View File

@ -763,12 +763,11 @@ class group_non_members_selector extends groups_user_selector_base {
JOIN {groups} g ON gm.groupid = g.id
WHERE u.id $membersidsclause AND g.courseid = :courseid ";
$params['courseid'] = $courseid;
if ($rs = $DB->get_recordset_sql($sql, $params)) {
foreach ($rs as $usergroup) {
$usergroups[$usergroup->userid][$usergroup->id] = $usergroup;
}
$rs->close();
$rs = $DB->get_recordset_sql($sql, $params);
foreach ($rs as $usergroup) {
$usergroups[$usergroup->userid][$usergroup->id] = $usergroup;
}
$rs->close();
foreach ($potentialmembersids as $userid) {
if (isset($usergroups[$userid])) {