ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 27 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 451 of file class.ilAssQuestionHintTracking.php.

References $DIC, $ilDB, and $query.

Referenced by ilObjTest\removeTestResultsByActiveIds().

451  : void
452  {
453  global $DIC;
454  $ilDB = $DIC['ilDB'];
455 
456  $__active_fi__IN__activeIds = $ilDB->in('qhtr_active_fi', $activeIds, false, 'integer');
457 
458  $query = "
459  DELETE FROM qpl_hint_tracking
460  WHERE $__active_fi__IN__activeIds
461  ";
462 
463  $ilDB->manipulate($query);
464  }
global $DIC
Definition: feed.php:28
$query
+ 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 213 of file class.ilAssQuestionHintTracking.php.

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

214  {
215  global $DIC;
216  $ilDB = $DIC['ilDB'];
217 
218  $query = "
219  SELECT qht_hint_id
220 
221  FROM qpl_hints
222 
223  LEFT JOIN qpl_hint_tracking
224  ON qhtr_hint_fi = qht_hint_id
225  AND qhtr_active_fi = %s
226  AND qhtr_pass = %s
227 
228  WHERE qht_question_fi = %s
229  AND qhtr_track_id IS NULL
230 
231  ORDER BY qht_hint_index ASC
232  ";
233 
234  $ilDB->setLimit(1);
235 
236  $res = $ilDB->queryF(
237  $query,
238  array('integer', 'integer', 'integer'),
239  array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
240  );
241 
242  while ($row = $ilDB->fetchAssoc($res)) {
243  $nextHint = ilAssQuestionHint::getInstanceById($row['qht_hint_id']);
244 
245  return $nextHint;
246  }
247 
248  require_once 'Modules/Test/exceptions/class.ilTestNoNextRequestableHintExistsException.php';
249 
251  "no next hint found for questionId={$this->getQuestionId()}, activeId={$this->getActiveId()}, pass={$this->getPass()}"
252  );
253  }
$res
Definition: ltiservices.php:69
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
global $DIC
Definition: feed.php:28
$query
+ 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 97 of file class.ilAssQuestionHintTracking.php.

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

