Permalink
Browse files

MDL-25708 recordsets - tag and user directory

  • Loading branch information...
1 parent cfd62f1 commit cd5fdfd87a910bda6a1caad185d25103b54ccca4 @stronk7 stronk7 committed Jan 22, 2011
Showing with 11 additions and 13 deletions.
  1. +7 −8 tag/lib.php
  2. +4 −5 user/selector/lib.php
View
@@ -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
@@ -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])) {

0 comments on commit cd5fdfd

Please sign in to comment.