ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAssQuestionHintTracking Class Reference
+ Collaboration diagram for ilAssQuestionHintTracking:

Public Member Functions

 __construct ($questionId, $activeId, $pass)
 
 setActiveId ($activeId)
 
 getActiveId ()
 
 setPass ($pass)
 
 getPass ()
 
 setQuestionId ($questionId)
 
 getQuestionId ()
 
 requestsExist ()
 Returns the fact wether there exists hint requests for the given question relating to the given testactive and testpass or not. More...
 
 getNumExistingRequests ()
 Returns the number existing hint requests for the given question relating to the given testactive and testpass or not. More...
 
 requestsPossible ()
 Returns the fact wether (further) hint requests are possible for the given question relating to the given testactive and testpass or not. More...
 
 isRequested ($hintId)
 Returns the fact wether the hint for given id is requested for the given testactive and testpass. More...
 
 getNextRequestableHint ()
 Returns the next requestable hint for given question relating to given testactive and testpass. More...
 
 getRequestedHintsList ()
 Returns an object of class ilAssQuestionHintList containing objects of class ilAssQuestionHint for all allready requested hints relating to the given question, testactive and testpass. More...
 
 storeRequest (ilAssQuestionHint $questionHint)
 Tracks the given hint as requested for the given question, testactive and testpass. More...
 
 getRequestStatisticDataByQuestionAndTestpass ()
 Returns a question hint request statistic data container containing the statistics for all requests relating to given ... More...
 

Static Public Member Functions

static getRequestRequestStatisticDataRegisterByActiveId ($activeId)
 
static deleteRequestsByActiveIds ($activeIds)
 Deletes all hint requests relating to a testactive included in given active ids. More...
 

Private Attributes

 $questionId
 
 $activeId
 
 $pass
 

Detailed Description

Definition at line 14 of file class.ilAssQuestionHintTracking.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionHintTracking::__construct (   $questionId,
  $activeId,
  $pass 
)

Member Function Documentation

◆ deleteRequestsByActiveIds()

static ilAssQuestionHintTracking::deleteRequestsByActiveIds (   $activeIds)
static

Deletes all hint requests relating to a testactive included in given active ids.

public ilDBInterface $ilDB

Parameters
array[integer]$activeIds

Definition at line 430 of file class.ilAssQuestionHintTracking.php.

References $ilDB, and $query.

Referenced by ilObjTest\removeTestResultsByActiveIds().

431  {
432  global $ilDB;
433 
434  $__active_fi__IN__activeIds = $ilDB->in('qhtr_active_fi', $activeIds, false, 'integer');
435 
436  $query = "
437  DELETE FROM qpl_hint_tracking
438  WHERE $__active_fi__IN__activeIds
439  ";
440 
441  $ilDB->manipulate($query);
442  }
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getActiveId()

ilAssQuestionHintTracking::getActiveId ( )

◆ getNextRequestableHint()

ilAssQuestionHintTracking::getNextRequestableHint ( )

Returns the next requestable hint for given question relating to given testactive and testpass.

public ilDBInterface $ilDB

Returns
ilAssQuestionHint $nextRequestableHint
Exceptions
ilTestException

Definition at line 197 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, array, getActiveId(), ilAssQuestionHint\getInstanceById(), getPass(), and getQuestionId().

198  {
199  global $ilDB;
200 
201  $query = "
202  SELECT qht_hint_id
203 
204  FROM qpl_hints
205 
206  LEFT JOIN qpl_hint_tracking
207  ON qhtr_hint_fi = qht_hint_id
208  AND qhtr_active_fi = %s
209  AND qhtr_pass = %s
210 
211  WHERE qht_question_fi = %s
212  AND qhtr_track_id IS NULL
213 
214  ORDER BY qht_hint_index ASC
215  ";
216 
217  $ilDB->setLimit(1);
218 
219  $res = $ilDB->queryF(
220  $query,
221  array('integer', 'integer', 'integer'),
222  array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
223  );
224 
225  while ($row = $ilDB->fetchAssoc($res)) {
226  $nextHint = ilAssQuestionHint::getInstanceById($row['qht_hint_id']);
227 
228  return $nextHint;
229  }
230 
231  require_once 'Modules/Test/exceptions/class.ilTestNoNextRequestableHintExistsException.php';
232 
234  "no next hint found for questionId={$this->getQuestionId()}, activeId={$this->getActiveId()}, pass={$this->getPass()}"
235  );
236  }
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getNumExistingRequests()

ilAssQuestionHintTracking::getNumExistingRequests ( )

Returns the number existing hint requests for the given question relating to the given testactive and testpass or not.

public ilDBInterface $ilDB

Returns
integer $numExisingRequests

Definition at line 84 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, array, getActiveId(), getPass(), and getQuestionId().

