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 ()
 ilTestSession constructor More...
 
 getQuestionSetFilterSelection ()
 
 loadFromDb ($active_id)
 Loads the session data for a given active id. More...
 
 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 ( )

ilTestSession constructor

The constructor takes possible arguments an creates an instance of the ilTestSession object.

@access public

Reimplemented from ilTestSession.

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.

191 {
192 return $this->getLastSequence();
193 }

References ilTestSession\getLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

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

Loads the session data for a given active id.

Parameters
integer$active_idThe database id of the test session

Reimplemented from ilTestSession.

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

40 {
41 global $ilDB;
42 $result = $ilDB->queryF(
43 "SELECT * FROM tst_active WHERE active_id = %s",
44 array('integer'),
45 array($active_id)
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
global $ilDB

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

◆ loadTestSession()

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

Reimplemented from ilTestSession.

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

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'),
92 array($user_id, $test_id)
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()) {
116 }
117 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$ilUser
Definition: imgupload.php:18

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

+ Here is the call graph for this function:

◆ saveToDb()

ilTestSessionDynamicQuestionSet::saveToDb ( )

Reimplemented from ilTestSession.

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

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 _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 _getParticipantId($active_id)
Get user id for active id.
static _lookupObjIdForTestId($a_test_id)
Lookup object id for test id.
activeIDExists($user_id, $test_id)
getRefId()
Get Ref id.

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

+ Here is the call graph for this function:

◆ setCurrentQuestionId()

ilTestSessionDynamicQuestionSet::setCurrentQuestionId (   $currentQuestionId)

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

196 {
197 $this->setLastSequence((int) $currentQuestionId);
198 }
setLastSequence($lastsequence)

References ilTestSession\setLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

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