-
Bug
-
Resolution: Fixed
-
Minor
-
2.0.3, 2.1.2, 2.2
-
Any
-
MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
-
MOODLE_20_STABLE, MOODLE_21_STABLE
-
-
The base export_to_xml function in question/type/questiontype.php does not set the feedback (or answer) format values in the exported XML. When these questions are re-read the feedback blocks are converted to 'moodle-auto-format' from whatever they currently are (usually the default HTML). The standard XML import function already supports reading the format value from the attribute of the answer 'text' element and the feedback element. The patch below, when applied to 2.0.3+ should fix the issue.
— questiontype.php 9 Mar 2011 08:20:51 -0000 1.173
+++ questiontype.php 21 Jul 2011 18:29:19 -0000
@@ -1608,10 +1608,12 @@
//TODO export answers with any extra data
} else {
foreach ($question->options->answers as $answer) {
+ $ansformat=$format->get_format($answer->answerformat);
+ $fbformat=$format->get_format($answer->feedbackformat);
$percent = 100 * $answer->fraction;
- $expout .= " <answer fraction=\"$percent\">\n";
+ $expout .= " <answer fraction=\"$percent\" format=\"{$ansformat}\">\n";
$expout .= $format->writetext($answer->answer, 3, false); - $expout .= " <feedback>\n";
+ $expout .= " <feedback format=\"{$fbformat}\">\n";
$expout .= $format->writetext($answer->feedback, 4, false);
$expout .= " </feedback>\n";
$expout .= " </answer>\n";
- caused a regression
-
MDL-30397 qformat_xml::format() should be public
-
- Closed
-