ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestSequenceDynamicQuestionSet Class Reference
+ Collaboration diagram for ilTestSequenceDynamicQuestionSet:

Public Member Functions

 __construct (ilDB $db, ilTestDynamicQuestionSet $questionSet, $activeId)
 Constructor. More...
 
 getActiveId ()
 
 setPreventCheckedQuestionsFromComingUpEnabled ($preventCheckedQuestionsFromComingUpEnabled)
 
 isPreventCheckedQuestionsFromComingUpEnabled ()
 
 loadFromDb ()
 
 saveToDb ()
 
 loadQuestions (ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilTestDynamicQuestionSetFilterSelection $filterSelection)
 
 cleanupQuestions (ilTestSessionDynamicQuestionSet $testSession)
 
 getUpcomingQuestionId ()
 
 isAnsweredQuestion ($questionId)
 
 isPostponedQuestion ($questionId)
 
 isFilteredQuestion ($questionId)
 
 trackedQuestionExists ()
 
 getTrackedQuestionList ($currentQuestionId=null)
 
 resetTrackedQuestionList ()
 
 openQuestionExists ()
 
 getOpenQuestions ()
 
 getTrackedQuestionCount ()
 
 getCurrentPositionIndex ($questionId)
 
 getLastPositionIndex ()
 
 setQuestionUnchecked ($questionId)
 
 setQuestionChecked ($questionId)
 
 isQuestionChecked ($questionId)
 
 setQuestionPostponed ($questionId)
 
 unsetQuestionPostponed ($questionId)
 
 setQuestionAnsweredCorrect ($questionId)
 
 setQuestionAnsweredWrong ($questionId)
 
 hasStarted ()
 
 getCompleteQuestionsData ()
 
 getFilteredQuestionsData ()
 
 getUserSequenceQuestions ()
 

Private Member Functions

 loadQuestionTracking ()
 
 loadAnswerStatus ()
 
 loadPostponedQuestions ()
 
 loadCheckedQuestions ()
 
 saveNewlyTrackedQuestion ()
 
 getNewOrderIndexForQuestionTracking ()
 
 saveNewlyAnsweredQuestionsAnswerStatus ()
 
 saveNewlyPostponedQuestion ()
 
 removeQuestionsNotPostponedAnymore ()
 
 saveNewlyCheckedQuestion ()
 
 removeQuestionsNotCheckedAnymore ()
 
 fetchUpcomingQuestionId ($excludePostponedQuestions, $forceNonAnsweredQuestion)
 
 trackQuestion ($questionId, $answerStatus)
 
 fetchMostLeastPostponedQuestion ($postponedQuestions)
 

Private Attributes

 $db = null
 
 $questionSet = null
 
 $activeId = null
 
 $preventCheckedQuestionsFromComingUpEnabled
 
 $questionTracking = array()
 
 $newlyTrackedQuestion
 
 $newlyTrackedQuestionsStatus
 
 $postponedQuestions = array()
 
 $newlyPostponedQuestion
 
 $newlyPostponedQuestionsCount
 
 $alreadyCheckedQuestions
 
 $newlyCheckedQuestion
 
 $correctAnsweredQuestions = array()
 
 $wrongAnsweredQuestions = array()
 
 $newlyAnsweredQuestion
 
 $newlyAnsweredQuestionsAnswerStatus
 

Detailed Description

Definition at line 14 of file class.ilTestSequenceDynamicQuestionSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestSequenceDynamicQuestionSet::__construct ( ilDB  $db,
ilTestDynamicQuestionSet  $questionSet,
  $activeId 
)

Constructor.

Parameters
ilTestDynamicQuestionSet$questionSet

Definition at line 101 of file class.ilTestSequenceDynamicQuestionSet.php.

References $activeId, $db, and $questionSet.

102  {
103  $this->db = $db;
104  $this->questionSet = $questionSet;
105  $this->activeId = $activeId;
106 
107  $this->newlyTrackedQuestion = null;
108  $this->newlyTrackedQuestionsStatus = null;
109 
110  $this->newlyPostponedQuestion = null;
111  $this->newlyPostponedQuestionsCount = null;
112 
113  $this->newlyAnsweredQuestion = null;
114  $this->newlyAnsweredQuestionsAnswerStatus = null;
115 
116  $this->alreadyCheckedQuestions = array();
117  $this->newlyCheckedQuestion = null;
118 
119  $this->preventCheckedQuestionsFromComingUpEnabled = false;
120  }

