ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

public

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.

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

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

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
global $DIC
Definition: saml.php:7
setObjectiveOrientedContainerId($objectiveOriented)
setLastFinishedPass($lastFinishedPass)
setLastStartedPass($lastStartedPass)
$row
global $ilDB
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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.

References $code, $i, and $index.

Referenced by createNewAccessCode().

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  }
$code
Definition: example_050.php:99
$index
Definition: metadata.php:60
$i
Definition: disco.tpl.php:19
+ Here is the caller graph for this function:

◆ createNewAccessCode()

ilTestSession::createNewAccessCode ( )

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

References $code, buildAccessCode(), and isAccessCodeUsed().

536  {
537  do {
538  $code = $this->buildAccessCode();
539  } while ($this->isAccessCodeUsed($code));
540 
541  return $code;
542  }
$code
Definition: example_050.php:99
+ Here is the call graph for this function:

◆ doesAccessCodeInSessionExists()

ilTestSession::doesAccessCodeInSessionExists ( )

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

References $_SESSION, and getTestId().

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

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

References $_SESSION, and getTestId().

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

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 
523  return $_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()];
524  }
$_SESSION["AccountId"]
+ 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.

References $anonymous_id.

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

379  {
380  return $this->anonymous_id;
381  }
+ Here is the caller graph for this function:

◆ getLastFinishedPass()

ilTestSession::getLastFinishedPass ( )

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

References $lastFinishedPass.

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

434  {
436  }
+ 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.

References $lastStartedPass.

Referenced by increaseTestPass().

452  {
453  return $this->lastStartedPass;
454  }
+ Here is the caller graph for this function:

◆ getObjectiveOrientedContainerId()

ilTestSession::getObjectiveOrientedContainerId ( )

◆ getPass()

ilTestSession::getPass ( )

◆ getRefId()

◆ getSubmittedTimestamp()

ilTestSession::getSubmittedTimestamp ( )

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

References $submittedTimestamp.

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

419  {
421  }
+ Here is the caller graph for this function:

◆ getTestId()

ilTestSession::getTestId ( )

◆ getUserId()

◆ hasSinglePassReportable()

ilTestSession::hasSinglePassReportable ( ilObjTest  $testObj)
Returns
bool

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

References $DIC, getActiveId(), getLastFinishedPass(), and ilTestPassesSelector\setActiveId().

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  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

◆ increasePass()

ilTestSession::increasePass ( )

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

Referenced by increaseTestPass().

404  {
405  $this->pass += 1;
406  }
+ Here is the caller graph for this function:

◆ increaseTestPass()

ilTestSession::increaseTestPass ( )

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

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

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  }
$_SESSION["AccountId"]
global $DIC
Definition: saml.php:7
Base Exception for all Exceptions relating to Modules/Test.
global $ilDB
setLastSequence($lastsequence)
+ Here is the call graph for this function:

◆ isAccessCodeUsed()

ilTestSession::isAccessCodeUsed (   $code)

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

References $code, $DIC, $ilDB, $query, $result, and getTestId().

Referenced by createNewAccessCode().

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  }
$result
global $DIC
Definition: saml.php:7
$code
Definition: example_050.php:99
$query
global $ilDB
+ 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.

References getUserId().

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

578  {
579  return $this->getUserId() == ANONYMOUS_USER_ID;
580  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isObjectiveOriented()

ilTestSession::isObjectiveOriented ( )

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

References getObjectiveOrientedContainerId().

465  {
466  return (bool) $this->getObjectiveOrientedContainerId();
467  }
+ Here is the call graph for this function:

◆ isSubmitted()

ilTestSession::isSubmitted ( )

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

References $submitted.

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

409  {
410  return $this->submitted;
411  }
+ 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

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

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

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  }
$result
global $DIC
Definition: saml.php:7
setObjectiveOrientedContainerId($objectiveOriented)
setLastFinishedPass($lastFinishedPass)
setLastStartedPass($lastStartedPass)
$row
global $ilDB
+ Here is the call graph for this function:

◆ loadTestSession()

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

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

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

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'),
274  array($user_id, $test_id, $this->getAccessCodeFromSession())
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()) {
312  $this->unsetAccessCodeInSession();
313  }
314  }
$result
global $DIC
Definition: saml.php:7
setObjectiveOrientedContainerId($objectiveOriented)
setLastFinishedPass($lastFinishedPass)
setLastStartedPass($lastStartedPass)
$ilUser
Definition: imgupload.php:18
$row
global $ilDB
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ lookupTestStartLock()

ilTestSession::lookupTestStartLock ( )

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

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

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  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB
+ Here is the call graph for this function:

◆ persistTestStartLock()

ilTestSession::persistTestStartLock (   $testStartLock)

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

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

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  }
global $DIC
Definition: saml.php:7
global $ilDB
+ 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.

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

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  }
reportableResultsAvailable(ilObjTest $testOBJ)
canShowTestResults(ilTestSession $testSession)
+ Here is the call graph for this function:

◆ saveToDb()

ilTestSession::saveToDb ( )

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

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

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

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  }
global $DIC
Definition: saml.php:7
global $ilDB
activeIDExists($user_id, $test_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAccessCodeToSession()

ilTestSession::setAccessCodeToSession (   $access_code)

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

References $_SESSION, and getTestId().

500  {
501  if (!is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
502  $_SESSION[self::ACCESS_CODE_SESSION_INDEX] = array();
503  }
504 
505  $_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()] = $access_code;
506  }
$_SESSION["AccountId"]
+ Here is the call graph for this function:

◆ setAnonymousId()

ilTestSession::setAnonymousId (   $anonymous_id)

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

References $anonymous_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

374  {
375  $this->anonymous_id = $anonymous_id;
376  }
+ Here is the caller graph for this function:

◆ setLastFinishedPass()

ilTestSession::setLastFinishedPass (   $lastFinishedPass)

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

References $lastFinishedPass.

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

429  {
430  $this->lastFinishedPass = $lastFinishedPass;
431  }
+ Here is the caller graph for this function:

◆ setLastSequence()

ilTestSession::setLastSequence (   $lastsequence)

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

References $lastsequence.

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

384  {
385  $this->lastsequence = $lastsequence;
386  }
+ Here is the caller graph for this function:

◆ setLastStartedPass()

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

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

References $lastStartedPass.

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

460  {
461  $this->lastStartedPass = $lastStartedPass;
462  }
+ Here is the caller graph for this function:

◆ setObjectiveOrientedContainerId()

ilTestSession::setObjectiveOrientedContainerId (   $objectiveOriented)

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

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

439  {
440  $this->objectiveOrientedContainerId = $objectiveOriented;
441  }
+ Here is the caller graph for this function:

◆ setPass()

ilTestSession::setPass (   $pass)

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

References $pass.

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

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

References $test_id.

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

◆ setUserId()

ilTestSession::setUserId (   $user_id)

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

References $user_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

354  {
355  $this->user_id = $user_id;
356  }
+ Here is the caller graph for this function:

◆ unsetAccessCodeInSession()

ilTestSession::unsetAccessCodeInSession ( )

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

References $_SESSION, and getTestId().

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

509  {
510  unset($_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()]);
511  }
$_SESSION["AccountId"]
+ 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.

◆ ACCESS_CODE_LENGTH

const ilTestSession::ACCESS_CODE_LENGTH = 5

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

◆ ACCESS_CODE_SESSION_INDEX

const ilTestSession::ACCESS_CODE_SESSION_INDEX = "tst_access_code"

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


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