ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

public ilDBInterface $ilDB

Parameters
array[integer]$activeIds

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

References $ilDB, and $query.

Referenced by ilObjTest\removeTestResultsByActiveIds().

429  {
430  global $ilDB;
431 
432  $__active_fi__IN__activeIds = $ilDB->in('qhtr_active_fi', $activeIds, false, 'integer');
433 
434  $query = "
435  DELETE FROM qpl_hint_tracking
436  WHERE $__active_fi__IN__activeIds
437  ";
438 
439  $ilDB->manipulate($query);
440  }
global $ilDB
+ 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 196 of file class.ilAssQuestionHintTracking.php.

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

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...
Create styles array
The data for the language used.
global $ilDB
+ 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 85 of file class.ilAssQuestionHintTracking.php.

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

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  }
Create styles array
The data for the language used.
global $ilDB
+ 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 246 of file class.ilAssQuestionHintTracking.php.

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

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
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getRequestRequestStatisticDataRegisterByActiveId()

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

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

References $activeId, $DIC, $ilDB, $query, $res, $row, and array.

Referenced by ilTestServiceGUI\getPassOverviewTableData().

355  {
356  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticRegister.php';
357  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
358 
359  /* @var ILIAS\DI\Container $DIC */ global $DIC; $db = $DIC->database();
360 
361  $query = "
362  SELECT qhtr_pass requests_pass,
363  qhtr_question_fi requests_question,
364  COUNT(qhtr_track_id) requests_count,
365  SUM(qht_hint_points) requests_points
366 
367  FROM qpl_hint_tracking
368 
369  INNER JOIN qpl_hints
370  ON qht_hint_id = qhtr_hint_fi
371 
372  WHERE qhtr_active_fi = %s
373 
374  GROUP BY qhtr_pass, qhtr_question_fi
375  ";
376 
377  $res = $db->queryF(
378  $query, array('integer'), array($activeId)
379  );
380 
382 
383  while( $row = $db->fetchAssoc($res) )
384  {
385  if( $row['requests_points'] === null )
386  {
387  $row['requests_points'] = 0;
388  }
389 
390  $requestsStatisticData = new ilAssQuestionHintRequestStatisticData();
391  $requestsStatisticData->setRequestsCount($row['requests_count']);
392  $requestsStatisticData->setRequestsPoints($row['requests_points']);
393 
394  $register->addRequestByTestPassIndexAndQuestionId($row['requests_pass'], $row['requests_question'], $requestsStatisticData);
395  }
396 
397  return $register;
398  }
Create styles array
The data for the language used.
global $DIC
+ 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 311 of file class.ilAssQuestionHintTracking.php.

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

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  }
Create styles array
The data for the language used.
global $ilDB
+ 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 159 of file class.ilAssQuestionHintTracking.php.

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

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  }
Create styles array
The data for the language used.
global $ilDB
+ 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 67 of file class.ilAssQuestionHintTracking.php.

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

68  {
69  if( self::getNumExistingRequests($this->getQuestionId(), $this->getActiveId(), $this->getPass()) > 0 )
70  {
71  return true;
72  }
73 
74  return false;
75  }
+ 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 117 of file class.ilAssQuestionHintTracking.php.

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

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  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ setActiveId()

ilAssQuestionHintTracking::setActiveId (   $activeId)

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

References $activeId.

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

◆ setPass()

ilAssQuestionHintTracking::setPass (   $pass)

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

References $pass.

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

◆ setQuestionId()

ilAssQuestionHintTracking::setQuestionId (   $questionId)

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

References $questionId.

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

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

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

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
Create styles array
The data for the language used.
global $ilDB
+ 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: