From bd23e396a40f6aecdb906f1aadc6eb8da743175a Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 26 Apr 2004 14:16:05 +0000 Subject: [PATCH] You can now unenrol all students quickly with one button bug 1238 --- course/student.php | 24 ++++++++++++++++++++++++ lang/en/moodle.php | 2 ++ 2 files changed, 26 insertions(+) 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'; -- 2.39.5