ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilTestSession Class Reference

Test session handler. More...

+ Inheritance diagram for ilTestSession:
+ Collaboration diagram for ilTestSession:

Public Member Functions

 __construct ()
 ilTestSession constructor More...
 
 setRefId ($a_val)
 Set Ref id. More...
 
 getRefId ()
 Get Ref id. More...
 
 increaseTestPass ()
 
 saveToDb ()
 
 loadTestSession ($test_id, $user_id="", $anonymous_id="")
 
 loadFromDb ($active_id)
 Loads the session data for a given active id. More...
 
 getActiveId ()
 
 setUserId ($user_id)
 
 getUserId ()
 
 setTestId ($test_id)
 
 getTestId ()
 
 setAnonymousId ($anonymous_id)
 
 getAnonymousId ()
 
 setLastSequence ($lastsequence)
 
 getLastSequence ()
 
 setPass ($pass)
 
 getPass ()
 
 increasePass ()
 
 isSubmitted ()
 
 setSubmitted ()
 
 getSubmittedTimestamp ()
 
 setSubmittedTimestamp ()
 
 setLastFinishedPass ($lastFinishedPass)
 
 getLastFinishedPass ()
 
 setObjectiveOrientedContainerId ($objectiveOriented)
 
 getObjectiveOrientedContainerId ()
 
 getLastStartedPass ()
 
 setLastStartedPass ($lastStartedPass)
 
 isObjectiveOriented ()
 
 persistTestStartLock ($testStartLock)
 
 lookupTestStartLock ()
 
 setAccessCodeToSession ($access_code)
 
 unsetAccessCodeInSession ()
 
 getAccessCodeFromSession ()
 
 doesAccessCodeInSessionExists ()
 
 createNewAccessCode ()
 
 isAccessCodeUsed ($code)
 
 isAnonymousUser ()
 
 reportableResultsAvailable (ilObjTest $testOBJ)
 
 hasSinglePassReportable (ilObjTest $testObj)
 

Data Fields

const ACCESS_CODE_SESSION_INDEX = "tst_access_code"
 
const ACCESS_CODE_CHAR_DOMAIN = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
const ACCESS_CODE_LENGTH = 5
 
 $active_id
 
 $user_id
 
 $anonymous_id
 
 $test_id
 
 $lastsequence
 
 $submitted
 
 $tstamp
 
 $submittedTimestamp
 

Protected Member Functions

 activeIDExists ($user_id, $test_id)
 

Protected Attributes

 $lastPresentationMode
 

Private Member Functions

 buildAccessCode ()
 

Private Attributes

 $lastFinishedPass
 
 $lastStartedPass
 
 $objectiveOrientedContainerId
 
 $reportableResultsAvailable = 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 13 of file class.ilTestSession.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestSession::__construct ( )

ilTestSession constructor

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

@access public

Reimplemented in ilTestSessionDynamicQuestionSet.

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

97 {
98 $this->active_id = 0;
99 $this->user_id = 0;
100 $this->anonymous_id = 0;
101 $this->test_id = 0;
102 $this->lastsequence = 0;
103 $this->lastPresentationMode = null;
104 $this->submitted = false;
105 $this->submittedTimestamp = "";
106 $this->pass = 0;
107 $this->ref_id = 0;
108 $this->tstamp = 0;
109
110 $this->lastStartedPass = null;
111 $this->lastFinishedPass = null;
112 $this->objectiveOrientedContainerId = 0;
113 }

Member Function Documentation

◆ activeIDExists()

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

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

136 {
137 global $DIC;
138 $ilDB = $DIC['ilDB'];
139
140 if ($GLOBALS['DIC']['ilUser']->getId() != ANONYMOUS_USER_ID) {
141 $result = $ilDB->queryF(
142 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
143 array('integer','integer'),
144 array($user_id, $test_id)
145 );
146 if ($result->numRows()) {
147 $row = $ilDB->fetchAssoc($result);
148 $this->active_id = $row["active_id"];
149 $this->user_id = $row["user_fi"];
150 $this->anonymous_id = $row["anonymous_id"];
151 $this->test_id = $row["test_fi"];
152 $this->lastsequence = $row["lastindex"];
153 $this->pass = $row["tries"];
154 $this->submitted = ($row["submitted"]) ? true : false;
155 $this->submittedTimestamp = $row["submittimestamp"];
156 $this->tstamp = $row["tstamp"];
157
158 $this->setLastStartedPass($row['last_started_pass']);
159 $this->setLastFinishedPass($row['last_finished_pass']);
160 $this->setObjectiveOrientedContainerId((int) $row['objective_container']);
161
162 return true;
163 }
164 }
165 return false;
166 }
$result
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
setObjectiveOrientedContainerId($objectiveOriented)
setLastFinishedPass($lastFinishedPass)
setLastStartedPass($lastStartedPass)
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $GLOBALS, $ilDB, $result, $test_id, $user_id, setLastFinishedPass(), setLastStartedPass(), and setObjectiveOrientedContainerId().

