ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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.

@access public @global ilDBInterface $ilDB

Parameters
array[integer]$activeIds

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

439 {
440 global $DIC;
441 $ilDB = $DIC['ilDB'];
442
443 $__active_fi__IN__activeIds = $ilDB->in('qhtr_active_fi', $activeIds, false, 'integer');
444
445 $query = "
446 DELETE FROM qpl_hint_tracking
447 WHERE $__active_fi__IN__activeIds
448 ";
449
450 $ilDB->manipulate($query);
451 }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $ilDB, and $query.

Referenced by ilObjTest\removeTestResultsByActiveIds().

+ 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.

@access public @global ilDBInterface $ilDB

Returns
ilAssQuestionHint $nextRequestableHint
Exceptions
ilTestException

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

201 {
202 global $DIC;
203 $ilDB = $DIC['ilDB'];
204
205 $query = "
206 SELECT qht_hint_id
207
208 FROM qpl_hints
209
210 LEFT JOIN qpl_hint_tracking
211 ON qhtr_hint_fi = qht_hint_id
212 AND qhtr_active_fi = %s
213 AND qhtr_pass = %s
214
215 WHERE qht_question_fi = %s
216 AND qhtr_track_id IS NULL
217
218 ORDER BY qht_hint_index ASC
219 ";
220
221 $ilDB->setLimit(1);
222
223 $res = $ilDB->queryF(
224 $query,
225 array('integer', 'integer', 'integer'),
226 array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
227 );
228
229 while ($row = $ilDB->fetchAssoc($res)) {
230 $nextHint = ilAssQuestionHint::getInstanceById($row['qht_hint_id']);
231
232 return $nextHint;
233 }
234
235 require_once 'Modules/Test/exceptions/class.ilTestNoNextRequestableHintExistsException.php';
236
238 "no next hint found for questionId={$this->getQuestionId()}, activeId={$this->getActiveId()}, pass={$this->getPass()}"
239 );
240 }
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

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

+ 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.

@access public @global ilDBInterface $ilDB

Returns
integer $numExisingRequests

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

85 {
86 global $DIC;
87 $ilDB = $DIC['ilDB'];
88
89 $query = "
90 SELECT COUNT(qhtr_track_id) cnt
91
92 FROM qpl_hint_tracking
93
94 WHERE qhtr_question_fi = %s
95 AND qhtr_active_fi = %s
96 AND qhtr_pass = %s
97 ";
98
99 $res = $ilDB->queryF(
100 $query,
101 array('integer', 'integer', 'integer'),
102 array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
103 );
104
105 $row = $ilDB->fetchAssoc($res);
106
107 return $row['cnt'];
108 }

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

+ 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.

@access public @global ilDBInterface $ilDB

Returns
ilAssQuestionHintList $requestedHintsList

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

252 {
253 global $DIC;
254 $ilDB = $DIC['ilDB'];
255
256 $query = "
257 SELECT qhtr_hint_fi
258
259 FROM qpl_hint_tracking
260
261 WHERE qhtr_question_fi = %s
262 AND qhtr_active_fi = %s
263 AND qhtr_pass = %s
264 ";
265
266 $res = $ilDB->queryF(
267 $query,
268 array('integer', 'integer', 'integer'),
269 array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
270 );
271
272 $hintIds = array();
273
274 while ($row = $ilDB->fetchAssoc($res)) {
275 $hintIds[] = $row['qhtr_hint_fi'];
276 }
277
278 $requestedHintsList = ilAssQuestionHintList::getListByHintIds($hintIds);
279
280 return $requestedHintsList;
281 }
static getListByHintIds($hintIds)
instantiates a question hint list for the passed hint ids

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

+ Here is the call graph for this function:

◆ getRequestRequestStatisticDataRegisterByActiveId()

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

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

363 {
364 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticRegister.php';
365 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
366
367 /* @var ILIAS\DI\Container $DIC */ global $DIC;
368 $db = $DIC->database();
369
370 $query = "
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
375
376 FROM qpl_hint_tracking
377
378 INNER JOIN qpl_hints
379 ON qht_hint_id = qhtr_hint_fi
380
381 WHERE qhtr_active_fi = %s
382
383 GROUP BY qhtr_pass, qhtr_question_fi
384 ";
385
386 $res = $db->queryF(
387 $query,
388 array('integer'),
389 array($activeId)
390 );
391
393
394 while ($row = $db->fetchAssoc($res)) {
395 if ($row['requests_points'] === null) {
396 $row['requests_points'] = 0;
397 }
398
399 $requestsStatisticData = new ilAssQuestionHintRequestStatisticData();
400 $requestsStatisticData->setRequestsCount($row['requests_count']);
401 $requestsStatisticData->setRequestsPoints($row['requests_points']);
402
403 $register->addRequestByTestPassIndexAndQuestionId($row['requests_pass'], $row['requests_question'], $requestsStatisticData);
404 }
405
406 return $register;
407 }

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

