100 $this->anonymous_id = 0;
102 $this->lastsequence = 0;
103 $this->lastPresentationMode =
null;
104 $this->submitted =
false;
105 $this->submittedTimestamp =
"";
110 $this->lastStartedPass =
null;
111 $this->lastFinishedPass =
null;
112 $this->objectiveOrientedContainerId = 0;
122 $this->ref_id = $a_val;
132 return $this->ref_id;
139 if (
$GLOBALS[
'DIC'][
'ilUser']->getId() != ANONYMOUS_USER_ID) {
141 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
142 array(
'integer',
'integer'),
147 $this->active_id =
$row[
"active_id"];
148 $this->user_id =
$row[
"user_fi"];
149 $this->anonymous_id =
$row[
"anonymous_id"];
150 $this->test_id =
$row[
"test_fi"];
151 $this->lastsequence =
$row[
"lastindex"];
152 $this->pass =
$row[
"tries"];
153 $this->submitted = (
$row[
"submitted"]) ?
true :
false;
154 $this->submittedTimestamp =
$row[
"submittimestamp"];
155 $this->tstamp =
$row[
"tstamp"];
171 if (!$this->active_id) {
172 require_once
'Modules/Test/exceptions/class.ilTestException.php';
180 if (!isset(
$_SESSION[$this->active_id][
'tst_last_increase_pass'])) {
187 $this->tstamp = time();
192 'tries' => array(
'integer', $this->
getPass()),
195 'tstamp' => array(
'integer', time()),
201 'active_id' => array(
'integer', $this->
getActiveId())
212 if ($this->active_id > 0) {
217 'tries' => array(
'integer', $this->
getPass()),
220 'tstamp' => array(
'integer', time()-10),
222 'last_started_pass' => array(
'integer', $this->
getPass()),
226 'active_id' => array(
'integer', $this->
getActiveId())
233 $next_id =
$ilDB->nextId(
'tst_active');
237 'active_id' => array(
'integer', $next_id),
238 'user_fi' => array(
'integer', $this->
getUserId()),
240 'test_fi' => array(
'integer', $this->
getTestId()),
242 'tries' => array(
'integer', $this->
getPass()),
245 'tstamp' => array(
'integer', time()-10),
247 'last_started_pass' => array(
'integer', $this->
getPass()),
251 $this->active_id = $next_id;
266 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
267 array(
'integer',
'integer',
'text'),
272 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
273 array(
'integer',
'integer',
'text'),
277 if (
$GLOBALS[
'DIC'][
'ilUser']->getId() == ANONYMOUS_USER_ID) {
281 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
282 array(
'integer',
'integer'),
292 $this->active_id =
$row[
"active_id"];
293 $this->user_id =
$row[
"user_fi"];
294 $this->anonymous_id =
$row[
"anonymous_id"];
295 $this->test_id =
$row[
"test_fi"];
296 $this->lastsequence =
$row[
"lastindex"];
297 $this->pass =
$row[
"tries"];
298 $this->submitted = (
$row[
"submitted"]) ?
true :
false;
299 $this->submittedTimestamp =
$row[
"submittimestamp"];
300 $this->tstamp =
$row[
"tstamp"];
319 "SELECT * FROM tst_active WHERE active_id = %s",
325 $this->active_id =
$row[
"active_id"];
326 $this->user_id =
$row[
"user_fi"];
327 $this->anonymous_id =
$row[
"anonymous_id"];
328 $this->test_id =
$row[
"test_fi"];
329 $this->lastsequence =
$row[
"lastindex"];
330 $this->pass =
$row[
"tries"];
331 $this->submitted = (
$row[
"submitted"]) ?
true :
false;
332 $this->submittedTimestamp =
$row[
"submittimestamp"];
333 $this->tstamp =
$row[
"tstamp"];
408 $this->submitted =
true;
418 $this->submittedTimestamp = strftime(
"%Y-%m-%d %H:%M:%S");
433 $this->objectiveOrientedContainerId = $objectiveOriented;
468 array(
'start_lock' => array(
'text', $testStartLock)),
469 array(
'active_id' => array(
'integer', $this->
getActiveId()))
478 "SELECT start_lock FROM tst_active WHERE active_id = %s",
483 while (
$row = $ilDB->fetchAssoc(
$res)) {
484 return $row[
'start_lock'];
492 if (!is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
506 if (!is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
519 if (!is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
539 $query =
"SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s";
543 array(
'integer',
'text'),
547 return (
$result->numRows() > 0);
560 $index = mt_rand(0, strlen($codestring)-1);
569 return $this->
getUserId() == ANONYMOUS_USER_ID;
An exception for terminatinating execution or to throw for unit testing.
Base Exception for all Exceptions relating to Modules/Test.
activeIDExists($user_id, $test_id)
setAccessCodeToSession($access_code)
persistTestStartLock($testStartLock)
__construct()
ilTestSession constructor
getAccessCodeFromSession()
setAnonymousId($anonymous_id)
setRefId($a_val)
Set Ref id.
setObjectiveOrientedContainerId($objectiveOriented)
const ACCESS_CODE_SESSION_INDEX
loadTestSession($test_id, $user_id="", $anonymous_id="")
loadFromDb($active_id)
Loads the session data for a given active id.
getObjectiveOrientedContainerId()
setLastSequence($lastsequence)
$objectiveOrientedContainerId
const ACCESS_CODE_CHAR_DOMAIN
setLastFinishedPass($lastFinishedPass)
doesAccessCodeInSessionExists()
setLastStartedPass($lastStartedPass)
unsetAccessCodeInSession()
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
foreach($_POST as $key=> $value) $res