X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=blobdiff_plain;f=question%2Ftype%2Fessay%2Fquestion.php;h=8e443ae5fed887883539855477a548379e5c5baf;hp=733a78c6e8346fb5dd1c60db3b17fca5b84b6ac0;hb=caeeff07262f6cb89fe6d14f9f5d05b6c9e358d3;hpb=b36d2d0643b19e82daf22842fc9321ef1783f8b6;ds=inline diff --git a/question/type/essay/question.php b/question/type/essay/question.php index 733a78c6e83..8e443ae5fed 100644 --- a/question/type/essay/question.php +++ b/question/type/essay/question.php @@ -55,7 +55,11 @@ class qtype_essay_question extends question_with_responses { } public function get_expected_data() { - return array('answer' => PARAM_CLEANHTML); + $expecteddata = array('answer' => PARAM_CLEANHTML); + if ($this->attachments != 0) { + $expecteddata['attachments'] = question_attempt::PARAM_FILES; + } + return $expecteddata; } public function summarise_response(array $response) { @@ -80,4 +84,14 @@ class qtype_essay_question extends question_with_responses { return question_utils::arrays_same_at_key_missing_is_blank( $prevresponse, $newresponse, 'answer'); } + + public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload) { + if ($component == 'question' && $filearea == 'response_attachments') { + // Response attachments visible if the question has them. + return $this->attachments != 0; + + } else { + return parent::check_file_access($qa, $options, $component, $filearea, $args, $forcedownload); + } + } }