protected function ensureExistingTestSession(ilTestSession $testSession) { if (!$testSession->getActiveId()) { global $ilUser; $testSession->setUserId($ilUser->getId()); $testSession->setAnonymousId($_SESSION['tst_access_code'][$this->object->getTestId()]); $testSession->saveToDb(); } }
/** * Start a test for the first time after a redirect */ protected function initTestCmd() { if ($this->object->checkMaximumAllowedUsers() == FALSE) { return $this->showMaximumAllowedUsersReachedMessage(); } if ($this->testSession->isAnonymousUser() && !$this->testSession->getActiveId()) { $accessCode = $this->testSession->createNewAccessCode(); $this->testSession->setAccessCodeToSession($accessCode); $this->testSession->setAnonymousId($accessCode); $this->testSession->saveToDb(); $this->ctrl->redirect($this, 'displayCode'); } $this->ctrl->redirect($this, 'startTest'); }
/** * Creates the test session data for the active user * * @return object The ilTestSession object or FALSE if the creation of the object fails * @access public */ function &createTestSession() { global $ilUser; include_once "./Modules/Test/classes/class.ilTestSession.php"; $testSession = FALSE; $testSession = new ilTestSession(); $testSession->setRefId($this->getRefId()); $testSession->setTestId($this->getTestId()); $testSession->setUserId($ilUser->getId()); $testSession->setAnonymousId($_SESSION["tst_access_code"][$this->getTestId()]); $testSession->saveToDb(); $this->testSession =& $testSession; return $this->testSession; }