MDL-37621 assign: Improvements to assignment default settings.
authorDamyon Wiese <damyon@moodle.com>
Wed, 12 Jun 2013 05:05:56 +0000 (13:05 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 12 Jun 2013 06:19:52 +0000 (14:19 +0800)
Remove locked flag from datetime settings.
Change requiresubmissionstatement to use the new admin flags instead of it's previous custom behaviour.
This means there is a language change:

AMOS BEGIN
 CPY [requiresubmissionstatementassignment_help,mod_assign],[requiresubmissionstatement_help,mod_assign]
AMOS END

mod/assign/lang/en/assign.php
mod/assign/locallib.php
mod/assign/mod_form.php
mod/assign/settings.php

index f243a24..34c193e 100644 (file)
@@ -278,9 +278,7 @@ $string['quickgradingresult'] = 'Quick grading';
 $string['quickgradingchangessaved'] = 'The grade changes were saved';
 $string['quickgrading_help'] = 'Quick grading allows you to assign grades (and outcomes) directly in the submissions table. Quick grading is not compatible with advanced grading and is not recommended when there are multiple markers.';
 $string['requiresubmissionstatement'] = 'Require that students accept the submission statement';
-$string['requiresubmissionstatement_help'] = 'Require that students accept the submission statement for all assignment submissions for this entire Moodle installation. If this setting is not enabled, then submission statements can be enabled or disabled in the settings for each assignment.';
-$string['requiresubmissionstatementassignment'] = 'Require that students accept the submission statement';
-$string['requiresubmissionstatementassignment_help'] = 'Require that students accept the submission statement for all submissions to this assignment.';
+$string['requiresubmissionstatement_help'] = 'Require that students accept the submission statement for all submissions to this assignment.';
 $string['requireallteammemberssubmit'] = 'Require all group members submit';
 $string['requireallteammemberssubmit_help'] = 'If enabled, all members of the student group must click the submit button for this assignment before the group submission will be considered as submitted. If disabled, the group submission will be considered as submitted as soon as any member of the student group clicks the submit button.';
 $string['recordid'] = 'Identifier';
index 3f307d3..25ca157 100644 (file)
@@ -3425,8 +3425,7 @@ class assign {
 
         $data = new stdClass();
         $adminconfig = $this->get_admin_config();
-        $requiresubmissionstatement = (!empty($adminconfig->requiresubmissionstatement) ||
-                                       $this->get_instance()->requiresubmissionstatement) &&
+        $requiresubmissionstatement = $this->get_instance()->requiresubmissionstatement &&
                                        !empty($adminconfig->submissionstatement);
 
         $submissionstatement = '';
@@ -4412,8 +4411,7 @@ class assign {
         $instance = $this->get_instance();
         $data = new stdClass();
         $adminconfig = $this->get_admin_config();
-        $requiresubmissionstatement = (!empty($adminconfig->requiresubmissionstatement) ||
-                                       $instance->requiresubmissionstatement) &&
+        $requiresubmissionstatement = $instance->requiresubmissionstatement &&
                                        !empty($adminconfig->submissionstatement);
 
         $submissionstatement = '';
@@ -5485,8 +5483,7 @@ class assign {
         // Submission statement.
         $adminconfig = $this->get_admin_config();
 
-        $requiresubmissionstatement = (!empty($adminconfig->requiresubmissionstatement) ||
-                                       $this->get_instance()->requiresubmissionstatement) &&
+        $requiresubmissionstatement = $this->get_instance()->requiresubmissionstatement &&
                                        !empty($adminconfig->submissionstatement);
 
         $draftsenabled = $this->get_instance()->submissiondrafts;
index 4570805..d622435 100644 (file)
@@ -103,17 +103,11 @@ class mod_assign_mod_form extends moodleform_mod {
         $mform->addElement('selectyesno', 'submissiondrafts', $name);
         $mform->addHelpButton('submissiondrafts', 'submissiondrafts', 'assign');
 
-        if (empty($config->submissionstatement)) {
-            $mform->addElement('hidden', 'requiresubmissionstatement', 0);
-        } else if (empty($config->requiresubmissionstatement)) {
-            $name = get_string('requiresubmissionstatement', 'assign');
-            $mform->addElement('selectyesno', 'requiresubmissionstatement', $name);
-            $mform->addHelpButton('requiresubmissionstatement',
-                                  'requiresubmissionstatementassignment',
-                                  'assign');
-        } else {
-            $mform->addElement('hidden', 'requiresubmissionstatement', 1);
-        }
+        $name = get_string('requiresubmissionstatement', 'assign');
+        $mform->addElement('selectyesno', 'requiresubmissionstatement', $name);
+        $mform->addHelpButton('requiresubmissionstatement',
+                              'requiresubmissionstatement',
+                              'assign');
         $mform->setType('requiresubmissionstatement', PARAM_BOOL);
 
         $options = array(
index 6cdc9f1..f05c91e 100644 (file)
@@ -79,13 +79,6 @@ if ($ADMIN->fulltree) {
                                                     $description,
                                                     $default));
 
-    $name = new lang_string('requiresubmissionstatement', 'mod_assign');
-    $description = new lang_string('requiresubmissionstatement_help', 'mod_assign');
-    $settings->add(new admin_setting_configcheckbox('assign/requiresubmissionstatement',
-                                                    $name,
-                                                    $description,
-                                                    0));
-
     $name = new lang_string('defaultsettings', 'mod_assign');
     $description = new lang_string('defaultsettings_help', 'mod_assign');
     $settings->add(new admin_setting_heading('defaultsettings', $name, $description));
@@ -108,7 +101,6 @@ if ($ADMIN->fulltree) {
                                                     0);
     $setting->set_enabled_flag_options(admin_setting_flag::ENABLED, true);
     $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('duedate', 'mod_assign');
@@ -119,7 +111,6 @@ if ($ADMIN->fulltree) {
                                                     604800);
     $setting->set_enabled_flag_options(admin_setting_flag::ENABLED, true);
     $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('cutoffdate', 'mod_assign');
@@ -130,7 +121,6 @@ if ($ADMIN->fulltree) {
                                                     1209600);
     $setting->set_enabled_flag_options(admin_setting_flag::ENABLED, false);
     $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('submissiondrafts', 'mod_assign');
@@ -143,6 +133,16 @@ if ($ADMIN->fulltree) {
     $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
     $settings->add($setting);
 
+    $name = new lang_string('requiresubmissionstatement', 'mod_assign');
+    $description = new lang_string('requiresubmissionstatement_help', 'mod_assign');
+    $setting = new admin_setting_configcheckbox('assign/requiresubmissionstatement',
+                                                    $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);
+
     // Constants from locallib.php
     $options = array(
         'none' => get_string('attemptreopenmethod_none', 'mod_assign'),