100 $this->anonymous_id = 0;
102 $this->lastsequence = 0;
103 $this->lastPresentationMode =
null;
104 $this->submitted = FALSE;
105 $this->submittedTimestamp =
"";
110 $this->lastStartedPass =
null;
111 $this->lastFinishedPass =
null;
112 $this->objectiveOrientedContainerId = 0;
122 $this->ref_id = $a_val;
139 if (
$GLOBALS[
'DIC'][
'ilUser']->getId() != ANONYMOUS_USER_ID)
141 $result =
$ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
142 array(
'integer',
'integer'),
148 $this->active_id =
$row[
"active_id"];
149 $this->user_id =
$row[
"user_fi"];
150 $this->anonymous_id =
$row[
"anonymous_id"];
151 $this->test_id =
$row[
"test_fi"];
152 $this->lastsequence =
$row[
"lastindex"];
153 $this->pass =
$row[
"tries"];
154 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
155 $this->submittedTimestamp =
$row[
"submittimestamp"];
156 $this->tstamp =
$row[
"tstamp"];
172 if( !$this->active_id )
174 require_once
'Modules/Test/exceptions/class.ilTestException.php';
182 if( !isset(
$_SESSION[$this->active_id][
'tst_last_increase_pass']) )
191 $this->tstamp = time();
192 $ilDB->update(
'tst_active',
195 'tries' => array(
'integer', $this->
getPass()),
198 'tstamp' => array(
'integer', time()),
204 'active_id' => array(
'integer', $this->
getActiveId())
215 if ($this->active_id > 0)
217 $ilDB->update(
'tst_active',
220 'tries' => array(
'integer', $this->
getPass()),
223 'tstamp' => array(
'integer', time()-10),
225 'last_started_pass' => array(
'integer', $this->
getPass()),
229 'active_id' => array(
'integer', $this->
getActiveId())
239 $next_id =
$ilDB->nextId(
'tst_active');
240 $ilDB->insert(
'tst_active',
242 'active_id' => array(
'integer', $next_id),
243 'user_fi' => array(
'integer', $this->
getUserId()),
245 'test_fi' => array(
'integer', $this->
getTestId()),
247 'tries' => array(
'integer', $this->
getPass()),
250 'tstamp' => array(
'integer', time()-10),
252 'last_started_pass' => array(
'integer', $this->
getPass()),
256 $this->active_id = $next_id;
273 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
274 array(
'integer',
'integer',
'text'),
280 $result =
$ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
281 array(
'integer',
'integer',
'text'),
287 if (
$GLOBALS[
'DIC'][
'ilUser']->getId() == ANONYMOUS_USER_ID)
291 $result =
$ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
292 array(
'integer',
'integer'),
303 $this->active_id =
$row[
"active_id"];
304 $this->user_id =
$row[
"user_fi"];
305 $this->anonymous_id =
$row[
"anonymous_id"];
306 $this->test_id =
$row[
"test_fi"];
307 $this->lastsequence =
$row[
"lastindex"];
308 $this->pass =
$row[
"tries"];
309 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
310 $this->submittedTimestamp =
$row[
"submittimestamp"];
311 $this->tstamp =
$row[
"tstamp"];
331 $result =
$ilDB->queryF(
"SELECT * FROM tst_active WHERE active_id = %s",
338 $this->active_id =
$row[
"active_id"];
339 $this->user_id =
$row[
"user_fi"];
340 $this->anonymous_id =
$row[
"anonymous_id"];
341 $this->test_id =
$row[
"test_fi"];
342 $this->lastsequence =
$row[
"lastindex"];
343 $this->pass =
$row[
"tries"];
344 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
345 $this->submittedTimestamp =
$row[
"submittimestamp"];
346 $this->tstamp =
$row[
"tstamp"];
421 $this->submitted = TRUE;
431 $this->submittedTimestamp = strftime(
"%Y-%m-%d %H:%M:%S");
446 $this->objectiveOrientedContainerId = $objectiveOriented;
481 array(
'start_lock' => array(
'text', $testStartLock)),
482 array(
'active_id' => array(
'integer', $this->
getActiveId()))
491 "SELECT start_lock FROM tst_active WHERE active_id = %s",
495 while(
$row = $ilDB->fetchAssoc(
$res))
497 return $row[
'start_lock'];
505 if (!is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX]))
520 if( !is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
535 if( !is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
558 $query =
"SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s";
564 return (
$result->numRows() > 0);
578 $index = mt_rand(0, strlen($codestring)-1);
579 $code .= substr($codestring, $index, 1);
587 return $this->
getUserId() == ANONYMOUS_USER_ID;
An exception for terminatinating execution or to throw for unit testing.
Base Exception for all Exceptions relating to Modules/Test.
activeIDExists($user_id, $test_id)
setAccessCodeToSession($access_code)
persistTestStartLock($testStartLock)
__construct()
ilTestSession constructor
getAccessCodeFromSession()
setAnonymousId($anonymous_id)
setRefId($a_val)
Set Ref id.
setObjectiveOrientedContainerId($objectiveOriented)
const ACCESS_CODE_SESSION_INDEX
loadTestSession($test_id, $user_id="", $anonymous_id="")
loadFromDb($active_id)
Loads the session data for a given active id.
getObjectiveOrientedContainerId()
setLastSequence($lastsequence)
$objectiveOrientedContainerId
const ACCESS_CODE_CHAR_DOMAIN
setLastFinishedPass($lastFinishedPass)
doesAccessCodeInSessionExists()
setLastStartedPass($lastStartedPass)
unsetAccessCodeInSession()
$GLOBALS['loaded']
Global hash that tracks already loaded includes.