mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
Merge branch 'MDL-27907' of git://github.com/timhunt/moodle
This commit is contained in:
commit
8e307054d3
2 changed files with 8 additions and 48 deletions
|
@ -73,28 +73,15 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
|
||||||
|
|
||||||
public function get_per_answer_fields($mform, $label, $gradeoptions,
|
public function get_per_answer_fields($mform, $label, $gradeoptions,
|
||||||
&$repeatedoptions, &$answersoption) {
|
&$repeatedoptions, &$answersoption) {
|
||||||
$repeated = array();
|
$repeated = parent::get_per_answer_fields($mform, $label, $gradeoptions,
|
||||||
$repeated[] = $mform->createElement('header', 'answerhdr', $label);
|
$repeatedoptions, $answersoption);
|
||||||
$repeated[] = $mform->createElement('text', 'answer',
|
|
||||||
get_string('answer', 'question'), array('size' => 50));
|
|
||||||
$repeated[] = $mform->createElement('select', 'fraction',
|
|
||||||
get_string('grade'), $gradeoptions);
|
|
||||||
$repeated[] = $mform->createElement('editor', 'feedback',
|
|
||||||
get_string('feedback', 'question'), null, $this->editoroptions);
|
|
||||||
$repeatedoptions['answer']['type'] = PARAM_RAW;
|
|
||||||
$repeatedoptions['fraction']['default'] = 0;
|
|
||||||
$answersoption = 'answers';
|
|
||||||
|
|
||||||
$mform->setType('answer', PARAM_NOTAGS);
|
$repeated[1]->setLabel(get_string('correctanswerformula', 'qtype_calculated') . '=');
|
||||||
|
$repeatedoptions['tolerance']['default'] = 0.01;
|
||||||
|
|
||||||
$addrepeated = array();
|
$addrepeated = array();
|
||||||
$addrepeated[] = $mform->createElement('text', 'tolerance',
|
|
||||||
get_string('tolerance', 'qtype_calculated'));
|
|
||||||
$addrepeated[] = $mform->createElement('select', 'tolerancetype',
|
$addrepeated[] = $mform->createElement('select', 'tolerancetype',
|
||||||
get_string('tolerancetype', 'qtype_numerical'),
|
get_string('tolerancetype', 'qtype_numerical'), $this->qtypeobj->tolerance_types());
|
||||||
$this->qtypeobj->tolerance_types());
|
|
||||||
$repeatedoptions['tolerance']['type'] = PARAM_NUMBER;
|
|
||||||
$repeatedoptions['tolerance']['default'] = 0.01;
|
|
||||||
|
|
||||||
$addrepeated[] = $mform->createElement('select', 'correctanswerlength',
|
$addrepeated[] = $mform->createElement('select', 'correctanswerlength',
|
||||||
get_string('correctanswershows', 'qtype_calculated'), range(0, 9));
|
get_string('correctanswershows', 'qtype_calculated'), range(0, 9));
|
||||||
|
@ -106,8 +93,9 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
|
||||||
);
|
);
|
||||||
$addrepeated[] = $mform->createElement('select', 'correctanswerformat',
|
$addrepeated[] = $mform->createElement('select', 'correctanswerformat',
|
||||||
get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats);
|
get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats);
|
||||||
array_splice($repeated, 3, 0, $addrepeated);
|
|
||||||
$repeated[1]->setLabel(get_string('correctanswerformula', 'qtype_calculated') . ' = ');
|
array_splice($repeated, 4, 0, $addrepeated);
|
||||||
|
|
||||||
return $repeated;
|
return $repeated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,34 +286,6 @@ class qtype_calculatedsimple_edit_form extends qtype_calculated_edit_form {
|
||||||
parent::__construct($submiturl, $question, $category, $contexts, $formeditable);
|
parent::__construct($submiturl, $question, $category, $contexts, $formeditable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public 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', 'qtype_numerical'), $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', 'qtype_numerical'),
|
|
||||||
'2' => get_string('significantfiguresformat', 'qtype_calculated')
|
|
||||||
);
|
|
||||||
$addrepeated[] = $mform->createElement('select', 'correctanswerformat',
|
|
||||||
get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats);
|
|
||||||
array_splice($repeated, 3, 0, $addrepeated);
|
|
||||||
$repeated[1]->setLabel(get_string('correctanswerformula', 'qtype_calculated').'=');
|
|
||||||
|
|
||||||
return $repeated;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add question-type specific form fields.
|
* Add question-type specific form fields.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue