MDL-34190 Course: Role with student archtype should be selected as default in user...
authorRajesh Taneja <rajesh@moodle.com>
Fri, 18 Jan 2013 02:10:57 +0000 (10:10 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 29 Jan 2013 08:54:17 +0000 (16:54 +0800)
course/reset_form.php

index b4a86fe..f1e6446 100644 (file)
@@ -107,6 +107,11 @@ class course_reset_form extends moodleform {
 
         $defaults = array ('reset_events'=>1, 'reset_logs'=>1, 'reset_roles_local'=>1, 'reset_gradebook_grades'=>1, 'reset_notes'=>1);
 
+        // Set student as default in unenrol user list, if role with student archetype exist.
+        if ($studentrole = get_archetype_roles('student')) {
+            $defaults['unenrol_users'] = array_keys($studentrole);
+        }
+
         if ($allmods = $DB->get_records('modules') ) {
             foreach ($allmods as $mod) {
                 $modname = $mod->name;