MDL-25708 recordsets - fix group dir uses
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 30 Dec 2010 00:21:15 +0000 (01:21 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 25 Jan 2011 18:58:59 +0000 (19:58 +0100)
group/overview.php

index 53a5a8b..88d348c 100644 (file)
@@ -80,26 +80,25 @@ $sql = "SELECT g.id AS groupid, gg.groupingid, u.id AS userid, u.firstname, u.la
          WHERE g.courseid = :courseid $groupwhere $groupingwhere
       ORDER BY g.name, u.lastname, u.firstname";
 
-if ($rs = $DB->get_recordset_sql($sql, $params)) {
-    foreach ($rs as $row) {
-        $user = new stdClass();
-        $user->id        = $row->userid;
-        $user->firstname = $row->firstname;
-        $user->lastname  = $row->lastname;
-        $user->username  = $row->username;
-        $user->idnumber  = $row->idnumber;
-        if (!$row->groupingid) {
-            $row->groupingid = -1;
-        }
-        if (!array_key_exists($row->groupid, $members[$row->groupingid])) {
-            $members[$row->groupingid][$row->groupid] = array();
-        }
-        if(isset($user->id)){
-           $members[$row->groupingid][$row->groupid][] = $user;
-        }
+$rs = $DB->get_recordset_sql($sql, $params);
+foreach ($rs as $row) {
+    $user = new stdClass();
+    $user->id        = $row->userid;
+    $user->firstname = $row->firstname;
+    $user->lastname  = $row->lastname;
+    $user->username  = $row->username;
+    $user->idnumber  = $row->idnumber;
+    if (!$row->groupingid) {
+        $row->groupingid = -1;
+    }
+    if (!array_key_exists($row->groupid, $members[$row->groupingid])) {
+        $members[$row->groupingid][$row->groupid] = array();
+    }
+    if(isset($user->id)){
+        $members[$row->groupingid][$row->groupid][] = $user;
     }
-    $rs->close();
 }
+$rs->close();
 
 navigation_node::override_active_url(new moodle_url('/group/index.php', array('id'=>$courseid)));
 $PAGE->navbar->add(get_string('overview', 'group'));