ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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...
 
 deleteRequestsByQuestionIds ($questionIds)
 Deletes all hint requests relating to a question included in given question ids. More...
 
 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()

ilAssQuestionHintTracking::deleteRequestsByActiveIds (   $activeIds)

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

@access public @global ilDB $ilDB

Parameters
array[integer]$activeIds

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

377 {
378 global $ilDB;
379
380 $__active_fi__IN__activeIds = $ilDB->in('qhtr_active_fi', $activeIds, false, 'integer');
381
382 $query = "
383 DELETE FROM qpl_hint_tracking
384 WHERE $__active_fi__IN__activeIds
385 ";
386
387 $ilDB->manipulate($query);
388 }
global $ilDB

References $ilDB, and $query.

Referenced by ilObjTest\removeAllTestEditings(), ilObjTest\removeTestResultsByActiveIds(), and ilObjTest\removeTestResultsForUser().

+ Here is the caller graph for this function:

◆ deleteRequestsByQuestionIds()

ilAssQuestionHintTracking::deleteRequestsByQuestionIds (   $questionIds)

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

@access public @global ilDB $ilDB

Parameters
array[integer]$questionIds

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

356 {
357 global $ilDB;
358
359 $__question_fi__IN__questionIds = $ilDB->in('qhtr_question_fi', $questionIds, false, 'integer');
360
361 $query = "
362 DELETE FROM qpl_hint_tracking
363 WHERE $__question_fi__IN__questionIds
364 ";
365
366 $ilDB->manipulate($query);
367 }

References $ilDB, and $query.

Referenced by assQuestion\delete(), and ilObjTest\removeAllTestEditings().

+ 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 ilDB $ilDB

Returns
ilAssQuestionHint $nextRequestableHint
Exceptions
ilTestException

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

197 {
198 global $ilDB;
199
200 $query = "
201 SELECT qht_hint_id
202
203 FROM qpl_hints
204
205 LEFT JOIN qpl_hint_tracking
206 ON qhtr_hint_fi = qht_hint_id
207 AND qhtr_active_fi = %s
208 AND qhtr_pass = %s
209
210 WHERE qht_question_fi = %s
211 AND qhtr_track_id IS NULL
212
213 ORDER BY qht_hint_index ASC
214 ";
215
216 $ilDB->setLimit(1);
217
218 $res = $ilDB->queryF(
219 $query, array('integer', 'integer', 'integer'),
220 array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
221 );
222
223 while( $row = $ilDB->fetchAssoc($res) )
224 {
225 $nextHint = ilAssQuestionHint::getInstanceById($row['qht_hint_id']);
226
227 return $nextHint;
228 }
229
230 throw new ilTestException(
231 "no next hint found for questionId={$this->getQuestionId()}, activeId={$this->getActiveId()}, pass={$this->getPass()}"
232 );
233 }
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
Base Exception for all Exceptions relating to Modules/Test.

References $ilDB, $query, $res, $row, 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 ilDB $ilDB

Returns
integer $numExisingRequests

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

86 {
87 global $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, 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 }

References $ilDB, $query, $res, $row, 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 ilDB $ilDB

Returns
ilAssQuestionHintList $requestedHintsList

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

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

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

+ Here is the call 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 ilDB $ilDB

Returns
ilAssQuestionHintRequestStatisticData $requestsStatisticData

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

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

References $ilDB, $query, $res, $row, 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 ilDB $ilDB

Parameters
integer$hintId
Returns
boolean $isRequested

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

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, array('integer', 'integer', 'integer'), array($hintId, $this->getActiveId(), $this->getPass())
175 );
176
177 $row = $ilDB->fetchAssoc($res);
178
179 if( $row['cnt'] > 0 )
180 {
181 return true;
182 }
183
184 return false;
185 }

References $ilDB, $query, $res, $row, 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 ilDB $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 {
71 return true;
72 }
73
74 return false;
75 }

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 ilDB $ilDB

Returns
boolean $requestsPossible

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

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, array('integer', 'integer', 'integer'),
137 array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
138 );
139
140 $row = $ilDB->fetchAssoc($res);
141
142 if( $row['cnt_available'] > $row['cnt_requested'] )
143 {
144 return true;
145 }
146
147 return false;
148 }

References $ilDB, $query, $res, $row, 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 ilDB $ilDB

Parameters
ilAssQuestionHint$questionHint

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

284 {
285 global $ilDB;
286
287 $trackId = $ilDB->nextId('qpl_hint_tracking');
288
289 $ilDB->insert('qpl_hint_tracking', array(
290 'qhtr_track_id' => array('integer', $trackId),
291 'qhtr_active_fi' => array('integer', $this->getActiveId()),
292 'qhtr_pass' => array('integer', $this->getPass()),
293 'qhtr_question_fi' => array('integer', $this->getQuestionId()),
294 'qhtr_hint_fi' => array('integer', $questionHint->getId()),
295 ));
296 }
getId()
returns the hint id

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

+ Here is the call graph for this function:

Field Documentation

◆ $activeId

ilAssQuestionHintTracking::$activeId
private

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

Referenced by __construct(), getActiveId(), and setActiveId().

◆ $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: