Пример #1
0
 function check_file_access($question, $state, $options, $contextid, $component, $filearea, $args)
 {
     $itemid = reset($args);
     if ($component == 'question' && $filearea == 'answerfeedback') {
         $result = $options->feedback && array_key_exists($itemid, $question->options->answers);
         if (!$result) {
             return false;
         }
         foreach ($question->options->answers as $answer) {
             if ($this->test_response($question, $state, $answer)) {
                 return true;
             }
         }
         return false;
     } else {
         if ($filearea == 'instruction') {
             if ($itemid != $question->id) {
                 return false;
             } else {
                 return true;
             }
         } else {
             return parent::check_file_access($question, $state, $options, $contextid, $component, $filearea, $args);
         }
     }
 }