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'),
143 array($user_id, $test_id)
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',
196 'submitted' =>
array(
'integer', $submitted),
215 if ($this->active_id > 0)
217 $ilDB->update(
'tst_active',
221 'submitted' =>
array(
'integer', $submitted),
225 'last_started_pass' =>
array(
'integer', $this->
getPass()),
239 $next_id = $ilDB->nextId(
'tst_active');
240 $ilDB->insert(
'tst_active',
242 'active_id' =>
array(
'integer', $next_id),
244 'anonymous_id' =>
array(
'text', $anonymous_id),
248 'submitted' =>
array(
'integer', $submitted),
252 'last_started_pass' =>
array(
'integer', $this->
getPass()),
256 $this->active_id = $next_id;
269 $user_id = $ilUser->getId();
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'),
278 else if (strlen($anonymous_id))
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'),
282 array($user_id, $test_id, $anonymous_id)
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'),
293 array($user_id, $test_id)
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)),
490 $res = $ilDB->queryF(
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);
570 $codestring = self::ACCESS_CODE_CHAR_DOMAIN;
576 for($i = 1; $i <= self::ACCESS_CODE_LENGTH; $i++)
578 $index = mt_rand(0, strlen($codestring)-1);
579 $code .= substr($codestring, $index, 1);
587 return $this->
getUserId() == ANONYMOUS_USER_ID;
const ACCESS_CODE_CHAR_DOMAIN
$objectiveOrientedContainerId
getAccessCodeFromSession()
setObjectiveOrientedContainerId($objectiveOriented)
setRefId($a_val)
Set Ref id.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
__construct()
ilTestSession constructor
doesAccessCodeInSessionExists()
setAnonymousId($anonymous_id)
getObjectiveOrientedContainerId()
Base Exception for all Exceptions relating to Modules/Test.
const ACCESS_CODE_SESSION_INDEX
setAccessCodeToSession($access_code)
loadFromDb($active_id)
Loads the session data for a given active id.
setLastFinishedPass($lastFinishedPass)
setLastStartedPass($lastStartedPass)
unsetAccessCodeInSession()
Create styles array
The data for the language used.
persistTestStartLock($testStartLock)
setLastSequence($lastsequence)
activeIDExists($user_id, $test_id)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
loadTestSession($test_id, $user_id="", $anonymous_id="")