4 require_once
'Modules/Test/interfaces/interface.ilTestSequenceSummaryProvider.php';
114 $this->newlyTrackedQuestion = null;
115 $this->newlyTrackedQuestionsStatus = null;
117 $this->newlyPostponedQuestion = null;
118 $this->newlyPostponedQuestionsCount = null;
120 $this->newlyAnsweredQuestion = null;
121 $this->newlyAnsweredQuestionsAnswerStatus = null;
123 $this->alreadyCheckedQuestions =
array();
124 $this->newlyCheckedQuestion = null;
126 $this->preventCheckedQuestionsFromComingUpEnabled =
false;
128 $this->currentQuestionId = null;
173 SELECT question_fi, status 174 FROM tst_seq_qst_tracking 177 ORDER BY orderindex ASC 182 $this->questionTracking =
array();
184 while(
$row = $this->db->fetchAssoc(
$res) )
186 $this->questionTracking[] =
array(
187 'qid' =>
$row[
'question_fi'],
188 'status' =>
$row[
'status']
196 SELECT question_fi, correctness 197 FROM tst_seq_qst_answstatus 204 $this->correctAnsweredQuestions =
array();
205 $this->wrongAnsweredQuestions =
array();
207 while(
$row = $this->db->fetchAssoc(
$res) )
209 if(
$row[
'correctness'] )
211 $this->correctAnsweredQuestions[
$row[
'question_fi'] ] = $row[
'question_fi'];
215 $this->wrongAnsweredQuestions[
$row[
'question_fi'] ] = $row[
'question_fi'];
223 SELECT question_fi, cnt 224 FROM tst_seq_qst_postponed 231 $this->postponedQuestions =
array();
233 while(
$row = $this->db->fetchAssoc(
$res) )
235 $this->postponedQuestions[
$row[
'question_fi'] ] = $row[
'cnt'];
241 $res = $this->db->queryF(
"SELECT question_fi FROM tst_seq_qst_checked WHERE active_fi = %s AND pass = %s",
245 while(
$row = $this->db->fetchAssoc(
$res) )
247 $this->alreadyCheckedQuestions[
$row[
'question_fi'] ] = $row[
'question_fi'];
253 $this->db->manipulateF(
254 "DELETE FROM tst_sequence WHERE active_fi = %s AND pass = %s",
258 $this->db->insert(
'tst_sequence',
array(
260 'pass' =>
array(
'integer', 0),
261 'sequence' =>
array(
'clob', null),
262 'postponed' =>
array(
'text', null),
263 'hidden' =>
array(
'text', null),
277 if( (
int)$this->newlyTrackedQuestion )
281 $this->db->replace(
'tst_seq_qst_tracking',
284 'pass' =>
array(
'integer', 0),
285 'question_fi' =>
array(
'integer', (
int)$this->newlyTrackedQuestion)
288 'status' =>
array(
'text', $this->newlyTrackedQuestionsStatus),
289 'orderindex' =>
array(
'integer', $newOrderIndex)
298 SELECT (MAX(orderindex) + 1) new_order_index 299 FROM tst_seq_qst_tracking 308 if(
$row[
'new_order_index'] )
310 return $row[
'new_order_index'];
318 if( (
int)$this->newlyAnsweredQuestion )
320 $this->db->replace(
'tst_seq_qst_answstatus',
323 'pass' =>
array(
'integer', 0),
324 'question_fi' =>
array(
'integer', (
int)$this->newlyAnsweredQuestion)
327 'correctness' =>
array(
'integer', (
int)$this->newlyAnsweredQuestionsAnswerStatus)
335 if( (
int)$this->newlyPostponedQuestion )
337 $this->db->replace(
'tst_seq_qst_postponed',
340 'pass' =>
array(
'integer', 0),
341 'question_fi' =>
array(
'integer', (
int)$this->newlyPostponedQuestion)
344 'cnt' =>
array(
'integer', (
int)$this->newlyPostponedQuestionsCount)
352 $INquestions = $this->db->in(
'question_fi', array_keys($this->postponedQuestions),
true,
'integer');
355 DELETE FROM tst_seq_qst_postponed 366 if( (
int)$this->newlyCheckedQuestion )
368 $this->db->replace(
'tst_seq_qst_checked',
array(
370 'pass' =>
array(
'integer', 0),
371 'question_fi' =>
array(
'integer', (
int)$this->newlyCheckedQuestion)
378 $NOT_IN_checkedQuestions = $this->db->in(
'question_fi', $this->alreadyCheckedQuestions,
true,
'integer');
381 if($NOT_IN_checkedQuestions ==
' 1=2 ') $NOT_IN_checkedQuestions =
' 1=1 ';
385 DELETE FROM tst_seq_qst_checked 388 AND $NOT_IN_checkedQuestions 396 $this->questionSet->load($dynamicQuestionSetConfig, $filterSelection);
417 foreach($this->postponedQuestions as $questionId)
419 if( !$this->questionSet->questionExists($questionId) )
421 unset($this->postponedQuestions[$questionId]);
425 foreach($this->wrongAnsweredQuestions as $questionId)
427 if( !$this->questionSet->questionExists($questionId) )
429 unset($this->wrongAnsweredQuestions[$questionId]);
433 foreach($this->correctAnsweredQuestions as $questionId)
435 if( !$this->questionSet->questionExists($questionId) )
437 unset($this->correctAnsweredQuestions[$questionId]);
463 foreach($this->questionSet->getActualQuestionSequence() as $level => $questions)
467 foreach($questions as $pos => $qId)
469 if( isset($this->correctAnsweredQuestions[$qId]) )
479 if( $forceNonAnsweredQuestion && isset($this->wrongAnsweredQuestions[$qId]) )
484 if( isset($this->postponedQuestions[$qId]) )
505 isset($this->correctAnsweredQuestions[$questionId])
506 || isset($this->wrongAnsweredQuestions[$questionId])
512 return isset($this->postponedQuestions[$questionId]);
517 foreach($this->questionSet->getActualQuestionSequence() as $level => $questions)
519 if( in_array($questionId, $questions) )
530 return (
bool)count($this->questionTracking);
535 $questionList =
array();
542 foreach( array_reverse($this->questionTracking) as $trackedQuestion)
544 if( !isset($questionList[ $trackedQuestion[
'qid'] ]) )
546 $questionList[ $trackedQuestion[
'qid'] ] = $this->questionSet->getQuestionData($trackedQuestion[
'qid']);
550 return $questionList;
555 $this->questionTracking =
array();
565 $completeQuestionIds = array_keys( $this->questionSet->getAllQuestionsData() );
567 $openQuestions = array_diff($completeQuestionIds, $this->correctAnsweredQuestions);
569 return $openQuestions;
574 $uniqueQuestions =
array();
576 foreach($this->questionTracking as $trackedQuestion)
578 $uniqueQuestions[$trackedQuestion[
'qid']] = $trackedQuestion[
'qid'];
581 return count($uniqueQuestions);
592 if($qId == $questionId)
610 unset($this->alreadyCheckedQuestions[$questionId]);
615 $this->newlyCheckedQuestion = $questionId;
616 $this->alreadyCheckedQuestions[$questionId] = $questionId;
621 return isset($this->alreadyCheckedQuestions[$questionId]);
628 if( !isset($this->postponedQuestions[$questionId]) )
630 $this->postponedQuestions[$questionId] = 0;
633 $this->postponedQuestions[$questionId]++;
635 $this->newlyPostponedQuestion = $questionId;
636 $this->newlyPostponedQuestionsCount = $this->postponedQuestions[$questionId];
641 if( isset($this->postponedQuestions[$questionId]) )
642 unset($this->postponedQuestions[$questionId]);
649 $this->correctAnsweredQuestions[$questionId] = $questionId;
651 if( isset($this->wrongAnsweredQuestions[$questionId]) )
652 unset($this->wrongAnsweredQuestions[$questionId]);
654 $this->newlyAnsweredQuestion = $questionId;
655 $this->newlyAnsweredQuestionsAnswerStatus =
true;
662 $this->wrongAnsweredQuestions[$questionId] = $questionId;
664 if( isset($this->correctAnsweredQuestions[$questionId]) )
665 unset($this->correctAnsweredQuestions[$questionId]);
667 $this->newlyAnsweredQuestion = $questionId;
668 $this->newlyAnsweredQuestionsAnswerStatus =
false;
673 $this->questionTracking[] =
array(
674 'qid' => $questionId,
'status' => $answerStatus
677 $this->newlyTrackedQuestion = $questionId;
678 $this->newlyTrackedQuestionsStatus = $answerStatus;
700 return $this->questionSet->getCompleteQuestionList()->getQuestionDataArray();
705 return $this->questionSet->getFilteredQuestionList()->getQuestionDataArray();
714 $questionSequence =
array();
716 foreach( $this->questionSet->getActualQuestionSequence() as $level => $questions )
718 $questionSequence = array_merge($questionSequence, $questions);
721 return $questionSequence;
730 $minPostponeCount = null;
731 $minPostponeItem = null;
735 if($minPostponeCount === null || $postponeCount <= $minPostponeCount)
737 $minPostponeCount = $postponeCount;
738 $minPostponeItem = $qId;
741 return $minPostponeItem;
755 $orderedSequence =
array();
758 for($i = 1; $i <= $maxPostponeCount; $i++)
760 if(!isset($postponedCountDomain[$i]))
767 if($postponeCount == $i)
769 $orderedSequence[] = $qId;
774 return $orderedSequence;
779 $questionSequence =
array();
781 foreach($this->questionSet->getActualQuestionSequence() as $level => $questions)
785 foreach($questions as $pos => $qId)
787 if( isset($this->correctAnsweredQuestions[$qId]) )
792 if( $nonAnsweredQuestions && isset($this->wrongAnsweredQuestions[$qId]) )
796 elseif( !$nonAnsweredQuestions && !isset($this->wrongAnsweredQuestions[$qId]) )
801 if( !$nonPostponedQuestions && isset($this->postponedQuestions[$qId]) )
806 elseif($nonPostponedQuestions && !isset($this->postponedQuestions[$qId]))
808 $questionSequence[] = $qId;
814 $questionSequence = array_merge(
820 return $questionSequence;
825 $questionSequence =
array();
827 foreach($this->questionTracking as $key => $question)
829 $qId = $question[
'qid'];
831 if( !isset($this->correctAnsweredQuestions[$qId]) )
836 $questionSequence[] = $qId;
839 return $questionSequence;
863 $nonAnsweredQuestions, $postponedNonAnsweredQuestions,
867 return $questionOrder;
876 if( !$this->
getQuestionSet()->getSelectionQuestionList()->isInList($qId) )
897 foreach ($questionOrder as $qId)
900 if(is_object($question))
902 $worked_through = $question->_isWorkedThrough($this->
getActiveId(), $question->getId(), $this->
getPass());
904 if(array_key_exists($question->getId(), $solved_questions))
906 $solved = $solved_questions[$question->getId()][
"solved"];
912 $row =
array(
"nr" =>
"$key",
"title" => $question->getTitle(),
"qid" => $question->getId(),
"visited" => $worked_through,
"solved" => (($solved) ?
"1" :
"0"),
"description" => $question->getComment(),
"points" => $question->getMaximumPoints(),
"worked_through" => $worked_through,
"postponed" => $is_postponed,
"sequence" => $qId,
"obligatory" =>
ilObjTest::isQuestionObligatory($question->getId()),
'isAnswered' => $question->isAnswered($this->getActiveId(), $this->
getPass()));
914 if(!$obligationsFilterEnabled ||
$row[
'obligatory'])
928 $filteredQuestions = $this->questionSet->getFilteredQuestionList()->getQuestionDataArray();
930 foreach($filteredQuestions as $filteredQuestion)
943 $filteredQuestions = $this->questionSet->getFilteredQuestionList()->getQuestionDataArray();
945 foreach($filteredQuestions as $filteredQuestion)
saveNewlyTrackedQuestion()
saveNewlyAnsweredQuestionsAnswerStatus()
getTrackedQuestionCount()
trackQuestion($questionId, $answerStatus)
setQuestionUnchecked($questionId)
orderQuestionsByPostponeCount($postponedQuestions)
isFilteredQuestion($questionId)
removeQuestionsNotPostponedAnymore()
resetFilteredQuestionListsCheckedStatus()
setQuestionAnsweredWrong($questionId)
getSequenceSummary($obligationsFilterEnabled=false)
isPostponedQuestion($questionId)
setQuestionChecked($questionId)
saveNewlyCheckedQuestion()
getUserSequenceQuestions()
getTrackedQuestionList($currentQuestionId=null)
setPreventCheckedQuestionsFromComingUpEnabled($preventCheckedQuestionsFromComingUpEnabled)
cleanupQuestions(ilTestSessionDynamicQuestionSet $testSession)
isPreventCheckedQuestionsFromComingUpEnabled()
loadQuestions(ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilTestDynamicQuestionSetFilterSelection $filterSelection)
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
resetTrackedQuestionList()
removeQuestionsNotCheckedAnymore()
static _getSolvedQuestions($active_id, $question_fi=null)
get solved questions
setQuestionAnsweredCorrect($questionId)
$newlyPostponedQuestionsCount
setCurrentQuestionId($currentQuestionId)
setQuestionPostponed($questionId)
getSelectionOrderedSequence()
Create styles array
The data for the language used.
__construct(ilDBInterface $db, ilTestDynamicQuestionSet $questionSet, $activeId)
Constructor.
isAnsweredQuestion($questionId)
setCurrentQuestionId($currentQuestionId)
getCompleteQuestionsData()
saveNewlyPostponedQuestion()
fetchQuestionSequence($nonPostponedQuestions, $nonAnsweredQuestions)
$newlyAnsweredQuestionsAnswerStatus
fetchTrackedCorrectAnsweredSequence()
getFilteredQuestionsData()
hasFilteredQuestionListCheckedQuestions()
$newlyTrackedQuestionsStatus
unsetQuestionPostponed($questionId)
$preventCheckedQuestionsFromComingUpEnabled
$correctAnsweredQuestions
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
fetchMostLeastPostponedQuestion($postponedQuestions)
getCurrentPositionIndex($questionId)
fetchUpcomingQuestionId($excludePostponedQuestions, $forceNonAnsweredQuestion)
isQuestionChecked($questionId)
getNewOrderIndexForQuestionTracking()