Member Function Documentation

◆ cleanupQuestions()

ilTestSequenceDynamicQuestionSet::cleanupQuestions ( ilTestSessionDynamicQuestionSet  $testSession)

Definition at line 382 of file class.ilTestSequenceDynamicQuestionSet.php.

References ilTestSessionDynamicQuestionSet\getCurrentQuestionId(), isFilteredQuestion(), and ilTestSessionDynamicQuestionSet\setCurrentQuestionId().

383  {
384  switch( true )
385  {
386  case !$this->questionSet->questionExists($testSession->getCurrentQuestionId()):
387  case !$this->isFilteredQuestion($testSession->getCurrentQuestionId()):
388 
389  $testSession->setCurrentQuestionId(null);
390  }
391 
392  foreach($this->postponedQuestions as $questionId)
393  {
394  if( !$this->questionSet->questionExists($questionId) )
395  {
396  unset($this->postponedQuestions[$questionId]);
397  }
398  }
399 
400  foreach($this->wrongAnsweredQuestions as $questionId)
401  {
402  if( !$this->questionSet->questionExists($questionId) )
403  {
404  unset($this->wrongAnsweredQuestions[$questionId]);
405  }
406  }
407 
408  foreach($this->correctAnsweredQuestions as $questionId)
409  {
410  if( !$this->questionSet->questionExists($questionId) )
411  {
412  unset($this->correctAnsweredQuestions[$questionId]);
413  }
414  }
415  }
+ Here is the call graph for this function:

◆ fetchMostLeastPostponedQuestion()

ilTestSequenceDynamicQuestionSet::fetchMostLeastPostponedQuestion (   $postponedQuestions)
private
Parameters
$postponedQuestions
Returns
int|null|string

Definition at line 705 of file class.ilTestSequenceDynamicQuestionSet.php.

References $postponedQuestions.

Referenced by fetchUpcomingQuestionId().

706  {
707  $minPostponeCount = null;
708  $minPostponeItem = null;
709 
710  foreach(array_reverse($postponedQuestions, true) as $qId => $postponeCount)
711  {
712  if($minPostponeCount === null || $postponeCount <= $minPostponeCount)
713  {
714  $minPostponeCount = $postponeCount;
715  $minPostponeItem = $qId;
716  }
717  }
718  return $minPostponeItem;
719  }
+ Here is the caller graph for this function:

◆ fetchUpcomingQuestionId()

ilTestSequenceDynamicQuestionSet::fetchUpcomingQuestionId (   $excludePostponedQuestions,
  $forceNonAnsweredQuestion 
)
private

Definition at line 436 of file class.ilTestSequenceDynamicQuestionSet.php.

References $postponedQuestions, fetchMostLeastPostponedQuestion(), isPreventCheckedQuestionsFromComingUpEnabled(), and isQuestionChecked().

Referenced by getUpcomingQuestionId().

437  {
438  foreach($this->questionSet->getActualQuestionSequence() as $level => $questions)
439  {
440  $postponedQuestions = array();
441 
442  foreach($questions as $pos => $qId)
443  {
444  if( isset($this->correctAnsweredQuestions[$qId]) )
445  {
446  continue;
447  }
448 
450  {
451  continue;
452  }
453 
454  if( $forceNonAnsweredQuestion && isset($this->wrongAnsweredQuestions[$qId]) )
455  {
456  continue;
457  }
458 
459  if( isset($this->postponedQuestions[$qId]) )
460  {
461  $postponedQuestions[$qId] = $this->postponedQuestions[$qId];
462  continue;
463  }
464 
465  return $qId;
466  }
467 
468  if( !$excludePostponedQuestions && count($postponedQuestions) )
469  {
471  }
472  }
473 
474  return null;
475  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveId()

◆ getCompleteQuestionsData()

ilTestSequenceDynamicQuestionSet::getCompleteQuestionsData ( )

Definition at line 675 of file class.ilTestSequenceDynamicQuestionSet.php.

676  {
677  return $this->questionSet->getCompleteQuestionList()->getQuestionDataArray();
678  }

◆ getCurrentPositionIndex()

ilTestSequenceDynamicQuestionSet::getCurrentPositionIndex (   $questionId)

Definition at line 559 of file class.ilTestSequenceDynamicQuestionSet.php.

560  {
561  $i = 0;
562 
563  foreach($this->questionSet->getActualQuestionSequence() as $level => $questions)
564  {
565  foreach($questions as $pos => $qId)
566  {
567  $i++;
568 
569  if($qId == $questionId)
570  {
571  return $i;
572  }
573  }
574  }
575 
576  return null;
577  }

◆ getFilteredQuestionsData()

ilTestSequenceDynamicQuestionSet::getFilteredQuestionsData ( )

Definition at line 680 of file class.ilTestSequenceDynamicQuestionSet.php.

681  {
682  return $this->questionSet->getFilteredQuestionList()->getQuestionDataArray();
683  }

◆ getLastPositionIndex()

ilTestSequenceDynamicQuestionSet::getLastPositionIndex ( )

Definition at line 579 of file class.ilTestSequenceDynamicQuestionSet.php.

580  {
581  $count = 0;
582 
583  foreach($this->questionSet->getActualQuestionSequence() as $level => $questions)
584  {
585  $count += count($questions);
586  }
587 
588  return $count;
589  }

◆ getNewOrderIndexForQuestionTracking()

ilTestSequenceDynamicQuestionSet::getNewOrderIndexForQuestionTracking ( )
private

Definition at line 270 of file class.ilTestSequenceDynamicQuestionSet.php.

References $query, $res, $row, and getActiveId().

Referenced by saveNewlyTrackedQuestion().

271  {
272  $query = "
273  SELECT (MAX(orderindex) + 1) new_order_index
274  FROM tst_seq_qst_tracking
275  WHERE active_fi = %s
276  AND pass = %s
277  ";
278 
279  $res = $this->db->queryF($query, array('integer','integer'), array($this->getActiveId(), 0));
280 
281  $row = $this->db->fetchAssoc($res);
282 
283  if( $row['new_order_index'] )
284  {
285  return $row['new_order_index'];
286  }
287 
288  return 1;
289  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOpenQuestions()

ilTestSequenceDynamicQuestionSet::getOpenQuestions ( )

Definition at line 538 of file class.ilTestSequenceDynamicQuestionSet.php.

Referenced by openQuestionExists().

539  {
540  $completeQuestionIds = array_keys( $this->questionSet->getAllQuestionsData() );
541 
542  $openQuestions = array_diff($completeQuestionIds, $this->correctAnsweredQuestions);
543 
544  return $openQuestions;
545  }
+ Here is the caller graph for this function:

◆ getTrackedQuestionCount()

ilTestSequenceDynamicQuestionSet::getTrackedQuestionCount ( )

Definition at line 547 of file class.ilTestSequenceDynamicQuestionSet.php.

548  {
549  $uniqueQuestions = array();
550 
551  foreach($this->questionTracking as $trackedQuestion)
552  {
553  $uniqueQuestions[$trackedQuestion['qid']] = $trackedQuestion['qid'];
554  }
555 
556  return count($uniqueQuestions);
557  }

◆ getTrackedQuestionList()

ilTestSequenceDynamicQuestionSet::getTrackedQuestionList (   $currentQuestionId = null)

Definition at line 508 of file class.ilTestSequenceDynamicQuestionSet.php.

509  {
510  $questionList = array();
511 
512  if( $currentQuestionId )
513  {
514  $questionList[$currentQuestionId] = $this->questionSet->getQuestionData($currentQuestionId);
515  }
516 
517  foreach( array_reverse($this->questionTracking) as $trackedQuestion)
518  {
519  if( !isset($questionList[ $trackedQuestion['qid'] ]) )
520  {
521  $questionList[ $trackedQuestion['qid'] ] = $this->questionSet->getQuestionData($trackedQuestion['qid']);
522  }
523  }
524 
525  return $questionList;
526  }

◆ getUpcomingQuestionId()

ilTestSequenceDynamicQuestionSet::getUpcomingQuestionId ( )

Definition at line 419 of file class.ilTestSequenceDynamicQuestionSet.php.

References fetchUpcomingQuestionId().

420  {
421  if( $questionId = $this->fetchUpcomingQuestionId(true, true) )
422  return $questionId;
423 
424  if( $questionId = $this->fetchUpcomingQuestionId(true, false) )
425  return $questionId;
426 
427  if( $questionId = $this->fetchUpcomingQuestionId(false, true) )
428  return $questionId;
429 
430  if( $questionId = $this->fetchUpcomingQuestionId(false, false) )
431  return $questionId;
432 
433  return null;
434  }
fetchUpcomingQuestionId($excludePostponedQuestions, $forceNonAnsweredQuestion)
+ Here is the call graph for this function:

◆ getUserSequenceQuestions()

ilTestSequenceDynamicQuestionSet::getUserSequenceQuestions ( )

Definition at line 687 of file class.ilTestSequenceDynamicQuestionSet.php.

688  {
689  //return array_keys( $this->getTrackedQuestionList() );
690 
691  $questionSequence = array();
692 
693  foreach( $this->questionSet->getActualQuestionSequence() as $level => $questions )
694  {
695  $questionSequence = array_merge($questionSequence, $questions);
696  }
697 
698  return $questionSequence;
699  }

◆ hasStarted()

ilTestSequenceDynamicQuestionSet::hasStarted ( )

Definition at line 668 of file class.ilTestSequenceDynamicQuestionSet.php.

References trackedQuestionExists().

+ Here is the call graph for this function:

◆ isAnsweredQuestion()

ilTestSequenceDynamicQuestionSet::isAnsweredQuestion (   $questionId)

Definition at line 477 of file class.ilTestSequenceDynamicQuestionSet.php.

478  {
479  return (
480  isset($this->correctAnsweredQuestions[$questionId])
481  || isset($this->wrongAnsweredQuestions[$questionId])
482  );
483  }

◆ isFilteredQuestion()

ilTestSequenceDynamicQuestionSet::isFilteredQuestion (   $questionId)

Definition at line 490 of file class.ilTestSequenceDynamicQuestionSet.php.

Referenced by cleanupQuestions().

491  {
492  foreach($this->questionSet->getActualQuestionSequence() as $level => $questions)
493  {
494  if( in_array($questionId, $questions) )
495  {
496  return true;
497  }
498  }
499 
500  return false;
501  }
+ Here is the caller graph for this function:

◆ isPostponedQuestion()

ilTestSequenceDynamicQuestionSet::isPostponedQuestion (   $questionId)

Definition at line 485 of file class.ilTestSequenceDynamicQuestionSet.php.

486  {
487  return isset($this->postponedQuestions[$questionId]);
488  }

◆ isPreventCheckedQuestionsFromComingUpEnabled()

ilTestSequenceDynamicQuestionSet::isPreventCheckedQuestionsFromComingUpEnabled ( )

Definition at line 132 of file class.ilTestSequenceDynamicQuestionSet.php.

References $preventCheckedQuestionsFromComingUpEnabled.

Referenced by fetchUpcomingQuestionId().

+ Here is the caller graph for this function:

◆ isQuestionChecked()

ilTestSequenceDynamicQuestionSet::isQuestionChecked (   $questionId)

Definition at line 604 of file class.ilTestSequenceDynamicQuestionSet.php.

Referenced by fetchUpcomingQuestionId().

605  {
606  return isset($this->alreadyCheckedQuestions[$questionId]);
607  }
+ Here is the caller graph for this function:

◆ loadAnswerStatus()

ilTestSequenceDynamicQuestionSet::loadAnswerStatus ( )
private

Definition at line 168 of file class.ilTestSequenceDynamicQuestionSet.php.

References $query, $res, and $row.

Referenced by loadFromDb().

169  {
170  $query = "
171  SELECT question_fi, correctness
172  FROM tst_seq_qst_answstatus
173  WHERE active_fi = %s
174  AND pass = %s
175  ";
176 
177  $res = $this->db->queryF($query, array('integer','integer'), array($this->activeId, 0));
178 
179  $this->correctAnsweredQuestions = array();
180  $this->wrongAnsweredQuestions = array();
181 
182  while( $row = $this->db->fetchAssoc($res) )
183  {
184  if( $row['correctness'] )
185  {
186  $this->correctAnsweredQuestions[ $row['question_fi'] ] = $row['question_fi'];
187  }
188  else
189  {
190  $this->wrongAnsweredQuestions[ $row['question_fi'] ] = $row['question_fi'];
191  }
192  }
193  }
+ Here is the caller graph for this function:

◆ loadCheckedQuestions()

ilTestSequenceDynamicQuestionSet::loadCheckedQuestions ( )
private

Definition at line 214 of file class.ilTestSequenceDynamicQuestionSet.php.

References $res, $row, and getActiveId().

Referenced by loadFromDb().

215  {
216  $res = $this->db->queryF("SELECT question_fi FROM tst_seq_qst_checked WHERE active_fi = %s AND pass = %s",
217  array('integer','integer'), array($this->getActiveId(), 0)
218  );
219 
220  while( $row = $this->db->fetchAssoc($res) )
221  {
222  $this->alreadyCheckedQuestions[ $row['question_fi'] ] = $row['question_fi'];
223  }
224  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromDb()

◆ loadPostponedQuestions()

ilTestSequenceDynamicQuestionSet::loadPostponedQuestions ( )
private

Definition at line 195 of file class.ilTestSequenceDynamicQuestionSet.php.

References $query, $res, and $row.

Referenced by loadFromDb().

196  {
197  $query = "
198  SELECT question_fi, cnt
199  FROM tst_seq_qst_postponed
200  WHERE active_fi = %s
201  AND pass = %s
202  ";
203 
204  $res = $this->db->queryF($query, array('integer','integer'), array($this->activeId, 0));
205 
206  $this->postponedQuestions = array();
207 
208  while( $row = $this->db->fetchAssoc($res) )
209  {
210  $this->postponedQuestions[ $row['question_fi'] ] = $row['cnt'];
211  }
212  }
+ Here is the caller graph for this function:

◆ loadQuestions()

ilTestSequenceDynamicQuestionSet::loadQuestions ( ilObjTestDynamicQuestionSetConfig  $dynamicQuestionSetConfig,
ilTestDynamicQuestionSetFilterSelection  $filterSelection 
)

Definition at line 369 of file class.ilTestSequenceDynamicQuestionSet.php.

370  {
371  $this->questionSet->load($dynamicQuestionSetConfig, $filterSelection);
372 
373 // echo "<table><tr>";
374 // echo "<td width='200'><pre>".print_r($this->questionSet->getActualQuestionSequence(), 1)."</pre></td>";
375 // echo "<td width='200'><pre>".print_r($this->correctAnsweredQuestions, 1)."</pre></td>";
376 // echo "<td width='200'><pre>".print_r($this->wrongAnsweredQuestions, 1)."</pre></td>";
377 // echo "</tr></table>";
378  }

◆ loadQuestionTracking()

ilTestSequenceDynamicQuestionSet::loadQuestionTracking ( )
private

Definition at line 145 of file class.ilTestSequenceDynamicQuestionSet.php.

References $query, $res, and $row.

Referenced by loadFromDb().

146  {
147  $query = "
148  SELECT question_fi, status
149  FROM tst_seq_qst_tracking
150  WHERE active_fi = %s
151  AND pass = %s
152  ORDER BY orderindex ASC
153  ";
154 
155  $res = $this->db->queryF($query, array('integer','integer'), array($this->activeId, 0));
156 
157  $this->questionTracking = array();
158 
159  while( $row = $this->db->fetchAssoc($res) )
160  {
161  $this->questionTracking[] = array(
162  'qid' => $row['question_fi'],
163  'status' => $row['status']
164  );
165  }
166  }
+ Here is the caller graph for this function:

◆ openQuestionExists()

ilTestSequenceDynamicQuestionSet::openQuestionExists ( )

Definition at line 533 of file class.ilTestSequenceDynamicQuestionSet.php.

References getOpenQuestions().

534  {
535  return count($this->getOpenQuestions()) > 0;
536  }
+ Here is the call graph for this function:

◆ removeQuestionsNotCheckedAnymore()

ilTestSequenceDynamicQuestionSet::removeQuestionsNotCheckedAnymore ( )
private

Definition at line 351 of file class.ilTestSequenceDynamicQuestionSet.php.

References $query, and getActiveId().

Referenced by saveToDb().

352  {
353  $NOT_IN_checkedQuestions = $this->db->in('question_fi', $this->alreadyCheckedQuestions, true, 'integer');
354 
355  // BEGIN: FIX IN QUERY
356  if($NOT_IN_checkedQuestions == ' 1=2 ') $NOT_IN_checkedQuestions = ' 1=1 ';
357  // END: FIX IN QUERY
358 
359  $query = "
360  DELETE FROM tst_seq_qst_checked
361  WHERE active_fi = %s
362  AND pass = %s
363  AND $NOT_IN_checkedQuestions
364  ";
365 
366  $this->db->manipulateF($query, array('integer', 'integer'), array((int)$this->getActiveId(), 0));
367  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionsNotPostponedAnymore()

ilTestSequenceDynamicQuestionSet::removeQuestionsNotPostponedAnymore ( )
private

Definition at line 325 of file class.ilTestSequenceDynamicQuestionSet.php.

References $query, and getActiveId().

Referenced by saveToDb().

326  {
327  $INquestions = $this->db->in('question_fi', array_keys($this->postponedQuestions), true, 'integer');
328 
329  $query = "
330  DELETE FROM tst_seq_qst_postponed
331  WHERE active_fi = %s
332  AND pass = %s
333  AND $INquestions
334  ";
335 
336  $this->db->manipulateF($query, array('integer','integer'), array($this->getActiveId(), 0));
337  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetTrackedQuestionList()

ilTestSequenceDynamicQuestionSet::resetTrackedQuestionList ( )

Definition at line 528 of file class.ilTestSequenceDynamicQuestionSet.php.

529  {
530  $this->questionTracking = array();
531  }

◆ saveNewlyAnsweredQuestionsAnswerStatus()

ilTestSequenceDynamicQuestionSet::saveNewlyAnsweredQuestionsAnswerStatus ( )
private

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

References getActiveId().

Referenced by saveToDb().

292  {
293  if( (int)$this->newlyAnsweredQuestion )
294  {
295  $this->db->replace('tst_seq_qst_answstatus',
296  array(
297  'active_fi' => array('integer', (int)$this->getActiveId()),
298  'pass' => array('integer', 0),
299  'question_fi' => array('integer', (int)$this->newlyAnsweredQuestion)
300  ),
301  array(
302  'correctness' => array('integer', (int)$this->newlyAnsweredQuestionsAnswerStatus)
303  )
304  );
305  }
306  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveNewlyCheckedQuestion()

ilTestSequenceDynamicQuestionSet::saveNewlyCheckedQuestion ( )
private

Definition at line 339 of file class.ilTestSequenceDynamicQuestionSet.php.

References getActiveId().

Referenced by saveToDb().

340  {
341  if( (int)$this->newlyCheckedQuestion )
342  {
343  $this->db->replace('tst_seq_qst_checked', array(
344  'active_fi' => array('integer', (int)$this->getActiveId()),
345  'pass' => array('integer', 0),
346  'question_fi' => array('integer', (int)$this->newlyCheckedQuestion)
347  ), array());
348  }
349  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveNewlyPostponedQuestion()

ilTestSequenceDynamicQuestionSet::saveNewlyPostponedQuestion ( )
private

Definition at line 308 of file class.ilTestSequenceDynamicQuestionSet.php.

References getActiveId().

Referenced by saveToDb().

309  {
310  if( (int)$this->newlyPostponedQuestion )
311  {
312  $this->db->replace('tst_seq_qst_postponed',
313  array(
314  'active_fi' => array('integer', (int)$this->getActiveId()),
315  'pass' => array('integer', 0),
316  'question_fi' => array('integer', (int)$this->newlyPostponedQuestion)
317  ),
318  array(
319  'cnt' => array('integer', (int)$this->newlyPostponedQuestionsCount)
320  )
321  );
322  }
323  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveNewlyTrackedQuestion()

ilTestSequenceDynamicQuestionSet::saveNewlyTrackedQuestion ( )
private

Definition at line 250 of file class.ilTestSequenceDynamicQuestionSet.php.

References getActiveId(), and getNewOrderIndexForQuestionTracking().

Referenced by saveToDb().

251  {
252  if( (int)$this->newlyTrackedQuestion )
253  {
254  $newOrderIndex = $this->getNewOrderIndexForQuestionTracking();
255 
256  $this->db->replace('tst_seq_qst_tracking',
257  array(
258  'active_fi' => array('integer', (int)$this->getActiveId()),
259  'pass' => array('integer', 0),
260  'question_fi' => array('integer', (int)$this->newlyTrackedQuestion)
261  ),
262  array(
263  'status' => array('text', $this->newlyTrackedQuestionsStatus),
264  'orderindex' => array('integer', $newOrderIndex)
265  )
266  );
267  }
268  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToDb()

ilTestSequenceDynamicQuestionSet::saveToDb ( )

Definition at line 226 of file class.ilTestSequenceDynamicQuestionSet.php.

References getActiveId(), removeQuestionsNotCheckedAnymore(), removeQuestionsNotPostponedAnymore(), saveNewlyAnsweredQuestionsAnswerStatus(), saveNewlyCheckedQuestion(), saveNewlyPostponedQuestion(), and saveNewlyTrackedQuestion().

227  {
228  $this->db->manipulateF(
229  "DELETE FROM tst_sequence WHERE active_fi = %s AND pass = %s",
230  array('integer','integer'), array($this->getActiveId(), 0)
231  );
232 
233  $this->db->insert('tst_sequence', array(
234  'active_fi' => array('integer', $this->getActiveId()),
235  'pass' => array('integer', 0),
236  'sequence' => array('clob', null),
237  'postponed' => array('text', null),
238  'hidden' => array('text', null),
239  'tstamp' => array('integer', time())
240  ));
241 
242  $this->saveNewlyTrackedQuestion();
246  $this->saveNewlyCheckedQuestion();
248  }
+ Here is the call graph for this function:

◆ setPreventCheckedQuestionsFromComingUpEnabled()

ilTestSequenceDynamicQuestionSet::setPreventCheckedQuestionsFromComingUpEnabled (   $preventCheckedQuestionsFromComingUpEnabled)

Definition at line 127 of file class.ilTestSequenceDynamicQuestionSet.php.

References $preventCheckedQuestionsFromComingUpEnabled.

128  {
129  $this->preventCheckedQuestionsFromComingUpEnabled = $preventCheckedQuestionsFromComingUpEnabled;
130  }

◆ setQuestionAnsweredCorrect()

ilTestSequenceDynamicQuestionSet::setQuestionAnsweredCorrect (   $questionId)

Definition at line 630 of file class.ilTestSequenceDynamicQuestionSet.php.

References trackQuestion().

631  {
632  $this->trackQuestion($questionId, 'correct');
633 
634  $this->correctAnsweredQuestions[$questionId] = $questionId;
635 
636  if( isset($this->wrongAnsweredQuestions[$questionId]) )
637  unset($this->wrongAnsweredQuestions[$questionId]);
638 
639  $this->newlyAnsweredQuestion = $questionId;
640  $this->newlyAnsweredQuestionsAnswerStatus = true;
641  }
+ Here is the call graph for this function:

◆ setQuestionAnsweredWrong()

ilTestSequenceDynamicQuestionSet::setQuestionAnsweredWrong (   $questionId)

Definition at line 643 of file class.ilTestSequenceDynamicQuestionSet.php.

References trackQuestion().

644  {
645  $this->trackQuestion($questionId, 'wrong');
646 
647  $this->wrongAnsweredQuestions[$questionId] = $questionId;
648 
649  if( isset($this->correctAnsweredQuestions[$questionId]) )
650  unset($this->correctAnsweredQuestions[$questionId]);
651 
652  $this->newlyAnsweredQuestion = $questionId;
653  $this->newlyAnsweredQuestionsAnswerStatus = false;
654  }
+ Here is the call graph for this function:

◆ setQuestionChecked()

ilTestSequenceDynamicQuestionSet::setQuestionChecked (   $questionId)

Definition at line 598 of file class.ilTestSequenceDynamicQuestionSet.php.

599  {
600  $this->newlyCheckedQuestion = $questionId;
601  $this->alreadyCheckedQuestions[$questionId] = $questionId;
602  }

◆ setQuestionPostponed()

ilTestSequenceDynamicQuestionSet::setQuestionPostponed (   $questionId)

Definition at line 609 of file class.ilTestSequenceDynamicQuestionSet.php.

References trackQuestion().

610  {
611  $this->trackQuestion($questionId, 'postponed');
612 
613  if( !isset($this->postponedQuestions[$questionId]) )
614  {
615  $this->postponedQuestions[$questionId] = 0;
616  }
617 
618  $this->postponedQuestions[$questionId]++;
619 
620  $this->newlyPostponedQuestion = $questionId;
621  $this->newlyPostponedQuestionsCount = $this->postponedQuestions[$questionId];
622  }
+ Here is the call graph for this function:

◆ setQuestionUnchecked()

ilTestSequenceDynamicQuestionSet::setQuestionUnchecked (   $questionId)

Definition at line 593 of file class.ilTestSequenceDynamicQuestionSet.php.

594  {
595  unset($this->alreadyCheckedQuestions[$questionId]);
596  }

◆ trackedQuestionExists()

ilTestSequenceDynamicQuestionSet::trackedQuestionExists ( )

Definition at line 503 of file class.ilTestSequenceDynamicQuestionSet.php.

Referenced by hasStarted().

504  {
505  return (bool)count($this->questionTracking);
506  }
+ Here is the caller graph for this function:

◆ trackQuestion()

ilTestSequenceDynamicQuestionSet::trackQuestion (   $questionId,
  $answerStatus 
)
private

Definition at line 656 of file class.ilTestSequenceDynamicQuestionSet.php.

Referenced by setQuestionAnsweredCorrect(), setQuestionAnsweredWrong(), and setQuestionPostponed().

657  {
658  $this->questionTracking[] = array(
659  'qid' => $questionId, 'status' => $answerStatus
660  );
661 
662  $this->newlyTrackedQuestion = $questionId;
663  $this->newlyTrackedQuestionsStatus = $answerStatus;
664  }
+ Here is the caller graph for this function:

◆ unsetQuestionPostponed()

ilTestSequenceDynamicQuestionSet::unsetQuestionPostponed (   $questionId)

Definition at line 624 of file class.ilTestSequenceDynamicQuestionSet.php.

625  {
626  if( isset($this->postponedQuestions[$questionId]) )
627  unset($this->postponedQuestions[$questionId]);
628  }

Field Documentation

◆ $activeId

ilTestSequenceDynamicQuestionSet::$activeId = null
private

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

Referenced by __construct(), and getActiveId().

◆ $alreadyCheckedQuestions

ilTestSequenceDynamicQuestionSet::$alreadyCheckedQuestions
private

Definition at line 69 of file class.ilTestSequenceDynamicQuestionSet.php.

◆ $correctAnsweredQuestions

ilTestSequenceDynamicQuestionSet::$correctAnsweredQuestions = array()
private

Definition at line 79 of file class.ilTestSequenceDynamicQuestionSet.php.

◆ $db

ilTestSequenceDynamicQuestionSet::$db = null
private

Definition at line 19 of file class.ilTestSequenceDynamicQuestionSet.php.

Referenced by __construct().

◆ $newlyAnsweredQuestion

ilTestSequenceDynamicQuestionSet::$newlyAnsweredQuestion
private

Definition at line 89 of file class.ilTestSequenceDynamicQuestionSet.php.

◆ $newlyAnsweredQuestionsAnswerStatus

ilTestSequenceDynamicQuestionSet::$newlyAnsweredQuestionsAnswerStatus
private

Definition at line 94 of file class.ilTestSequenceDynamicQuestionSet.php.

◆ $newlyCheckedQuestion

ilTestSequenceDynamicQuestionSet::$newlyCheckedQuestion
private

Definition at line 74 of file class.ilTestSequenceDynamicQuestionSet.php.

◆ $newlyPostponedQuestion

ilTestSequenceDynamicQuestionSet::$newlyPostponedQuestion
private

Definition at line 59 of file class.ilTestSequenceDynamicQuestionSet.php.

◆ $newlyPostponedQuestionsCount

ilTestSequenceDynamicQuestionSet::$newlyPostponedQuestionsCount
private

Definition at line 64 of file class.ilTestSequenceDynamicQuestionSet.php.

◆ $newlyTrackedQuestion

ilTestSequenceDynamicQuestionSet::$newlyTrackedQuestion
private

Definition at line 44 of file class.ilTestSequenceDynamicQuestionSet.php.

◆ $newlyTrackedQuestionsStatus

ilTestSequenceDynamicQuestionSet::$newlyTrackedQuestionsStatus
private

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

◆ $postponedQuestions

ilTestSequenceDynamicQuestionSet::$postponedQuestions = array()
private

◆ $preventCheckedQuestionsFromComingUpEnabled

ilTestSequenceDynamicQuestionSet::$preventCheckedQuestionsFromComingUpEnabled
private

◆ $questionSet

ilTestSequenceDynamicQuestionSet::$questionSet = null
private

Definition at line 24 of file class.ilTestSequenceDynamicQuestionSet.php.

Referenced by __construct().

◆ $questionTracking

ilTestSequenceDynamicQuestionSet::$questionTracking = array()
private

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

◆ $wrongAnsweredQuestions

ilTestSequenceDynamicQuestionSet::$wrongAnsweredQuestions = array()
private

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


The documentation for this class was generated from the following file: