Skip to content

Commit

Permalink
MDL-37621 assign: Improvements to assignment default settings.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Damyon Wiese committed Jun 12, 2013
1 parent c303711 commit de6a0a3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 30 deletions.
4 changes: 1 addition & 3 deletions mod/assign/lang/en/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,7 @@
$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';
Expand Down
9 changes: 3 additions & 6 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3425,8 +3425,7 @@ protected function check_submit_for_grading($mform) {

$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 = '';
Expand Down Expand Up @@ -4412,8 +4411,7 @@ protected function process_submit_for_grading($mform) {
$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 = '';
Expand Down Expand Up @@ -5485,8 +5483,7 @@ public function add_submission_form_elements(MoodleQuickForm $mform, stdClass $d
// 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;
Expand Down
16 changes: 5 additions & 11 deletions mod/assign/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,11 @@ public function definition() {
$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(
Expand Down
20 changes: 10 additions & 10 deletions mod/assign/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@
$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));
Expand All @@ -108,7 +101,6 @@
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');
Expand All @@ -119,7 +111,6 @@
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');
Expand All @@ -130,7 +121,6 @@
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');
Expand All @@ -143,6 +133,16 @@
$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'),
Expand Down

0 comments on commit de6a0a3

Please sign in to comment.