예제 #1
0
 public function adjust_display_options(question_display_options $options)
 {
     // We only need different behaviour in try again states.
     if (!$this->is_try_again_state()) {
         parent::adjust_display_options($options);
         if ($this->qa->get_state() == question_state::$invalid && $options->marks == question_display_options::MARK_AND_MAX) {
             $options->marks = question_display_options::MAX_ONLY;
         }
         return;
     }
     // Let the hint adjust the options.
     $hint = $this->get_applicable_hint();
     if (!is_null($hint)) {
         $hint->adjust_display_options($options);
     }
     // Now call the base class method, but protect some fields from being overwritten.
     $save = clone $options;
     parent::adjust_display_options($options);
     $options->feedback = $save->feedback;
     $options->numpartscorrect = $save->numpartscorrect;
     // In a try-again state, everything except the try again button
     // Should be read-only. This is a mild hack to achieve this.
     if (!$options->readonly) {
         $options->readonly = self::READONLY_EXCEPT_TRY_AGAIN;
     }
 }
예제 #2
0
 public function adjust_display_options(question_display_options $options)
 {
     // Save some bits so we can put them back later.
     $save = clone $options;
     // Do the default thing.
     parent::adjust_display_options($options);
     // Then, if they have just Checked an answer, show them the applicable bits of feedback.
     if (!$this->qa->get_state()->is_finished() && $this->qa->get_last_behaviour_var('_try')) {
         $options->feedback = $save->feedback;
         $options->correctness = $save->correctness;
         $options->numpartscorrect = $save->numpartscorrect;
     }
 }