ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 378 of file class.ilAssQuestionHintTracking.php.

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

References $ilDB, and $query.

Referenced by ilObjTest\removeTestResultsByActiveIds().

+ 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 357 of file class.ilAssQuestionHintTracking.php.

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

References $ilDB, and $query.

Referenced by assQuestion\delete().

+ 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 require_once 'Modules/Test/exceptions/class.ilTestNoNextRequestableHintExistsException.php';
231
233 "no next hint found for questionId={$this->getQuestionId()}, activeId={$this->getActiveId()}, pass={$this->getPass()}"
234 );
235 }
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...

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

247 {
248 global $ilDB;
249
250 $query = "
251 SELECT qhtr_hint_fi
252
253 FROM qpl_hint_tracking
254
255 WHERE qhtr_question_fi = %s
256 AND qhtr_active_fi = %s
257 AND qhtr_pass = %s
258 ";
259
260 $res = $ilDB->queryF(
261 $query, array('integer', 'integer', 'integer'),
262 array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
263 );
264
265 $hintIds = array();
266
267 while( $row = $ilDB->fetchAssoc($res) )
268 {
269 $hintIds[] = $row['qhtr_hint_fi'];
270 }
271
272 $requestedHintsList = ilAssQuestionHintList::getListByHintIds($hintIds);
273
274 return $requestedHintsList;
275 }
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 311 of file class.ilAssQuestionHintTracking.php.

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

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

286 {
287 global $ilDB;
288
289 $trackId = $ilDB->nextId('qpl_hint_tracking');
290
291 $ilDB->insert('qpl_hint_tracking', array(
292 'qhtr_track_id' => array('integer', $trackId),
293 'qhtr_active_fi' => array('integer', $this->getActiveId()),
294 'qhtr_pass' => array('integer', $this->getPass()),
295 'qhtr_question_fi' => array('integer', $this->getQuestionId()),
296 'qhtr_hint_fi' => array('integer', $questionHint->getId()),
297 ));
298 }
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: