ILIAS  release_8 Revision v8.23
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 (int $a_val)
 
 getRefId ()
 
 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
 
int $active_id
 
int $user_id
 
 $anonymous_id = null
 
int $test_id
 
int $lastsequence
 
bool $submitted
 
int $tstamp
 
string $submittedTimestamp
 
- Protected Member Functions inherited from ilTestSession
 activeIDExists ($user_id, $test_id)
 
- Protected Attributes inherited from ilTestSession
string $lastPresentationMode
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestSessionDynamicQuestionSet::__construct ( )

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

References ILIAS\GlobalScreen\Provider\__construct().

35  {
37 
38  $this->questionSetFilterSelection = new ilTestDynamicQuestionSetFilterSelection();
39  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getCurrentQuestionId()

ilTestSessionDynamicQuestionSet::getCurrentQuestionId ( )

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

References ilTestSession\getLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

202  : int
203  {
204  return $this->getLastSequence();
205  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionSetFilterSelection()

ilTestSessionDynamicQuestionSet::getQuestionSetFilterSelection ( )

◆ loadFromDb()

ilTestSessionDynamicQuestionSet::loadFromDb (   $active_id)

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

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

50  {
51  global $DIC;
52  $ilDB = $DIC['ilDB'];
53  $result = $ilDB->queryF(
54  "SELECT * FROM tst_active WHERE active_id = %s",
55  array('integer'),
56  array($active_id)
57  );
58  if ($result->numRows()) {
59  $row = $ilDB->fetchAssoc($result);
60  $this->active_id = $row["active_id"];
61  $this->user_id = $row["user_fi"];
62  $this->anonymous_id = $row["anonymous_id"];
63  $this->test_id = $row["test_fi"];
64  $this->lastsequence = $row["lastindex"];
65  $this->submitted = ($row["submitted"]) ? true : false;
66  $this->submittedTimestamp = $row["submittimestamp"];
67  $this->tstamp = $row["tstamp"];
68 
69  $this->questionSetFilterSelection->setTaxonomySelection(unserialize($row['taxfilter']));
70  $this->questionSetFilterSelection->setAnswerStatusSelection($row['answerstatusfilter']);
71  $this->questionSetFilterSelection->setAnswerStatusActiveId($row['active_id']);
72  }
73  }
global $DIC
Definition: feed.php:28

◆ loadTestSession()

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

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

References ilTestSession\$anonymous_id, $DIC, $GLOBALS, $ilDB, $ilUser, ilTestSession\$test_id, ilTestSession\$user_id, ANONYMOUS_USER_ID, ilTestSession\doesAccessCodeInSessionExists(), ilTestSession\getAccessCodeFromSession(), ILIAS\Survey\Mode\getId(), and ilTestSession\unsetAccessCodeInSession().

75  : void
76  {
77  global $DIC;
78  $ilDB = $DIC['ilDB'];
79  $ilUser = $DIC['ilUser'];
80 
81  if (!$user_id) {
82  $user_id = $ilUser->getId();
83  }
84  if (($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) && $this->doesAccessCodeInSessionExists()) {
85  $result = $ilDB->queryF(
86  "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
87  array('integer','integer','text'),
89  );
90  } elseif (strlen($anonymous_id)) {
91  $result = $ilDB->queryF(
92  "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
93  array('integer','integer','text'),
95  );
96  } else {
97  if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) {
98  return;
99  }
100  $result = $ilDB->queryF(
101  "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
102  array('integer','integer'),
103  array($user_id, $test_id)
104  );
105  }
106 
107  // TODO bheyser: Refactor
108  $this->user_id = $user_id;
109 
110  if ($result->numRows()) {
111  $row = $ilDB->fetchAssoc($result);
112  $this->active_id = $row["active_id"];
113  $this->user_id = $row["user_fi"];
114  $this->anonymous_id = $row["anonymous_id"];
115  $this->test_id = $row["test_fi"];
116  $this->lastsequence = $row["lastindex"];
117  $this->submitted = ($row["submitted"]) ? true : false;
118  $this->submittedTimestamp = $row["submittimestamp"];
119  $this->tstamp = $row["tstamp"];
120 
121  $this->questionSetFilterSelection->setTaxonomySelection(unserialize($row['taxfilter']));
122  $this->questionSetFilterSelection->setAnswerStatusSelection($row['answerstatusfilter']);
123  $this->questionSetFilterSelection->setAnswerStatusActiveId($row['active_id']);
124  } elseif ($this->doesAccessCodeInSessionExists()) {
125  $this->unsetAccessCodeInSession();
126  }
127  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: feed.php:28
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:

◆ saveToDb()

ilTestSessionDynamicQuestionSet::saveToDb ( )

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

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

129  : void
130  {
131  global $DIC;
132  $ilDB = $DIC['ilDB'];
133  $ilLog = $DIC['ilLog'];
134 
135  $submitted = ($this->isSubmitted()) ? 1 : 0;
136  if ($this->active_id > 0) {
137  $affectedRows = $ilDB->update(
138  'tst_active',
139  array(
140  'lastindex' => array('integer', $this->getLastSequence()),
141  'tries' => array('integer', $this->getPass()),
142  'submitted' => array('integer', $submitted),
143  'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : null),
144  'tstamp' => array('integer', time() - 10),
145  'taxfilter' => array('text', serialize($this->getQuestionSetFilterSelection()->getTaxonomySelection())),
146  'answerstatusfilter' => array('text', $this->getQuestionSetFilterSelection()->getAnswerStatusSelection())
147  ),
148  array(
149  'active_id' => array('integer', $this->getActiveId())
150  )
151  );
152 
153  // update learning progress
154  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
155  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
159  );
160  } else {
161  if (!$this->activeIDExists($this->getUserId(), $this->getTestId())) {
162  $anonymous_id = ($this->getAnonymousId()) ?: null;
163 
164  $next_id = $ilDB->nextId('tst_active');
165  $affectedRows = $ilDB->insert(
166  'tst_active',
167  array(
168  'active_id' => array('integer', $next_id),
169  'user_fi' => array('integer', $this->getUserId()),
170  'anonymous_id' => array('text', $anonymous_id),
171  'test_fi' => array('integer', $this->getTestId()),
172  'lastindex' => array('integer', $this->getLastSequence()),
173  'tries' => array('integer', $this->getPass()),
174  'submitted' => array('integer', $submitted),
175  'submittimestamp' => array('timestamp', (strlen($this->getSubmittedTimestamp())) ? $this->getSubmittedTimestamp() : null),
176  'tstamp' => array('integer', time() - 10),
177  'taxfilter' => array('text', serialize($this->getQuestionSetFilterSelection()->getTaxonomySelection())),
178  'answerstatusfilter' => array('text', $this->getQuestionSetFilterSelection()->getAnswerStatusSelection())
179  )
180  );
181  $this->active_id = $next_id;
182 
183  // update learning progress
184  include_once("./Modules/Test/classes/class.ilObjTestAccess.php");
185  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
188  $this->getUserId()
189  );
190  }
191  }
192 
193  include_once("./Services/Tracking/classes/class.ilLearningProgress.php");
195  $this->getUserId(),
197  $this->getRefId(),
198  'tst'
199  );
200  }
static _getParticipantId($active_id)
Get user id for active id.
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
global $DIC
Definition: feed.php:28
static _lookupObjIdForTestId($a_test_id)
Lookup object id for test id.
activeIDExists($user_id, $test_id)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ Here is the call graph for this function:

◆ setCurrentQuestionId()

ilTestSessionDynamicQuestionSet::setCurrentQuestionId (   $currentQuestionId)

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

References ilTestSession\setLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

208  {
209  $this->setLastSequence((int) $currentQuestionId);
210  }
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: