ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 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)
 

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 189 of file class.ilTestSessionDynamicQuestionSet.php.

References ilTestSession\getLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

190  {
191  return $this->getLastSequence();
192  }
+ 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, and $row.

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

◆ loadTestSession()

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

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

References $_SESSION, ilTestSession\$anonymous_id, $ilDB, $ilUser, $result, $row, ilTestSession\$test_id, ilTestSession\$user_id, 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 (($_SESSION["AccountId"] == 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 ($_SESSION["AccountId"] == 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'),
96  array($user_id, $test_id)
97  );
98  }
99  if ($result->numRows())
100  {
101  $row = $ilDB->fetchAssoc($result);
102  $this->active_id = $row["active_id"];
103  $this->user_id = $row["user_fi"];
104  $this->anonymous_id = $row["anonymous_id"];
105  $this->test_id = $row["test_fi"];
106  $this->lastsequence = $row["lastindex"];
107  $this->pass = $row["tries"];
108  $this->submitted = ($row["submitted"]) ? TRUE : FALSE;
109  $this->submittedTimestamp = $row["submittimestamp"];
110  $this->tstamp = $row["tstamp"];
111 
112  $this->questionSetFilterSelection->setTaxonomySelection(unserialize($row['taxfilter']));
113  $this->questionSetFilterSelection->setAnswerStatusSelection($row['answerstatusfilter']);
114  $this->questionSetFilterSelection->setAnswerStatusActiveId($row['active_id']);
115  }
116  elseif( $this->doesAccessCodeInSessionExists() )
117  {
118  $this->unsetAccessCodeInSession();
119  }
120  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$result
global $ilUser
Definition: imgupload.php:15
global $ilDB
+ Here is the call graph for this function:

◆ saveToDb()

ilTestSessionDynamicQuestionSet::saveToDb ( )

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

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

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

◆ setCurrentQuestionId()

ilTestSessionDynamicQuestionSet::setCurrentQuestionId (   $currentQuestionId)

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

References ilTestSession\setLastSequence().

Referenced by ilTestSequenceDynamicQuestionSet\cleanupQuestions().

195  {
196  $this->setLastSequence((int)$currentQuestionId);
197  }
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: