108 $this->active_id = 0;
110 $this->anonymous_id = 0;
112 $this->lastsequence = 0;
113 $this->submitted = FALSE;
114 $this->submittedTimestamp =
"";
128 if ($this->active_id > 0)
130 $query = sprintf(
"UPDATE tst_active SET lastindex = %s, tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
131 $ilDB->quote($this->getLastSequence() .
""),
132 $ilDB->quote($this->getPass() .
""),
137 $result = $ilDB->query($query);
142 $query = sprintf(
"INSERT INTO tst_active (active_id, user_fi, anonymous_id, test_fi, lastindex, tries, submitted, submittimestamp) VALUES (NULL, %s, %s, %s, %s, %s, %s, %s)",
143 $ilDB->quote($this->getUserId() .
""),
145 $ilDB->quote($this->getTestId() .
""),
146 $ilDB->quote($this->getLastSequence() .
""),
147 $ilDB->quote($this->getPass() .
""),
151 $result = $ilDB->query($query);
152 $this->active_id = $ilDB->getLastInsertId();
167 $query = sprintf(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
169 $ilDB->quote($test_id),
170 $ilDB->quote(
$_SESSION[
"tst_access_code"][$test_id])
175 $query = sprintf(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
177 $ilDB->quote($test_id),
183 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
187 $query = sprintf(
"SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
189 $ilDB->quote($test_id)
192 $result = $ilDB->query($query);
195 $row =
$result->fetchRow(MDB2_FETCHMODE_ASSOC);
196 $this->active_id = $row[
"active_id"];
197 $this->user_id = $row[
"user_fi"];
198 $this->anonymous_id = $row[
"anonymous_id"];
199 $this->test_id = $row[
"test_fi"];
200 $this->lastsequence = $row[
"lastindex"];
201 $this->pass = $row[
"tries"];
202 $this->submitted = ($row[
"submitted"]) ? TRUE : FALSE;
203 $this->submittedTimestamp = $row[
"submittimestamp"];
218 $query = sprintf(
"SELECT * FROM tst_active WHERE active_id = %s",
221 $result = $ilDB->query($query);
222 if ($result->numRows())
224 $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
225 $this->active_id = $row[
"active_id"];
226 $this->user_id = $row[
"user_fi"];
227 $this->anonymous_id = $row[
"anonymous_id"];
228 $this->test_id = $row[
"test_fi"];
229 $this->lastsequence = $row[
"lastindex"];
230 $this->pass = $row[
"tries"];
231 $this->submitted = ($row[
"submitted"]) ? TRUE : FALSE;
232 $this->submittedTimestamp = $row[
"submittimestamp"];
303 $this->submitted = TRUE;
313 $this->submittedTimestamp = strftime(
"%Y-%m-%d %H:%M:%S");