MDL-38359 assign: Add support for admin defaults for marking workflow settings
authorDamyon Wiese <damyon@moodle.com>
Tue, 11 Jun 2013 06:26:33 +0000 (14:26 +0800)
committerDamyon Wiese <damyon@moodle.com>
Tue, 11 Jun 2013 06:26:33 +0000 (14:26 +0800)
mod/assign/mod_form.php
mod/assign/settings.php

index 79c3239..626b60a 100644 (file)
@@ -179,14 +179,14 @@ class mod_assign_mod_form extends moodleform_mod {
             $mform->freeze('blindmarking');
         }
 
-        $mform->addElement('advcheckbox', 'markingworkflow', get_string('markingworkflow', 'assign'), '', null, array(0, 1));
+        $name = get_string('markingworkflow', 'assign');
+        $mform->addElement('selectyesno', 'markingworkflow', $name);
         $mform->addHelpButton('markingworkflow', 'markingworkflow', 'assign');
-        $mform->setDefault('markingworkflow', 0);
 
-        $mform->addElement('advcheckbox', 'markingallocation', get_string('markingallocation', 'assign'), '', null, array(0, 1));
+        $name = get_string('markingallocation', 'assign');
+        $mform->addElement('selectyesno', 'markingallocation', $name);
         $mform->addHelpButton('markingallocation', 'markingallocation', 'assign');
-        $mform->setDefault('markingallocation', 0);
-        $mform->disabledIf('markingallocation', 'markingworkflow', 'notchecked');
+        $mform->disabledIf('markingallocation', 'markingworkflow', 'eq', 0);
 
         $this->standard_coursemodule_elements();
         $this->apply_admin_defaults();
index c535780..6cdc9f1 100644 (file)
@@ -224,4 +224,23 @@ if ($ADMIN->fulltree) {
     $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
     $settings->add($setting);
 
+    $name = new lang_string('markingworkflow', 'mod_assign');
+    $description = new lang_string('markingworkflow_help', 'mod_assign');
+    $setting = new admin_setting_configcheckbox('assign/markingworkflow',
+                                                    $name,
+                                                    $description,
+                                                    0);
+    $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
+    $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
+    $settings->add($setting);
+
+    $name = new lang_string('markingallocation', 'mod_assign');
+    $description = new lang_string('markingallocation_help', 'mod_assign');
+    $setting = new admin_setting_configcheckbox('assign/markingallocation',
+                                                    $name,
+                                                    $description,
+                                                    0);
+    $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
+    $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
+    $settings->add($setting);
 }