4require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
90 SELECT COUNT(qhtr_track_id) cnt
92 FROM qpl_hint_tracking
94 WHERE qhtr_question_fi = %s
95 AND qhtr_active_fi = %s
101 array(
'integer',
'integer',
'integer'),
124 SELECT COUNT(qht_hint_id) cnt_available,
125 COUNT(qhtr_track_id) cnt_requested
129 LEFT JOIN qpl_hint_tracking
130 ON qhtr_hint_fi = qht_hint_id
131 AND qhtr_active_fi = %s
134 WHERE qht_question_fi = %s
139 array(
'integer',
'integer',
'integer'),
145 if ($row[
'cnt_available'] > $row[
'cnt_requested']) {
167 SELECT COUNT(qhtr_track_id) cnt
169 FROM qpl_hint_tracking
171 WHERE qhtr_hint_fi = %s
172 AND qhtr_active_fi = %s
178 array(
'integer',
'integer',
'integer'),
184 if ($row[
'cnt'] > 0) {
210 LEFT JOIN qpl_hint_tracking
211 ON qhtr_hint_fi = qht_hint_id
212 AND qhtr_active_fi = %s
215 WHERE qht_question_fi = %s
216 AND qhtr_track_id IS NULL
218 ORDER BY qht_hint_index ASC
225 array(
'integer',
'integer',
'integer'),
235 require_once
'Modules/Test/exceptions/class.ilTestNoNextRequestableHintExistsException.php';
238 "no next hint found for questionId={$this->getQuestionId()}, activeId={$this->getActiveId()}, pass={$this->getPass()}"
259 FROM qpl_hint_tracking
261 WHERE qhtr_question_fi = %s
262 AND qhtr_active_fi = %s
268 array(
'integer',
'integer',
'integer'),
275 $hintIds[] = $row[
'qhtr_hint_fi'];
280 return $requestedHintsList;
296 $trackId =
$ilDB->nextId(
'qpl_hint_tracking');
298 $ilDB->insert(
'qpl_hint_tracking', array(
299 'qhtr_track_id' => array(
'integer', $trackId),
300 'qhtr_active_fi' => array(
'integer', $this->
getActiveId()),
301 'qhtr_pass' => array(
'integer', $this->
getPass()),
302 'qhtr_question_fi' => array(
'integer', $this->
getQuestionId()),
303 'qhtr_hint_fi' => array(
'integer', $questionHint->
getId()),
324 SELECT COUNT(qhtr_track_id) requests_count,
325 SUM(qht_hint_points) requests_points
327 FROM qpl_hint_tracking
330 ON qht_hint_id = qhtr_hint_fi
332 WHERE qhtr_question_fi = %s
333 AND qhtr_active_fi = %s
339 array(
'integer',
'integer',
'integer'),
345 if ($row[
'requests_points'] ===
null) {
346 $row[
'requests_points'] = 0;
349 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
352 $requestsStatisticData->setRequestsCount($row[
'requests_count']);
353 $requestsStatisticData->setRequestsPoints($row[
'requests_points']);
355 return $requestsStatisticData;
364 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticRegister.php';
365 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
368 $db =
$DIC->database();
371 SELECT qhtr_pass requests_pass,
372 qhtr_question_fi requests_question,
373 COUNT(qhtr_track_id) requests_count,
374 SUM(qht_hint_points) requests_points
376 FROM qpl_hint_tracking
379 ON qht_hint_id = qhtr_hint_fi
381 WHERE qhtr_active_fi = %s
383 GROUP BY qhtr_pass, qhtr_question_fi
394 while ($row = $db->fetchAssoc(
$res)) {
395 if ($row[
'requests_points'] ===
null) {
396 $row[
'requests_points'] = 0;
400 $requestsStatisticData->setRequestsCount($row[
'requests_count']);
401 $requestsStatisticData->setRequestsPoints($row[
'requests_points']);
403 $register->addRequestByTestPassIndexAndQuestionId($row[
'requests_pass'], $row[
'requests_question'], $requestsStatisticData);
413 public static function deleteRequestsByQuestionIds($questionIds)
421 $__question_fi__IN__questionIds =
$ilDB->in(
'qhtr_question_fi', $questionIds,
false,
'integer');
424 DELETE FROM qpl_hint_tracking
425 WHERE $__question_fi__IN__questionIds
443 $__active_fi__IN__activeIds =
$ilDB->in(
'qhtr_active_fi', $activeIds,
false,
'integer');
446 DELETE FROM qpl_hint_tracking
447 WHERE $__active_fi__IN__activeIds
An exception for terminatinating execution or to throw for unit testing.
static getListByHintIds($hintIds)
instantiates a question hint list for the passed hint ids
static deleteRequestsByActiveIds($activeIds)
Deletes all hint requests relating to a testactive included in given active ids.
__construct($questionId, $activeId, $pass)
isRequested($hintId)
Returns the fact wether the hint for given id is requested for the given testactive and testpass.
getRequestStatisticDataByQuestionAndTestpass()
Returns a question hint request statistic data container containing the statistics for all requests r...
getNextRequestableHint()
Returns the next requestable hint for given question relating to given testactive and testpass.
requestsPossible()
Returns the fact wether (further) hint requests are possible for the given question relating to the g...
storeRequest(ilAssQuestionHint $questionHint)
Tracks the given hint as requested for the given question, testactive and testpass.
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
getRequestedHintsList()
Returns an object of class ilAssQuestionHintList containing objects of class ilAssQuestionHint for al...
getNumExistingRequests()
Returns the number existing hint requests for the given question relating to the given testactive and...
setQuestionId($questionId)
requestsExist()
Returns the fact wether there exists hint requests for the given question relating to the given testa...
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
getId()
returns the hint id
foreach($_POST as $key=> $value) $res