diff --git a/question/type/multianswer/question.php b/question/type/multianswer/question.php index 42a8b8fee5e..94f374c366e 100644 --- a/question/type/multianswer/question.php +++ b/question/type/multianswer/question.php @@ -245,6 +245,22 @@ class qtype_multianswer_question extends question_graded_automatically { } public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload) { - // TODO + if ($component == 'question' && $filearea == 'answer') { + return true; + + } else if ($component == 'question' && $filearea == 'answerfeedback') { + // Full logic to control which feedbacks a student can see is too complex. + // Just allow access to all images. There is a theoretical chance the + // students could see files they are not meant to see by guessing URLs, + // but it is remote. + return $options->feedback; + + } else if ($component == 'question' && $filearea == 'hint') { + return $this->check_hint_file_access($qa, $options, $args); + + } else { + return parent::check_file_access($qa, $options, $component, $filearea, + $args, $forcedownload); + } } } diff --git a/question/type/numerical/question.php b/question/type/numerical/question.php index 7adacae84a2..764552834f1 100644 --- a/question/type/numerical/question.php +++ b/question/type/numerical/question.php @@ -240,8 +240,8 @@ class qtype_numerical_question extends question_graded_automatically { $this->apply_unit_penalty($ans->fraction, $unit))); } - public function check_file_access($question, $state, $options, $contextid, $component, - $filearea, $args) { + public function check_file_access($qa, $options, $component, $filearea, $args, + $forcedownload) { if ($component == 'question' && $filearea == 'answerfeedback') { $currentanswer = $qa->get_last_qt_var('answer'); $answer = $qa->get_question()->get_matching_answer(array('answer' => $currentanswer));