public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)
 {
     // TODO.
     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);
     }
 }
Example #2
0
 public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)
 {
     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);
             }
         }
     }
 }
Example #3
0
 public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)
 {
     if ($component == 'question' && in_array($filearea, array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback'))) {
         return $this->check_combined_feedback_file_access($qa, $options, $filearea);
     } 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);
         }
     }
 }
Example #4
0
 public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)
 {
     if ($component == 'qtype_match' && $filearea == 'subquestion') {
         $subqid = reset($args);
         // Itemid is sub question id.
         return array_key_exists($subqid, $this->stems);
     } else {
         if ($component == 'question' && in_array($filearea, array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback'))) {
             return $this->check_combined_feedback_file_access($qa, $options, $filearea);
         } 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);
             }
         }
     }
 }
Example #5
0
 public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)
 {
     if ($component == 'qtype_stack' && $filearea == 'specificfeedback') {
         // Specific feedback files only visibile when the feedback is.
         return $options->feedback;
     } else {
         if ($component == 'qtype_stack' && in_array($filearea, array('prtcorrect', 'prtpartiallycorrect', 'prtincorrect'))) {
             // This is a bit lax, but anything else is computationally very expensive.
             return $options->feedback;
         } else {
             if ($component == 'qtype_stack' && in_array($filearea, array('prtnodefalsefeedback', 'prtnodetruefeedback'))) {
                 // This is a bit lax, but anything else is computationally very expensive.
                 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);
                 }
             }
         }
     }
 }