"MDL-16094, fixed file server function in match type question"
authorDongsheng Cai <unoter@gmail.com>
Wed, 8 Sep 2010 14:37:22 +0000 (14:37 +0000)
committerDongsheng Cai <unoter@gmail.com>
Wed, 8 Sep 2010 14:37:22 +0000 (14:37 +0000)
question/type/match/questiontype.php

index 469e11a..f30ebdf 100644 (file)
@@ -813,11 +813,11 @@ class question_match_qtype extends default_questiontype {
 
         $itemid = reset($args);
         if ($filearea == 'subquestion') {
 
         $itemid = reset($args);
         if ($filearea == 'subquestion') {
-            // always display quetion images
             // itemid is sub question id
             // itemid is sub question id
-            if ($itemid != $question->id) {
+            if (!array_key_exists($itemid, $question->options->subquestions)) {
                 return false;
             }
                 return false;
             }
+
             return true;
         } else {
             return parent::check_file_access($question, $state, $options, $contextid, $component,
             return true;
         } else {
             return parent::check_file_access($question, $state, $options, $contextid, $component,