diff --git a/question/type/ordering/edit_ordering_form.php b/question/type/ordering/edit_ordering_form.php index c51f7d2bb33..0051f836c58 100644 --- a/question/type/ordering/edit_ordering_form.php +++ b/question/type/ordering/edit_ordering_form.php @@ -177,7 +177,7 @@ class qtype_ordering_edit_form extends question_edit_form { $value = $editor->getValue(); $value['format'] = $format; $value = $editor->setValue($value); - return $editor->getFormat(); + return $format; } /** @@ -270,20 +270,22 @@ class qtype_ordering_edit_form extends question_edit_form { if ($answerid = array_shift($answerids)) { $answer = $question->options->answers[$answerid]; } else { - $answer = (object)array( - 'answer' => '', - 'answerformat' => FORMAT_MOODLE, - ); - $answerid = $answer->id; + $answer = (object)array('answer' => '', + 'answerformat' => FORMAT_MOODLE); + $answerid = 0; } - $itemid = file_get_submitted_draft_itemid("answer[$i]"); - $format = $answer->answerformat; - $text = file_prepare_draft_area($itemid, $this->context->id, 'question', 'answer', - $answerid, $this->editoroptions, $answer->answer); - $question->answer[$i] = array('text' => $text, - 'format' => $format, - 'itemid' => $itemid); + if (empty($question->id)) { + $question->answer[$i] = $answer->answer; + } else { + $itemid = file_get_submitted_draft_itemid("answer[$i]"); + $format = $answer->answerformat; + $text = file_prepare_draft_area($itemid, $this->context->id, 'question', 'answer', + $answerid, $this->editoroptions, $answer->answer); + $question->answer[$i] = array('text' => $text, + 'format' => $format, + 'itemid' => $itemid); + } $question->fraction[$i] = ($i + 1); } diff --git a/question/type/ordering/version.php b/question/type/ordering/version.php index 1b789bcca8e..0bd6f00dba3 100644 --- a/question/type/ordering/version.php +++ b/question/type/ordering/version.php @@ -30,6 +30,6 @@ defined('MOODLE_INTERNAL') || die(); $plugin->cron = 0; $plugin->component = 'qtype_ordering'; $plugin->maturity = MATURITY_STABLE; // ALPHA=50, BETA=100, RC=150, STABLE=200 -$plugin->release = '2015-11-18 (32)'; -$plugin->version = 2015111832; +$plugin->release = '2015-11-23 (33)'; +$plugin->version = 2015112333; $plugin->requires = 2010112400; // Moodle 2.0