function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { $repeated = parent::get_per_answer_fields($mform, $label, $gradeoptions, $repeatedoptions, $answersoption); $tolerance =& $mform->createElement('text', 'tolerance', get_string('acceptederror', 'quiz')); $repeatedoptions['tolerance']['type'] = PARAM_NUMBER; array_splice($repeated, 3, 0, array($tolerance)); $repeated[1]->setSize(10); return $repeated; }
protected function get_per_answer_fields($mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { $repeated = parent::get_per_answer_fields($mform, $label, $gradeoptions, $repeatedoptions, $answersoption); $tolerance = $mform->createElement('text', 'tolerance', get_string('acceptederror', 'qtype_numerical')); $repeatedoptions['tolerance']['type'] = PARAM_FLOAT; $repeatedoptions['tolerance']['default'] = 0; array_splice($repeated, 3, 0, array($tolerance)); $repeated[1]->setSize(10); return $repeated; }
protected function get_per_answer_fields($mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { $repeated = parent::get_per_answer_fields($mform, $label, $gradeoptions, $repeatedoptions, $answersoption); $tolerance = $mform->createElement('text', 'tolerance', get_string('answererror', 'qtype_numerical'), array('size' => 15)); $repeatedoptions['tolerance']['type'] = PARAM_FLOAT; $repeatedoptions['tolerance']['default'] = 0; $elements = $repeated[0]->getElements(); $elements[0]->setSize(15); array_splice($elements, 1, 0, array($tolerance)); $repeated[0]->setElements($elements); return $repeated; }
function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { $repeated = parent::get_per_answer_fields(&$mform, $label, $gradeoptions, $repeatedoptions, $answersoption); $mform->setType('answer', PARAM_NOTAGS); $addrepeated = array(); $addrepeated[] =& $mform->createElement('text', 'tolerance', get_string('tolerance', 'qtype_calculated')); $repeatedoptions['tolerance']['type'] = PARAM_NUMBER; $repeatedoptions['tolerance']['default'] = 0.01; $addrepeated[] =& $mform->createElement('select', 'tolerancetype', get_string('tolerancetype', 'quiz'), $this->qtypeobj->tolerance_types()); $addrepeated[] =& $mform->createElement('select', 'correctanswerlength', get_string('correctanswershows', 'qtype_calculated'), range(0, 9)); $repeatedoptions['correctanswerlength']['default'] = 2; $answerlengthformats = array('1' => get_string('decimalformat', 'quiz'), '2' => get_string('significantfiguresformat', 'quiz')); $addrepeated[] =& $mform->createElement('select', 'correctanswerformat', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats); array_splice($repeated, 3, 0, $addrepeated); $repeated[1]->setLabel(get_string('correctanswerformula', 'quiz') . '='); return $repeated; }