public function process_action(question_attempt_pending_step $pendingstep)
 {
     if ($pendingstep->has_behaviour_var('helpme')) {
         return $this->process_helpme($pendingstep);
     } else {
         return parent::process_action($pendingstep);
     }
 }
 public function process_action(question_attempt_pending_step $pendingstep)
 {
     if ($pendingstep->has_behaviour_var('precheck')) {
         return $this->process_submit($pendingstep, PRECHECK);
     } else {
         return parent::process_action($pendingstep);
     }
 }
Esempio n. 3
0
 public function process_action(question_attempt_pending_step $pendingstep) {
     if ($pendingstep->has_behaviour_var('comment')) {
         return $this->process_comment($pendingstep);
     } else if ($pendingstep->has_behaviour_var('finish')) {
         return $this->process_finish($pendingstep);
     } else {
         return $this->process_save($pendingstep);
     }
 }
Esempio n. 4
0
 public function process_comment(question_attempt_pending_step $pendingstep)
 {
     if ($pendingstep->has_behaviour_var('mark')) {
         throw new coding_exception('Information items cannot be graded.');
     }
     return parent::process_comment($pendingstep);
 }
 public function process_action(question_attempt_pending_step $pendingstep)
 {
     if ($pendingstep->has_behaviour_var('finish')) {
         return $this->process_finish($pendingstep);
     }
     if ($this->is_try_again_state()) {
         if ($pendingstep->has_behaviour_var('tryagain')) {
             return $this->process_try_again($pendingstep);
         } else {
             return question_attempt::DISCARD;
         }
     } else {
         if ($pendingstep->has_behaviour_var('comment')) {
             return $this->process_comment($pendingstep);
         } else {
             if ($pendingstep->has_behaviour_var('submit')) {
                 return $this->process_submit($pendingstep);
             } else {
                 return $this->process_save($pendingstep);
             }
         }
     }
 }
Esempio n. 6
0
    public function process_submit(question_attempt_pending_step $pendingstep) {
        if ($this->qa->get_state()->is_finished()) {
            return question_attempt::DISCARD;
        }

        if (!$this->qa->get_question()->is_gradable_response($pendingstep->get_qt_data()) ||
                !$pendingstep->has_behaviour_var('certainty')) {
            $pendingstep->set_state(question_state::$invalid);
            return question_attempt::KEEP;
        }

        return $this->do_grading($pendingstep, $pendingstep);
    }
 public function process_action(question_attempt_pending_step $pendingstep)
 {
     $result = null;
     // Process hint button press.
     foreach ($this->question->hints_available_for_student($pendingstep->get_qt_data()) as $hintkey) {
         $hintkey = $this->adjust_hintkey($hintkey);
         if ($pendingstep->has_behaviour_var($hintkey . 'btn')) {
             $result = $this->process_hint($pendingstep, $hintkey);
         }
     }
     // Proces all actions.
     if ($result === null) {
         $result = parent::process_action($pendingstep);
     }
     // Compute variables to show question it should render it's hint buttons.
     if (!$this->qa->get_state()->is_finished()) {
         $pendingstep->set_behaviour_var('_nonresp_hintbtns', true);
         $response = $pendingstep->get_qt_data();
         if ($this->question->is_complete_response($response)) {
             $pendingstep->set_behaviour_var('_resp_hintbtns', true);
         }
     }
     return $result;
 }