Referenced by saveToDb(), and ilTestSessionDynamicQuestionSet\saveToDb().

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

◆ buildAccessCode()

ilTestSession::buildAccessCode ( )
private

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

561 {
562 // create a 5 character code
563 $codestring = self::ACCESS_CODE_CHAR_DOMAIN;
564
565 mt_srand();
566
567 $code = "";
568
569 for ($i = 1; $i <= self::ACCESS_CODE_LENGTH; $i++) {
570 $index = mt_rand(0, strlen($codestring) - 1);
571 $code .= substr($codestring, $index, 1);
572 }
573
574 return $code;
575 }
$index
Definition: metadata.php:128
$i
Definition: metadata.php:24

References $i, $index, 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 535 of file class.ilTestSession.php.

536 {
537 do {
538 $code = $this->buildAccessCode();
539 } while ($this->isAccessCodeUsed($code));
540
541 return $code;
542 }

References buildAccessCode(), and isAccessCodeUsed().

+ Here is the call graph for this function:

◆ doesAccessCodeInSessionExists()

ilTestSession::doesAccessCodeInSessionExists ( )

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

527 {
528 if (!is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
529 return false;
530 }
531
532 return isset($_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()]);
533 }
$_SESSION["AccountId"]

References $_SESSION, and getTestId().

Referenced by loadTestSession(), and ilTestSessionDynamicQuestionSet\loadTestSession().

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

◆ getAccessCodeFromSession()

ilTestSession::getAccessCodeFromSession ( )

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

514 {
515 if (!is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
516 return null;
517 }
518
519 if (!isset($_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()])) {
520 return null;
521 }
522
524 }

References $_SESSION, ACCESS_CODE_SESSION_INDEX, and getTestId().

Referenced by loadTestSession(), and ilTestSessionDynamicQuestionSet\loadTestSession().

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

◆ getActiveId()

◆ getAnonymousId()

ilTestSession::getAnonymousId ( )

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

379 {
380 return $this->anonymous_id;
381 }

References $anonymous_id.

Referenced by saveToDb(), and ilTestSessionDynamicQuestionSet\saveToDb().

+ Here is the caller graph for this function:

◆ getLastFinishedPass()

ilTestSession::getLastFinishedPass ( )

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

434 {
436 }

References $lastFinishedPass.

Referenced by hasSinglePassReportable(), increaseTestPass(), and saveToDb().

+ Here is the caller graph for this function:

◆ getLastSequence()

ilTestSession::getLastSequence ( )

◆ getLastStartedPass()

ilTestSession::getLastStartedPass ( )
Returns
int

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

452 {
454 }

References $lastStartedPass.

Referenced by increaseTestPass().

+ Here is the caller graph for this function:

◆ getObjectiveOrientedContainerId()

ilTestSession::getObjectiveOrientedContainerId ( )

◆ getPass()

ilTestSession::getPass ( )

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

399 {
400 return $this->pass;
401 }

References $pass.

Referenced by increaseTestPass(), saveToDb(), ilTestSessionDynamicQuestionSet\saveToDb(), and ilTestRandomQuestionSetBuilder\storeQuestion().

+ Here is the caller graph for this function:

◆ getRefId()

ilTestSession::getRefId ( )

Get Ref id.

Returns
integer Ref id

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

131 {
132 return $this->ref_id;
133 }

Referenced by ilLOTestQuestionAdapter\getInstance(), ilLOTestQuestionAdapter\isQualifiedStartRun(), ilLOTestQuestionAdapter\notifyTestStart(), and ilTestSessionDynamicQuestionSet\saveToDb().

+ Here is the caller graph for this function:

◆ getSubmittedTimestamp()

ilTestSession::getSubmittedTimestamp ( )

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

419 {
421 }

References $submittedTimestamp.

