ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 isObjectiveOriented ()
 
 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
 
 $objectiveOrientedContainerId
 

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

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

Member Function Documentation

◆ activeIDExists()

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

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

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

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

127  {
128  global $ilDB;
129 
130  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
131  {
132  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
133  array('integer','integer'),
134  array($user_id, $test_id)
135  );
136  if ($result->numRows())
137  {
138  $row = $ilDB->fetchAssoc($result);
139  $this->active_id = $row["active_id"];
140  $this->user_id = $row["user_fi"];
141  $this->anonymous_id = $row["anonymous_id"];
142  $this->test_id = $row["test_fi"];
143  $this->lastsequence = $row["lastindex"];
144  $this->pass = $row["tries"];
145  $this->submitted = ($row["submitted"]) ? TRUE : FALSE;
146  $this->submittedTimestamp = $row["submittimestamp"];
147  $this->tstamp = $row["tstamp"];
148 
149  $this->setLastFinishedPass($row['last_finished_pass']);
150  $this->setObjectiveOrientedContainerId((int)$row['objective_container']);
151 
152  return true;
153  }
154  }
155  return false;
156  }
< 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
setObjectiveOrientedContainerId($objectiveOriented)
setLastFinishedPass($lastFinishedPass)
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildAccessCode()

ilTestSession::buildAccessCode ( )
private

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

Referenced by createNewAccessCode().

577  {
578  // create a 5 character code
579  $codestring = self::ACCESS_CODE_CHAR_DOMAIN;
580 
581  mt_srand();
582 
583  $code = "";
584 
585  for($i = 1; $i <= self::ACCESS_CODE_LENGTH; $i++)
586  {
587  $index = mt_rand(0, strlen($codestring)-1);
588  $code .= substr($codestring, $index, 1);
589  }
590 
591  return $code;
592  }
+ Here is the caller graph for this function:

◆ createNewAccessCode()

ilTestSession::createNewAccessCode ( )

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

References buildAccessCode(), and isAccessCodeUsed().

553  {
554  do
555  {
556  $code = $this->buildAccessCode();
557  }
558  while( $this->isAccessCodeUsed($code) );
559 
560  return $code;
561  }
+ Here is the call graph for this function:

◆ doesAccessCodeInSessionExists()

ilTestSession::doesAccessCodeInSessionExists ( )

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

References $_SESSION, and getTestId().

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

543  {
544  if( !is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
545  {
546  return false;
547  }
548 
549  return isset($_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()]);
550  }
< 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 527 of file class.ilTestSession.php.

References $_SESSION, and getTestId().

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

528  {
529  if( !is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX]) )
530  {
531  return null;
532  }
533 
534  if( !isset($_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()]) )
535  {
536  return null;
537  }
538 
539  return $_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()];
540  }
< 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 409 of file class.ilTestSession.php.

References $anonymous_id.

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

410  {
411  return $this->anonymous_id;
412  }
+ Here is the caller graph for this function:

◆ getLastFinishedPass()

ilTestSession::getLastFinishedPass ( )

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

References $lastFinishedPass.

Referenced by increaseTestPass(), and saveToDb().

465  {
467  }
+ Here is the caller graph for this function:

◆ getLastSequence()

ilTestSession::getLastSequence ( )

◆ getObjectiveOrientedContainerId()

ilTestSession::getObjectiveOrientedContainerId ( )

◆ getPass()

ilTestSession::getPass ( )

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

References $pass.

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

430  {
431  return $this->pass;
432  }
+ Here is the caller graph for this function:

◆ getRefId()

◆ getSubmittedTimestamp()

ilTestSession::getSubmittedTimestamp ( )

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

References $submittedTimestamp.

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

450  {
452  }
+ Here is the caller graph for this function:

◆ getTestId()

ilTestSession::getTestId ( )

◆ getUserId()

ilTestSession::getUserId ( )

◆ increasePass()

ilTestSession::increasePass ( )

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

Referenced by increaseTestPass().

435  {
436  $this->pass += 1;
437  }
+ Here is the caller graph for this function:

◆ increaseTestPass()

ilTestSession::increaseTestPass ( )

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

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

