function finishTestCmd($requires_confirmation = true) { global $ilUser, $ilAuth; unset($_SESSION["tst_next"]); $active_id = $this->testSession->getActiveId(); $actualpass = $this->object->_getPass($active_id); $allObligationsAnswered = ilObjTest::allObligationsAnswered($this->testSession->getTestId(), $active_id, $actualpass); /* * The following "endgames" are possible prior to actually finishing the test: * - Obligations (Ability to finish the test.) * If not all obligatory questions are answered, the user is presented a list * showing the deficits. * - Examview (Will to finish the test.) * With the examview, the participant can review all answers given in ILIAS or a PDF prior to * commencing to the finished test. * - Last pass allowed (Reassuring the will to finish the test.) * If passes are limited, on the last pass, an additional confirmation is to be displayed. */ // Obligations fulfilled? redirectQuestion : one or the other summary -> no finish if ($this->object->areObligationsEnabled() && !$allObligationsAnswered) { if ($this->object->getListOfQuestions()) { $_GET['activecommand'] = 'summary_obligations'; } else { $_GET['activecommand'] = 'summary_obligations_only'; } $this->redirectQuestionCmd(); return; } // Examview enabled & !reviewed & requires_confirmation? test_submission_overview (review gui) if ($this->object->getEnableExamview() && !isset($_GET['reviewed']) && $requires_confirmation) { $_GET['activecommand'] = 'test_submission_overview'; $this->redirectQuestionCmd(); return; } // Last try in limited tries & !confirmed if ($requires_confirmation && $actualpass == $this->object->getNrOfTries() - 1) { // show confirmation page return $this->confirmFinishTestCmd(); } // Last try in limited tries & confirmed? if ($actualpass == $this->object->getNrOfTries() - 1 && !$requires_confirmation) { $ilAuth->setIdle(ilSession::getIdleValue(), false); $ilAuth->setExpire(0); switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } // Non-last try finish if (!$_SESSION['tst_pass_finish']) { if (!$_SESSION['tst_pass_finish']) { $_SESSION['tst_pass_finish'] = 1; } if ($this->object->getMailNotificationType() == 1) { switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } } // no redirect request loops after test pass finished tasks has been performed $this->performTestPassFinishedTasks($actualpass); $this->testSession->setLastFinishedPass($this->testSession->getPass()); $this->testSession->increaseTestPass(); $this->ctrl->redirect($this, 'afterTestPassFinished'); }