Referenced by increaseTestPass(), saveToDb(), and ilTestSessionDynamicQuestionSet\saveToDb().

+ Here is the caller graph for this function:

◆ getTestId()

ilTestSession::getTestId ( )

◆ getUserId()

ilTestSession::getUserId ( )

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

359 {
360 return $this->user_id;
361 }

References $user_id.

Referenced by ilLOTestQuestionAdapter\getInstance(), isAnonymousUser(), ilLOTestQuestionAdapter\notifyTestStart(), saveToDb(), and ilTestSessionDynamicQuestionSet\saveToDb().

+ Here is the caller graph for this function:

◆ hasSinglePassReportable()

ilTestSession::hasSinglePassReportable ( ilObjTest  $testObj)
Returns
bool

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

612 {
613 global $DIC; /* @var ILIAS\DI\Container $DIC */
614
615 require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
616 $testPassesSelector = new ilTestPassesSelector($DIC->database(), $testObj);
617 $testPassesSelector->setActiveId($this->getActiveId());
618 $testPassesSelector->setLastFinishedPass($this->getLastFinishedPass());
619
620 if (count($testPassesSelector->getReportablePasses()) == 1) {
621 return true;
622 }
623
624 return false;
625 }

References $DIC, getActiveId(), and getLastFinishedPass().

+ Here is the call graph for this function:

◆ increasePass()

ilTestSession::increasePass ( )

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

404 {
405 $this->pass += 1;
406 }

Referenced by increaseTestPass().

+ Here is the caller graph for this function:

◆ increaseTestPass()

ilTestSession::increaseTestPass ( )

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

169 {
170 global $DIC;
171 $ilDB = $DIC['ilDB'];
172 $ilLog = $DIC['ilLog'];
173
174 if (!$this->active_id) {
175 require_once 'Modules/Test/exceptions/class.ilTestException.php';
176 throw new ilTestException('missing active id on test pass increase!');
177 }
178
179 $this->increasePass();
180 $this->setLastSequence(0);
181 $submitted = ($this->isSubmitted()) ? 1 : 0;
182
183 if (!isset($_SESSION[$this->active_id]['tst_last_increase_pass'])) {
184 $_SESSION[$this->active_id]['tst_last_increase_pass'] = 0;
185 }
186
187 // 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)
188 if (time() - $_SESSION[$this->active_id]['tst_last_increase_pass'] > 10) {
189 $_SESSION[$this->active_id]['tst_last_increase_pass'] = time();
190 $this->tstamp = time();
191 $ilDB->update(
192 'tst_active',
193 array(
194 'lastindex' => array('integer', $this->getLastSequence()),
195 'tries' => array('integer', $this->getPass()),
196 'submitted' => array('integer', $submitted),
197 'submittimestamp' => array('timestamp', strlen($this->getSubmittedTimestamp()) ? $this->getSubmittedTimestamp() : null),
198 'tstamp' => array('integer', time()),
199 'last_finished_pass' => array('integer', $this->getLastFinishedPass()),
200 'last_started_pass' => array('integer', $this->getLastStartedPass()),
201 'objective_container' => array('integer', (int) $this->getObjectiveOrientedContainerId())
202 ),
203 array(
204 'active_id' => array('integer', $this->getActiveId())
205 )
206 );
207 }
208 }
Base Exception for all Exceptions relating to Modules/Test.
setLastSequence($lastsequence)

References $_SESSION, $active_id, $DIC, $ilDB, $ilLog, $submitted, getActiveId(), getLastFinishedPass(), getLastSequence(), getLastStartedPass(), getObjectiveOrientedContainerId(), getPass(), getSubmittedTimestamp(), increasePass(), isSubmitted(), and setLastSequence().

+ Here is the call graph for this function:

◆ isAccessCodeUsed()

ilTestSession::isAccessCodeUsed (   $code)

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

545 {
546 global $DIC;
547 $ilDB = $DIC['ilDB'];
548
549 $query = "SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s";
550
551 $result = $ilDB->queryF(
552 $query,
553 array('integer', 'text'),
554 array($this->getTestId(), $code)
555 );
556
557 return ($result->numRows() > 0);
558 }
$query

References $DIC, $ilDB, $query, $result, and 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 577 of file class.ilTestSession.php.

578 {
579 return $this->getUserId() == ANONYMOUS_USER_ID;
580 }

References getUserId().

+ Here is the call graph for this function:

