Choice: MDL-20440 Added completion support to Choice (mark completed when user makes choice)

This commit is contained in:
Sam Marshall 2010-10-14 14:58:43 +00:00
parent 14333c1128
commit bc499733f8
9 changed files with 108 additions and 15 deletions

View file

@ -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']);
}
}