コード例 #1
0
ファイル: question.php プロジェクト: evltuma/moodle
 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 == 'answer') {
             $answerid = reset($args);
             // Itemid is answer id.
             return in_array($answerid, $this->order);
         } else {
             if ($component == 'question' && $filearea == 'answerfeedback') {
                 $answerid = reset($args);
                 // Itemid is answer id.
                 $response = $this->get_response($qa);
                 $isselected = false;
                 foreach ($this->order as $value => $ansid) {
                     if ($ansid == $answerid) {
                         $isselected = $this->is_choice_selected($response, $value);
                         break;
                     }
                 }
                 // Param $options->suppresschoicefeedback is a hack specific to the
                 // oumultiresponse question type. It would be good to refactor to
                 // avoid refering to it here.
                 return $options->feedback && empty($options->suppresschoicefeedback) && $isselected;
             } 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
0
 public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)
 {
     return parent::check_file_access($qa, $options, $component, $filearea, $args, $forcedownload);
 }
コード例 #3
0
 public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)
 {
     if ($component == 'question' && $filearea == 'answerfeedback') {
         $currentanswer = $qa->get_last_qt_var('answer');
         if ($this->has_separate_unit_field()) {
             $selectedunit = $qa->get_last_qt_var('unit');
         } else {
             $selectedunit = null;
         }
         list($value, $unit, $multiplier) = $this->ap->apply_units($currentanswer, $selectedunit);
         $answer = $this->get_matching_answer($value, $multiplier);
         $answerid = reset($args);
         // Itemid is answer id.
         return $options->feedback && $answer && $answerid == $answer->id;
     } 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);
         }
     }
 }
コード例 #4
0
 public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)
 {
     if ($component == 'question' && $filearea == 'answerfeedback') {
         $answerid = reset($args);
         // itemid is answer id.
         $response = $qa->get_last_qt_var('answer', '');
         return $options->feedback && ($answerid == $this->trueanswerid && $response || $answerid == $this->falseanswerid && $response !== '');
     } else {
         return parent::check_file_access($qa, $options, $component, $filearea, $args, $forcedownload);
     }
 }
コード例 #5
0
ファイル: question.php プロジェクト: JP-Git/moodle
    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);
        }
    }
コード例 #6
0
 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));
         $answerid = reset($args);
         // itemid is answer id.
         return $options->feedback && $answerid == $answer->id;
     } 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);
         }
     }
 }