Referenced by ilTestServiceGUI\getPassOverviewTableData().

+ 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

@access public @global ilDBInterface $ilDB

Returns
ilAssQuestionHintRequestStatisticData $requestsStatisticData

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

319 {
320 global $DIC;
321 $ilDB = $DIC['ilDB'];
322
323 $query = "
324 SELECT COUNT(qhtr_track_id) requests_count,
325 SUM(qht_hint_points) requests_points
326
327 FROM qpl_hint_tracking
328
329 INNER JOIN qpl_hints
330 ON qht_hint_id = qhtr_hint_fi
331
332 WHERE qhtr_question_fi = %s
333 AND qhtr_active_fi = %s
334 AND qhtr_pass = %s
335 ";
336
337 $res = $ilDB->queryF(
338 $query,
339 array('integer', 'integer', 'integer'),
340 array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
341 );
342
343 $row = $ilDB->fetchAssoc($res);
344
345 if ($row['requests_points'] === null) {
346 $row['requests_points'] = 0;
347 }
348
349 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
350
351 $requestsStatisticData = new ilAssQuestionHintRequestStatisticData();
352 $requestsStatisticData->setRequestsCount($row['requests_count']);
353 $requestsStatisticData->setRequestsPoints($row['requests_points']);
354
355 return $requestsStatisticData;
356 }

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

+ 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.

@access public @global ilDBInterface $ilDB

Parameters
integer$hintId
Returns
boolean $isRequested

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

162 {
163 global $DIC;
164 $ilDB = $DIC['ilDB'];
165
166 $query = "
167 SELECT COUNT(qhtr_track_id) cnt
168
169 FROM qpl_hint_tracking
170
171 WHERE qhtr_hint_fi = %s
172 AND qhtr_active_fi = %s
173 AND qhtr_pass = %s
174 ";
175
176 $res = $ilDB->queryF(
177 $query,
178 array('integer', 'integer', 'integer'),
179 array($hintId, $this->getActiveId(), $this->getPass())
180 );
181
182 $row = $ilDB->fetchAssoc($res);
183
184 if ($row['cnt'] > 0) {
185 return true;
186 }
187
188 return false;
189 }

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

+ 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.

@access public @global ilDBInterface $ilDB

Returns
boolean $requestsExist

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

68 {
69 if (self::getNumExistingRequests($this->getQuestionId(), $this->getActiveId(), $this->getPass()) > 0) {
70 return true;
71 }
72
73 return false;
74 }

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

+ 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.

@access public @global ilDBInterface $ilDB

Returns
boolean $requestsPossible

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

119 {
120 global $DIC;
121 $ilDB = $DIC['ilDB'];
122
123 $query = "
124 SELECT COUNT(qht_hint_id) cnt_available,
125 COUNT(qhtr_track_id) cnt_requested
126
127 FROM qpl_hints
128
129 LEFT JOIN qpl_hint_tracking
130 ON qhtr_hint_fi = qht_hint_id
131 AND qhtr_active_fi = %s
132 AND qhtr_pass = %s
133
134 WHERE qht_question_fi = %s
135 ";
136
137 $res = $ilDB->queryF(
138 $query,
139 array('integer', 'integer', 'integer'),
140 array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
141 );
142
143 $row = $ilDB->fetchAssoc($res);
144
145 if ($row['cnt_available'] > $row['cnt_requested']) {
146 return true;
147 }
148
149 return false;
150 }

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

+ Here is the call graph for this function:

◆ setActiveId()

ilAssQuestionHintTracking::setActiveId (   $activeId)

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

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

References $activeId.

◆ setPass()

ilAssQuestionHintTracking::setPass (   $pass)

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

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

References $pass.

◆ setQuestionId()

ilAssQuestionHintTracking::setQuestionId (   $questionId)

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

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

References $questionId.

◆ storeRequest()

ilAssQuestionHintTracking::storeRequest ( ilAssQuestionHint  $questionHint)

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

@access public @global ilDBInterface $ilDB

Parameters
ilAssQuestionHint$questionHint

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

292 {
293 global $DIC;
294 $ilDB = $DIC['ilDB'];
295
296 $trackId = $ilDB->nextId('qpl_hint_tracking');
297
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()),
304 ));
305 }
getId()
returns the hint id

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

+ 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: