From: moodler Date: Mon, 26 Apr 2004 14:16:05 +0000 (+0000) Subject: You can now unenrol all students quickly with one button X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=bd23e396a40f6aecdb906f1aadc6eb8da743175a;p=moodle.git You can now unenrol all students quickly with one button bug 1238 --- diff --git a/course/student.php b/course/student.php index 416f1bb61e..db40e9abba 100644 --- a/course/student.php +++ b/course/student.php @@ -36,6 +36,9 @@ $strsearchagain = get_string("searchagain"); $strtoomanytoshow = get_string("toomanytoshow"); $strstudents = get_string("students"); + $strunenrolallstudents = get_string("unenrolallstudents"); + $strunenrolallstudentssure = get_string("unenrolallstudentssure"); + if ($search) { $searchstring = $strsearchagain; @@ -69,6 +72,18 @@ } } +/// 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)) { @@ -103,6 +118,15 @@ } $studentlist = implode(",",$studentarray); unset($studentarray); + + // button to unenrol all students from course + + echo "

 

\n"; + echo "

\n"; + echo "\n"; + echo "

\n"; } echo " "; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 9dea4c7a1c..63c9f24641 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -852,6 +852,8 @@ $string['turneditingoff'] = 'Turn editing off'; $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';