Skip to content

Commit

Permalink
MDL-25708 recordsets - tag and user directory
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jan 22, 2011
1 parent cfd62f1 commit cd5fdfd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
15 changes: 7 additions & 8 deletions tag/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 4 additions & 5 deletions user/selector/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -763,12 +763,11 @@ public function print_user_summaries($courseid) {
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])) {
Expand Down

0 comments on commit cd5fdfd

Please sign in to comment.