Skip to content

Commit

Permalink
Merge branch 'MDL-32201' of git://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Apr 2, 2012
2 parents f9488a6 + 04fcd1f commit bec2179
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions question/type/questiontypebase.php
Expand Up @@ -978,21 +978,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;
}
Expand Down

0 comments on commit bec2179

Please sign in to comment.