MDL-39606 question: Fix missing setType warnings

This commit is contained in:
Frederic Massart 2013-05-10 15:06:30 +08:00
parent dec909fcdd
commit 7d1904de1d
2 changed files with 8 additions and 7 deletions

View file

@ -183,6 +183,7 @@ class question_dataset_dependent_items_form extends question_wizard_form {
$answer->answer); $answer->answer);
$mform->addElement('text', 'tolerance['.$key.']', $mform->addElement('text', 'tolerance['.$key.']',
get_string('tolerance', 'qtype_calculated')); get_string('tolerance', 'qtype_calculated'));
$mform->setType('tolerance['.$key.']', PARAM_RAW);
$mform->setAdvanced('tolerance['.$key.']', true); $mform->setAdvanced('tolerance['.$key.']', true);
$mform->addElement('select', 'tolerancetype['.$key.']', $mform->addElement('select', 'tolerancetype['.$key.']',
get_string('tolerancetype', 'qtype_numerical'), get_string('tolerancetype', 'qtype_numerical'),

View file

@ -145,10 +145,11 @@ class qtype_numerical_edit_form extends question_edit_form {
$unitfields = array($mform->createElement('group', 'units', $unitfields = array($mform->createElement('group', 'units',
get_string('unitx', 'qtype_numerical'), $this->unit_group($mform), null, false)); get_string('unitx', 'qtype_numerical'), $this->unit_group($mform), null, false));
$repeatedoptions['unit']['disabledif'] = $repeatedoptions['unit']['disabledif'] = array('unitrole', 'eq', qtype_numerical::UNITNONE);
array('unitrole', 'eq', qtype_numerical::UNITNONE); $repeatedoptions['unit']['type'] = PARAM_NOTAGS;
$repeatedoptions['multiplier']['disabledif'] = $repeatedoptions['multiplier']['disabledif'] = array('unitrole', 'eq', qtype_numerical::UNITNONE);
array('unitrole', 'eq', qtype_numerical::UNITNONE); $repeatedoptions['multiplier']['type'] = PARAM_NUMBER;
$mform->disabledIf('addunits', 'unitrole', 'eq', qtype_numerical::UNITNONE); $mform->disabledIf('addunits', 'unitrole', 'eq', qtype_numerical::UNITNONE);
if (isset($this->question->options->units)) { if (isset($this->question->options->units)) {
@ -184,12 +185,11 @@ class qtype_numerical_edit_form extends question_edit_form {
*/ */
protected function unit_group($mform) { protected function unit_group($mform) {
$grouparray = array(); $grouparray = array();
$grouparray[] = $mform->createElement('text', 'unit', get_string('unit', 'quiz'), $grouparray[] = $mform->createElement('text', 'unit', get_string('unit', 'quiz'), array('size'=>10));
array('type'=>PARAM_NOTAGS, 'size'=>10));
$grouparray[] = $mform->createElement('static', '', '', ' ' . $grouparray[] = $mform->createElement('static', '', '', ' ' .
get_string('multiplier', 'quiz').' '); get_string('multiplier', 'quiz').' ');
$grouparray[] = $mform->createElement('text', 'multiplier', $grouparray[] = $mform->createElement('text', 'multiplier',
get_string('multiplier', 'quiz'), array('type'=>PARAM_NUMBER, 'size'=>10)); get_string('multiplier', 'quiz'), array('size'=>10));
return $grouparray; return $grouparray;
} }