ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
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 444 of file class.ilAssQuestionHintTracking.php.

References $DIC, and $ilDB.

Referenced by ilObjTest\removeTestResultsByActiveIds().

444  : void
445  {
446  global $DIC;
447  $ilDB = $DIC['ilDB'];
448 
449  $__active_fi__IN__activeIds = $ilDB->in('qhtr_active_fi', $activeIds, false, 'integer');
450 
451  $query = "
452  DELETE FROM qpl_hint_tracking
453  WHERE $__active_fi__IN__activeIds
454  ";
455 
456  $ilDB->manipulate($query);
457  }
$DIC
Definition: xapitoken.php:62
+ 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, $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 
249  "no next hint found for questionId={$this->getQuestionId()}, activeId={$this->getActiveId()}, pass={$this->getPass()}"
250  );
251  }
$res
Definition: ltiservices.php:67
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
$DIC
Definition: xapitoken.php:62
+ 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, $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:67
$DIC
Definition: xapitoken.php:62
+ 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 262 of file class.ilAssQuestionHintTracking.php.

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

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

◆ getRequestRequestStatisticDataRegisterByActiveId()

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

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

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

Referenced by ilTestServiceGUI\getPassOverviewTableData().

372  {
373  global $DIC;
374  $db = $DIC->database();
375 
376  $query = "
377  SELECT qhtr_pass requests_pass,
378  qhtr_question_fi requests_question,
379  COUNT(qhtr_track_id) requests_count,
380  SUM(qht_hint_points) requests_points
381 
382  FROM qpl_hint_tracking
383 
384  INNER JOIN qpl_hints
385  ON qht_hint_id = qhtr_hint_fi
386 
387  WHERE qhtr_active_fi = %s
388 
389  GROUP BY qhtr_pass, qhtr_question_fi
390  ";
391 
392  $res = $db->queryF(
393  $query,
394  array('integer'),
395  array($activeId)
396  );
397 
399 
400  while ($row = $db->fetchAssoc($res)) {
401  if ($row['requests_points'] === null) {
402  $row['requests_points'] = 0;
403  }
404 
405  $requestsStatisticData = new ilAssQuestionHintRequestStatisticData();
406  $requestsStatisticData->setRequestsCount($row['requests_count']);
407  $requestsStatisticData->setRequestsPoints($row['requests_points']);
408 
409  $register->addRequestByTestPassIndexAndQuestionId($row['requests_pass'], $row['requests_question'], $requestsStatisticData);
410  }
411 
412  return $register;
413  }
$res
Definition: ltiservices.php:67
$DIC
Definition: xapitoken.php:62
+ 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 329 of file class.ilAssQuestionHintTracking.php.

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

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

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

302  : void
303  {
304  global $DIC;
305  $ilDB = $DIC['ilDB'];
306 
307  $trackId = $ilDB->nextId('qpl_hint_tracking');
308 
309  $ilDB->insert('qpl_hint_tracking', array(
310  'qhtr_track_id' => array('integer', $trackId),
311  'qhtr_active_fi' => array('integer', $this->getActiveId()),
312  'qhtr_pass' => array('integer', $this->getPass()),
313  'qhtr_question_fi' => array('integer', $this->getQuestionId()),
314  'qhtr_hint_fi' => array('integer', $questionHint->getId()),
315  ));
316  }
getId()
returns the hint id
$DIC
Definition: xapitoken.php:62
+ 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: