ILIAS  release_4-4 Revision
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 ()
 
 persistTestStartLock ($testStartLock)
 
 lookupTestStartLock ()
 
 setAccessCodeToSession ($access_code)
 
 unsetAccessCodeInSession ()
 
 getAccessCodeFromSession ()
 
 doesAccessCodeInSessionExists ()
 
 createNewAccessCode ()
 
 isAccessCodeUsed ($code)
 
 isAnonymousUser ()
 

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)
 

Private Member Functions

 buildAccessCode ()
 

Private Attributes

 $lastFinishedPass
 

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 87 of file class.ilTestSession.php.

88  {
89  $this->active_id = 0;
90  $this->user_id = 0;
91  $this->anonymous_id = 0;
92  $this->test_id = 0;
93  $this->lastsequence = 0;
94  $this->submitted = FALSE;
95  $this->submittedTimestamp = "";
96  $this->pass = 0;
97  $this->ref_id = 0;
98  $this->tstamp = 0;
99 
100  $this->lastFinishedPass = null;
101  }

Member Function Documentation

◆ activeIDExists()

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

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

References $_SESSION, $result, $row, and setLastFinishedPass().

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

124  {
125  global $ilDB;
126 
127  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
128  {
129  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
130  array('integer','integer'),
131  array($user_id, $test_id)
132  );
133  if ($result->numRows())
134  {
135  $row = $ilDB->fetchAssoc($result);
136  $this->active_id = $row["active_id"];
137  $this->user_id = $row["user_fi"];
138  $this->anonymous_id = $row["anonymous_id"];
139  $this->test_id = $row["test_fi"];
140  $this->lastsequence = $row["lastindex"];
141  $this->pass = $row["tries"];
142  $this->submitted = ($row["submitted"]) ? TRUE : FALSE;
143  $this->submittedTimestamp = $row["submittimestamp"];
144  $this->tstamp = $row["tstamp"];
145 
146  $this->setLastFinishedPass($row['last_finished_pass']);
147 
148  return true;
149  }
150  }
151  return false;
152  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$result
setLastFinishedPass($lastFinishedPass)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildAccessCode()

ilTestSession::buildAccessCode ( )
private

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

Referenced by createNewAccessCode().

552  {
553  // create a 5 character code
554  $codestring = self::ACCESS_CODE_CHAR_DOMAIN;
555 
556  mt_srand();
557 
558  $code = "";
559 
560  for($i = 1; $i <= self::ACCESS_CODE_LENGTH; $i++)
561  {
562  $index = mt_rand(0, strlen($codestring)-1);
563  $code .= substr($codestring, $index, 1);
564  }
565 
566  return $code;
567  }
+ Here is the caller graph for this function:

◆ createNewAccessCode()

ilTestSession::createNewAccessCode ( )

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

References buildAccessCode(), and isAccessCodeUsed().

528  {
529  do
530  {
531  $code = $this->buildAccessCode();
532  }
533  while( $this->isAccessCodeUsed($code) );
534 
535  return $code;
536  }
+ Here is the call graph for this function:

◆ doesAccessCodeInSessionExists()

ilTestSession::doesAccessCodeInSessionExists ( )

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

References $_SESSION, and getTestId().

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

518  {
519  if( !is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
520  {
521  return false;
522  }
523 
524  return isset($_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()]);
525  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAccessCodeFromSession()

ilTestSession::getAccessCodeFromSession ( )

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

References $_SESSION, and getTestId().

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

503  {
504  if( !is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
505  {
506  return null;
507  }
508 
509  if( !isset($_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()]) )
510  {
511  return null;
512  }
513 
514  return $_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()];
515  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveId()

◆ getAnonymousId()

ilTestSession::getAnonymousId ( )

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

References $anonymous_id.

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

400  {
401  return $this->anonymous_id;
402  }
+ Here is the caller graph for this function:

◆ getLastFinishedPass()

ilTestSession::getLastFinishedPass ( )

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

References $lastFinishedPass.

Referenced by increaseTestPass(), and saveToDb().

455  {
457  }
+ Here is the caller graph for this function:

◆ getLastSequence()

ilTestSession::getLastSequence ( )

◆ getPass()

ilTestSession::getPass ( )

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

References $pass.

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

420  {
421  return $this->pass;
422  }
+ Here is the caller graph for this function:

◆ getRefId()

ilTestSession::getRefId ( )

Get Ref id.

Returns
integer Ref id

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

References $ref_id.

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

119  {
120  return $this->ref_id;
121  }
$ref_id
Definition: sahs_server.php:39
+ Here is the caller graph for this function:

◆ getSubmittedTimestamp()

ilTestSession::getSubmittedTimestamp ( )

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

References $submittedTimestamp.

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

440  {
442  }
+ Here is the caller graph for this function:

◆ getTestId()

ilTestSession::getTestId ( )

◆ getUserId()

ilTestSession::getUserId ( )

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

References $user_id.

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

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

◆ increasePass()

ilTestSession::increasePass ( )

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

Referenced by increaseTestPass().

425  {
426  $this->pass += 1;
427  }
+ Here is the caller graph for this function:

◆ increaseTestPass()

ilTestSession::increaseTestPass ( )

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

References $_SESSION, $ilLog, ilObjTestAccess\_getParticipantId(), ilObjTestAccess\_lookupObjIdForTestId(), ilLPStatusWrapper\_updateStatus(), activeIDExists(), getActiveId(), getAnonymousId(), getLastFinishedPass(), getLastSequence(), getPass(), getSubmittedTimestamp(), getTestId(), getUserId(), increasePass(), isSubmitted(), and setLastSequence().

155  {
156  global $ilDB, $ilLog;
157 
158  $this->increasePass();
159  $this->setLastSequence(0);
160  $submitted = ($this->isSubmitted()) ? 1 : 0;
161  // 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)
162  if (time() - $_SESSION['tst_last_increase_pass'] > 10)
163  {
164  $_SESSION['tst_last_increase_pass'] = time();
165  $this->tstamp = time();
166  if ($this->active_id > 0)
167  {
168  $ilDB->update('tst_active',
169  array(
170  'lastindex' => array('integer', $this->getLastSequence()),
171  'tries' => array('integer', $this->getPass()),
172  'submitted' => array('integer', $submitted),
173  'submittimestamp' => array('timestamp', strlen($this->getSubmittedTimestamp()) ? $this->getSubmittedTimestamp() : NULL),
174  'tstamp' => array('integer', time()),
175  'last_finished_pass' => array('integer', $this->getLastFinishedPass())
176  ),
177  array(
178  'active_id' => array('integer', $this->getActiveId())
179  )
180  );
181 
182  // update learning progress
183  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
184  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
186  ilObjTestAccess::_getParticipantId($this->active_id));
187  }
188  else
189  {
190  if (!$this->activeIDExists($this->getUserId(), $this->getTestId()))
191  {
192  $anonymous_id = ($this->getAnonymousId()) ? $this->getAnonymousId() : NULL;
193  $next_id = $ilDB->nextId('tst_active');
194  $affectedRows = $ilDB->manipulateF("INSERT INTO tst_active (active_id, user_fi, anonymous_id, test_fi, lastindex, tries, submitted, submittimestamp, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
195  array('integer', 'integer', 'text', 'integer', 'integer', 'integer', 'integer', 'timestamp', 'integer'),
196  array(
197  $next_id,
198  $this->getUserId(),
200  $this->getTestId(),
201  $this->getLastSequence(),
202  $this->getPass(),
203  $submitted,
204  (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : NULL,
205  time()
206  )
207  );
208  $this->active_id = $next_id;
209 
210  // update learning progress
211  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
212  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
214  $this->getUserId());
215  }
216  }
217  }
218  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
Update status.
_lookupObjIdForTestId($a_test_id)
Lookup object id for test id.
_getParticipantId($active_id)
Get user id for active id.
setLastSequence($lastsequence)
activeIDExists($user_id, $test_id)
+ Here is the call graph for this function:

◆ isAccessCodeUsed()

ilTestSession::isAccessCodeUsed (   $code)

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

References $query, $result, and getTestId().

Referenced by createNewAccessCode().

539  {
540  global $ilDB;
541 
542  $query = "SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s";
543 
544  $result = $ilDB->queryF(
545  $query, array('integer', 'text'), array($this->getTestId(), $code)
546  );
547 
548  return ($result->numRows() > 0);
549  }
$result
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnonymousUser()

ilTestSession::isAnonymousUser ( )

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

References getUserId().

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

570  {
571  return $this->getUserId() == ANONYMOUS_USER_ID;
572  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSubmitted()

ilTestSession::isSubmitted ( )

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

References $submitted.

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

430  {
431  return $this->submitted;
432  }
+ 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 345 of file class.ilTestSession.php.

References $result, $row, and setLastFinishedPass().

346  {
347  global $ilDB;
348  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE active_id = %s",
349  array('integer'),
350  array($active_id)
351  );
352  if ($result->numRows())
353  {
354  $row = $ilDB->fetchAssoc($result);
355  $this->active_id = $row["active_id"];
356  $this->user_id = $row["user_fi"];
357  $this->anonymous_id = $row["anonymous_id"];
358  $this->test_id = $row["test_fi"];
359  $this->lastsequence = $row["lastindex"];
360  $this->pass = $row["tries"];
361  $this->submitted = ($row["submitted"]) ? TRUE : FALSE;
362  $this->submittedTimestamp = $row["submittimestamp"];
363  $this->tstamp = $row["tstamp"];
364 
365  $this->setLastFinishedPass($row['last_finished_pass']);
366  }
367  }
$result
setLastFinishedPass($lastFinishedPass)
+ Here is the call graph for this function:

◆ loadTestSession()

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

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

References $_SESSION, $ilUser, $result, $row, doesAccessCodeInSessionExists(), getAccessCodeFromSession(), setLastFinishedPass(), and unsetAccessCodeInSession().

286  {
287  global $ilDB;
288  global $ilUser;
289 
290  if (!$user_id)
291  {
292  $user_id = $ilUser->getId();
293  }
294  if (($_SESSION["AccountId"] == ANONYMOUS_USER_ID) && $this->doesAccessCodeInSessionExists())
295  {
296  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
297  array('integer','integer','text'),
298  array($user_id, $test_id, $this->getAccessCodeFromSession())
299  );
300  }
301  else if (strlen($anonymous_id))
302  {
303  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
304  array('integer','integer','text'),
306  );
307  }
308  else
309  {
310  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
311  {
312  return NULL;
313  }
314  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
315  array('integer','integer'),
316  array($user_id, $test_id)
317  );
318  }
319  if ($result->numRows())
320  {
321  $row = $ilDB->fetchAssoc($result);
322  $this->active_id = $row["active_id"];
323  $this->user_id = $row["user_fi"];
324  $this->anonymous_id = $row["anonymous_id"];
325  $this->test_id = $row["test_fi"];
326  $this->lastsequence = $row["lastindex"];
327  $this->pass = $row["tries"];
328  $this->submitted = ($row["submitted"]) ? TRUE : FALSE;
329  $this->submittedTimestamp = $row["submittimestamp"];
330  $this->tstamp = $row["tstamp"];
331 
332  $this->setLastFinishedPass($row['last_finished_pass']);
333  }
334  elseif( $this->doesAccessCodeInSessionExists() )
335  {
336  $this->unsetAccessCodeInSession();
337  }
338  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$result
setLastFinishedPass($lastFinishedPass)
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ lookupTestStartLock()

ilTestSession::lookupTestStartLock ( )

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

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

471  {
472  global $ilDB;
473 
474  $res = $ilDB->queryF(
475  "SELECT start_lock FROM tst_active WHERE active_id = %s",
476  array('integer'), array($this->getActiveId())
477  );
478 
479  while($row = $ilDB->fetchAssoc($res))
480  {
481  return $row['start_lock'];
482  }
483 
484  return null;
485  }
+ Here is the call graph for this function:

◆ persistTestStartLock()

ilTestSession::persistTestStartLock (   $testStartLock)

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

References getActiveId().

460  {
461  global $ilDB;
462 
463  $ilDB->update(
464  'tst_active',
465  array('start_lock' => array('text', $testStartLock)),
466  array('active_id' => array('integer', $this->getActiveId()))
467  );
468  }
+ Here is the call graph for this function:

◆ saveToDb()

ilTestSession::saveToDb ( )

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

References $ilLog, ilObjTestAccess\_getParticipantId(), ilObjTestAccess\_lookupObjIdForTestId(), ilLearningProgress\_tracProgress(), ilLPStatusWrapper\_updateStatus(), activeIDExists(), getActiveId(), getAnonymousId(), getLastFinishedPass(), getLastSequence(), getPass(), getRefId(), getSubmittedTimestamp(), getTestId(), getUserId(), and isSubmitted().

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

221  {
222  global $ilDB, $ilLog;
223 
224  $submitted = ($this->isSubmitted()) ? 1 : 0;
225  if ($this->active_id > 0)
226  {
227  $affectedRows = $ilDB->update('tst_active',
228  array(
229  'lastindex' => array('integer', $this->getLastSequence()),
230  'tries' => array('integer', $this->getPass()),
231  'submitted' => array('integer', $submitted),
232  'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : NULL),
233  'tstamp' => array('integer', time()-10),
234  'last_finished_pass' => array('integer', $this->getLastFinishedPass())
235  ),
236  array(
237  'active_id' => array('integer', $this->getActiveId())
238  )
239  );
240 
241  // update learning progress
242  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
243  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
246  }
247  else
248  {
249  if (!$this->activeIDExists($this->getUserId(), $this->getTestId()))
250  {
251  $anonymous_id = ($this->getAnonymousId()) ? $this->getAnonymousId() : NULL;
252 
253  $next_id = $ilDB->nextId('tst_active');
254  $affectedRows = $ilDB->insert('tst_active',
255  array(
256  'active_id' => array('integer', $next_id),
257  'user_fi' => array('integer', $this->getUserId()),
258  'anonymous_id' => array('text', $anonymous_id),
259  'test_fi' => array('integer', $this->getTestId()),
260  'lastindex' => array('integer', $this->getLastSequence()),
261  'tries' => array('integer', $this->getPass()),
262  'submitted' => array('integer', $submitted),
263  'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : NULL),
264  'tstamp' => array('integer', time()-10),
265  'last_finished_pass' => array('integer', $this->getLastFinishedPass())
266  )
267  );
268  $this->active_id = $next_id;
269 
270  // update learning progress
271  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
272  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
274  $this->getUserId());
275  }
276  }
277 
278  include_once("./Services/Tracking/classes/class.ilLearningProgress.php");
281  $this->getRefId(),
282  'tst');
283  }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
Update status.
_lookupObjIdForTestId($a_test_id)
Lookup object id for test id.
getRefId()
Get Ref id.
_getParticipantId($active_id)
Get user id for active id.
_tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
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 487 of file class.ilTestSession.php.

References $_SESSION, and getTestId().

488  {
489  if (!is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX]))
490  {
491  $_SESSION[self::ACCESS_CODE_SESSION_INDEX] = array();
492  }
493 
494  $_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()] = $access_code;
495  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the call graph for this function:

◆ setAnonymousId()

ilTestSession::setAnonymousId (   $anonymous_id)

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

References $anonymous_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

395  {
396  $this->anonymous_id = $anonymous_id;
397  }
+ Here is the caller graph for this function:

◆ setLastFinishedPass()

ilTestSession::setLastFinishedPass (   $lastFinishedPass)

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

References $lastFinishedPass.

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

450  {
451  $this->lastFinishedPass = $lastFinishedPass;
452  }
+ Here is the caller graph for this function:

◆ setLastSequence()

ilTestSession::setLastSequence (   $lastsequence)

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

References $lastsequence.

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

405  {
406  $this->lastsequence = $lastsequence;
407  }
+ Here is the caller graph for this function:

◆ setPass()

ilTestSession::setPass (   $pass)

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

References $pass.

415  {
416  $this->pass = $pass;
417  }

◆ setRefId()

ilTestSession::setRefId (   $a_val)

Set Ref id.

Parameters
integerRef id

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

109  {
110  $this->ref_id = $a_val;
111  }

◆ setSubmitted()

ilTestSession::setSubmitted ( )

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

435  {
436  $this->submitted = TRUE;
437  }

◆ setSubmittedTimestamp()

ilTestSession::setSubmittedTimestamp ( )

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

445  {
446  $this->submittedTimestamp = strftime("%Y-%m-%d %H:%M:%S");
447  }

◆ setTestId()

ilTestSession::setTestId (   $test_id)

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

References $test_id.

385  {
386  $this->test_id = $test_id;
387  }

◆ setUserId()

ilTestSession::setUserId (   $user_id)

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

References $user_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

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

◆ unsetAccessCodeInSession()

ilTestSession::unsetAccessCodeInSession ( )

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

References $_SESSION, and getTestId().

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

498  {
499  unset($_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()]);
500  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ 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 77 of file class.ilTestSession.php.

Referenced by getLastFinishedPass(), and setLastFinishedPass().

◆ $lastsequence

ilTestSession::$lastsequence

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

Referenced by getLastSequence(), and setLastSequence().

◆ $submitted

ilTestSession::$submitted

◆ $submittedTimestamp

ilTestSession::$submittedTimestamp

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

Referenced by getSubmittedTimestamp().

◆ $test_id

ilTestSession::$test_id

◆ $tstamp

ilTestSession::$tstamp

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

◆ $user_id

ilTestSession::$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: