/** * creates and returns an instance of a test sequence * that corresponds to the current test mode * * @param integer $activeId * @return ilTestSession|ilTestSessionDynamicQuestionSet */ public function getSession($activeId = null) { global $ilUser; if (self::$testSession === null) { switch ($this->testOBJ->getQuestionSetType()) { case ilObjTest::QUESTION_SET_TYPE_FIXED: case ilObjTest::QUESTION_SET_TYPE_RANDOM: global $ilUser; require_once 'Modules/Test/classes/class.ilTestSession.php'; self::$testSession = new ilTestSession(); break; case ilObjTest::QUESTION_SET_TYPE_DYNAMIC: require_once 'Modules/Test/classes/class.ilTestSessionDynamicQuestionSet.php'; self::$testSession = new ilTestSessionDynamicQuestionSet(); break; } self::$testSession->setRefId($this->testOBJ->getRefId()); self::$testSession->setTestId($this->testOBJ->getTestId()); if ($activeId) { self::$testSession->loadFromDb($activeId); } else { self::$testSession->loadTestSession($this->testOBJ->getTestId(), $ilUser->getId(), $_SESSION["tst_access_code"][$this->testOBJ->getTestId()]); } } return self::$testSession; }
/** * creates and returns an instance of a test sequence * that corresponds to the current test mode and given pass * * @param ilTestSession|ilTestSessionDynamicQuestionSet $testSession * @param integer $pass * @return ilTestSequence|ilTestSequenceDynamicQuestionSet */ public function getSequenceByPass($testSession, $pass) { if ($this->testSequence === null) { switch ($this->testOBJ->getQuestionSetType()) { case ilObjTest::QUESTION_SET_TYPE_FIXED: require_once 'Modules/Test/classes/class.ilTestSequenceFixedQuestionSet.php'; $this->testSequence = new ilTestSequenceFixedQuestionSet($testSession->getActiveId(), $pass, $this->testOBJ->isRandomTest()); break; case ilObjTest::QUESTION_SET_TYPE_RANDOM: require_once 'Modules/Test/classes/class.ilTestSequenceRandomQuestionSet.php'; $this->testSequence = new ilTestSequenceRandomQuestionSet($testSession->getActiveId(), $pass, $this->testOBJ->isRandomTest()); break; case ilObjTest::QUESTION_SET_TYPE_DYNAMIC: require_once 'Modules/Test/classes/class.ilTestSequenceDynamicQuestionSet.php'; require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSet.php'; $questionSet = new ilTestDynamicQuestionSet($this->db, $this->lng, $this->pluginAdmin, $this->testOBJ); $this->testSequence = new ilTestSequenceDynamicQuestionSet($this->db, $questionSet, $testSession->getActiveId()); #$this->testSequence->setPreventCheckedQuestionsFromComingUpEnabled( # $this->testOBJ->isInstantFeedbackAnswerFixationEnabled() #); // checked questions now has to come up any time, so they can be set to unchecked right at this moment break; } } return $this->testSequence; }
/** * @return string */ private function getPassDeletionTarget() { require_once 'Modules/Test/classes/confirmations/class.ilTestPassDeletionConfirmationGUI.php'; $this->ctrl->setParameterByClass('ilTestEvaluationGUI', 'context', ilTestPassDeletionConfirmationGUI::CONTEXT_DYN_TEST_PLAYER); $this->ctrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', $this->testSession->getActiveId()); $this->ctrl->setParameterByClass('ilTestEvaluationGUI', 'pass', $this->testSession->getPass()); return $this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'confirmDeletePass'); }
/** * creates and returns an instance of a test sequence * that corresponds to the current test mode and given pass * * @param ilTestSession|ilTestSessionDynamicQuestionSet $testSession * @param integer $pass * @return ilTestSequence|ilTestSequenceDynamicQuestionSet */ public function getSequenceByPass($testSession, $pass) { if ($this->testSequence === null) { switch ($this->testOBJ->getQuestionSetType()) { case ilObjTest::QUESTION_SET_TYPE_FIXED: require_once 'Modules/Test/classes/class.ilTestSequence.php'; $this->testSequence = new ilTestSequence($testSession->getActiveId(), $pass, $this->testOBJ->isRandomTest()); break; case ilObjTest::QUESTION_SET_TYPE_RANDOM: require_once 'Modules/Test/classes/class.ilTestSequenceRandomQuestionSet.php'; $this->testSequence = new ilTestSequenceRandomQuestionSet($testSession->getActiveId(), $pass, $this->testOBJ->isRandomTest()); break; case ilObjTest::QUESTION_SET_TYPE_DYNAMIC: require_once 'Modules/Test/classes/class.ilTestSequenceDynamicQuestionSet.php'; require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSet.php'; $questionSet = new ilTestDynamicQuestionSet($this->db, $this->lng, $this->pluginAdmin, $this->testOBJ); $this->testSequence = new ilTestSequenceDynamicQuestionSet($this->db, $questionSet, $testSession->getActiveId()); break; } } return $this->testSequence; }
public function cleanupQuestions(ilTestSessionDynamicQuestionSet $testSession) { switch (true) { case !$this->questionSet->questionExists($testSession->getCurrentQuestionId()): case !$this->isFilteredQuestion($testSession->getCurrentQuestionId()): $testSession->setCurrentQuestionId(null); } foreach ($this->postponedQuestions as $questionId) { if (!$this->questionSet->questionExists($questionId)) { unset($this->postponedQuestions[$questionId]); } } foreach ($this->wrongAnsweredQuestions as $questionId) { if (!$this->questionSet->questionExists($questionId)) { unset($this->wrongAnsweredQuestions[$questionId]); } } foreach ($this->correctAnsweredQuestions as $questionId) { if (!$this->questionSet->questionExists($questionId)) { unset($this->correctAnsweredQuestions[$questionId]); } } }
/** * creates and returns an instance of a test sequence * that corresponds to the current test mode and the pass stored in test session * * @param ilTestSession|ilTestSessionDynamicQuestionSet $testSession * @return ilTestSequence|ilTestSequenceDynamicQuestionSet */ public function getSequenceByTestSession($testSession) { return $this->getSequenceByActiveIdAndPass($testSession->getActiveId(), $testSession->getPass()); }