◆ isObjectiveOriented()

ilTestSession::isObjectiveOriented ( )

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

465 {
466 return (bool) $this->getObjectiveOrientedContainerId();
467 }

References getObjectiveOrientedContainerId().

+ Here is the call graph for this function:

◆ isSubmitted()

ilTestSession::isSubmitted ( )

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

409 {
410 return $this->submitted;
411 }

References $submitted.

Referenced by increaseTestPass(), saveToDb(), and ilTestSessionDynamicQuestionSet\saveToDb().

+ Here is the caller graph for this function:

◆ loadFromDb()

ilTestSession::loadFromDb (   $active_id)

Loads the session data for a given active id.

Parameters
integer$active_idThe database id of the test session

Reimplemented in ilTestSessionDynamicQuestionSet.

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

322 {
323 global $DIC;
324 $ilDB = $DIC['ilDB'];
325 $result = $ilDB->queryF(
326 "SELECT * FROM tst_active WHERE active_id = %s",
327 array('integer'),
328 array($active_id)
329 );
330 if ($result->numRows()) {
331 $row = $ilDB->fetchAssoc($result);
332 $this->active_id = $row["active_id"];
333 $this->user_id = $row["user_fi"];
334 $this->anonymous_id = $row["anonymous_id"];
335 $this->test_id = $row["test_fi"];
336 $this->lastsequence = $row["lastindex"];
337 $this->pass = $row["tries"];
338 $this->submitted = ($row["submitted"]) ? true : false;
339 $this->submittedTimestamp = $row["submittimestamp"];
340 $this->tstamp = $row["tstamp"];
341
342 $this->setLastStartedPass($row['last_started_pass']);
343 $this->setLastFinishedPass($row['last_finished_pass']);
344 $this->setObjectiveOrientedContainerId((int) $row['objective_container']);
345 }
346 }

References $active_id, $DIC, $ilDB, $result, setLastFinishedPass(), setLastStartedPass(), and setObjectiveOrientedContainerId().

+ Here is the call graph for this function:

◆ loadTestSession()

ilTestSession::loadTestSession (   $test_id,
  $user_id = "",
  $anonymous_id = "" 
)

Reimplemented in ilTestSessionDynamicQuestionSet.

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

262 {
263 global $DIC;
264 $ilDB = $DIC['ilDB'];
265 $ilUser = $DIC['ilUser'];
266
267 if (!$user_id) {
268 $user_id = $ilUser->getId();
269 }
270 if (($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) && $this->doesAccessCodeInSessionExists()) {
271 $result = $ilDB->queryF(
272 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
273 array('integer','integer','text'),
275 );
276 } elseif (strlen($anonymous_id)) {
277 $result = $ilDB->queryF(
278 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
279 array('integer','integer','text'),
281 );
282 } else {
283 if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) {
284 return null;
285 }
286 $result = $ilDB->queryF(
287 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
288 array('integer','integer'),
289 array($user_id, $test_id)
290 );
291 }
292
293 // TODO bheyser: Refactor
294 $this->user_id = $user_id;
295
296 if ($result->numRows()) {
297 $row = $ilDB->fetchAssoc($result);
298 $this->active_id = $row["active_id"];
299 $this->user_id = $row["user_fi"];
300 $this->anonymous_id = $row["anonymous_id"];
301 $this->test_id = $row["test_fi"];
302 $this->lastsequence = $row["lastindex"];
303 $this->pass = $row["tries"];
304 $this->submitted = ($row["submitted"]) ? true : false;
305 $this->submittedTimestamp = $row["submittimestamp"];
306 $this->tstamp = $row["tstamp"];
307
308 $this->setLastStartedPass($row['last_started_pass']);
309 $this->setLastFinishedPass($row['last_finished_pass']);
310 $this->setObjectiveOrientedContainerId((int) $row['objective_container']);
311 } elseif ($this->doesAccessCodeInSessionExists()) {
313 }
314 }
$ilUser
Definition: imgupload.php:18

References $anonymous_id, $DIC, $GLOBALS, $ilDB, $ilUser, $result, $test_id, $user_id, doesAccessCodeInSessionExists(), getAccessCodeFromSession(), setLastFinishedPass(), setLastStartedPass(), setObjectiveOrientedContainerId(), and unsetAccessCodeInSession().

+ Here is the call graph for this function:

◆ lookupTestStartLock()

ilTestSession::lookupTestStartLock ( )

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

