/** * if it's the first question, we need to save the initial quiz view * and question view. All other quiz and question view data is handled * by the response class * @param quiz object * @param question_id (to see if we're on the first question) */ protected function save_initial_view_data() { if ($this->state === 'question') { // we're on a question. It might be the first one, let's find out! $question_ids = $this->quiz->get_questions(); if ((int) $this->current_question_id === (int) $question_ids[0]) { // we're on the first question of the first quiz in the question state, so we can update the quiz views and first question view // save quiz view $quiz_data = new Enp_quiz_Save_quiz_take_Quiz_data($this->quiz); $quiz_data->update_quiz_views(); // save question view $save_question_view = new Enp_quiz_Save_quiz_take_Question_view($this->current_question_id); } } }