159  {
160  global $ilDB, $ilLog;
161 
162  $this->increasePass();
163  $this->setLastSequence(0);
164  $submitted = ($this->isSubmitted()) ? 1 : 0;
165  // 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)
166  if (time() - $_SESSION['tst_last_increase_pass'] > 10)
167  {
168  $_SESSION['tst_last_increase_pass'] = time();
169  $this->tstamp = time();
170  if ($this->active_id > 0)
171  {
172  $ilDB->update('tst_active',
173  array(
174  'lastindex' => array('integer', $this->getLastSequence()),
175  'tries' => array('integer', $this->getPass()),
176  'submitted' => array('integer', $submitted),
177  'submittimestamp' => array('timestamp', strlen($this->getSubmittedTimestamp()) ? $this->getSubmittedTimestamp() : NULL),
178  'tstamp' => array('integer', time()),
179  'last_finished_pass' => array('integer', $this->getLastFinishedPass()),
180  'objective_container' => array('integer', (int)$this->getObjectiveOrientedContainerId())
181  ),
182  array(
183  'active_id' => array('integer', $this->getActiveId())
184  )
185  );
186 
187  // update learning progress
188  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
189  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
191  ilObjTestAccess::_getParticipantId($this->active_id));
192  }
193  else
194  {
195  if (!$this->activeIDExists($this->getUserId(), $this->getTestId()))
196  {
197  $anonymous_id = ($this->getAnonymousId()) ? $this->getAnonymousId() : NULL;
198  $next_id = $ilDB->nextId('tst_active');
199  $affectedRows = $ilDB->manipulateF("INSERT INTO tst_active (active_id, user_fi, anonymous_id, test_fi, lastindex, tries, submitted, submittimestamp, tstamp, objective_container) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
200  array('integer', 'integer', 'text', 'integer', 'integer', 'integer', 'integer', 'timestamp', 'integer', 'integer'),
201  array(
202  $next_id,
203  $this->getUserId(),
205  $this->getTestId(),
206  $this->getLastSequence(),
207  $this->getPass(),
208  $submitted,
209  (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : NULL,
210  time(),
211  (int)$this->getObjectiveOrientedContainerId()
212  )
213  );
214  $this->active_id = $next_id;
215 
216  // update learning progress
217  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
218  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
220  $this->getUserId());
221  }
222  }
223  }
224  }
< 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.
global $ilDB
setLastSequence($lastsequence)
activeIDExists($user_id, $test_id)
+ Here is the call graph for this function:

◆ isAccessCodeUsed()

ilTestSession::isAccessCodeUsed (   $code)

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

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

Referenced by createNewAccessCode().

564  {
565  global $ilDB;
566 
567  $query = "SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s";
568 
569  $result = $ilDB->queryF(
570  $query, array('integer', 'text'), array($this->getTestId(), $code)
571  );
572 
573  return ($result->numRows() > 0);
574  }
$result
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnonymousUser()

ilTestSession::isAnonymousUser ( )

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

References getUserId().

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

595  {
596  return $this->getUserId() == ANONYMOUS_USER_ID;
597  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isObjectiveOriented()

ilTestSession::isObjectiveOriented ( )

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

References getObjectiveOrientedContainerId().

480  {
481  return (bool)$this->getObjectiveOrientedContainerId();
482  }
+ Here is the call graph for this function:

◆ isSubmitted()

ilTestSession::isSubmitted ( )

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

References $submitted.

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

440  {
441  return $this->submitted;
442  }
+ 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 354 of file class.ilTestSession.php.

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

355  {
356  global $ilDB;
357  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE active_id = %s",
358  array('integer'),
359  array($active_id)
360  );
361  if ($result->numRows())
362  {
363  $row = $ilDB->fetchAssoc($result);
364  $this->active_id = $row["active_id"];
365  $this->user_id = $row["user_fi"];
366  $this->anonymous_id = $row["anonymous_id"];
367  $this->test_id = $row["test_fi"];
368  $this->lastsequence = $row["lastindex"];
369  $this->pass = $row["tries"];
370  $this->submitted = ($row["submitted"]) ? TRUE : FALSE;
371  $this->submittedTimestamp = $row["submittimestamp"];
372  $this->tstamp = $row["tstamp"];
373 
374  $this->setLastFinishedPass($row['last_finished_pass']);
375  $this->setObjectiveOrientedContainerId((int)$row['objective_container']);
376  }
377  }
$result
setObjectiveOrientedContainerId($objectiveOriented)
setLastFinishedPass($lastFinishedPass)
global $ilDB
+ Here is the call graph for this function:

◆ loadTestSession()

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

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

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

