MDL-20636 Essay questions can now handle files in the HTML editor. #216
[moodle.git] / question / type / essay / question.php
index 3f730cd..92d2070 100644 (file)
@@ -55,7 +55,12 @@ class qtype_essay_question extends question_with_responses {
     }
 
     public function get_expected_data() {
-        $expecteddata = array('answer' => PARAM_CLEANHTML, 'answerformat' => PARAM_FORMAT);
+        if ($this->responseformat == 'editorfilepicker') {
+            $expecteddata = array('answer' => question_attempt::PARAM_CLEANHTML_FILES);
+        } else {
+            $expecteddata = array('answer' => PARAM_CLEANHTML);
+        }
+        $expecteddata['answerformat'] = PARAM_FORMAT;
         if ($this->attachments != 0) {
             $expecteddata['attachments'] = question_attempt::PARAM_FILES;
         }
@@ -92,6 +97,10 @@ class qtype_essay_question extends question_with_responses {
             // Response attachments visible if the question has them.
             return $this->attachments != 0;
 
+        } else if ($component == 'question' && $filearea == 'response_answer') {
+            // Response attachments visible if the question has them.
+            return $this->responseformat === 'editorfilepicker';
+
         } else if ($component == 'qtype_essay' && $filearea == 'graderinfo') {
             return $options->manualcomment;