Merge branch 'MDL-27869' of git://github.com/timhunt/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2011-06-17 18:32:00 +02:00
2 changed files with 19 additions and 3 deletions
+17 -1
View File
@@ -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);
}
}
}
+2 -2
View File
@@ -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));