Permalink
Browse files

Fixing warning about invalid argument for foreach in course/lib.php i…

…n log selector form
  • Loading branch information...
1 parent 2cb9e31 commit 1f08492ac1fa96008956edd1a9a52c3c8c02a215 mjollnir_ committed Jan 13, 2005
Showing with 7 additions and 3 deletions.
  1. +7 −3 course/lib.php
View
@@ -380,9 +380,13 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
}
if ($showgroups) {
- $cgroups = get_groups($course->id);
- foreach ($cgroups as $cgroup) {
- $groups[$cgroup->id] = $cgroup->name;
+ if ($cgroups = get_groups($course->id)) {
+ foreach ($cgroups as $cgroup) {
+ $groups[$cgroup->id] = $cgroup->name;
+ }
+ }
+ else {
+ $groups = array();
}
choose_from_menu ($groups, "group", $selectedgroup, get_string("allgroups") );
}

0 comments on commit 1f08492

Please sign in to comment.