$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];
$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++) {