294  {
295  global $ilDB;
296  global $ilUser;
297 
298  if (!$user_id)
299  {
300  $user_id = $ilUser->getId();
301  }
302  if (($_SESSION["AccountId"] == ANONYMOUS_USER_ID) && $this->doesAccessCodeInSessionExists())
303  {
304  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
305  array('integer','integer','text'),
306  array($user_id, $test_id, $this->getAccessCodeFromSession())
307  );
308  }
309  else if (strlen($anonymous_id))
310  {
311  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
312  array('integer','integer','text'),
314  );
315  }
316  else
317  {
318  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
319  {
320  return NULL;
321  }
322  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
323  array('integer','integer'),
324  array($user_id, $test_id)
325  );
326  }
327  if ($result->numRows())
328  {
329  $row = $ilDB->fetchAssoc($result);
330  $this->active_id = $row["active_id"];
331  $this->user_id = $row["user_fi"];
332  $this->anonymous_id = $row["anonymous_id"];
333  $this->test_id = $row["test_fi"];
334  $this->lastsequence = $row["lastindex"];
335  $this->pass = $row["tries"];
336  $this->submitted = ($row["submitted"]) ? TRUE : FALSE;
337  $this->submittedTimestamp = $row["submittimestamp"];
338  $this->tstamp = $row["tstamp"];
339 
340  $this->setLastFinishedPass($row['last_finished_pass']);
341  $this->setObjectiveOrientedContainerId((int)$row['objective_container']);
342  }
343  elseif( $this->doesAccessCodeInSessionExists() )
344  {
345  $this->unsetAccessCodeInSession();
346  }
347  }
< 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
setObjectiveOrientedContainerId($objectiveOriented)
setLastFinishedPass($lastFinishedPass)
global $ilUser
Definition: imgupload.php:15
global $ilDB
+ Here is the call graph for this function:

◆ lookupTestStartLock()

ilTestSession::lookupTestStartLock ( )

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

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

496  {
497  global $ilDB;
498 
499  $res = $ilDB->queryF(
500  "SELECT start_lock FROM tst_active WHERE active_id = %s",
501  array('integer'), array($this->getActiveId())
502  );
503 
504  while($row = $ilDB->fetchAssoc($res))
505  {
506  return $row['start_lock'];
507  }
508 
509  return null;
510  }
global $ilDB
+ Here is the call graph for this function:

◆ persistTestStartLock()

ilTestSession::persistTestStartLock (   $testStartLock)

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

References $ilDB, and getActiveId().

485  {
486  global $ilDB;
487 
488  $ilDB->update(
489  'tst_active',
490  array('start_lock' => array('text', $testStartLock)),
491  array('active_id' => array('integer', $this->getActiveId()))
492  );
493  }
global $ilDB
+ Here is the call graph for this function:

◆ saveToDb()

ilTestSession::saveToDb ( )

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

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

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

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

References $_SESSION, and getTestId().

513  {
514  if (!is_array($_SESSION[self::ACCESS_CODE_SESSION_INDEX]))
515  {
516  $_SESSION[self::ACCESS_CODE_SESSION_INDEX] = array();
517  }
518 
519  $_SESSION[self::ACCESS_CODE_SESSION_INDEX][$this->getTestId()] = $access_code;
520  }
< 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 404 of file class.ilTestSession.php.

References $anonymous_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

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

◆ setLastFinishedPass()

ilTestSession::setLastFinishedPass (   $lastFinishedPass)

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

References $lastFinishedPass.

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

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

◆ setLastSequence()

ilTestSession::setLastSequence (   $lastsequence)

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

References $lastsequence.

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

415  {
416  $this->lastsequence = $lastsequence;
417  }
+ Here is the caller graph for this function:

◆ setObjectiveOrientedContainerId()

ilTestSession::setObjectiveOrientedContainerId (   $objectiveOriented)

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

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

470  {
471  $this->objectiveOrientedContainerId = $objectiveOriented;
472  }
+ Here is the caller graph for this function:

◆ setPass()

ilTestSession::setPass (   $pass)

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

References $pass.

425  {
426  $this->pass = $pass;
427  }

◆ setRefId()

ilTestSession::setRefId (   $a_val)

Set Ref id.

Parameters
integerRef id

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

112  {
113  $this->ref_id = $a_val;
114  }

◆ setSubmitted()

ilTestSession::setSubmitted ( )

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

445  {
446  $this->submitted = TRUE;
447  }

◆ setSubmittedTimestamp()

ilTestSession::setSubmittedTimestamp ( )

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

455  {
456  $this->submittedTimestamp = strftime("%Y-%m-%d %H:%M:%S");
457  }

◆ setTestId()

ilTestSession::setTestId (   $test_id)

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

References $test_id.

395  {
396  $this->test_id = $test_id;
397  }

◆ setUserId()

ilTestSession::setUserId (   $user_id)

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

References $user_id.

Referenced by ilTestPlayerAbstractGUI\ensureExistingTestSession().

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

◆ unsetAccessCodeInSession()

ilTestSession::unsetAccessCodeInSession ( )

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

References $_SESSION, and getTestId().

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

523  {
524  unset($_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:

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

◆ $objectiveOrientedContainerId

ilTestSession::$objectiveOrientedContainerId
private

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

Referenced by getObjectiveOrientedContainerId().

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