From: thepurpleblob Date: Thu, 1 Jun 2006 10:13:57 +0000 (+0000) Subject: Merged from STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a0d187bfd7ac3181ef5df972bb948c8a79b797f1;p=moodle.git Merged from STABLE --- diff --git a/question/format/xml/format.php b/question/format/xml/format.php index 70843ccf7e..6c0d5bcdb0 100755 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -210,20 +210,21 @@ class qformat_xml extends qformat_default { $qo->tolerance = array(); foreach ($answers as $answer) { $qo->answer[] = $answer['#'][0]; - $qo->feedback[] = $answer['#']['feedback'][0]['#']['text'][0]['#']; + $qo->feedback[] = $this->import_text( $answer['#']['feedback'][0]['#']['text'] ); $qo->fraction[] = $answer['#']['fraction'][0]['#']; $qo->tolerance[] = $answer['#']['tolerance'][0]['#']; } // get units array - $units = $question['#']['units'][0]['#']['unit']; $qo->unit = array(); - $qo->multiplier = array(); - foreach ($units as $unit) { - $qo->multiplier[] = $unit['#']['multiplier'][0]['#']; - $qo->unit[] = $unit['#']['unit_name'][0]['#']; + if (isset($question['#']['units'][0]['#']['unit'])) { + $units = $question['#']['units'][0]['#']['unit']; + $qo->multiplier = array(); + foreach ($units as $unit) { + $qo->multiplier[] = $unit['#']['multiplier'][0]['#']; + $qo->unit[] = $unit['#']['unit_name'][0]['#']; + } } - return $qo; } @@ -244,8 +245,8 @@ class qformat_xml extends qformat_default { // run through subquestions foreach ($subquestions as $subquestion) { - $qtext = $subquestion['#']['text'][0]['#']; - $atext = $subquestion['#']['answer'][0]['#']['text'][0]['#']; + $qtext = $this->import_text( $subquestion['#']['text'] ); + $atext = $this->import_text( $subquestion['#']['answer'][0]['#']['text'] ); $qo->subquestions[] = $qtext; $qo->subanswers[] = $atext; }