Skip to content

Commit

Permalink
Fixed behaviour of groups.php in the case of an empty group, see bug …
Browse files Browse the repository at this point in the history
…2346
  • Loading branch information
gustav_delius committed Feb 13, 2005
1 parent ce3c1c2 commit db837a6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
28 changes: 17 additions & 11 deletions course/grades.php
Expand Up @@ -35,20 +35,26 @@
$currentgroup = false;
}

/// Get a list of all students
if ($currentgroup) {
$students = get_group_students($currentgroup, "u.lastname ASC");
if (!$students = get_group_students($currentgroup, "u.lastname ASC")) {
print_header("$course->shortname: $strgrades", "$course->fullname",
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
-> $strgrades");
setup_and_print_groups($course, $groupmode, "grades.php?id=$course->id");
notice(get_string("nostudentsingroup"), "$CFG->wwwroot/course/view.php?id=$course->id");
print_footer();
exit;
}
} else {
$students = get_course_students($course->id, "u.lastname ASC");
}

/// Get a list of all students
if (!$students) {
print_header("$course->shortname: $strgrades", "$course->fullname",
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
if (!$students = get_course_students($course->id, "u.lastname ASC")) {
print_header("$course->shortname: $strgrades", "$course->fullname",
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
-> $strgrades");
print_heading(get_string("nostudentsyet"));
print_footer($course);
exit;
notice(get_string("nostudentsyet"), "$CFG->wwwroot/course/view.php?id=$course->id");
print_footer();
exit;
}
}

foreach ($students as $student) {
Expand Down
1 change: 1 addition & 0 deletions lang/en/moodle.php
Expand Up @@ -763,6 +763,7 @@
$string['normalfilter'] = 'Normal search';
$string['nostudentsfound'] = 'No $a found';
$string['nostudentsyet'] = 'No students enrolled in this course yet';
$string['nostudentsingroup'] = 'There are no students in this group yet';
$string['nosuchemail'] = 'No such email address';
$string['notavailable'] = 'Not available';
$string['noteachersyet'] = 'No teachers in this course yet';
Expand Down

0 comments on commit db837a6

Please sign in to comment.