]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8342\rPHP5 migration thing causing string offset fatal error when data not present...
authorthepurpleblob <thepurpleblob>
Tue, 30 Jan 2007 15:16:47 +0000 (15:16 +0000)
committerthepurpleblob <thepurpleblob>
Tue, 30 Jan 2007 15:16:47 +0000 (15:16 +0000)
question/format/blackboard/format.php

index 12afb7403e7346f360843b9a7b6bd7170baff008..ac09fa21afce0ed6e3d53250e0c0a9c0f244fdcf 100644 (file)
@@ -1,5 +1,6 @@
 
 <?php // $Id$
+
 ////////////////////////////////////////////////////////////////////////////
 /// Blackboard 6.0 Format
 ///
@@ -267,9 +268,9 @@ function process_fib($xml, &$questions) {
     else {
         return;
     }
+    
 
     for ($i = 0; $i < sizeof ($fibquestions); $i++) {
-
         $question = $this->defaultquestion();
 
         $question->qtype = SHORTANSWER;
@@ -292,11 +293,23 @@ function process_fib($xml, &$questions) {
 
         $question->answer[] = addslashes($answer);
         $question->fraction[] = 1;
-        $question->feedback[0] = addslashes(trim(@$thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_CORRECT"][0]["#"]));
-        $question->feedback[1] = addslashes(trim(@$thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_INCORRECT"][0]["#"]));
+        $question->feedback = array();
+
+        if (is_array( $thisquestion['#']['GRADABLE'][0]['#'] )) {
+            $question->feedback[0] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_CORRECT"][0]["#"]));
+        }
+        else {
+            $question->feedback[0] = '';
+        }      
+        if (is_array( $thisquestion["#"]["GRADABLE"][0]["#"] )) {
+            $question->feedback[1] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_INCORRECT"][0]["#"]));
+        }
+        else {
+            $question->feedback[1] = '';
+        }        
          
         $questions[] = $question;
-      }
+      } 
 }
 
 //----------------------------------------