97  : int
98  {
99  global $DIC;
100  $ilDB = $DIC['ilDB'];
101 
102  $query = "
103  SELECT COUNT(qhtr_track_id) cnt
104 
105  FROM qpl_hint_tracking
106 
107  WHERE qhtr_question_fi = %s
108  AND qhtr_active_fi = %s
109  AND qhtr_pass = %s
110  ";
111 
112  $res = $ilDB->queryF(
113  $query,
114  array('integer', 'integer', 'integer'),
115  array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
116  );
117 
118  $row = $ilDB->fetchAssoc($res);
119 
120  return $row['cnt'];
121  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ 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 264 of file class.ilAssQuestionHintTracking.php.

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

265  {
266  global $DIC;
267  $ilDB = $DIC['ilDB'];
268 
269  $query = "
270  SELECT qhtr_hint_fi
271 
272  FROM qpl_hint_tracking
273 
274  WHERE qhtr_question_fi = %s
275  AND qhtr_active_fi = %s
276  AND qhtr_pass = %s
277  ";
278 
279  $res = $ilDB->queryF(
280  $query,
281  array('integer', 'integer', 'integer'),
282  array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
283  );
284 
285  $hintIds = array();
286 
287  while ($row = $ilDB->fetchAssoc($res)) {
288  $hintIds[] = $row['qhtr_hint_fi'];
289  }
290 
291  $requestedHintsList = ilAssQuestionHintList::getListByHintIds($hintIds);
292 
293  return $requestedHintsList;
294  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
static getListByHintIds($hintIds)
instantiates a question hint list for the passed hint ids
$query
+ Here is the call graph for this function:

◆ getRequestRequestStatisticDataRegisterByActiveId()

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

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

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

Referenced by ilTestServiceGUI\getPassOverviewTableData().

376  {
377  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticRegister.php';
378  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
379 
380  /* @var ILIAS\DI\Container $DIC */ global $DIC;
381  $db = $DIC->database();
382 
383  $query = "
384  SELECT qhtr_pass requests_pass,
385  qhtr_question_fi requests_question,
386  COUNT(qhtr_track_id) requests_count,
387  SUM(qht_hint_points) requests_points
388 
389  FROM qpl_hint_tracking
390 
391  INNER JOIN qpl_hints
392  ON qht_hint_id = qhtr_hint_fi
393 
394  WHERE qhtr_active_fi = %s
395 
396  GROUP BY qhtr_pass, qhtr_question_fi
397  ";
398 
399  $res = $db->queryF(
400  $query,
401  array('integer'),
402  array($activeId)
403  );
404 
406 
407  while ($row = $db->fetchAssoc($res)) {
408  if ($row['requests_points'] === null) {
409  $row['requests_points'] = 0;
410  }
411 
412  $requestsStatisticData = new ilAssQuestionHintRequestStatisticData();
413  $requestsStatisticData->setRequestsCount($row['requests_count']);
414  $requestsStatisticData->setRequestsPoints($row['requests_points']);
415 
416  $register->addRequestByTestPassIndexAndQuestionId($row['requests_pass'], $row['requests_question'], $requestsStatisticData);
417  }
418 
419  return $register;
420  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ 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 331 of file class.ilAssQuestionHintTracking.php.

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

332  {
333  global $DIC;
334  $ilDB = $DIC['ilDB'];
335 
336  $query = "
337  SELECT COUNT(qhtr_track_id) requests_count,
338  SUM(qht_hint_points) requests_points
339 
340  FROM qpl_hint_tracking
341 
342  INNER JOIN qpl_hints
343  ON qht_hint_id = qhtr_hint_fi
344 
345  WHERE qhtr_question_fi = %s
346  AND qhtr_active_fi = %s
347  AND qhtr_pass = %s
348  ";
349 
350  $res = $ilDB->queryF(
351  $query,
352  array('integer', 'integer', 'integer'),
353  array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
354  );
355 
356  $row = $ilDB->fetchAssoc($res);
357 
358  if ($row['requests_points'] === null) {
359  $row['requests_points'] = 0;
360  }
361 
362  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
363 
364  $requestsStatisticData = new ilAssQuestionHintRequestStatisticData();
365  $requestsStatisticData->setRequestsCount($row['requests_count']);
366  $requestsStatisticData->setRequestsPoints($row['requests_points']);
367 
368  return $requestsStatisticData;
369  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ 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 174 of file class.ilAssQuestionHintTracking.php.

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

174  : bool
175  {
176  global $DIC;
177  $ilDB = $DIC['ilDB'];
178 
179  $query = "
180  SELECT COUNT(qhtr_track_id) cnt
181 
182  FROM qpl_hint_tracking
183 
184  WHERE qhtr_hint_fi = %s
185  AND qhtr_active_fi = %s
186  AND qhtr_pass = %s
187  ";
188 
189  $res = $ilDB->queryF(
190  $query,
191  array('integer', 'integer', 'integer'),
192  array($hintId, $this->getActiveId(), $this->getPass())
193  );
194 
195  $row = $ilDB->fetchAssoc($res);
196 
197  if ($row['cnt'] > 0) {
198  return true;
199  }
200 
201  return false;
202  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ 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 80 of file class.ilAssQuestionHintTracking.php.

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

80  : bool
81  {
82  if (self::getNumExistingRequests($this->getQuestionId(), $this->getActiveId(), $this->getPass()) > 0) {
83  return true;
84  }
85 
86  return false;
87  }
+ 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 131 of file class.ilAssQuestionHintTracking.php.

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

131  : bool
132  {
133  global $DIC;
134  $ilDB = $DIC['ilDB'];
135 
136  $query = "
137  SELECT COUNT(qht_hint_id) cnt_available,
138  COUNT(qhtr_track_id) cnt_requested
139 
140  FROM qpl_hints
141 
142  LEFT JOIN qpl_hint_tracking
143  ON qhtr_hint_fi = qht_hint_id
144  AND qhtr_active_fi = %s
145  AND qhtr_pass = %s
146 
147  WHERE qht_question_fi = %s
148  ";
149 
150  $res = $ilDB->queryF(
151  $query,
152  array('integer', 'integer', 'integer'),
153  array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
154  );
155 
156  $row = $ilDB->fetchAssoc($res);
157 
158  if ($row['cnt_available'] > $row['cnt_requested']) {
159  return true;
160  }
161 
162  return false;
163  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:

◆ setActiveId()

ilAssQuestionHintTracking::setActiveId (   $activeId)

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

References $activeId.

42  : void
43  {
44  $this->activeId = $activeId;
45  }

◆ setPass()

ilAssQuestionHintTracking::setPass (   $pass)

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

References $pass.

52  : void
53  {
54  $this->pass = $pass;
55  }

◆ setQuestionId()

ilAssQuestionHintTracking::setQuestionId (   $questionId)

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

References $questionId.

62  : void
63  {
64  $this->questionId = $questionId;
65  }

◆ 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 304 of file class.ilAssQuestionHintTracking.php.

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

304  : void
305  {
306  global $DIC;
307  $ilDB = $DIC['ilDB'];
308 
309  $trackId = $ilDB->nextId('qpl_hint_tracking');
310 
311  $ilDB->insert('qpl_hint_tracking', array(
312  'qhtr_track_id' => array('integer', $trackId),
313  'qhtr_active_fi' => array('integer', $this->getActiveId()),
314  'qhtr_pass' => array('integer', $this->getPass()),
315  'qhtr_question_fi' => array('integer', $this->getQuestionId()),
316  'qhtr_hint_fi' => array('integer', $questionHint->getId()),
317  ));
318  }
getId()
returns the hint id
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Field Documentation

◆ $activeId

ilAssQuestionHintTracking::$activeId
private

◆ $pass

ilAssQuestionHintTracking::$pass
private

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

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

◆ $questionId

ilAssQuestionHintTracking::$questionId
private

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

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


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