public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)
 {
     if ($component == 'qtype_order' && $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);
             }
         }
     }
 }
Esempio n. 2
0
 public function apply_attempt_state(question_attempt_step $step)
 {
     $saquestions = explode(',', $step->get_qt_var('_stemorder'));
     foreach ($saquestions as $questionid) {
         $this->stems[$questionid] = $step->get_qt_var('_stem_' . $questionid);
         $this->stemformat[$questionid] = $step->get_qt_var('_stemformat_' . $questionid);
         $key = $step->get_qt_var('_right_' . $questionid);
         $this->right[$questionid] = $key;
         $this->choices[$key] = $step->get_qt_var('_choice_' . $key);
     }
     parent::apply_attempt_state($step);
 }