ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 
 isPasswordChecked ()
 
 setPasswordChecked (bool $value)
 
 reportableResultsAvailable (ilObjTest $testOBJ)
 
 hasSinglePassReportable (ilObjTest $testObj)
 

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 {
27
28 $this->questionSetFilterSelection = new ilTestDynamicQuestionSetFilterSelection();
29 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getCurrentQuestionId()

ilTestSessionDynamicQuestionSet::getCurrentQuestionId ( )

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

195 {
196 return $this->getLastSequence();
197 }

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 $DIC;
42 $ilDB = $DIC['ilDB'];
43 $result = $ilDB->queryF(
44 "SELECT * FROM tst_active WHERE active_id = %s",
45 array('integer'),
46 array($active_id)
47 );
48 if ($result->numRows()) {
49 $row = $ilDB->fetchAssoc($result);
50 $this->active_id = $row["active_id"];
51 $this->user_id = $row["user_fi"];
52 $this->anonymous_id = $row["anonymous_id"];
53 $this->test_id = $row["test_fi"];
54 $this->lastsequence = $row["lastindex"];
55 $this->pass = $row["tries"];
56 $this->submitted = ($row["submitted"]) ? true : false;
57 $this->submittedTimestamp = $row["submittimestamp"];
58 $this->tstamp = $row["tstamp"];
59
60 $this->questionSetFilterSelection->setTaxonomySelection(unserialize($row['taxfilter']));
61 $this->questionSetFilterSelection->setAnswerStatusSelection($row['answerstatusfilter']);
62 $this->questionSetFilterSelection->setAnswerStatusActiveId($row['active_id']);
63 }
64 }
$result
global $DIC
Definition: goto.php:24
global $ilDB

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

◆ loadTestSession()

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

Reimplemented from ilTestSession.

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

67 {
68 global $DIC;
69 $ilDB = $DIC['ilDB'];
70 $ilUser = $DIC['ilUser'];
71
72 if (!$user_id) {
73 $user_id = $ilUser->getId();
74 }
75 if (($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) && $this->doesAccessCodeInSessionExists()) {
76 $result = $ilDB->queryF(
77 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
78 array('integer','integer','text'),
80 );
81 } elseif (strlen($anonymous_id)) {
82 $result = $ilDB->queryF(
83 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
84 array('integer','integer','text'),
86 );
87 } else {
88 if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) {
89 return null;
90 }
91 $result = $ilDB->queryF(
92 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
93 array('integer','integer'),
94 array($user_id, $test_id)
95 );
96 }
97
98 // TODO bheyser: Refactor
99 $this->user_id = $user_id;
100
101 if ($result->numRows()) {
102 $row = $ilDB->fetchAssoc($result);
103 $this->active_id = $row["active_id"];
104 $this->user_id = $row["user_fi"];
105 $this->anonymous_id = $row["anonymous_id"];
106 $this->test_id = $row["test_fi"];
107 $this->lastsequence = $row["lastindex"];
108 $this->pass = $row["tries"];
109 $this->submitted = ($row["submitted"]) ? true : false;
110 $this->submittedTimestamp = $row["submittimestamp"];
111 $this->tstamp = $row["tstamp"];
112
113 $this->questionSetFilterSelection->setTaxonomySelection(unserialize($row['taxfilter']));
114 $this->questionSetFilterSelection->setAnswerStatusSelection($row['answerstatusfilter']);
115 $this->questionSetFilterSelection->setAnswerStatusActiveId($row['active_id']);
116 } elseif ($this->doesAccessCodeInSessionExists()) {
118 }
119 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
const ANONYMOUS_USER_ID
Definition: constants.php:25
$ilUser
Definition: imgupload.php:18

References ilTestSession\$anonymous_id, $DIC, $GLOBALS, $ilDB, $ilUser, $result, ilTestSession\$test_id, ilTestSession\$user_id, ANONYMOUS_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 121 of file class.ilTestSessionDynamicQuestionSet.php.

122 {
123 global $DIC;
124 $ilDB = $DIC['ilDB'];
125 $ilLog = $DIC['ilLog'];
126
127 $submitted = ($this->isSubmitted()) ? 1 : 0;
128 if ($this->active_id > 0) {
129 $affectedRows = $ilDB->update(
130 'tst_active',
131 array(
132 'lastindex' => array('integer', $this->getLastSequence()),
133 'tries' => array('integer', $this->getPass()),
134 'submitted' => array('integer', $submitted),
135 'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : null),
136 'tstamp' => array('integer', time() - 10),
137 'taxfilter' => array('text', serialize($this->getQuestionSetFilterSelection()->getTaxonomySelection())),
138 'answerstatusfilter' => array('text', $this->getQuestionSetFilterSelection()->getAnswerStatusSelection())
139 ),
140 array(
141 'active_id' => array('integer', $this->getActiveId())
142 )
143 );
144
145 // update learning progress
146 include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
147 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
151 );
152 } else {
153 if (!$this->activeIDExists($this->getUserId(), $this->getTestId())) {
154 $anonymous_id = ($this->getAnonymousId()) ? $this->getAnonymousId() : null;
155
156 $next_id = $ilDB->nextId('tst_active');
157 $affectedRows = $ilDB->insert(
158 'tst_active',
159 array(
160 'active_id' => array('integer', $next_id),
161 'user_fi' => array('integer', $this->getUserId()),
162 'anonymous_id' => array('text', $anonymous_id),
163 'test_fi' => array('integer', $this->getTestId()),
164 'lastindex' => array('integer', $this->getLastSequence()),
165 'tries' => array('integer', $this->getPass()),
166 'submitted' => array('integer', $submitted),
167 'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : null),
168 'tstamp' => array('integer', time() - 10),
169 'taxfilter' => array('text', serialize($this->getQuestionSetFilterSelection()->getTaxonomySelection())),
170 'answerstatusfilter' => array('text', $this->getQuestionSetFilterSelection()->getAnswerStatusSelection())
171 )
172 );
173 $this->active_id = $next_id;
174
175 // update learning progress
176 include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
177 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
180 $this->getUserId()
181 );
182 }
183 }
184
185 include_once("./Services/Tracking/classes/class.ilLearningProgress.php");
187 $this->getUserId(),
189 $this->getRefId(),
190 'tst'
191 );
192 }
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, $DIC, $ilDB, 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 199 of file class.ilTestSessionDynamicQuestionSet.php.

200 {
201 $this->setLastSequence((int) $currentQuestionId);
202 }
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: