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();
212 if ($this->active_id > 0) {
222 'last_started_pass' =>
array(
'integer', $this->
getPass()),
233 $next_id = $ilDB->nextId(
'tst_active');
237 'active_id' =>
array(
'integer', $next_id),
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)),
477 $res = $ilDB->queryF(
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);
553 $codestring = self::ACCESS_CODE_CHAR_DOMAIN;
559 for (
$i = 1;
$i <= self::ACCESS_CODE_LENGTH;
$i++) {
560 $index = mt_rand(0, strlen($codestring)-1);
569 return $this->
getUserId() == ANONYMOUS_USER_ID;
const ACCESS_CODE_CHAR_DOMAIN
$objectiveOrientedContainerId
getAccessCodeFromSession()
setObjectiveOrientedContainerId($objectiveOriented)
setRefId($a_val)
Set Ref id.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
__construct()
ilTestSession constructor
doesAccessCodeInSessionExists()
setAnonymousId($anonymous_id)
getObjectiveOrientedContainerId()
Base Exception for all Exceptions relating to Modules/Test.
const ACCESS_CODE_SESSION_INDEX
setAccessCodeToSession($access_code)
loadFromDb($active_id)
Loads the session data for a given active id.
setLastFinishedPass($lastFinishedPass)
foreach($_POST as $key=> $value) $res
setLastStartedPass($lastStartedPass)
unsetAccessCodeInSession()
Create styles array
The data for the language used.
persistTestStartLock($testStartLock)
setLastSequence($lastsequence)
activeIDExists($user_id, $test_id)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
loadTestSession($test_id, $user_id="", $anonymous_id="")