Browse Source

Fix issue in QTI import if question type is not defined - refs BT#11633

Yannick Warnier 8 years ago
parent
commit
7a2a590120
1 changed files with 4 additions and 0 deletions
  1. 4 0
      main/exercise/export/exercise_import.inc.php

+ 4 - 0
main/exercise/export/exercise_import.inc.php

@@ -170,6 +170,10 @@ function import_exercise($file)
             //2. Create question
             $question = new Ims2Question();
             $question->type = $question_array['type'];
+            if (empty($question->type)) {
+                // If the type was not provided, assume this is a multiple choice, unique answer type (the most basic)
+                $question->type = MCUA;
+            }
             $question->setAnswer();
             if (strlen($question_array['title']) < 50) {
                 $question->updateTitle(formatText(strip_tags($question_array['title'])) . '...');