]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from STABLE
authorthepurpleblob <thepurpleblob>
Thu, 1 Jun 2006 10:13:57 +0000 (10:13 +0000)
committerthepurpleblob <thepurpleblob>
Thu, 1 Jun 2006 10:13:57 +0000 (10:13 +0000)
question/format/xml/format.php

index 70843ccf7e6badcd434fbab9c5f3f88939864c21..6c0d5bcdb0853d0729e05f6b7d7b2fd0b11c9a42 100755 (executable)
@@ -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;
         }