]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15290 - Missing question types not handled properly on backup.
authortjhunt <tjhunt>
Wed, 18 Jun 2008 14:29:37 +0000 (14:29 +0000)
committertjhunt <tjhunt>
Wed, 18 Jun 2008 14:29:37 +0000 (14:29 +0000)
question/backuplib.php

index f09284c06287cf1ee16005690a637f4a5da257a1..762093446b1f14d900bc03ec998af9aeff6da728 100644 (file)
             $counter = 0;
             //Iterate over each question
             foreach ($questions as $question) {
+                // Deal with missing question types - they need to be included becuase
+                // user data or quizzes may refer to them.
+                if (!array_key_exists($question->qtype, $QTYPES)) {
+                    $question->qtype = 'missingtype';
+                    $question->questiontext = '<p>' . get_string('warningmissingtype', 'quiz') . '</p>' . $question->questiontext;
+                }
                 //Start question
                 $status = $status && fwrite ($bf,start_tag("QUESTION",$level + 1,true));
                 //Print question contents