Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-32201 question export: use qformat_xml::write_answer in base class

Without this, images in answers were not being written to the export
file for questions using extra_answer_fields.
  • Loading branch information...
commit 0971dd793965cb5f7fe49b7834a3ea415a0c7c30 1 parent 58db57a
@timhunt timhunt authored
Showing with 3 additions and 9 deletions.
  1. +3 −9 question/type/questiontypebase.php
View
12 question/type/questiontypebase.php
@@ -992,21 +992,15 @@ public function export_to_xml($question, $format, $extra=null) {
array_shift($extraanswersfields);
}
foreach ($question->options->answers as $answer) {
- // TODO this should be re-factored to use $format->write_answer().
- $percent = 100 * $answer->fraction;
- $expout .= " <answer fraction=\"$percent\" {$format->format($answer->answerformat)}>\n";
- $expout .= $format->writetext($answer->answer, 3, false);
- $expout .= " <feedback {$format->format($answer->feedbackformat)}>\n";
- $expout .= $format->writetext($answer->feedback, 4, false);
- $expout .= " </feedback>\n";
+ $extra = '';
if (is_array($extraanswersfields)) {
foreach ($extraanswersfields as $field) {
$exportedvalue = $format->xml_escape($answer->$field);
- $expout .= " <{$field}>{$exportedvalue}</{$field}>\n";
+ $extra .= " <{$field}>{$exportedvalue}</{$field}>\n";
}
}
- $expout .= " </answer>\n";
+ $expout .= $format->write_answer($answer, $extra);
}
return $expout;
}
Please sign in to comment.
Something went wrong with that request. Please try again.