ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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.

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

Referenced by saveToDb().

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
+ 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.

Referenced by createNewAccessCode().

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  }
+ Here is the caller graph for this function:

◆ createNewAccessCode()

ilTestSession::createNewAccessCode ( )

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

References buildAccessCode(), and isAccessCodeUsed().

448  : string
449  {
450  do {
451  $code = $this->buildAccessCode();
452  } while ($this->isAccessCodeUsed($code));
453 
454  return $code;
455  }
isAccessCodeUsed(string $code)
+ Here is the call graph for this function:

◆ doesAccessCodeInSessionExists()

ilTestSession::doesAccessCodeInSessionExists ( )

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

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

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

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)
+ 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.

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

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

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  }
static get(string $a_var)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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.

References $anonymous_id.

Referenced by saveToDb().

301  : string
302  {
303  return $this->anonymous_id;
304  }
+ Here is the caller graph for this function:

◆ getLastFinishedPass()

ilTestSession::getLastFinishedPass ( )

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

References $lastFinishedPass.

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

356  : ?int
357  {
359  }
+ Here is the caller graph for this function:

◆ getLastSequence()

ilTestSession::getLastSequence ( )

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

References $lastsequence.

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

311  : int
312  {
313  return $this->lastsequence;
314  }
+ Here is the caller graph for this function:

◆ getLastStartedPass()

ilTestSession::getLastStartedPass ( )
Returns
int

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

References $lastStartedPass.

Referenced by increaseTestPass().

374  : ?int
375  {
376  return $this->lastStartedPass;
377  }
+ Here is the caller graph for this function:

◆ getObjectiveOrientedContainerId()

ilTestSession::getObjectiveOrientedContainerId ( )

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

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

366  : int
367  {
368  return $this->objectiveOrientedContainerId ?? 0;
369  }
+ Here is the caller graph for this function:

◆ getPass()

ilTestSession::getPass ( )

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

References $pass.

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

321  : int
322  {
323  return $this->pass;
324  }
+ Here is the caller graph for this function:

◆ getRefId()

◆ getSubmittedTimestamp()

ilTestSession::getSubmittedTimestamp ( )

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

References $submittedTimestamp.

Referenced by increaseTestPass(), and saveToDb().

341  : ?string
342  {
344  }
+ Here is the caller graph for this function:

◆ getTestId()

ilTestSession::getTestId ( )

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

References $test_id.

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

291  : int
292  {
293  return $this->test_id;
294  }
+ 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.

References getActiveId(), and getLastFinishedPass().

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  }
+ Here is the call graph for this function:

◆ increasePass()

ilTestSession::increasePass ( )

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

Referenced by increaseTestPass().

327  {
328  $this->pass += 1;
329  }
+ Here is the caller graph for this function:

◆ increaseTestPass()

ilTestSession::increaseTestPass ( )

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

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

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  }
static get(string $a_var)
setLastSequence(int $lastsequence)
Base Exception for all Exceptions relating to Modules/Test.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ isAccessCodeUsed()

ilTestSession::isAccessCodeUsed ( string  $code)

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

References getTestId().

Referenced by createNewAccessCode().

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  }
+ 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.

References ANONYMOUS_USER_ID, and getUserId().

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

487  : bool
488  {
489  return $this->getUserId() == ANONYMOUS_USER_ID;
490  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
+ 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.

References getObjectiveOrientedContainerId().

384  : bool
385  {
386  return (bool) $this->getObjectiveOrientedContainerId();
387  }
+ Here is the call graph for this function:

◆ isPasswordChecked()

ilTestSession::isPasswordChecked ( )

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

References ilSession\get(), and null.

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  }
static get(string $a_var)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ isSubmitted()

ilTestSession::isSubmitted ( )

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

References $submitted.

Referenced by increaseTestPass(), and saveToDb().

331  : bool
332  {
333  return $this->submitted;
334  }
+ Here is the caller graph for this function:

◆ loadFromDb()

ilTestSession::loadFromDb ( int  $active_id)

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

References setObjectiveOrientedContainerId().

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)
+ 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.

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

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'],
220  [$user_id, $test_id]
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()) {
242  $this->unsetAccessCodeInSession();
243  }
244  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setObjectiveOrientedContainerId(int $objectiveOriented)
+ Here is the call graph for this function:

◆ lookupTestStartLock()

ilTestSession::lookupTestStartLock ( )

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

References $res, getActiveId(), and null.

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:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ persistTestStartLock()

ilTestSession::persistTestStartLock ( string  $testStartLock)

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

References getActiveId().

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

◆ reportableResultsAvailable()

ilTestSession::reportableResultsAvailable ( ilObjTest  $test_obj)

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

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
canShowTestResults(ilTestSession $test_session)
+ Here is the call graph for this function:

◆ saveToDb()

ilTestSession::saveToDb ( )

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

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

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
activeIDExists(int $user_id, int $test_id)
+ 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.

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

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 get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ setAnonymousId()

ilTestSession::setAnonymousId ( string  $anonymous_id)

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

References $anonymous_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

296  : void
297  {
298  $this->anonymous_id = $anonymous_id;
299  }
+ Here is the caller graph for this function:

◆ setLastFinishedPass()

ilTestSession::setLastFinishedPass ( int  $lastFinishedPass)

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

References $lastFinishedPass.

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

◆ setLastSequence()

ilTestSession::setLastSequence ( int  $lastsequence)

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

References $lastsequence.

Referenced by increaseTestPass().

306  : void
307  {
308  $this->lastsequence = $lastsequence;
309  }
+ Here is the caller graph for this function:

◆ setLastStartedPass()

ilTestSession::setLastStartedPass ( int  $lastStartedPass)

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

References $lastStartedPass.

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

◆ setObjectiveOrientedContainerId()

ilTestSession::setObjectiveOrientedContainerId ( int  $objectiveOriented)

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

Referenced by loadFromDb(), and loadTestSession().

361  : void
362  {
363  $this->objectiveOrientedContainerId = $objectiveOriented;
364  }
+ Here is the caller graph for this function:

◆ setPass()

ilTestSession::setPass ( int  $pass)

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

References $pass.

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

◆ setPasswordChecked()

ilTestSession::setPasswordChecked ( bool  $value)

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

References ilSession\set().

500  : void
501  {
502  ilSession::set('pw_checked_' . $this->active_id, $value);
503  }
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ setRefId()

ilTestSession::setRefId ( int  $ref_id)

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

References $ref_id.

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

◆ 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.

References $test_id.

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

◆ setUserId()

ilTestSession::setUserId ( int  $user_id)

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

References $user_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

276  : void
277  {
278  $this->user_id = $user_id;
279  }
+ Here is the caller graph for this function:

◆ unsetAccessCodeInSession()

ilTestSession::unsetAccessCodeInSession ( )

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

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

Referenced by loadTestSession().

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  }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ 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().

◆ $anonymous_id

string ilTestSession::$anonymous_id = ''

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

Referenced by getAnonymousId(), 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().

◆ $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 getTestId(), 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 getUserId(), loadTestSession(), and setUserId().

◆ ACCESS_CODE_CHAR_DOMAIN

const ilTestSession::ACCESS_CODE_CHAR_DOMAIN = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

◆ ACCESS_CODE_LENGTH

const ilTestSession::ACCESS_CODE_LENGTH = 5

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

◆ ACCESS_CODE_SESSION_INDEX


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