From 42e6506ebeda008a6fdb6c1fecebb402bc8779ce Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 10 Mar 2011 19:09:42 +0000 Subject: [PATCH] MDL-20636 Minor fixes to the truefalse and match editing forms. --- question/type/match/edit_match_form.php | 4 ++-- question/type/truefalse/edit_truefalse_form.php | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/question/type/match/edit_match_form.php b/question/type/match/edit_match_form.php index e2b77f8c027..d8bf17f189a 100644 --- a/question/type/match/edit_match_form.php +++ b/question/type/match/edit_match_form.php @@ -39,7 +39,7 @@ class qtype_match_edit_form extends question_edit_form { function get_per_answer_fields($mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { $repeated = array(); $repeated[] = $mform->createElement('header', 'answerhdr', $label); - $repeated[] = $mform->createElement('editor', 'subquestions', get_string('question', 'question'), array('rows'=>3), $this->editoroptions); + $repeated[] = $mform->createElement('editor', 'subquestions', get_string('question'), array('rows'=>40), $this->editoroptions); $repeated[] = $mform->createElement('text', 'subanswers', get_string('answer', 'question'), array('size'=>50)); $repeatedoptions['subquestions']['type'] = PARAM_RAW; $repeatedoptions['subanswers']['type'] = PARAM_TEXT; @@ -75,7 +75,7 @@ class qtype_match_edit_form extends question_edit_form { return $question; } - $question->shuffleanswers = $question->options->shuffleanswers; + $question->shuffleanswers = $question->options->shuffleanswers; $key = 0; foreach ($question->options->subquestions as $subquestion){ diff --git a/question/type/truefalse/edit_truefalse_form.php b/question/type/truefalse/edit_truefalse_form.php index 171ee63c8f1..ca651120676 100644 --- a/question/type/truefalse/edit_truefalse_form.php +++ b/question/type/truefalse/edit_truefalse_form.php @@ -61,7 +61,9 @@ class qtype_truefalse_edit_form extends question_edit_form { $mform->addHelpButton('penaltymessage', 'penaltyforeachincorrecttry', 'question'); } - public function set_data($question) { + public function data_preprocessing($question) { + $question = parent::data_preprocessing($question); + if (!empty($question->options->trueanswer)) { $trueanswer = $question->options->answers[$question->options->trueanswer]; $question->correctanswer = ($trueanswer->fraction != 0); @@ -83,6 +85,8 @@ class qtype_truefalse_edit_form extends question_edit_form { $text // text ); $question->feedbacktrue['itemid'] = $draftid; + + return $question; } if (!empty($question->options->falseanswer)) { @@ -106,7 +110,6 @@ class qtype_truefalse_edit_form extends question_edit_form { ); $question->feedbackfalse['itemid'] = $draftid; } - parent::set_data($question); } public function qtype() {