ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 193 of file class.ilTestSessionDynamicQuestionSet.php.

References ilTestSession\getLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

194  {
195  return $this->getLastSequence();
196  }
+ 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("SELECT * FROM tst_active WHERE active_id = %s",
43  array('integer'),
45  );
46  if ($result->numRows())
47  {
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  {
72  $user_id = $ilUser->getId();
73  }
74  if (($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) && $this->doesAccessCodeInSessionExists())
75  {
76  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
77  array('integer','integer','text'),
79  );
80  }
81  else if (strlen($anonymous_id))
82  {
83  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
84  array('integer','integer','text'),
86  );
87  }
88  else
89  {
90  if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID)
91  {
92  return NULL;
93  }
94  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
95  array('integer','integer'),
97  );
98  }
99 
100  // TODO bheyser: Refactor
101  $this->user_id = $user_id;
102 
103  if ($result->numRows())
104  {
105  $row = $ilDB->fetchAssoc($result);
106  $this->active_id = $row["active_id"];
107  $this->user_id = $row["user_fi"];
108  $this->anonymous_id = $row["anonymous_id"];
109  $this->test_id = $row["test_fi"];
110  $this->lastsequence = $row["lastindex"];
111  $this->pass = $row["tries"];
112  $this->submitted = ($row["submitted"]) ? TRUE : FALSE;
113  $this->submittedTimestamp = $row["submittimestamp"];
114  $this->tstamp = $row["tstamp"];
115 
116  $this->questionSetFilterSelection->setTaxonomySelection(unserialize($row['taxfilter']));
117  $this->questionSetFilterSelection->setAnswerStatusSelection($row['answerstatusfilter']);
118  $this->questionSetFilterSelection->setAnswerStatusActiveId($row['active_id']);
119  }
120  elseif( $this->doesAccessCodeInSessionExists() )
121  {
122  $this->unsetAccessCodeInSession();
123  }
124  }
$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 126 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.

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

References ilTestSession\setLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

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