MDL-79863 qtype_ordering: qtype/ordering fix errors creating new question on Moodle 3.0

This commit is contained in:
Gordon Bateson 2015-11-23 19:17:45 +09:00 committed by Mathew May
parent 141809c027
commit ad6a7229a5
2 changed files with 17 additions and 15 deletions

View File

@ -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);
}

View File

@ -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