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 =& $this->_form;
|
||||||
|
|
||||||
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'assign'));
|
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'assign'));
|
||||||
|
// Enable this completion rule by default.
|
||||||
|
$mform->setDefault('completionsubmit', 1);
|
||||||
return array('completionsubmit');
|
return array('completionsubmit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,6 +161,8 @@ class mod_choice_mod_form extends moodleform_mod {
|
|||||||
$mform =& $this->_form;
|
$mform =& $this->_form;
|
||||||
|
|
||||||
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'choice'));
|
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'choice'));
|
||||||
|
// Enable this completion rule by default.
|
||||||
|
$mform->setDefault('completionsubmit', 1);
|
||||||
return array('completionsubmit');
|
return array('completionsubmit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,6 +204,8 @@ class mod_feedback_mod_form extends moodleform_mod {
|
|||||||
'completionsubmit',
|
'completionsubmit',
|
||||||
'',
|
'',
|
||||||
get_string('completionsubmit', 'feedback'));
|
get_string('completionsubmit', 'feedback'));
|
||||||
|
// Enable this completion rule by default.
|
||||||
|
$mform->setDefault('completionsubmit', 1);
|
||||||
return array('completionsubmit');
|
return array('completionsubmit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,14 +243,18 @@ class mod_forum_mod_form extends moodleform_mod {
|
|||||||
if (empty($default_values['completionreplies'])) {
|
if (empty($default_values['completionreplies'])) {
|
||||||
$default_values['completionreplies']=1;
|
$default_values['completionreplies']=1;
|
||||||
}
|
}
|
||||||
$default_values['completionpostsenabled']=
|
// Tick by default if Add mode or if completion posts settings is set to 1 or more.
|
||||||
!empty($default_values['completionposts']) ? 1 : 0;
|
if (empty($this->_instance) || !empty($default_values['completionposts'])) {
|
||||||
|
$default_values['completionpostsenabled'] = 1;
|
||||||
|
} else {
|
||||||
|
$default_values['completionpostsenabled'] = 0;
|
||||||
|
}
|
||||||
if (empty($default_values['completionposts'])) {
|
if (empty($default_values['completionposts'])) {
|
||||||
$default_values['completionposts']=1;
|
$default_values['completionposts']=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_completion_rules() {
|
function add_completion_rules() {
|
||||||
$mform =& $this->_form;
|
$mform =& $this->_form;
|
||||||
|
|
||||||
$group=array();
|
$group=array();
|
||||||
|
@ -174,10 +174,12 @@ class mod_glossary_mod_form extends moodleform_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up the completion checkboxes which aren't part of standard data.
|
// 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
|
// Tick by default if Add mode or if completion entries settings is set to 1 or more.
|
||||||
// numbers to be 1, this will not apply unless checkbox is ticked.
|
if (empty($this->_instance) || !empty($default_values['completionentries'])) {
|
||||||
$default_values['completionentriesenabled']=
|
$default_values['completionentriesenabled'] = 1;
|
||||||
!empty($default_values['completionentries']) ? 1 : 0;
|
} else {
|
||||||
|
$default_values['completionentriesenabled'] = 0;
|
||||||
|
}
|
||||||
if (empty($default_values['completionentries'])) {
|
if (empty($default_values['completionentries'])) {
|
||||||
$default_values['completionentries']=1;
|
$default_values['completionentries']=1;
|
||||||
}
|
}
|
||||||
|
@ -408,6 +408,8 @@ class mod_lesson_mod_form extends moodleform_mod {
|
|||||||
|
|
||||||
$mform->addElement('checkbox', 'completionendreached', get_string('completionendreached', 'lesson'),
|
$mform->addElement('checkbox', 'completionendreached', get_string('completionendreached', 'lesson'),
|
||||||
get_string('completionendreached_desc', 'lesson'));
|
get_string('completionendreached_desc', 'lesson'));
|
||||||
|
// Enable this completion rule by default.
|
||||||
|
$mform->setDefault('completionendreached', 1);
|
||||||
|
|
||||||
$group = array();
|
$group = array();
|
||||||
$group[] =& $mform->createElement('checkbox', 'completiontimespentenabled', '',
|
$group[] =& $mform->createElement('checkbox', 'completiontimespentenabled', '',
|
||||||
|
@ -519,6 +519,10 @@ class mod_scorm_mod_form extends moodleform_mod {
|
|||||||
$firstkey = $key;
|
$firstkey = $key;
|
||||||
}
|
}
|
||||||
$mform->addElement('checkbox', $key, $name, $value);
|
$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);
|
$mform->setType($key, PARAM_BOOL);
|
||||||
$items[] = $key;
|
$items[] = $key;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,8 @@ class mod_survey_mod_form extends moodleform_mod {
|
|||||||
public function add_completion_rules() {
|
public function add_completion_rules() {
|
||||||
$mform =& $this->_form;
|
$mform =& $this->_form;
|
||||||
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'survey'));
|
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'survey'));
|
||||||
|
// Enable this completion rule by default.
|
||||||
|
$mform->setDefault('completionsubmit', 1);
|
||||||
return array('completionsubmit');
|
return array('completionsubmit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user