ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTestSessionDynamicQuestionSet Class Reference
+ Inheritance diagram for ilTestSessionDynamicQuestionSet:
+ Collaboration diagram for ilTestSessionDynamicQuestionSet:

Public Member Functions

 __construct ()
 
 getQuestionSetFilterSelection ()
 
 loadFromDb ($active_id)
 
 loadTestSession ($test_id, $user_id="", $anonymous_id="")
 
 saveToDb ()
 
 getCurrentQuestionId ()
 
 setCurrentQuestionId ($currentQuestionId)
 
- Public Member Functions inherited from ilTestSession
 __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 ()
 

Private Attributes

 $questionSetFilterSelection = null
 

Additional Inherited Members

- Data Fields inherited from ilTestSession
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 inherited from ilTestSession
 activeIDExists ($user_id, $test_id)
 
- Protected Attributes inherited from ilTestSession
 $lastPresentationMode
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestSessionDynamicQuestionSet::__construct ( )

Definition at line 24 of file class.ilTestSessionDynamicQuestionSet.php.

25  {
26  parent::__construct();
27 
28  $this->questionSetFilterSelection = new ilTestDynamicQuestionSetFilterSelection();
29  }

Member Function Documentation

◆ getCurrentQuestionId()

ilTestSessionDynamicQuestionSet::getCurrentQuestionId ( )

Definition at line 190 of file class.ilTestSessionDynamicQuestionSet.php.

References ilTestSession\getLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

191  {
192  return $this->getLastSequence();
193  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionSetFilterSelection()

ilTestSessionDynamicQuestionSet::getQuestionSetFilterSelection ( )
Returns
ilTestDynamicQuestionSetFilterSelection

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

References $questionSetFilterSelection.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ loadFromDb()

ilTestSessionDynamicQuestionSet::loadFromDb (   $active_id)

Definition at line 39 of file class.ilTestSessionDynamicQuestionSet.php.

References ilTestSession\$active_id, $ilDB, $result, $row, and array.

40  {
41  global $ilDB;
42  $result = $ilDB->queryF(
43  "SELECT * FROM tst_active WHERE active_id = %s",
44  array('integer'),
46  );
47  if ($result->numRows()) {
48  $row = $ilDB->fetchAssoc($result);
49  $this->active_id = $row["active_id"];
50  $this->user_id = $row["user_fi"];
51  $this->anonymous_id = $row["anonymous_id"];
52  $this->test_id = $row["test_fi"];
53  $this->lastsequence = $row["lastindex"];
54  $this->pass = $row["tries"];
55  $this->submitted = ($row["submitted"]) ? true : false;
56  $this->submittedTimestamp = $row["submittimestamp"];
57  $this->tstamp = $row["tstamp"];
58 
59  $this->questionSetFilterSelection->setTaxonomySelection(unserialize($row['taxfilter']));
60  $this->questionSetFilterSelection->setAnswerStatusSelection($row['answerstatusfilter']);
61  $this->questionSetFilterSelection->setAnswerStatusActiveId($row['active_id']);
62  }
63  }
$result
Create styles array
The data for the language used.
global $ilDB

◆ loadTestSession()

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

Definition at line 65 of file class.ilTestSessionDynamicQuestionSet.php.

References ilTestSession\$anonymous_id, $GLOBALS, $ilDB, $ilUser, $result, $row, ilTestSession\$test_id, ilTestSession\$user_id, array, ilTestSession\doesAccessCodeInSessionExists(), ilTestSession\getAccessCodeFromSession(), and ilTestSession\unsetAccessCodeInSession().

66  {
67  global $ilDB;
68  global $ilUser;
69 
70  if (!$user_id) {
71  $user_id = $ilUser->getId();
72  }
73  if (($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) && $this->doesAccessCodeInSessionExists()) {
74  $result = $ilDB->queryF(
75  "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
76  array('integer','integer','text'),
78  );
79  } elseif (strlen($anonymous_id)) {
80  $result = $ilDB->queryF(
81  "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
82  array('integer','integer','text'),
84  );
85  } else {
86  if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) {
87  return null;
88  }
89  $result = $ilDB->queryF(
90  "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
91  array('integer','integer'),
93  );
94  }
95 
96  // TODO bheyser: Refactor
97  $this->user_id = $user_id;
98 
99  if ($result->numRows()) {
100  $row = $ilDB->fetchAssoc($result);
101  $this->active_id = $row["active_id"];
102  $this->user_id = $row["user_fi"];
103  $this->anonymous_id = $row["anonymous_id"];
104  $this->test_id = $row["test_fi"];
105  $this->lastsequence = $row["lastindex"];
106  $this->pass = $row["tries"];
107  $this->submitted = ($row["submitted"]) ? true : false;
108  $this->submittedTimestamp = $row["submittimestamp"];
109  $this->tstamp = $row["tstamp"];
110 
111  $this->questionSetFilterSelection->setTaxonomySelection(unserialize($row['taxfilter']));
112  $this->questionSetFilterSelection->setAnswerStatusSelection($row['answerstatusfilter']);
113  $this->questionSetFilterSelection->setAnswerStatusActiveId($row['active_id']);
114  } elseif ($this->doesAccessCodeInSessionExists()) {
115  $this->unsetAccessCodeInSession();
116  }
117  }
$result
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ saveToDb()

ilTestSessionDynamicQuestionSet::saveToDb ( )

Definition at line 119 of file class.ilTestSessionDynamicQuestionSet.php.

References ilTestSession\$anonymous_id, $ilDB, $ilLog, ilTestSession\$submitted, ilObjTestAccess\_getParticipantId(), ilObjTestAccess\_lookupObjIdForTestId(), ilLearningProgress\_tracProgress(), ilLPStatusWrapper\_updateStatus(), ilTestSession\activeIDExists(), array, ilTestSession\getActiveId(), ilTestSession\getAnonymousId(), ilTestSession\getLastSequence(), ilTestSession\getPass(), getQuestionSetFilterSelection(), ilTestSession\getRefId(), ilTestSession\getSubmittedTimestamp(), ilTestSession\getTestId(), ilTestSession\getUserId(), ilTestSession\isSubmitted(), and time.

120  {
121  global $ilDB, $ilLog;
122 
123  $submitted = ($this->isSubmitted()) ? 1 : 0;
124  if ($this->active_id > 0) {
125  $affectedRows = $ilDB->update(
126  'tst_active',
127  array(
128  'lastindex' => array('integer', $this->getLastSequence()),
129  'tries' => array('integer', $this->getPass()),
130  'submitted' => array('integer', $submitted),
131  'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : null),
132  'tstamp' => array('integer', time()-10),
133  'taxfilter' => array('text', serialize($this->getQuestionSetFilterSelection()->getTaxonomySelection())),
134  'answerstatusfilter' => array('text', $this->getQuestionSetFilterSelection()->getAnswerStatusSelection())
135  ),
136  array(
137  'active_id' => array('integer', $this->getActiveId())
138  )
139  );
140 
141  // update learning progress
142  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
143  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
147  );
148  } else {
149  if (!$this->activeIDExists($this->getUserId(), $this->getTestId())) {
150  $anonymous_id = ($this->getAnonymousId()) ? $this->getAnonymousId() : null;
151 
152  $next_id = $ilDB->nextId('tst_active');
153  $affectedRows = $ilDB->insert(
154  'tst_active',
155  array(
156  'active_id' => array('integer', $next_id),
157  'user_fi' => array('integer', $this->getUserId()),
158  'anonymous_id' => array('text', $anonymous_id),
159  'test_fi' => array('integer', $this->getTestId()),
160  'lastindex' => array('integer', $this->getLastSequence()),
161  'tries' => array('integer', $this->getPass()),
162  'submitted' => array('integer', $submitted),
163  'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : null),
164  'tstamp' => array('integer', time()-10),
165  'taxfilter' => array('text', serialize($this->getQuestionSetFilterSelection()->getTaxonomySelection())),
166  'answerstatusfilter' => array('text', $this->getQuestionSetFilterSelection()->getAnswerStatusSelection())
167  )
168  );
169  $this->active_id = $next_id;
170 
171  // update learning progress
172  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
173  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
176  $this->getUserId()
177  );
178  }
179  }
180 
181  include_once("./Services/Tracking/classes/class.ilLearningProgress.php");
183  $this->getUserId(),
185  $this->getRefId(),
186  'tst'
187  );
188  }
static _getParticipantId($active_id)
Get user id for active id.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
static _lookupObjIdForTestId($a_test_id)
Lookup object id for test id.
getRefId()
Get Ref id.
Create styles array
The data for the language used.
global $ilDB
activeIDExists($user_id, $test_id)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ setCurrentQuestionId()

ilTestSessionDynamicQuestionSet::setCurrentQuestionId (   $currentQuestionId)

Definition at line 195 of file class.ilTestSessionDynamicQuestionSet.php.

References ilTestSession\setLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

196  {
197  $this->setLastSequence((int) $currentQuestionId);
198  }
setLastSequence($lastsequence)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $questionSetFilterSelection

ilTestSessionDynamicQuestionSet::$questionSetFilterSelection = null
private

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