482 {
483 global $DIC;
484 $ilDB = $DIC['ilDB'];
485
486 $res = $ilDB->queryF(
487 "SELECT start_lock FROM tst_active WHERE active_id = %s",
488 array('integer'),
489 array($this->getActiveId())
490 );
491
492 while ($row = $ilDB->fetchAssoc($res)) {
493 return $row['start_lock'];
494 }
495
496 return null;
497 }
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $res, and getActiveId().

+ Here is the call graph for this function:

◆ persistTestStartLock()

ilTestSession::persistTestStartLock (   $testStartLock)

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

470 {
471 global $DIC;
472 $ilDB = $DIC['ilDB'];
473
474 $ilDB->update(
475 'tst_active',
476 array('start_lock' => array('text', $testStartLock)),
477 array('active_id' => array('integer', $this->getActiveId()))
478 );
479 }

References $DIC, $ilDB, and getActiveId().

+ Here is the call graph for this function:

◆ reportableResultsAvailable()

ilTestSession::reportableResultsAvailable ( ilObjTest  $testOBJ)
Parameters
ilObjTest$testOBJ
Returns
bool

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

592 {
593 if ($this->reportableResultsAvailable === null) {
594 $this->reportableResultsAvailable = true;
595
596 if (!$this->getActiveId()) {
597 $this->reportableResultsAvailable = false;
598 }
599
600 if (!$testOBJ->canShowTestResults($this)) {
601 $this->reportableResultsAvailable = false;
602 }
603 }
604
606 }
canShowTestResults(ilTestSession $testSession)
reportableResultsAvailable(ilObjTest $testOBJ)

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

Referenced by reportableResultsAvailable().

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

◆ saveToDb()

ilTestSession::saveToDb ( )

Reimplemented in ilTestSessionDynamicQuestionSet.

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

211 {
212 global $DIC;
213 $ilDB = $DIC['ilDB'];
214 $ilLog = $DIC['ilLog'];
215
216 $submitted = ($this->isSubmitted()) ? 1 : 0;
217 if ($this->active_id > 0) {
218 $ilDB->update(
219 'tst_active',
220 array(
221 'lastindex' => array('integer', $this->getLastSequence()),
222 'tries' => array('integer', $this->getPass()),
223 'submitted' => array('integer', $submitted),
224 'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : null),
225 'tstamp' => array('integer', time() - 10),
226 'last_finished_pass' => array('integer', $this->getLastFinishedPass()),
227 'last_started_pass' => array('integer', $this->getPass()),
228 'objective_container' => array('integer', (int) $this->getObjectiveOrientedContainerId())
229 ),
230 array(
231 'active_id' => array('integer', $this->getActiveId())
232 )
233 );
234 } else {
235 if (!$this->activeIDExists($this->getUserId(), $this->getTestId())) {
236 $anonymous_id = ($this->getAnonymousId()) ? $this->getAnonymousId() : null;
237
238 $next_id = $ilDB->nextId('tst_active');
239 $ilDB->insert(
240 'tst_active',
241 array(
242 'active_id' => array('integer', $next_id),
243 'user_fi' => array('integer', $this->getUserId()),
244 'anonymous_id' => array('text', $anonymous_id),
245 'test_fi' => array('integer', $this->getTestId()),
246 'lastindex' => array('integer', $this->getLastSequence()),
247 'tries' => array('integer', $this->getPass()),
248 'submitted' => array('integer', $submitted),
249 'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : null),
250 'tstamp' => array('integer', time() - 10),
251 'last_finished_pass' => array('integer', $this->getLastFinishedPass()),
252 'last_started_pass' => array('integer', $this->getPass()),
253 'objective_container' => array('integer', (int) $this->getObjectiveOrientedContainerId())
254 )
255 );
256 $this->active_id = $next_id;
257 }
258 }
259 }
activeIDExists($user_id, $test_id)

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

+ Here is the call graph for this function:

◆ setAccessCodeToSession()

ilTestSession::setAccessCodeToSession (   $access_code)

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

500 {
501 if (!is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
503 }
504
505 $_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()] = $access_code;
506 }

References $_SESSION, ACCESS_CODE_SESSION_INDEX, and getTestId().

+ Here is the call graph for this function:

◆ setAnonymousId()

ilTestSession::setAnonymousId (   $anonymous_id)

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

374 {
375 $this->anonymous_id = $anonymous_id;
376 }

References $anonymous_id.

◆ setLastFinishedPass()

ilTestSession::setLastFinishedPass (   $lastFinishedPass)

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

429 {
430 $this->lastFinishedPass = $lastFinishedPass;
431 }

References $lastFinishedPass.

Referenced by activeIDExists(), loadFromDb(), and loadTestSession().

+ Here is the caller graph for this function:

◆ setLastSequence()

ilTestSession::setLastSequence (   $lastsequence)

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

384 {
385 $this->lastsequence = $lastsequence;
386 }

References $lastsequence.

Referenced by increaseTestPass(), and ilTestSessionDynamicQuestionSet\setCurrentQuestionId().

+ Here is the caller graph for this function:

◆ setLastStartedPass()

ilTestSession::setLastStartedPass (   $lastStartedPass)
Parameters
int$lastStartedPass

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

460 {
461 $this->lastStartedPass = $lastStartedPass;
462 }

References $lastStartedPass.

Referenced by activeIDExists(), loadFromDb(), and loadTestSession().

+ Here is the caller graph for this function:

◆ setObjectiveOrientedContainerId()

ilTestSession::setObjectiveOrientedContainerId (   $objectiveOriented)

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

439 {
440 $this->objectiveOrientedContainerId = $objectiveOriented;
441 }

Referenced by activeIDExists(), loadFromDb(), and loadTestSession().

+ Here is the caller graph for this function:

◆ setPass()

ilTestSession::setPass (   $pass)

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

394 {
395 $this->pass = $pass;
396 }

References $pass.

◆ setRefId()

ilTestSession::setRefId (   $a_val)

Set Ref id.

Parameters
integerRef id

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

121 {
122 $this->ref_id = $a_val;
123 }

◆ setSubmitted()

ilTestSession::setSubmitted ( )

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

414 {
415 $this->submitted = true;
416 }

◆ setSubmittedTimestamp()

ilTestSession::setSubmittedTimestamp ( )

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

424 {
425 $this->submittedTimestamp = strftime("%Y-%m-%d %H:%M:%S");
426 }

◆ setTestId()

ilTestSession::setTestId (   $test_id)

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

364 {
365 $this->test_id = $test_id;
366 }

References $test_id.

◆ setUserId()

ilTestSession::setUserId (   $user_id)

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

354 {
355 $this->user_id = $user_id;
356 }

References $user_id.

◆ unsetAccessCodeInSession()

ilTestSession::unsetAccessCodeInSession ( )

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

509 {
510 unset($_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()]);
511 }

References $_SESSION, and getTestId().

Referenced by loadTestSession(), and ilTestSessionDynamicQuestionSet\loadTestSession().

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

Field Documentation

◆ $active_id

ilTestSession::$active_id

◆ $anonymous_id

◆ $lastFinishedPass

ilTestSession::$lastFinishedPass
private

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

Referenced by getLastFinishedPass(), and setLastFinishedPass().

◆ $lastPresentationMode

ilTestSession::$lastPresentationMode
protected

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

◆ $lastsequence

ilTestSession::$lastsequence

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

Referenced by getLastSequence(), and setLastSequence().

◆ $lastStartedPass

ilTestSession::$lastStartedPass
private

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

Referenced by getLastStartedPass(), and setLastStartedPass().

◆ $objectiveOrientedContainerId

ilTestSession::$objectiveOrientedContainerId
private

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

Referenced by getObjectiveOrientedContainerId().

◆ $reportableResultsAvailable

ilTestSession::$reportableResultsAvailable = null
private

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

Referenced by reportableResultsAvailable().

◆ $submitted

ilTestSession::$submitted

◆ $submittedTimestamp

ilTestSession::$submittedTimestamp

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

Referenced by getSubmittedTimestamp().

◆ $test_id

◆ $tstamp

ilTestSession::$tstamp

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

◆ $user_id

◆ ACCESS_CODE_CHAR_DOMAIN

const ilTestSession::ACCESS_CODE_CHAR_DOMAIN = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

Referenced by buildAccessCode().

◆ ACCESS_CODE_LENGTH

const ilTestSession::ACCESS_CODE_LENGTH = 5

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

Referenced by buildAccessCode().

◆ ACCESS_CODE_SESSION_INDEX

const ilTestSession::ACCESS_CODE_SESSION_INDEX = "tst_access_code"

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

Referenced by getAccessCodeFromSession(), and setAccessCodeToSession().


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