98 $this->anonymous_id = 0;
100 $this->lastsequence = 0;
101 $this->lastPresentationMode = null;
102 $this->submitted = FALSE;
103 $this->submittedTimestamp =
"";
108 $this->lastFinishedPass = null;
109 $this->objectiveOrientedContainerId = 0;
119 $this->ref_id = $a_val;
136 if (
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID)
138 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
139 array(
'integer',
'integer'),
140 array($user_id, $test_id)
145 $this->active_id =
$row[
"active_id"];
146 $this->user_id =
$row[
"user_fi"];
147 $this->anonymous_id =
$row[
"anonymous_id"];
148 $this->test_id =
$row[
"test_fi"];
149 $this->lastsequence =
$row[
"lastindex"];
150 $this->pass =
$row[
"tries"];
151 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
152 $this->submittedTimestamp =
$row[
"submittimestamp"];
153 $this->tstamp =
$row[
"tstamp"];
172 if (time() -
$_SESSION[
'tst_last_increase_pass'] > 10)
174 $_SESSION[
'tst_last_increase_pass'] = time();
175 $this->tstamp = time();
176 if ($this->active_id > 0)
178 $ilDB->update(
'tst_active',
181 'tries' => array(
'integer', $this->
getPass()),
182 'submitted' => array(
'integer', $submitted),
184 'tstamp' => array(
'integer', time()),
189 'active_id' => array(
'integer', $this->
getActiveId())
194 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
195 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
205 $next_id = $ilDB->nextId(
'tst_active');
207 $ilDB->insert(
'tst_active', array(
208 'active_id' => array(
'integer', $next_id),
209 'user_fi' => array(
'integer', $this->
getUserId()),
210 'anonymous_id' => array(
'text', $anonymous_id),
211 'test_fi' => array(
'integer', $this->
getTestId()),
213 'tries' => array(
'integer', $this->
getPass()),
214 'submitted' => array(
'integer', $submitted),
215 'submittimestamp' => array(
'timestamp', $submittedTs),
216 'tstamp' => array(
'integer', time()),
220 $this->active_id = $next_id;
223 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
224 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
237 if ($this->active_id > 0)
239 $ilDB->update(
'tst_active',
242 'tries' => array(
'integer', $this->
getPass()),
243 'submitted' => array(
'integer', $submitted),
245 'tstamp' => array(
'integer', time()-10),
250 'active_id' => array(
'integer', $this->
getActiveId())
255 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
256 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
266 $next_id = $ilDB->nextId(
'tst_active');
267 $ilDB->insert(
'tst_active',
269 'active_id' => array(
'integer', $next_id),
270 'user_fi' => array(
'integer', $this->
getUserId()),
271 'anonymous_id' => array(
'text', $anonymous_id),
272 'test_fi' => array(
'integer', $this->
getTestId()),
274 'tries' => array(
'integer', $this->
getPass()),
275 'submitted' => array(
'integer', $submitted),
277 'tstamp' => array(
'integer', time()-10),
282 $this->active_id = $next_id;
285 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
286 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
291 include_once
'./Modules/Test/classes/class.ilObjTestAccess.php';
292 include_once(
"./Services/Tracking/classes/class.ilLearningProgress.php");
306 $user_id = $ilUser->getId();
310 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
311 array(
'integer',
'integer',
'text'),
315 else if (strlen($anonymous_id))
317 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
318 array(
'integer',
'integer',
'text'),
319 array($user_id, $test_id, $anonymous_id)
324 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
328 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
329 array(
'integer',
'integer'),
330 array($user_id, $test_id)
336 $this->active_id =
$row[
"active_id"];
337 $this->user_id =
$row[
"user_fi"];
338 $this->anonymous_id =
$row[
"anonymous_id"];
339 $this->test_id =
$row[
"test_fi"];
340 $this->lastsequence =
$row[
"lastindex"];
341 $this->pass =
$row[
"tries"];
342 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
343 $this->submittedTimestamp =
$row[
"submittimestamp"];
344 $this->tstamp =
$row[
"tstamp"];
363 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE active_id = %s",
370 $this->active_id =
$row[
"active_id"];
371 $this->user_id =
$row[
"user_fi"];
372 $this->anonymous_id =
$row[
"anonymous_id"];
373 $this->test_id =
$row[
"test_fi"];
374 $this->lastsequence =
$row[
"lastindex"];
375 $this->pass =
$row[
"tries"];
376 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
377 $this->submittedTimestamp =
$row[
"submittimestamp"];
378 $this->tstamp =
$row[
"tstamp"];
452 $this->submitted = TRUE;
462 $this->submittedTimestamp = strftime(
"%Y-%m-%d %H:%M:%S");
477 $this->objectiveOrientedContainerId = $objectiveOriented;
496 array(
'start_lock' => array(
'text', $testStartLock)),
497 array(
'active_id' => array(
'integer', $this->
getActiveId()))
505 $res = $ilDB->queryF(
506 "SELECT start_lock FROM tst_active WHERE active_id = %s",
510 while(
$row = $ilDB->fetchAssoc(
$res))
512 return $row[
'start_lock'];
520 if (!is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX]))
522 $_SESSION[self::ACCESS_CODE_SESSION_INDEX] = array();
535 if( !is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
550 if( !is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
573 $query =
"SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s";
579 return (
$result->numRows() > 0);
585 $codestring = self::ACCESS_CODE_CHAR_DOMAIN;
591 for($i = 1; $i <= self::ACCESS_CODE_LENGTH; $i++)
593 $index = mt_rand(0, strlen($codestring)-1);
594 $code .= substr($codestring, $index, 1);
602 return $this->
getUserId() == ANONYMOUS_USER_ID;
const ACCESS_CODE_CHAR_DOMAIN
$objectiveOrientedContainerId
getAccessCodeFromSession()
setObjectiveOrientedContainerId($objectiveOriented)
setRefId($a_val)
Set Ref id.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
__construct()
ilTestSession constructor
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
doesAccessCodeInSessionExists()
setAnonymousId($anonymous_id)
_lookupObjIdForTestId($a_test_id)
Lookup object id for test id.
getObjectiveOrientedContainerId()
const ACCESS_CODE_SESSION_INDEX
setAccessCodeToSession($access_code)
loadFromDb($active_id)
Loads the session data for a given active id.
setLastFinishedPass($lastFinishedPass)
unsetAccessCodeInSession()
_getParticipantId($active_id)
Get user id for active id.
persistTestStartLock($testStartLock)
setLastSequence($lastsequence)
activeIDExists($user_id, $test_id)
loadTestSession($test_id, $user_id="", $anonymous_id="")