101 $this->active_id = 0;
103 $this->anonymous_id = 0;
105 $this->lastsequence = 0;
106 $this->submitted = FALSE;
107 $this->submittedTimestamp =
"";
124 if (time() > $this->tstamp + 10)
126 $this->tstamp = time();
127 if ($this->active_id > 0)
129 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_active SET lastindex = %s, tries = %s, submitted = %s, submittimestamp = %s, tstamp = %s WHERE active_id = %s",
130 array(
'integer',
'integer',
'integer',
'timestamp',
'integer',
'integer'),
144 $next_id = $ilDB->nextId(
'tst_active');
145 $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)",
146 array(
'integer',
'integer',
'text',
'integer',
'integer',
'integer',
'integer',
'timestamp',
'integer'),
159 $this->active_id = $next_id;
169 if ($this->active_id > 0)
171 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_active SET lastindex = %s, tries = %s, submitted = %s, submittimestamp = %s, tstamp = %s WHERE active_id = %s",
172 array(
'integer',
'integer',
'integer',
'timestamp',
'integer',
'integer'),
186 $next_id = $ilDB->nextId(
'tst_active');
187 $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)",
188 array(
'integer',
'integer',
'text',
'integer',
'integer',
'integer',
'integer',
'timestamp',
'integer'),
201 $this->active_id = $next_id;
216 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
217 array(
'integer',
'integer',
'text'),
223 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
224 array(
'integer',
'integer',
'text'),
230 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
234 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
235 array(
'integer',
'integer'),
242 $this->active_id =
$row[
"active_id"];
243 $this->user_id =
$row[
"user_fi"];
244 $this->anonymous_id =
$row[
"anonymous_id"];
245 $this->test_id =
$row[
"test_fi"];
246 $this->lastsequence =
$row[
"lastindex"];
247 $this->pass =
$row[
"tries"];
248 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
249 $this->submittedTimestamp =
$row[
"submittimestamp"];
250 $this->tstamp =
$row[
"tstamp"];
263 $result = $ilDB->queryF(
"SELECT * FROM tst_active WHERE active_id = %s",
270 $this->active_id =
$row[
"active_id"];
271 $this->user_id =
$row[
"user_fi"];
272 $this->anonymous_id =
$row[
"anonymous_id"];
273 $this->test_id =
$row[
"test_fi"];
274 $this->lastsequence =
$row[
"lastindex"];
275 $this->pass =
$row[
"tries"];
276 $this->submitted = (
$row[
"submitted"]) ? TRUE : FALSE;
277 $this->submittedTimestamp =
$row[
"submittimestamp"];
278 $this->tstamp =
$row[
"tstamp"];
349 $this->submitted = TRUE;
359 $this->submittedTimestamp = strftime(
"%Y-%m-%d %H:%M:%S");