$strsearchagain = get_string("searchagain");
$strtoomanytoshow = get_string("toomanytoshow");
$strstudents = get_string("students");
+ $strunenrolallstudents = get_string("unenrolallstudents");
+ $strunenrolallstudentssure = get_string("unenrolallstudentssure");
+
if ($search) {
$searchstring = $strsearchagain;
}
}
+/// Remove all students from specified course
+
+ if (!empty($removeall)) {
+ $students = get_course_students($course->id, "u.lastname ASC, u.firstname ASC");
+ foreach ($students as $student) {
+ if (! unenrol_student($student->id, $course->id)) {
+ $fullname = fullname($student, true);
+ notify("Could not remove $fullname from this course!");
+ }
+ }
+ }
+
/// Print a help notice about the need to use this page
if (empty($add) and empty($remove) and empty($search)) {
}
$studentlist = implode(",",$studentarray);
unset($studentarray);
+
+ // button to unenrol all students from course
+
+ echo "<p> </p>\n";
+ echo "<p align=\"center\">\n";
+ echo "<input type=\"button\" value=\"$strunenrolallstudents\" ".
+ " OnClick=\"ctemp = window.confirm('".addslashes($strunenrolallstudentssure)."'); ".
+ " if(ctemp) window.location.href='student.php?id=$course->id&removeall=1';\"/>\n";
+ echo "</p>\n";
}
echo "<td> </td>";
$string['turneditingon'] = 'Turn editing on';
$string['undecided'] = 'Undecided';
$string['unenrol'] = 'Unenrol';
+$string['unenrolallstudents'] = 'Unenrol all students';
+$string['unenrolallstudentssure'] = 'Are you sure you want to completely unenrol all students from this course?';
$string['unenrolme'] = 'Unenrol me from $a';
$string['unenrolsure'] = 'Are you sure you want to unenrol $a from this course?';
$string['unknowncategory'] = 'Unknown category';