84 $this->anonymous_id = 0;
86 $this->lastsequence = 0;
87 $this->submitted = FALSE;
88 $this->submittedTimestamp =
"";
105 $this->ref_id = $a_val;
122 if (
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID)
124 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
125 array(
'integer',
'integer'),
131 $this->active_id =
$row[
"active_id"];
132 $this->active_id =
$row[
"active_id"];
133 $this->user_id =
$row[
"user_fi"];
134 $this->anonymous_id =
$row[
"anonymous_id"];
135 $this->test_id =
$row[
"test_fi"];
136 $this->lastsequence =
$row[
"lastindex"];
137 $this->pass =
$row[
"tries"];
138 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
139 $this->submittedTimestamp =
$row[
"submittimestamp"];
140 $this->tstamp =
$row[
"tstamp"];
155 if (time() -
$_SESSION[
'tst_last_increase_pass'] > 10)
157 $_SESSION[
'tst_last_increase_pass'] = time();
158 $this->tstamp = time();
159 if ($this->active_id > 0)
161 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_active SET lastindex = %s, tries = %s, submitted = %s, submittimestamp = %s, tstamp = %s WHERE active_id = %s",
162 array(
'integer',
'integer',
'integer',
'timestamp',
'integer',
'integer'),
174 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
175 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
184 $next_id = $ilDB->nextId(
'tst_active');
185 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_active (active_id, user_fi, anonymous_id, test_fi, lastindex, tries, submitted, submittimestamp, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
186 array(
'integer',
'integer',
'text',
'integer',
'integer',
'integer',
'integer',
'timestamp',
'integer'),
199 $this->active_id = $next_id;
202 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
203 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
216 if ($this->active_id > 0)
218 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_active SET lastindex = %s, tries = %s, submitted = %s, submittimestamp = %s, tstamp = %s WHERE active_id = %s",
219 array(
'integer',
'integer',
'integer',
'timestamp',
'integer',
'integer'),
231 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
232 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
241 $next_id = $ilDB->nextId(
'tst_active');
242 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_active (active_id, user_fi, anonymous_id, test_fi, lastindex, tries, submitted, submittimestamp, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
243 array(
'integer',
'integer',
'text',
'integer',
'integer',
'integer',
'integer',
'timestamp',
'integer'),
256 $this->active_id = $next_id;
259 include_once(
"./Modules/Test/classes/class.ilObjTestAccess.php");
260 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
266 include_once(
"./Services/Tracking/classes/class.ilLearningProgress.php");
284 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
285 array(
'integer',
'integer',
'text'),
291 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
292 array(
'integer',
'integer',
'text'),
298 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
302 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
303 array(
'integer',
'integer'),
310 $this->active_id =
$row[
"active_id"];
311 $this->user_id =
$row[
"user_fi"];
312 $this->anonymous_id =
$row[
"anonymous_id"];
313 $this->test_id =
$row[
"test_fi"];
314 $this->lastsequence =
$row[
"lastindex"];
315 $this->pass =
$row[
"tries"];
316 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
317 $this->submittedTimestamp =
$row[
"submittimestamp"];
318 $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"];
417 $this->submitted = TRUE;
427 $this->submittedTimestamp = strftime(
"%Y-%m-%d %H:%M:%S");