]> git.mjollnir.org Git - moodle.git/commitdiff
Modified a bit the xx_get_participants() function to avoid
authorstronk7 <stronk7>
Sun, 7 Sep 2003 21:40:52 +0000 (21:40 +0000)
committerstronk7 <stronk7>
Sun, 7 Sep 2003 21:40:52 +0000 (21:40 +0000)
non existing activities warnings.

mod/assignment/lib.php
mod/forum/lib.php

index 9e36202199efb6611f0fee6aea324725ef17e9cc..710acfb53cfc5631432f53846d333b2b83b15cc9 100644 (file)
@@ -520,8 +520,10 @@ function assignment_get_participants($assignmentid) {
                                        u.id = a.teacher");
 
     //Add teachers to students
-    foreach ($teachers as $teacher) {
-        $students[$teacher->id] = $teacher;
+    if ($teachers) {
+        foreach ($teachers as $teacher) {
+            $students[$teacher->id] = $teacher;
+        }
     }
     //Return students array (it contains an array of unique users)
     return ($students);
index eccee98eb6f91976894a31ff1039479c5e466ef8..9732a03dac4ea3e07e0106163fc789f37f39dded 100644 (file)
@@ -2138,12 +2138,16 @@ function forum_get_participants($forumid) {
                                          u.id = r.userid");
 
     //Add st_posts to st_subscriptions
-    foreach ($st_posts as $st_post) {
-        $st_subscriptions[$st_post->id] = $st_post;
+    if ($st_posts) {
+        foreach ($st_posts as $st_post) {
+            $st_subscriptions[$st_post->id] = $st_post;
+        }
     }
     //Add st_ratings to st_subscriptions
-    foreach ($st_ratings as $st_rating) { 
-        $st_subscriptions[$st_rating->id] = $st_rating;
+    if ($st_ratings) {
+        foreach ($st_ratings as $st_rating) { 
+            $st_subscriptions[$st_rating->id] = $st_rating;
+        }
     }
     //Return st_subscriptions array (it contains an array of unique users)
     return ($st_subscriptions);