85  {
86  global $ilDB;
87 
88  $query = "
89  SELECT COUNT(qhtr_track_id) cnt
90 
91  FROM qpl_hint_tracking
92 
93  WHERE qhtr_question_fi = %s
94  AND qhtr_active_fi = %s
95  AND qhtr_pass = %s
96  ";
97 
98  $res = $ilDB->queryF(
99  $query,
100  array('integer', 'integer', 'integer'),
101  array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
102  );
103 
104  $row = $ilDB->fetchAssoc($res);
105 
106  return $row['cnt'];
107  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getPass()

ilAssQuestionHintTracking::getPass ( )

◆ getQuestionId()

ilAssQuestionHintTracking::getQuestionId ( )

◆ getRequestedHintsList()

ilAssQuestionHintTracking::getRequestedHintsList ( )

Returns an object of class ilAssQuestionHintList containing objects of class ilAssQuestionHint for all allready requested hints relating to the given question, testactive and testpass.

public ilDBInterface $ilDB

Returns
ilAssQuestionHintList $requestedHintsList

Definition at line 247 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, array, getActiveId(), ilAssQuestionHintList\getListByHintIds(), getPass(), and getQuestionId().

248  {
249  global $ilDB;
250 
251  $query = "
252  SELECT qhtr_hint_fi
253 
254  FROM qpl_hint_tracking
255 
256  WHERE qhtr_question_fi = %s
257  AND qhtr_active_fi = %s
258  AND qhtr_pass = %s
259  ";
260 
261  $res = $ilDB->queryF(
262  $query,
263  array('integer', 'integer', 'integer'),
264  array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
265  );
266 
267  $hintIds = array();
268 
269  while ($row = $ilDB->fetchAssoc($res)) {
270  $hintIds[] = $row['qhtr_hint_fi'];
271  }
272 
273  $requestedHintsList = ilAssQuestionHintList::getListByHintIds($hintIds);
274 
275  return $requestedHintsList;
276  }
static getListByHintIds($hintIds)
instantiates a question hint list for the passed hint ids
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getRequestRequestStatisticDataRegisterByActiveId()

static ilAssQuestionHintTracking::getRequestRequestStatisticDataRegisterByActiveId (   $activeId)
static
Parameters
integer$activeId
Returns
ilAssQuestionHintRequestStatisticRegister

Definition at line 355 of file class.ilAssQuestionHintTracking.php.

References $activeId, $DIC, $ilDB, $query, $res, $row, and array.

Referenced by ilTestServiceGUI\getPassOverviewTableData().

356  {
357  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticRegister.php';
358  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
359 
360  /* @var ILIAS\DI\Container $DIC */ global $DIC;
361  $db = $DIC->database();
362 
363  $query = "
364  SELECT qhtr_pass requests_pass,
365  qhtr_question_fi requests_question,
366  COUNT(qhtr_track_id) requests_count,
367  SUM(qht_hint_points) requests_points
368 
369  FROM qpl_hint_tracking
370 
371  INNER JOIN qpl_hints
372  ON qht_hint_id = qhtr_hint_fi
373 
374  WHERE qhtr_active_fi = %s
375 
376  GROUP BY qhtr_pass, qhtr_question_fi
377  ";
378 
379  $res = $db->queryF(
380  $query,
381  array('integer'),
383  );
384 
386 
387  while ($row = $db->fetchAssoc($res)) {
388  if ($row['requests_points'] === null) {
389  $row['requests_points'] = 0;
390  }
391 
392  $requestsStatisticData = new ilAssQuestionHintRequestStatisticData();
393  $requestsStatisticData->setRequestsCount($row['requests_count']);
394  $requestsStatisticData->setRequestsPoints($row['requests_points']);
395 
396  $register->addRequestByTestPassIndexAndQuestionId($row['requests_pass'], $row['requests_question'], $requestsStatisticData);
397  }
398 
399  return $register;
400  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getRequestStatisticDataByQuestionAndTestpass()

ilAssQuestionHintTracking::getRequestStatisticDataByQuestionAndTestpass ( )

Returns a question hint request statistic data container containing the statistics for all requests relating to given ...

  • question
  • testactive
  • testpass

public ilDBInterface $ilDB

Returns
ilAssQuestionHintRequestStatisticData $requestsStatisticData

Definition at line 312 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, array, getActiveId(), getPass(), and getQuestionId().

313  {
314  global $ilDB;
315 
316  $query = "
317  SELECT COUNT(qhtr_track_id) requests_count,
318  SUM(qht_hint_points) requests_points
319 
320  FROM qpl_hint_tracking
321 
322  INNER JOIN qpl_hints
323  ON qht_hint_id = qhtr_hint_fi
324 
325  WHERE qhtr_question_fi = %s
326  AND qhtr_active_fi = %s
327  AND qhtr_pass = %s
328  ";
329 
330  $res = $ilDB->queryF(
331  $query,
332  array('integer', 'integer', 'integer'),
333  array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
334  );
335 
336  $row = $ilDB->fetchAssoc($res);
337 
338  if ($row['requests_points'] === null) {
339  $row['requests_points'] = 0;
340  }
341 
342  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
343 
344  $requestsStatisticData = new ilAssQuestionHintRequestStatisticData();
345  $requestsStatisticData->setRequestsCount($row['requests_count']);
346  $requestsStatisticData->setRequestsPoints($row['requests_points']);
347 
348  return $requestsStatisticData;
349  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ isRequested()

ilAssQuestionHintTracking::isRequested (   $hintId)

Returns the fact wether the hint for given id is requested for the given testactive and testpass.

public ilDBInterface $ilDB

Parameters
integer$hintId
Returns
boolean $isRequested

Definition at line 159 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, array, getActiveId(), and getPass().

160  {
161  global $ilDB;
162 
163  $query = "
164  SELECT COUNT(qhtr_track_id) cnt
165 
166  FROM qpl_hint_tracking
167 
168  WHERE qhtr_hint_fi = %s
169  AND qhtr_active_fi = %s
170  AND qhtr_pass = %s
171  ";
172 
173  $res = $ilDB->queryF(
174  $query,
175  array('integer', 'integer', 'integer'),
176  array($hintId, $this->getActiveId(), $this->getPass())
177  );
178 
179  $row = $ilDB->fetchAssoc($res);
180 
181  if ($row['cnt'] > 0) {
182  return true;
183  }
184 
185  return false;
186  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ requestsExist()

ilAssQuestionHintTracking::requestsExist ( )

Returns the fact wether there exists hint requests for the given question relating to the given testactive and testpass or not.

public ilDBInterface $ilDB

Returns
boolean $requestsExist

Definition at line 67 of file class.ilAssQuestionHintTracking.php.

References getActiveId(), getPass(), and getQuestionId().

68  {
69  if (self::getNumExistingRequests($this->getQuestionId(), $this->getActiveId(), $this->getPass()) > 0) {
70  return true;
71  }
72 
73  return false;
74  }
+ Here is the call graph for this function:

◆ requestsPossible()

ilAssQuestionHintTracking::requestsPossible ( )

Returns the fact wether (further) hint requests are possible for the given question relating to the given testactive and testpass or not.

public ilDBInterface $ilDB

Returns
boolean $requestsPossible

Definition at line 117 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, array, getActiveId(), getPass(), and getQuestionId().

118  {
119  global $ilDB;
120 
121  $query = "
122  SELECT COUNT(qht_hint_id) cnt_available,
123  COUNT(qhtr_track_id) cnt_requested
124 
125  FROM qpl_hints
126 
127  LEFT JOIN qpl_hint_tracking
128  ON qhtr_hint_fi = qht_hint_id
129  AND qhtr_active_fi = %s
130  AND qhtr_pass = %s
131 
132  WHERE qht_question_fi = %s
133  ";
134 
135  $res = $ilDB->queryF(
136  $query,
137  array('integer', 'integer', 'integer'),
138  array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
139  );
140 
141  $row = $ilDB->fetchAssoc($res);
142 
143  if ($row['cnt_available'] > $row['cnt_requested']) {
144  return true;
145  }
146 
147  return false;
148  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ setActiveId()

ilAssQuestionHintTracking::setActiveId (   $activeId)

Definition at line 29 of file class.ilAssQuestionHintTracking.php.

References $activeId.

30  {
31  $this->activeId = $activeId;
32  }

◆ setPass()

ilAssQuestionHintTracking::setPass (   $pass)

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

References $pass.

40  {
41  $this->pass = $pass;
42  }

◆ setQuestionId()

ilAssQuestionHintTracking::setQuestionId (   $questionId)

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

References $questionId.

50  {
51  $this->questionId = $questionId;
52  }

◆ storeRequest()

ilAssQuestionHintTracking::storeRequest ( ilAssQuestionHint  $questionHint)

Tracks the given hint as requested for the given question, testactive and testpass.

public ilDBInterface $ilDB

Parameters
ilAssQuestionHint$questionHint

Definition at line 286 of file class.ilAssQuestionHintTracking.php.

References $ilDB, array, getActiveId(), ilAssQuestionHint\getId(), getPass(), and getQuestionId().

287  {
288  global $ilDB;
289 
290  $trackId = $ilDB->nextId('qpl_hint_tracking');
291 
292  $ilDB->insert('qpl_hint_tracking', array(
293  'qhtr_track_id' => array('integer', $trackId),
294  'qhtr_active_fi' => array('integer', $this->getActiveId()),
295  'qhtr_pass' => array('integer', $this->getPass()),
296  'qhtr_question_fi' => array('integer', $this->getQuestionId()),
297  'qhtr_hint_fi' => array('integer', $questionHint->getId()),
298  ));
299  }
getId()
returns the hint id
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $activeId

ilAssQuestionHintTracking::$activeId
private

◆ $pass

ilAssQuestionHintTracking::$pass
private

Definition at line 20 of file class.ilAssQuestionHintTracking.php.

Referenced by __construct(), getPass(), and setPass().

◆ $questionId

ilAssQuestionHintTracking::$questionId
private

Definition at line 16 of file class.ilAssQuestionHintTracking.php.

Referenced by __construct(), getQuestionId(), and setQuestionId().


The documentation for this class was generated from the following file: