]> git.mjollnir.org Git - moodle.git/commitdiff
Fix notices from the quiz module on backup and restore. Merged from MOODLE_16_STABLE.
authortjhunt <tjhunt>
Tue, 6 Jun 2006 14:15:48 +0000 (14:15 +0000)
committertjhunt <tjhunt>
Tue, 6 Jun 2006 14:15:48 +0000 (14:15 +0000)
mod/quiz/restorelib.php
question/restorelib.php

index 3f225a9c091be1e17a8db53e687111c5da52c87f..c001f2bae0c18bcd74340af54633229ae1f5c012 100644 (file)
         $status = true;
 
         //Get the quiz_question_versions array
-        $versions = $info['MOD']['#']['QUESTION_VERSIONS']['0']['#']['QUESTION_VERSION'];
-
+        if (!empty($info['MOD']['#']['QUESTION_VERSIONS'])) {
+            $versions = $info['MOD']['#']['QUESTION_VERSIONS']['0']['#']['QUESTION_VERSION'];
+        } else {
+            $versions = array();
+        }
+        
         //Iterate over question_versions
         for($i = 0; $i < sizeof($versions); $i++) {
             $ver_info = $versions[$i];
index b9c60454072c3b4c3948b413ab397e97638dd631..a28238fe8b47378fd0a8e31f36e198dcabb30d87 100644 (file)
             $question_cat->parent = backup_todb($info['QUESTION_CATEGORY']['#']['PARENT']['0']['#']);
             $question_cat->sortorder = backup_todb($info['QUESTION_CATEGORY']['#']['SORTORDER']['0']['#']);
 
-            if ($catfound = restore_get_best_question_category($question_cat, $restore->course)) {
+            if ($catfound = restore_get_best_question_category($question_cat, $restore->course_id)) {
                 $newid = $catfound;
             } else {
                 if (!$question_cat->stamp) {
         $restored_questions = array();
 
         //Get the questions array
-        $questions = $info['QUESTION_CATEGORY']['#']['QUESTIONS']['0']['#']['QUESTION'];
+        if (!empty($info['QUESTION_CATEGORY']['#']['QUESTIONS'])) {
+            $questions = $info['QUESTION_CATEGORY']['#']['QUESTIONS']['0']['#']['QUESTION'];
+        } else {
+            $questions = array();
+        }
 
         //Iterate over questions
         for($i = 0; $i < sizeof($questions); $i++) {