mirror of
https://github.com/moodle/moodle.git
synced 2025-05-06 16:26:08 +02:00
MDL-58102 mod: Set sensible defaults for additional completion fields
Part of MDL-55611 epic.
This commit is contained in:
parent
a0a6762ec3
commit
e44d71a6ee
@ -284,6 +284,8 @@ class mod_assign_mod_form extends moodleform_mod {
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'assign'));
|
||||
// Enable this completion rule by default.
|
||||
$mform->setDefault('completionsubmit', 1);
|
||||
return array('completionsubmit');
|
||||
}
|
||||
|
||||
|
@ -161,6 +161,8 @@ class mod_choice_mod_form extends moodleform_mod {
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'choice'));
|
||||
// Enable this completion rule by default.
|
||||
$mform->setDefault('completionsubmit', 1);
|
||||
return array('completionsubmit');
|
||||
}
|
||||
|
||||
|
@ -204,6 +204,8 @@ class mod_feedback_mod_form extends moodleform_mod {
|
||||
'completionsubmit',
|
||||
'',
|
||||
get_string('completionsubmit', 'feedback'));
|
||||
// Enable this completion rule by default.
|
||||
$mform->setDefault('completionsubmit', 1);
|
||||
return array('completionsubmit');
|
||||
}
|
||||
|
||||
|
@ -243,8 +243,12 @@ class mod_forum_mod_form extends moodleform_mod {
|
||||
if (empty($default_values['completionreplies'])) {
|
||||
$default_values['completionreplies']=1;
|
||||
}
|
||||
$default_values['completionpostsenabled']=
|
||||
!empty($default_values['completionposts']) ? 1 : 0;
|
||||
// Tick by default if Add mode or if completion posts settings is set to 1 or more.
|
||||
if (empty($this->_instance) || !empty($default_values['completionposts'])) {
|
||||
$default_values['completionpostsenabled'] = 1;
|
||||
} else {
|
||||
$default_values['completionpostsenabled'] = 0;
|
||||
}
|
||||
if (empty($default_values['completionposts'])) {
|
||||
$default_values['completionposts']=1;
|
||||
}
|
||||
|
@ -174,10 +174,12 @@ class mod_glossary_mod_form extends moodleform_mod {
|
||||
}
|
||||
|
||||
// Set up the completion checkboxes which aren't part of standard data.
|
||||
// We also make the default value (if you turn on the checkbox) for those
|
||||
// numbers to be 1, this will not apply unless checkbox is ticked.
|
||||
$default_values['completionentriesenabled']=
|
||||
!empty($default_values['completionentries']) ? 1 : 0;
|
||||
// Tick by default if Add mode or if completion entries settings is set to 1 or more.
|
||||
if (empty($this->_instance) || !empty($default_values['completionentries'])) {
|
||||
$default_values['completionentriesenabled'] = 1;
|
||||
} else {
|
||||
$default_values['completionentriesenabled'] = 0;
|
||||
}
|
||||
if (empty($default_values['completionentries'])) {
|
||||
$default_values['completionentries']=1;
|
||||
}
|
||||
|
@ -408,6 +408,8 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
|
||||
$mform->addElement('checkbox', 'completionendreached', get_string('completionendreached', 'lesson'),
|
||||
get_string('completionendreached_desc', 'lesson'));
|
||||
// Enable this completion rule by default.
|
||||
$mform->setDefault('completionendreached', 1);
|
||||
|
||||
$group = array();
|
||||
$group[] =& $mform->createElement('checkbox', 'completiontimespentenabled', '',
|
||||
|
@ -519,6 +519,10 @@ class mod_scorm_mod_form extends moodleform_mod {
|
||||
$firstkey = $key;
|
||||
}
|
||||
$mform->addElement('checkbox', $key, $name, $value);
|
||||
// Default completion rule that requires the SCORM's status be set to "Completed".
|
||||
if ($key === 'completionstatusrequired[4]') {
|
||||
$mform->setDefault($key, 1);
|
||||
}
|
||||
$mform->setType($key, PARAM_BOOL);
|
||||
$items[] = $key;
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ class mod_survey_mod_form extends moodleform_mod {
|
||||
public function add_completion_rules() {
|
||||
$mform =& $this->_form;
|
||||
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'survey'));
|
||||
// Enable this completion rule by default.
|
||||
$mform->setDefault('completionsubmit', 1);
|
||||
return array('completionsubmit');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user