/**
  * Closes the attempt
  *
  * @param \mod_activequiz\activequiz $rtq
  *
  * @return bool Weather or not it was successful
  */
 public function close_attempt($rtq)
 {
     $this->quba->finish_all_questions(time());
     $this->attempt->status = self::FINISHED;
     $this->attempt->timefinish = time();
     $this->save();
     $params = array('objectid' => $this->attempt->id, 'context' => $rtq->getContext(), 'relateduserid' => $this->attempt->userid);
     $event = \mod_activequiz\event\attempt_ended::create($params);
     $event->add_record_snapshot('activequiz_attempts', $this->attempt);
     $event->trigger();
     return true;
 }
예제 #2
0
 protected function finish()
 {
     $this->quba->finish_all_questions();
 }