93 $this->anonymous_id = 0;
95 $this->lastsequence = 0;
96 $this->submitted = FALSE;
97 $this->submittedTimestamp =
"";
102 $this->lastFinishedPass = null;
103 $this->objectiveOrientedContainerId = 0;
113 $this->ref_id = $a_val;
130 if (
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID)
132 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
133 array(
'integer',
'integer'),
139 $this->active_id =
$row[
"active_id"];
140 $this->user_id =
$row[
"user_fi"];
141 $this->anonymous_id =
$row[
"anonymous_id"];
142 $this->test_id =
$row[
"test_fi"];
143 $this->lastsequence =
$row[
"lastindex"];
144 $this->pass =
$row[
"tries"];
145 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
146 $this->submittedTimestamp =
$row[
"submittimestamp"];
147 $this->tstamp =
$row[
"tstamp"];
166 if (time() -
$_SESSION[
'tst_last_increase_pass'] > 10)
168 $_SESSION[
'tst_last_increase_pass'] = time();
169 $this->tstamp = time();
170 if ($this->active_id > 0)
172 $ilDB->update(
'tst_active',
175 'tries' => array(
'integer', $this->
getPass()),
178 'tstamp' => array(
'integer', time()),
183 'active_id' => array(
'integer', $this->
getActiveId())
188 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
189 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
198 $next_id = $ilDB->nextId(
'tst_active');
199 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_active (active_id, user_fi, anonymous_id, test_fi, lastindex, tries, submitted, submittimestamp, tstamp, objective_container) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
200 array(
'integer',
'integer',
'text',
'integer',
'integer',
'integer',
'integer',
'timestamp',
'integer',
'integer'),
214 $this->active_id = $next_id;
217 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
218 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
231 if ($this->active_id > 0)
233 $ilDB->update(
'tst_active',
236 'tries' => array(
'integer', $this->
getPass()),
239 'tstamp' => array(
'integer', time()-10),
244 'active_id' => array(
'integer', $this->
getActiveId())
249 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
250 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
260 $next_id = $ilDB->nextId(
'tst_active');
261 $ilDB->insert(
'tst_active',
263 'active_id' => array(
'integer', $next_id),
264 'user_fi' => array(
'integer', $this->
getUserId()),
266 'test_fi' => array(
'integer', $this->
getTestId()),
268 'tries' => array(
'integer', $this->
getPass()),
271 'tstamp' => array(
'integer', time()-10),
276 $this->active_id = $next_id;
279 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
280 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
285 include_once
'./Modules/Test/classes/class.ilObjTestAccess.php';
286 include_once(
"./Services/Tracking/classes/class.ilLearningProgress.php");
304 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
305 array(
'integer',
'integer',
'text'),
311 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
312 array(
'integer',
'integer',
'text'),
318 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
322 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
323 array(
'integer',
'integer'),
330 $this->active_id =
$row[
"active_id"];
331 $this->user_id =
$row[
"user_fi"];
332 $this->anonymous_id =
$row[
"anonymous_id"];
333 $this->test_id =
$row[
"test_fi"];
334 $this->lastsequence =
$row[
"lastindex"];
335 $this->pass =
$row[
"tries"];
336 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
337 $this->submittedTimestamp =
$row[
"submittimestamp"];
338 $this->tstamp =
$row[
"tstamp"];
357 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE active_id = %s",
364 $this->active_id =
$row[
"active_id"];
365 $this->user_id =
$row[
"user_fi"];
366 $this->anonymous_id =
$row[
"anonymous_id"];
367 $this->test_id =
$row[
"test_fi"];
368 $this->lastsequence =
$row[
"lastindex"];
369 $this->pass =
$row[
"tries"];
370 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
371 $this->submittedTimestamp =
$row[
"submittimestamp"];
372 $this->tstamp =
$row[
"tstamp"];
446 $this->submitted = TRUE;
456 $this->submittedTimestamp = strftime(
"%Y-%m-%d %H:%M:%S");
471 $this->objectiveOrientedContainerId = $objectiveOriented;
490 array(
'start_lock' => array(
'text', $testStartLock)),
491 array(
'active_id' => array(
'integer', $this->
getActiveId()))
499 $res = $ilDB->queryF(
500 "SELECT start_lock FROM tst_active WHERE active_id = %s",
504 while(
$row = $ilDB->fetchAssoc(
$res))
506 return $row[
'start_lock'];
514 if (!is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX]))
529 if( !is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
544 if( !is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
567 $query =
"SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s";
573 return (
$result->numRows() > 0);
587 $index = mt_rand(0, strlen($codestring)-1);
588 $code .= substr($codestring, $index, 1);
596 return $this->
getUserId() == ANONYMOUS_USER_ID;