]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-6297 shuffleanswers option not imported correctly for MC questions.
authortjhunt <tjhunt>
Tue, 3 Oct 2006 14:01:38 +0000 (14:01 +0000)
committertjhunt <tjhunt>
Tue, 3 Oct 2006 14:01:38 +0000 (14:01 +0000)
question/format/xml/format.php

index 5b8972b241cae48d61ef5ba2d2ca55444b7d3d9b..5094305333b0954acc7e574a9d3ea98333730747 100755 (executable)
@@ -57,18 +57,12 @@ class qformat_xml extends qformat_default {
      * @return int internal code number
      */
     function trans_single( $name ) {
-      $name = trim($name);
-
-      if ($name=="true") {
-          $id = 1;
-      }
-      elseif ($name=="false") {
-        $id = 0;
-      }
-      else {
-          $id = 0; // or maybe warning required
-      }
-      return $id;
+        $name = trim($name);
+        if ($name == "false" || !$name) {
+            return 0;
+        } else {
+            return 1;
+        }
     }
 
     /**
@@ -169,7 +163,7 @@ class qformat_xml extends qformat_default {
         } else {
             $shuffleanswers = 'false';
         }
-        $qo->$shuffleanswers = $this->trans_single($shuffleanswers);
+        $qo->shuffleanswers = $this->trans_single($shuffleanswers);
         $qo->correctfeedback = $this->import_optional_text('correctfeedback', $question);
         $qo->partiallycorrectfeedback = $this->import_optional_text('partiallycorrectfeedback', $question);
         $qo->incorrectfeedback = $this->import_optional_text('incorrectfeedback', $question);