From da298d8201c2c20a886fc7d66da99ab2770106c1 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 17 Jul 2006 08:57:30 +0000 Subject: [PATCH] Bug 5840 - Image not displayed in Cloze question. Thanks to Joseph Rezeau for the fix. Merged from MOODLE_16_STABLE. --- question/type/multianswer/questiontype.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index 46dbbe2a59..ece94a7727 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -50,6 +50,7 @@ class embedded_cloze_qtype extends default_questiontype { function save_question_options($question) { global $QTYPES; + $result = new stdClass; // This function needs to be able to handle the case where the existing set of wrapped // questions does not match the new set of wrapped questions so that some need to be @@ -191,12 +192,15 @@ class embedded_cloze_qtype extends default_questiontype { global $QTYPES; $readonly = empty($options->readonly) ? '' : 'readonly="readonly"'; $disabled = empty($options->readonly) ? '' : 'disabled="disabled"'; + $formatoptions = new stdClass; $formatoptions->noclean = true; $formatoptions->para = false; $nameprefix = $question->name_prefix; // For this question type, we better print the image on top: - echo get_question_image($question, $cmoptions->course); + if ($image = get_question_image($question, $cmoptions->course)) { + echo('
'); + } $qtextremaining = format_text($question->questiontext, $question->questiontextformat, @@ -429,6 +433,7 @@ class embedded_cloze_qtype extends default_questiontype { $oldid = backup_todb($mul_info['#']['ID']['0']['#']); //Now, build the question_multianswer record structure + $multianswer = new stdClass; $multianswer->question = $new_question_id; $multianswer->sequence = backup_todb($mul_info['#']['SEQUENCE']['0']['#']); @@ -454,7 +459,7 @@ class embedded_cloze_qtype extends default_questiontype { //We have the answers field recoded to its new ids $multianswer->sequence = $sequence_field; //The structure is equal to the db, so insert the question_multianswer - $newid = insert_record ("question_multianswer",$multianswer); + $newid = insert_record("question_multianswer", $multianswer); //Save ids in backup_ids if ($newid) { -- 2.39.5