mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
Choice: MDL-20440 Added completion support to Choice (mark completed when user makes choice)
This commit is contained in:
parent
14333c1128
commit
bc499733f8
9 changed files with 108 additions and 15 deletions
|
@ -137,5 +137,27 @@ class mod_choice_mod_form extends moodleform_mod {
|
|||
return $errors;
|
||||
}
|
||||
|
||||
function get_data() {
|
||||
$data = parent::get_data();
|
||||
if (!$data) {
|
||||
return false;
|
||||
}
|
||||
// Set up completion section even if checkbox is not ticked
|
||||
if (empty($data->completionsection)) {
|
||||
$data->completionsection=0;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function add_completion_rules() {
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'choice'));
|
||||
return array('completionsubmit');
|
||||
}
|
||||
|
||||
function completion_rule_enabled($data) {
|
||||
return !empty($data['completionsubmit']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue