mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-27869 Fix images in numerical and calculated questions.
Also fix an embarassing TODO in multianswer quetsions.
This commit is contained in:
parent
c3f85e22d9
commit
03b2b8fa29
2 changed files with 19 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue