ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestSession Class Reference

Test session handler. More...

+ Collaboration diagram for ilTestSession:

Public Member Functions

 __construct (protected ilDBInterface $db, protected ilObjUser $user)
 ilTestSession constructor More...
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 increaseTestPass ()
 
 saveToDb ()
 
 loadTestSession (int $test_id, int $user_id=0, ?string $anonymous_id=null)
 
 loadFromDb (int $active_id)
 
 getActiveId ()
 
 setUserId (int $user_id)
 
 getUserId ()
 
 setTestId (int $test_id)
 
 getTestId ()
 
 setAnonymousId (string $anonymous_id)
 
 getAnonymousId ()
 
 setLastSequence (int $lastsequence)
 
 getLastSequence ()
 
 setPass (int $pass)
 
 getPass ()
 
 increasePass ()
 
 isSubmitted ()
 
 setSubmitted ()
 
 getSubmittedTimestamp ()
 
 setSubmittedTimestamp ()
 
 setLastFinishedPass (int $lastFinishedPass)
 
 getLastFinishedPass ()
 
 setObjectiveOrientedContainerId (int $objectiveOriented)
 
 getObjectiveOrientedContainerId ()
 
 getLastStartedPass ()
 
 setLastStartedPass (int $lastStartedPass)
 
 isObjectiveOriented ()
 
 persistTestStartLock (string $testStartLock)
 
 lookupTestStartLock ()
 
 setAccessCodeToSession (string $access_code)
 
 unsetAccessCodeInSession ()
 
 getAccessCodeFromSession ()
 
 doesAccessCodeInSessionExists ()
 
 createNewAccessCode ()
 
 isAccessCodeUsed (string $code)
 
 isAnonymousUser ()
 
 isPasswordChecked ()
 
 setPasswordChecked (bool $value)
 
 reportableResultsAvailable (ilObjTest $test_obj)
 
 hasSinglePassReportable (ilObjTest $testObj)
 

Data Fields

const ACCESS_CODE_SESSION_INDEX = "tst_access_code"
 
const ACCESS_CODE_CHAR_DOMAIN = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
const ACCESS_CODE_LENGTH = 5
 
int $active_id = 0
 
int $user_id = 0
 
string $anonymous_id = ''
 
int $test_id = 0
 
int $lastsequence = 0
 
bool $submitted = false
 
int $tstamp = 0
 
string $submittedTimestamp = ''
 

Protected Member Functions

 activeIDExists (int $user_id, int $test_id)
 

Protected Attributes

string $lastPresentationMode = null
 

Private Member Functions

 buildAccessCode ()
 

Private Attributes

int $ref_id = 0
 
int $pass = 0
 
int $objectiveOrientedContainerId = null
 
int $lastFinishedPass = null
 
int $lastStartedPass = null
 
bool $reportable_results_available = null
 

Detailed Description

Test session handler.

This class manages the test session for a participant

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$ \

Definition at line 30 of file class.ilTestSession.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestSession::__construct ( protected ilDBInterface  $db,
protected ilObjUser  $user 
)

ilTestSession constructor

The constructor takes possible arguments an creates an instance of the ilTestSession object.

@access public

Definition at line 61 of file class.ilTestSession.php.

64 {
65 }

Member Function Documentation

◆ activeIDExists()

ilTestSession::activeIDExists ( int  $user_id,
int  $test_id 
)
protected

Definition at line 77 of file class.ilTestSession.php.

77 : bool
78 {
79 if ($this->user->getId() === ANONYMOUS_USER_ID) {
80 return false;
81 }
82
83 $result = $this->db->queryF(
84 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
85 ['integer','integer'],
87 );
88 if ($result->numRows()) {
89 $row = $this->db->fetchAssoc($result);
90 $this->active_id = (int) $row["active_id"];
91 $this->user_id = (int) $row["user_fi"];
92 $this->anonymous_id = $row["anonymous_id"] ?? '';
93 $this->test_id = (int) $row["test_fi"];
94 $this->lastsequence = (int) $row["lastindex"];
95 $this->pass = (int) $row["tries"];
96 $this->submitted = ($row["submitted"]) ? true : false;
97 $this->submittedTimestamp = (string) $row["submittimestamp"];
98 $this->tstamp = (int) $row["tstamp"];
99
100 $this->lastStartedPass = $row['last_started_pass'];
101 $this->lastFinishedPass = $row['last_finished_pass'];
102 $this->objectiveOrientedContainerId = $row['objective_container'];
103
104 return true;
105 }
106 return false;
107 }
const ANONYMOUS_USER_ID
Definition: constants.php:27

References $test_id, $user_id, ANONYMOUS_USER_ID, ILIAS\Repository\int(), and ILIAS\Repository\user().

Referenced by saveToDb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildAccessCode()

ilTestSession::buildAccessCode ( )
private

Definition at line 470 of file class.ilTestSession.php.

470 : string
471 {
472 // create a 5 character code
473 $codestring = self::ACCESS_CODE_CHAR_DOMAIN;
474
475 mt_srand();
476
477 $code = "";
478
479 for ($i = 1; $i <= self::ACCESS_CODE_LENGTH; $i++) {
480 $index = mt_rand(0, strlen($codestring) - 1);
481 $code .= substr($codestring, $index, 1);
482 }
483
484 return $code;
485 }

References ACCESS_CODE_CHAR_DOMAIN, and ACCESS_CODE_LENGTH.

Referenced by createNewAccessCode().

+ Here is the caller graph for this function:

◆ createNewAccessCode()

ilTestSession::createNewAccessCode ( )

Definition at line 448 of file class.ilTestSession.php.

448 : string
449 {
450 do {
451 $code = $this->buildAccessCode();
452 } while ($this->isAccessCodeUsed($code));
453
454 return $code;
455 }
isAccessCodeUsed(string $code)

References buildAccessCode(), and isAccessCodeUsed().

+ Here is the call graph for this function:

◆ doesAccessCodeInSessionExists()

ilTestSession::doesAccessCodeInSessionExists ( )

Definition at line 443 of file class.ilTestSession.php.

443 : bool
444 {
445 return is_array(ilSession::get(self::ACCESS_CODE_SESSION_INDEX)) && isset(ilSession::get(self::ACCESS_CODE_SESSION_INDEX)[$this->getTestId()]);
446 }
static get(string $a_var)

References ilSession\get(), and getTestId().

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession(), and loadTestSession().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAccessCodeFromSession()

ilTestSession::getAccessCodeFromSession ( )

Definition at line 430 of file class.ilTestSession.php.

430 : ?string
431 {
432 if (!is_array(ilSession::get(self::ACCESS_CODE_SESSION_INDEX))) {
433 return null;
434 }
435 $session_code = ilSession::get(self::ACCESS_CODE_SESSION_INDEX);
436 if (!isset($session_code[$this->getTestId()])) {
437 return null;
438 }
439
440 return $session_code[$this->getTestId()];
441 }

References ilSession\get(), and getTestId().

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession(), and loadTestSession().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveId()

◆ getAnonymousId()

ilTestSession::getAnonymousId ( )

Definition at line 301 of file class.ilTestSession.php.

301 : string
302 {
303 return $this->anonymous_id;
304 }

References $anonymous_id.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getLastFinishedPass()

ilTestSession::getLastFinishedPass ( )

Definition at line 356 of file class.ilTestSession.php.

356 : ?int
357 {
359 }

References $lastFinishedPass.

Referenced by ilObjTest\canShowTestResults(), ilObjTest\hasAnyTestResult(), hasSinglePassReportable(), increaseTestPass(), and saveToDb().

+ Here is the caller graph for this function:

◆ getLastSequence()

ilTestSession::getLastSequence ( )

Definition at line 311 of file class.ilTestSession.php.

311 : int
312 {
313 return $this->lastsequence;
314 }

References $lastsequence.

Referenced by ilTestSequence\hasStarted(), increaseTestPass(), and saveToDb().

+ Here is the caller graph for this function:

◆ getLastStartedPass()

ilTestSession::getLastStartedPass ( )
Returns
int

Definition at line 374 of file class.ilTestSession.php.

374 : ?int
375 {
377 }

References $lastStartedPass.

Referenced by increaseTestPass().

+ Here is the caller graph for this function:

◆ getObjectiveOrientedContainerId()

ilTestSession::getObjectiveOrientedContainerId ( )

Definition at line 366 of file class.ilTestSession.php.

366 : int
367 {
368 return $this->objectiveOrientedContainerId ?? 0;
369 }

Referenced by ilLOTestQuestionAdapter\getInstance(), increaseTestPass(), isObjectiveOriented(), ilLOTestQuestionAdapter\notifyTestStart(), and saveToDb().

+ Here is the caller graph for this function:

◆ getPass()

ilTestSession::getPass ( )

Definition at line 321 of file class.ilTestSession.php.

321 : int
322 {
323 return $this->pass;
324 }

References $pass.

Referenced by ilTestPlayerAbstractGUI\handleSkillTriggering(), increaseTestPass(), saveToDb(), ilTestRandomQuestionSetBuilder\storeQuestion(), and ilLOTestQuestionAdapter\updateQuestionResult().

+ Here is the caller graph for this function:

◆ getRefId()

◆ getSubmittedTimestamp()

ilTestSession::getSubmittedTimestamp ( )

Definition at line 341 of file class.ilTestSession.php.

341 : ?string
342 {
344 }

References $submittedTimestamp.

Referenced by increaseTestPass(), and saveToDb().

+ Here is the caller graph for this function:

◆ getTestId()

ilTestSession::getTestId ( )

Definition at line 291 of file class.ilTestSession.php.

291 : int
292 {
293 return $this->test_id;
294 }

References $test_id.

Referenced by doesAccessCodeInSessionExists(), getAccessCodeFromSession(), isAccessCodeUsed(), saveToDb(), setAccessCodeToSession(), and unsetAccessCodeInSession().

+ Here is the caller graph for this function:

◆ getUserId()

ilTestSession::getUserId ( )

◆ hasSinglePassReportable()

ilTestSession::hasSinglePassReportable ( ilObjTest  $testObj)

Definition at line 524 of file class.ilTestSession.php.

524 : bool
525 {
526 $test_passes_selector = new ilTestPassesSelector($this->db, $testObj);
527 $test_passes_selector->setActiveId($this->getActiveId());
528 $test_passes_selector->setLastFinishedPass($this->getLastFinishedPass());
529
530 if (count($test_passes_selector->getReportablePasses()) == 1) {
531 return true;
532 }
533
534 return false;
535 }

References getActiveId(), and getLastFinishedPass().

+ Here is the call graph for this function:

◆ increasePass()

ilTestSession::increasePass ( )

Definition at line 326 of file class.ilTestSession.php.

327 {
328 $this->pass += 1;
329 }

Referenced by increaseTestPass().

+ Here is the caller graph for this function:

◆ increaseTestPass()

ilTestSession::increaseTestPass ( )

Definition at line 109 of file class.ilTestSession.php.

109 : void
110 {
111 if (!$this->active_id) {
112 throw new ilTestException('missing active id on test pass increase!');
113 }
114
115 $this->increasePass();
116 $this->setLastSequence(0);
117 $submitted = ($this->isSubmitted()) ? 1 : 0;
118 $active = ilSession::get((string) $this->active_id);
119 if (!isset($active['tst_last_increase_pass']) || $active['tst_last_increase_pass'] !== null) {
120 $active['tst_last_increase_pass'] = 0;
121 }
122
123 // there has to be at least 10 seconds between new test passes (to ensure that noone double clicks the finish button and increases the test pass by more than 1)
124 if (time() - $active['tst_last_increase_pass'] > 10) {
125 $active['tst_last_increase_pass'] = time();
126 $this->tstamp = time();
127 $submittedtimestamp = $this->getSubmittedTimestamp() !== null && $this->getSubmittedTimestamp() !== '' ? $this->getSubmittedTimestamp() : null;
128 $this->db->update(
129 'tst_active',
130 [
131 'lastindex' => ['integer', $this->getLastSequence()],
132 'tries' => ['integer', $this->getPass()],
133 'submitted' => ['integer', $submitted],
134 'submittimestamp' => ['timestamp', $submittedtimestamp],
135 'tstamp' => ['integer', time()],
136 'last_finished_pass' => ['integer', $this->getLastFinishedPass()],
137 'last_started_pass' => ['integer', $this->getLastStartedPass()],
138 'objective_container' => ['integer', $this->getObjectiveOrientedContainerId()]
139 ],
140 [
141 'active_id' => ['integer', $this->getActiveId()]
142 ]
143 );
144 }
145 }
Base Exception for all Exceptions relating to Modules/Test.
setLastSequence(int $lastsequence)

References ilSession\get(), getActiveId(), getLastFinishedPass(), getLastSequence(), getLastStartedPass(), getObjectiveOrientedContainerId(), getPass(), getSubmittedTimestamp(), increasePass(), isSubmitted(), and setLastSequence().

+ Here is the call graph for this function:

◆ isAccessCodeUsed()

ilTestSession::isAccessCodeUsed ( string  $code)

Definition at line 457 of file class.ilTestSession.php.

457 : bool
458 {
459 $query = "SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s";
460
461 $result = $this->db->queryF(
462 $query,
463 ['integer', 'text'],
464 [$this->getTestId(), $code]
465 );
466
467 return ($result->numRows() > 0);
468 }

References getTestId().

Referenced by createNewAccessCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnonymousUser()

ilTestSession::isAnonymousUser ( )

Definition at line 487 of file class.ilTestSession.php.

487 : bool
488 {
489 return $this->getUserId() == ANONYMOUS_USER_ID;
490 }

References ANONYMOUS_USER_ID, and getUserId().

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isObjectiveOriented()

ilTestSession::isObjectiveOriented ( )

Definition at line 384 of file class.ilTestSession.php.

384 : bool
385 {
386 return (bool) $this->getObjectiveOrientedContainerId();
387 }

References getObjectiveOrientedContainerId().

+ Here is the call graph for this function:

◆ isPasswordChecked()

ilTestSession::isPasswordChecked ( )

Definition at line 492 of file class.ilTestSession.php.

492 : bool
493 {
494 if (ilSession::get('pw_checked_' . $this->active_id) === null) {
495 return false;
496 }
497 return ilSession::get('pw_checked_' . $this->active_id);
498 }

References ilSession\get().

+ Here is the call graph for this function:

◆ isSubmitted()

ilTestSession::isSubmitted ( )

Definition at line 331 of file class.ilTestSession.php.

331 : bool
332 {
333 return $this->submitted;
334 }

References $submitted.

Referenced by increaseTestPass(), and saveToDb().

+ Here is the caller graph for this function:

◆ loadFromDb()

ilTestSession::loadFromDb ( int  $active_id)

Definition at line 246 of file class.ilTestSession.php.

246 : void
247 {
248 $result = $this->db->queryF(
249 "SELECT * FROM tst_active WHERE active_id = %s",
250 ['integer'],
251 [$active_id]
252 );
253 if ($result->numRows()) {
254 $row = $this->db->fetchAssoc($result);
255 $this->active_id = $row["active_id"];
256 $this->user_id = $row["user_fi"];
257 $this->anonymous_id = $row["anonymous_id"] ?? '';
258 $this->test_id = $row["test_fi"];
259 $this->lastsequence = $row["lastindex"];
260 $this->pass = $row["tries"];
261 $this->submitted = ($row["submitted"]) ? true : false;
262 $this->submittedTimestamp = $row["submittimestamp"] ?? '';
263 $this->tstamp = $row["tstamp"];
264
265 $this->lastStartedPass = $row['last_started_pass'];
266 $this->lastFinishedPass = $row['last_finished_pass'];
267 $this->setObjectiveOrientedContainerId((int) $row['objective_container']);
268 }
269 }
setObjectiveOrientedContainerId(int $objectiveOriented)

References $active_id, and setObjectiveOrientedContainerId().

+ Here is the call graph for this function:

◆ loadTestSession()

ilTestSession::loadTestSession ( int  $test_id,
int  $user_id = 0,
?string  $anonymous_id = null 
)

Definition at line 196 of file class.ilTestSession.php.

196 : void
197 {
198 if ($user_id === 0) {
199 $user_id = $this->user->getId();
200 }
201 if (($this->user->getId() == ANONYMOUS_USER_ID) && $this->doesAccessCodeInSessionExists()) {
202 $result = $this->db->queryF(
203 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
204 ['integer','integer','text'],
206 );
207 } elseif ($anonymous_id !== null) {
208 $result = $this->db->queryF(
209 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
210 ['integer','integer','text'],
212 );
213 } else {
214 if ($this->user->getId() == ANONYMOUS_USER_ID) {
215 return;
216 }
217 $result = $this->db->queryF(
218 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
219 ['integer','integer'],
221 );
222 }
223
224 // TODO bheyser: Refactor
225 $this->user_id = $user_id;
226
227 if ($result->numRows()) {
228 $row = $this->db->fetchAssoc($result);
229 $this->active_id = $row["active_id"];
230 $this->user_id = $row["user_fi"];
231 $this->anonymous_id = $row["anonymous_id"] ?? '';
232 $this->test_id = $row["test_fi"];
233 $this->lastsequence = $row["lastindex"];
234 $this->pass = $row["tries"];
235 $this->submitted = ($row["submitted"]) ? true : false;
236 $this->submittedTimestamp = $row["submittimestamp"] ?? '';
237 $this->tstamp = $row["tstamp"];
238 $this->lastStartedPass = $row['last_started_pass'];
239 $this->lastFinishedPass = $row['last_finished_pass'];
240 $this->setObjectiveOrientedContainerId((int) $row['objective_container']);
241 } elseif ($this->doesAccessCodeInSessionExists()) {
243 }
244 }

References $anonymous_id, $test_id, $user_id, ANONYMOUS_USER_ID, doesAccessCodeInSessionExists(), getAccessCodeFromSession(), setObjectiveOrientedContainerId(), unsetAccessCodeInSession(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ lookupTestStartLock()

ilTestSession::lookupTestStartLock ( )

Definition at line 398 of file class.ilTestSession.php.

398 : ?string
399 {
400 $res = $this->db->queryF(
401 "SELECT start_lock FROM tst_active WHERE active_id = %s",
402 ['integer'],
403 [$this->getActiveId()]
404 );
405
406 while ($row = $this->db->fetchAssoc($res)) {
407 return $row['start_lock'];
408 }
409
410 return null;
411 }
$res
Definition: ltiservices.php:69

References $res, and getActiveId().

+ Here is the call graph for this function:

◆ persistTestStartLock()

ilTestSession::persistTestStartLock ( string  $testStartLock)

Definition at line 389 of file class.ilTestSession.php.

389 : void
390 {
391 $this->db->update(
392 'tst_active',
393 ['start_lock' => ['text', $testStartLock]],
394 ['active_id' => ['integer', $this->getActiveId()]]
395 );
396 }

References getActiveId().

+ Here is the call graph for this function:

◆ reportableResultsAvailable()

ilTestSession::reportableResultsAvailable ( ilObjTest  $test_obj)

Definition at line 507 of file class.ilTestSession.php.

507 : ?bool
508 {
509 if ($this->reportable_results_available === null) {
510 $this->reportable_results_available = true;
511
512 if (!$this->getActiveId()) {
513 $this->reportable_results_available = false;
514 }
515
516 if (!$test_obj->canShowTestResults($this)) {
517 $this->reportable_results_available = false;
518 }
519 }
520
522 }
canShowTestResults(ilTestSession $test_session)

References $reportable_results_available, ilObjTest\canShowTestResults(), and getActiveId().

+ Here is the call graph for this function:

◆ saveToDb()

ilTestSession::saveToDb ( )

Definition at line 147 of file class.ilTestSession.php.

147 : void
148 {
149 $submitted = ($this->isSubmitted()) ? 1 : 0;
150 $submittedtimestamp = $this->getSubmittedTimestamp() !== null && $this->getSubmittedTimestamp() !== '' ? $this->getSubmittedTimestamp() : null;
151 if ($this->active_id > 0) {
152 $this->db->update(
153 'tst_active',
154 [
155 'lastindex' => ['integer', $this->getLastSequence()],
156 'tries' => ['integer', $this->getPass()],
157 'submitted' => ['integer', $submitted],
158 'submittimestamp' => ['timestamp', $submittedtimestamp],
159 'tstamp' => ['integer', time() - 10],
160 'last_finished_pass' => ['integer', $this->getLastFinishedPass()],
161 'last_started_pass' => ['integer', $this->getPass()],
162 'objective_container' => ['integer', $this->getObjectiveOrientedContainerId()]
163 ],
164 [
165 'active_id' => ['integer', $this->getActiveId()]
166 ]
167 );
168 return;
169 }
170
171 if (!$this->activeIDExists($this->getUserId(), $this->getTestId())) {
172 $anonymous_id = $this->getAnonymousId() ?: null;
173
174 $next_id = $this->db->nextId('tst_active');
175 $this->db->insert(
176 'tst_active',
177 [
178 'active_id' => ['integer', $next_id],
179 'user_fi' => ['integer', $this->getUserId()],
180 'anonymous_id' => ['text', $anonymous_id],
181 'test_fi' => ['integer', $this->getTestId()],
182 'lastindex' => ['integer', $this->getLastSequence()],
183 'tries' => ['integer', $this->getPass()],
184 'submitted' => ['integer', $submitted],
185 'submittimestamp' => ['timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : null],
186 'tstamp' => ['integer', time() - 10],
187 'last_finished_pass' => ['integer', $this->getLastFinishedPass()],
188 'last_started_pass' => ['integer', $this->getPass()],
189 'objective_container' => ['integer', $this->getObjectiveOrientedContainerId()]
190 ]
191 );
192 $this->active_id = $next_id;
193 }
194 }
activeIDExists(int $user_id, int $test_id)

References $submitted, activeIDExists(), getActiveId(), getAnonymousId(), getLastFinishedPass(), getLastSequence(), getObjectiveOrientedContainerId(), getPass(), getSubmittedTimestamp(), getTestId(), getUserId(), and isSubmitted().

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAccessCodeToSession()

ilTestSession::setAccessCodeToSession ( string  $access_code)

Definition at line 413 of file class.ilTestSession.php.

413 : void
414 {
415 if (!is_array(ilSession::get(self::ACCESS_CODE_SESSION_INDEX))) {
416 ilSession::set(self::ACCESS_CODE_SESSION_INDEX, []);
417 }
418 $session_code = ilSession::get(self::ACCESS_CODE_SESSION_INDEX);
419 $session_code[$this->getTestId()] = $access_code;
420 ilSession::set(self::ACCESS_CODE_SESSION_INDEX, $session_code);
421 }
static set(string $a_var, $a_val)
Set a value.

References ilSession\get(), getTestId(), and ilSession\set().

+ Here is the call graph for this function:

◆ setAnonymousId()

ilTestSession::setAnonymousId ( string  $anonymous_id)

Definition at line 296 of file class.ilTestSession.php.

296 : void
297 {
298 $this->anonymous_id = $anonymous_id;
299 }

References $anonymous_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

+ Here is the caller graph for this function:

◆ setLastFinishedPass()

ilTestSession::setLastFinishedPass ( int  $lastFinishedPass)

Definition at line 351 of file class.ilTestSession.php.

351 : void
352 {
353 $this->lastFinishedPass = $lastFinishedPass;
354 }

References $lastFinishedPass.

◆ setLastSequence()

ilTestSession::setLastSequence ( int  $lastsequence)

Definition at line 306 of file class.ilTestSession.php.

306 : void
307 {
308 $this->lastsequence = $lastsequence;
309 }

References $lastsequence.

Referenced by increaseTestPass().

+ Here is the caller graph for this function:

◆ setLastStartedPass()

ilTestSession::setLastStartedPass ( int  $lastStartedPass)

Definition at line 379 of file class.ilTestSession.php.

379 : void
380 {
381 $this->lastStartedPass = $lastStartedPass;
382 }

References $lastStartedPass.

◆ setObjectiveOrientedContainerId()

ilTestSession::setObjectiveOrientedContainerId ( int  $objectiveOriented)

Definition at line 361 of file class.ilTestSession.php.

361 : void
362 {
363 $this->objectiveOrientedContainerId = $objectiveOriented;
364 }

Referenced by loadFromDb(), and loadTestSession().

+ Here is the caller graph for this function:

◆ setPass()

ilTestSession::setPass ( int  $pass)

Definition at line 316 of file class.ilTestSession.php.

316 : void
317 {
318 $this->pass = $pass;
319 }

References $pass.

◆ setPasswordChecked()

ilTestSession::setPasswordChecked ( bool  $value)

Definition at line 500 of file class.ilTestSession.php.

500 : void
501 {
502 ilSession::set('pw_checked_' . $this->active_id, $value);
503 }

References ilSession\set().

+ Here is the call graph for this function:

◆ setRefId()

ilTestSession::setRefId ( int  $ref_id)

Definition at line 67 of file class.ilTestSession.php.

67 : void
68 {
69 $this->ref_id = $ref_id;
70 }

References $ref_id.

◆ setSubmitted()

ilTestSession::setSubmitted ( )

Definition at line 336 of file class.ilTestSession.php.

336 : void
337 {
338 $this->submitted = true;
339 }

◆ setSubmittedTimestamp()

ilTestSession::setSubmittedTimestamp ( )

Definition at line 346 of file class.ilTestSession.php.

346 : void
347 {
348 $this->submittedTimestamp = date('Y-m-d H:i:s');
349 }

◆ setTestId()

ilTestSession::setTestId ( int  $test_id)

Definition at line 286 of file class.ilTestSession.php.

286 : void
287 {
288 $this->test_id = $test_id;
289 }

References $test_id.

◆ setUserId()

ilTestSession::setUserId ( int  $user_id)

Definition at line 276 of file class.ilTestSession.php.

276 : void
277 {
278 $this->user_id = $user_id;
279 }

References $user_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

+ Here is the caller graph for this function:

◆ unsetAccessCodeInSession()

ilTestSession::unsetAccessCodeInSession ( )

Definition at line 423 of file class.ilTestSession.php.

423 : void
424 {
425 $session_code = ilSession::get(self::ACCESS_CODE_SESSION_INDEX);
426 unset($session_code[$this->getTestId()]);
427 ilSession::set(self::ACCESS_CODE_SESSION_INDEX, $session_code);
428 }

References ilSession\get(), getTestId(), and ilSession\set().

Referenced by loadTestSession().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $active_id

int ilTestSession::$active_id = 0

Definition at line 38 of file class.ilTestSession.php.

Referenced by getActiveId(), and loadFromDb().

◆ $anonymous_id

string ilTestSession::$anonymous_id = ''

Definition at line 40 of file class.ilTestSession.php.

Referenced by getAnonymousId(), loadTestSession(), and setAnonymousId().

◆ $lastFinishedPass

int ilTestSession::$lastFinishedPass = null
private

Definition at line 49 of file class.ilTestSession.php.

Referenced by getLastFinishedPass(), and setLastFinishedPass().

◆ $lastPresentationMode

string ilTestSession::$lastPresentationMode = null
protected

Definition at line 43 of file class.ilTestSession.php.

◆ $lastsequence

int ilTestSession::$lastsequence = 0

Definition at line 42 of file class.ilTestSession.php.

Referenced by getLastSequence(), and setLastSequence().

◆ $lastStartedPass

int ilTestSession::$lastStartedPass = null
private

Definition at line 50 of file class.ilTestSession.php.

Referenced by getLastStartedPass(), and setLastStartedPass().

◆ $objectiveOrientedContainerId

int ilTestSession::$objectiveOrientedContainerId = null
private

Definition at line 47 of file class.ilTestSession.php.

◆ $pass

int ilTestSession::$pass = 0
private

Definition at line 37 of file class.ilTestSession.php.

Referenced by getPass(), and setPass().

◆ $ref_id

int ilTestSession::$ref_id = 0
private

Definition at line 36 of file class.ilTestSession.php.

Referenced by getRefId(), and setRefId().

◆ $reportable_results_available

bool ilTestSession::$reportable_results_available = null
private

Definition at line 505 of file class.ilTestSession.php.

Referenced by reportableResultsAvailable().

◆ $submitted

bool ilTestSession::$submitted = false

Definition at line 44 of file class.ilTestSession.php.

Referenced by isSubmitted(), and saveToDb().

◆ $submittedTimestamp

string ilTestSession::$submittedTimestamp = ''

Definition at line 46 of file class.ilTestSession.php.

Referenced by getSubmittedTimestamp().

◆ $test_id

int ilTestSession::$test_id = 0

Definition at line 41 of file class.ilTestSession.php.

Referenced by activeIDExists(), getTestId(), loadTestSession(), and setTestId().

◆ $tstamp

int ilTestSession::$tstamp = 0

Definition at line 45 of file class.ilTestSession.php.

◆ $user_id

int ilTestSession::$user_id = 0

Definition at line 39 of file class.ilTestSession.php.

Referenced by activeIDExists(), getUserId(), loadTestSession(), and setUserId().

◆ ACCESS_CODE_CHAR_DOMAIN

const ilTestSession::ACCESS_CODE_CHAR_DOMAIN = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

Definition at line 33 of file class.ilTestSession.php.

Referenced by buildAccessCode().

◆ ACCESS_CODE_LENGTH

const ilTestSession::ACCESS_CODE_LENGTH = 5

Definition at line 34 of file class.ilTestSession.php.

Referenced by buildAccessCode().

◆ ACCESS_CODE_SESSION_INDEX


The documentation for this class was generated from the following file: