4 require_once
'Modules/Test/classes/class.ilTestPlayerAbstractGUI.php';
52 global $ilDB,
$lng, $ilPluginAdmin, $ilTabs,
$tree;
54 $ilTabs->clearTargets();
56 $this->ctrl->saveParameter($this,
"sequence");
57 $this->ctrl->saveParameter($this,
"active_id");
59 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
61 $this->dynamicQuestionSetConfig->loadFromDb();
70 $this->testSequence = $testSequenceFactory->getSequence($this->testSession);
71 $this->testSequence->loadFromDb();
73 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
75 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
77 if( $this->object->getKioskMode() )
79 include_once
'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
83 $cmd = $this->ctrl->getCmd();
84 $nextClass = $this->ctrl->getNextClass($this);
88 case 'ilassquestionpagegui':
90 $questionId = $this->testSequence->getQuestionForSequence( $this->
calculateSequence() );
92 require_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
94 $ret = $this->ctrl->forwardCommand($page_gui);
97 case 'ilassquestionhintrequestgui':
99 $questionGUI = $this->
object->createQuestionGUI(
100 "", $this->testSequenceFactory->getSequence()->getQuestionForSequence( $this->
calculateSequence() )
103 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
106 $this->ctrl->forwardCommand($gui);
110 case 'ildynamicquestionsetstatistictablegui':
131 if ($this->object->checkMaximumAllowedUsers() == FALSE)
138 if( $this->dynamicQuestionSetConfig->isTaxonomyFilterEnabled() )
140 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION_SELECTION);
143 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION);
150 $this->testSession->setCurrentQuestionId(null);
152 $this->testSession->saveToDb();
154 $this->ctrl->setParameter($this,
'active_id', $this->testSession->getActiveId());
156 assQuestion::_updateTestPassResults($this->testSession->getActiveId(), $this->testSession->getPass());
158 $_SESSION[
'active_time_id'] = $this->
object->startWorkingTime(
159 $this->testSession->getActiveId(), $this->testSession->getPass()
162 $this->ctrl->saveParameter($this,
'tst_javascript');
164 if( $this->dynamicQuestionSetConfig->isTaxonomyFilterEnabled() )
166 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION_SELECTION);
169 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION);
176 if( $this->testSession->getCurrentQuestionId() )
182 $this->testSequence->unsetQuestionPostponed($questionId);
185 $this->testSequence->loadQuestions(
186 $this->dynamicQuestionSetConfig, $this->testSession->getQuestionSetFilterSelection()
189 $this->testSequence->cleanupQuestions($this->testSession);
191 $this->testSequence->saveToDb();
193 require_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
196 $toolbarGUI->addButton(
198 '',
'',
'',
'',
'submit emphsubmit'
201 if( $this->object->isPassDeletionAllowed() )
203 require_once
'Modules/Test/classes/confirmations/class.ilTestPassDeletionConfirmationGUI.php';
205 $toolbarGUI->addButton(
206 $this->lng->txt(
'tst_dyn_test_pass_deletion_button'),
213 )); #
vd($filteredData);
215 $filteredTableGUI->setData($filteredData);
219 )); #
vd($completeData);
221 $completeTableGUI->setData($completeData);
223 $content = $this->ctrl->getHTML($toolbarGUI);
224 $content .= $this->ctrl->getHTML($filteredTableGUI);
225 $content .= $this->ctrl->getHTML($completeTableGUI);
227 $this->tpl->setVariable(
'TABLE_LIST_OF_QUESTIONS', $content);
229 if( $this->object->getEnableProcessingTime() )
238 $tableGUI->writeFilterToSession();
240 $taxFilterSelection = array();
243 foreach( $tableGUI->getFilterItems() as $item )
245 if( strpos($item->getPostVar(),
'tax_') !==
false )
247 $taxId = substr( $item->getPostVar(), strlen(
'tax_') );
248 $taxFilterSelection[$taxId] = $item->getValue();
250 elseif( $item->getPostVar() ==
'question_answer_status' )
252 $answerStatusFilterSelection = $item->getValue();
256 $this->testSession->getQuestionSetFilterSelection()->setTaxonomySelection($taxFilterSelection);
257 $this->testSession->getQuestionSetFilterSelection()->setAnswerStatusSelection($answerStatusFilterSelection);
258 $this->testSession->saveToDb();
260 $this->testSequence->resetTrackedQuestionList();
261 $this->testSequence->saveToDb();
263 $this->ctrl->redirect($this,
'showQuestionSelection');
269 $tableGUI->resetFilter();
271 $this->testSession->getQuestionSetFilterSelection()->setTaxonomySelection( array() );
272 $this->testSession->getQuestionSetFilterSelection()->setAnswerStatusSelection( null );
273 $this->testSession->saveToDb();
275 $this->testSequence->resetTrackedQuestionList();
276 $this->testSequence->saveToDb();
278 $this->ctrl->redirect($this,
'showQuestionSelection');
283 if( !$this->dynamicQuestionSetConfig->isPreviousQuestionsListEnabled() )
285 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION);
290 $questionId = $this->testSession->getCurrentQuestionId();
298 $this->testSequence->unsetQuestionPostponed($questionId);
301 $this->testSequence->loadQuestions(
302 $this->dynamicQuestionSetConfig, $this->testSession->getQuestionSetFilterSelection()
305 $this->testSequence->cleanupQuestions($this->testSession);
307 $this->testSequence->saveToDb();
310 $this->testSequence->getTrackedQuestionList( $this->testSession->getCurrentQuestionId() ),
314 include_once
"./Modules/Test/classes/tables/class.ilTrackedQuestionsTableGUI.php";
316 $this,
'showTrackedQuestionList', $this->object->getSequenceSettings(), $this->
object->getShowMarker()
321 $this->tpl->setVariable(
'TABLE_LIST_OF_QUESTIONS', $table_gui->getHTML());
323 if( $this->object->getEnableProcessingTime() )
337 $this->ctrl->redirect($this,
'showQuestion');
342 $questionId = $this->testSession->getCurrentQuestionId();
350 $this->testSequence->unsetQuestionPostponed($questionId);
351 $this->testSequence->saveToDb();
356 $this->ctrl->redirect($this,
'showQuestion');
361 $questionId = $this->testSession->getCurrentQuestionId();
369 $this->testSequence->setQuestionPostponed($questionId);
372 $this->testSession->setCurrentQuestionId(null);
374 $this->testSequence->saveToDb();
375 $this->testSession->saveToDb();
377 $this->ctrl->redirect($this,
'showQuestion');
382 $questionId = $this->testSession->getCurrentQuestionId();
390 $this->testSequence->unsetQuestionPostponed($questionId);
391 $this->testSequence->saveToDb();
395 $this->
object->setQuestionSetSolved(1, $this->testSession->getCurrentQuestionId(), $ilUser->getId());
397 $this->ctrl->redirect($this,
'showQuestion');
402 $questionId = $this->testSession->getCurrentQuestionId();
410 $this->testSequence->unsetQuestionPostponed($questionId);
411 $this->testSequence->saveToDb();
415 $this->
object->setQuestionSetSolved(0, $this->testSession->getCurrentQuestionId(), $ilUser->getId());
417 $this->ctrl->redirect($this,
'showQuestion');
422 $this->testSequence->loadQuestions(
423 $this->dynamicQuestionSetConfig, $this->testSession->getQuestionSetFilterSelection()
426 $this->testSequence->cleanupQuestions($this->testSession);
428 if( isset(
$_GET[
'sequence']) && (
int)
$_GET[
'sequence'] )
430 $this->testSession->setCurrentQuestionId( (
int)$_GET[
'sequence'] );
431 $this->testSession->saveToDb();
433 $this->ctrl->setParameter(
434 $this,
'sequence', $this->testSession->getCurrentQuestionId()
438 $this->ctrl->redirect($this,
'showQuestion');
445 $this->testSequence->loadQuestions(
446 $this->dynamicQuestionSetConfig, $this->testSession->getQuestionSetFilterSelection()
449 $this->testSequence->cleanupQuestions($this->testSession);
451 if( !$this->testSession->getCurrentQuestionId() )
453 $this->testSession->setCurrentQuestionId(
454 $this->testSequence->getUpcomingQuestionId()
458 if( $this->testSession->getCurrentQuestionId() )
460 $this->ctrl->setParameter(
461 $this,
'sequence', $this->testSession->getCurrentQuestionId()
471 $this->testSequence->saveToDb();
472 $this->testSession->saveToDb();
477 $questionId = $this->testSession->getCurrentQuestionId();
485 $this->testSequence->unsetQuestionPostponed($questionId);
490 $filterSelection = $this->testSession->getQuestionSetFilterSelection();
492 $filterSelection->setForcedQuestionIds(array($this->testSession->getCurrentQuestionId()));
494 $this->testSequence->loadQuestions($this->dynamicQuestionSetConfig, $filterSelection);
496 $this->testSequence->cleanupQuestions($this->testSession);
498 $this->ctrl->setParameter(
499 $this,
'sequence', $this->testSession->getCurrentQuestionId()
504 $this->testSequence->saveToDb();
505 $this->testSession->saveToDb();
510 $questionId = $this->testSession->getCurrentQuestionId();
518 $this->testSequence->unsetQuestionPostponed($questionId);
519 $this->testSequence->saveToDb();
522 $this->ctrl->setParameter(
523 $this,
'sequence', $this->testSession->getCurrentQuestionId()
526 $this->ctrl->redirect($this,
'showQuestion');
536 $_SESSION[
"active_time_id"] = $this->
object->startWorkingTime(
537 $this->testSession->getActiveId(), $this->testSession->getPass()
543 $question_gui = $this->
object->createQuestionGUI(
544 "", $this->testSession->getCurrentQuestionId()
547 if( !is_object($question_gui) )
552 "INV SEQ: active={$this->testSession->getActiveId()} qId={$this->testSession->getCurrentQuestionId()} "
553 .serialize($this->testSequence)
556 $ilLog->logStack(
'INV SEQ');
559 $this->ctrl->redirect($this,
'showQuestion');
562 $question_gui->setTargetGui($this);
564 $question_gui->setQuestionCount(
565 $this->testSequence->getLastPositionIndex()
567 $question_gui->setSequenceNumber( $this->testSequence->getCurrentPositionIndex(
568 $this->testSession->getCurrentQuestionId()
571 $this->ctrl->setParameter($this,
'sequence', $this->testSession->getCurrentQuestionId());
573 if ($this->object->getJavaScriptOutput())
578 $is_postponed = $this->testSequence->isPostponedQuestion($question_gui->object->getId());
579 $formaction = $this->ctrl->getFormAction($this);
582 $user_post_solution = FALSE;
585 $user_post_solution =
$_SESSION[
'previouspost'];
589 global $ilNavigationHistory;
590 $ilNavigationHistory->addItem(
$_GET[
"ref_id"], $this->ctrl->getLinkTarget($this,
"resumePlayer"),
"tst");
595 $answer_feedback = FALSE;
596 if (($directfeedback) && ($this->
object->getSpecificAnswerFeedback()))
598 $answer_feedback = TRUE;
603 $question_gui->outQuestionForTest(
604 $formaction, #form_action
605 $this->testSession->getActiveId(), #active_id
607 $is_postponed, #is_postponed
608 $user_post_solution, #user_post_solution
609 $answer_feedback #answer_feedback == inline_specific_feedback
622 if ($this->object->getInstantFeedbackSolution())
627 $solutionoutput = $question_gui->getSolutionOutput(
628 $this->testSession->getActiveId(), #active_id
630 TRUE, #graphical_output
631 $show_question_inline_score, #result_output
632 FALSE, #show_question_only
633 FALSE, #show_feedback
634 TRUE, #show_correct_solution
635 FALSE, #show_manual_scoring
636 FALSE #show_question_text
643 if ($this->object->getAnswerFeedbackPoints())
645 $reachedPoints = $question_gui->object->getAdjustedReachedPoints($this->testSession->getActiveId(), NULL);
646 $maxPoints = $question_gui->object->getMaximumPoints();
653 if ($this->object->getGenericAnswerFeedback())
660 if ($this->object->getSpecificAnswerFeedback())
668 if( $postpone_allowed )
673 if ($this->object->getShowCancel())
680 if ($this->object->getListOfQuestionsEnd())
694 if( $this->dynamicQuestionSetConfig->isTaxonomyFilterEnabled() )
699 if ($this->object->getShowMarker())
701 include_once
"./Modules/Test/classes/class.ilObjTest.php";
705 if (count ($solved_array) > 0)
707 $solved = array_pop($solved_array);
708 $solved = $solved[
"solved"];
723 if ($this->object->getJavaScriptOutput())
726 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"disable_javascript"));
727 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"disable_javascript"));
728 $this->ctrl->setParameter($this,
"tst_javascript",
"0");
729 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
734 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"enable_javascript"));
735 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"enable_javascript"));
736 $this->ctrl->setParameter($this,
"tst_javascript",
"1");
737 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
740 if ($question_gui->object->supportsJavascriptOutput())
742 $this->tpl->touchBlock(
"jsswitch");
747 $this->tpl->setVariable(
"AUTOSAVE_URL", $this->ctrl->getFormAction($this,
"autosave",
"",
true));
749 if ($question_gui->isAutosaveable()&& $this->
object->getAutosave())
751 $this->tpl->touchBlock(
'autosave');
755 $this->tpl->setVariable(
"AUTOSAVEFORMACTION", str_replace(
"&",
"&", $this->ctrl->getLinkTarget($this,
"autosave")));
756 $this->tpl->setVariable(
"AUTOSAVEINTERVAL", $this->object->getAutosaveIval());
761 $this->tpl->touchBlock(
'question_obligatory');
762 $this->tpl->setVariable(
'QUESTION_OBLIGATORY', $this->lng->txt(
'required_field'));
772 if ($this->object->getKioskMode())
777 if ($this->object->getEnableProcessingTime())
782 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
783 $this->tpl->setVariable(
"FORM_TIMESTAMP", time());
785 $this->tpl->setVariable(
"PAGETITLE",
"- " . $this->object->getTitle());
787 if ($this->object->isShowExamIdInTestPassEnabled() && !$this->
object->getKioskMode())
789 $this->tpl->setCurrentBlock(
'exam_id');
791 $this->testSession->getActiveId(), $this->testSession->getPass(), $this->
object->getId()
793 $this->tpl->setVariable(
'EXAM_ID_TXT', $this->lng->txt(
'exam_id'));
794 $this->tpl->parseCurrentBlock();
797 if ($this->object->getShowCancel())
802 if( $this->dynamicQuestionSetConfig->isTaxonomyFilterEnabled() )
807 if( $this->testSequence->openQuestionExists() )
809 $message = $this->lng->txt(
'tst_dyn_test_msg_currently_finished_selection');
813 $message = $this->lng->txt(
'tst_dyn_test_msg_currently_finished_completely');
814 $message .=
"<br /><br />{$this->buildFinishPagePassDeletionLink()}";
817 $msgHtml = $this->tpl->getMessageHTML($message);
819 $this->tpl->addBlockFile(
820 'QUESTION_OUTPUT',
'test_currently_finished_msg_block',
821 'tpl.test_currently_finished_msg.html',
'Modules/Test'
824 $this->tpl->setCurrentBlock(
'test_currently_finished_msg_block');
825 $this->tpl->setVariable(
'TEST_CURRENTLY_FINISHED_MSG', $msgHtml);
826 $this->tpl->parseCurrentBlock();
832 return !$this->testSequence->trackedQuestionExists();
844 if( isset(
$_GET[
'tst_javascript']) )
846 $ilUser->writePref(
'tst_javascript',
$_GET[
'tst_javascript']);
857 return !$this->
object->endingTimeReached();
868 $formtimestamp =
$_POST[
"formtimestamp"];
869 if (strlen($formtimestamp) == 0) $formtimestamp =
$_GET[
"formtimestamp"];
870 if ($formtimestamp !=
$_SESSION[
"formtimestamp"])
872 $_SESSION[
"formtimestamp"] = $formtimestamp;
882 $qId = $this->testSession->getCurrentQuestionId();
884 if( !$qId || $qId !=
$_GET[
"sequence"])
891 $this->saveResult = FALSE;
897 $questionGUI = $this->
object->createQuestionGUI(
"", $qId);
899 if( $this->object->getJavaScriptOutput() )
904 $activeId = $this->testSession->getActiveId();
906 $this->saveResult = $questionGUI->object->persistWorkingState(
907 $activeId,
$pass = null, $this->object->areObligationsEnabled()
911 if ($this->saveResult == FALSE)
913 $this->ctrl->setParameter($this,
"save_error",
"1");
922 $questionGUI = $this->
object->createQuestionGUI(
"", $questionId);
925 $maxPoints = $questionGUI->object->getMaximumPoints();
927 if($reachedPoints < $maxPoints)
938 if( !$this->dynamicQuestionSetConfig->isPreviousQuestionsListEnabled() )
949 'showTrackedQuestionList',
"<< " . $this->lng->txt(
"save_previous" )
952 'showTrackedQuestionList',
"<< " . $this->lng->txt(
"save_previous" )
960 foreach($questions as $key => $value )
962 $this->ctrl->setParameter($this,
'sequence', $value[
'question_id']);
963 $href = $this->ctrl->getLinkTarget($this,
'gotoQuestion');
964 $this->ctrl->setParameter($this,
'sequence',
'');
967 if( $this->object->getListOfQuestionsDescription() )
969 $description = $value[
"description"];
973 if( count($marked_questions) )
975 if( isset($marked_questions[$value[
"question_id"]]) )
977 if( $marked_questions[$value[
"question_id"]][
"solved"] == 1 )
984 array_push($data, array(
986 'title' => $this->object->getQuestionTitle($value[
"title"]),
987 'description' => $description,
988 'worked_through' => $this->testSequence->isAnsweredQuestion($value[
"question_id"]),
989 'postponed' => $this->testSequence->isPostponedQuestion($value[
"question_id"]),
999 $questionAnswerStats = array(
1000 'total_all' => count($questions),
1002 'non_answered' => 0,
1003 'wrong_answered' => 0,
1004 'correct_answered' => 0,
1009 foreach($questions as $key => $value )
1011 switch( $value[
'question_answer_status'] )
1014 $questionAnswerStats[
'non_answered']++;
1015 $questionAnswerStats[
'total_open']++;
1018 $questionAnswerStats[
'wrong_answered']++;
1019 $questionAnswerStats[
'total_open']++;
1022 $questionAnswerStats[
'correct_answered']++;
1026 if( $this->testSequence->isPostponedQuestion($value[
"question_id"]) )
1028 $questionAnswerStats[
'postponed']++;
1031 if( isset($marked_questions[$value[
"question_id"]]) )
1033 if( $marked_questions[$value[
"question_id"]][
"solved"] == 1 )
1035 $questionAnswerStats[
'marked']++;
1040 return $questionAnswerStats;
1045 require_once
'Modules/Test/classes/tables/class.ilTestDynamicQuestionSetStatisticTableGUI.php';
1050 $gui->initTitle(
'tst_dynamic_question_set_complete');
1051 $gui->initColumns(
'tst_num_all_questions');
1058 require_once
'Modules/Test/classes/tables/class.ilTestDynamicQuestionSetStatisticTableGUI.php';
1063 $gui->initTitle(
'tst_dynamic_question_set_selection');
1064 $gui->initColumns(
'tst_num_selected_questions');
1066 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1068 $this->dynamicQuestionSetConfig->getSourceQuestionPoolId()
1072 $gui->setFilterCommand(
'filterQuestionSelection');
1073 $gui->setResetCommand(
'resetQuestionSelection');
1080 require_once
'Modules/Test/classes/tables/class.ilTestDynamicQuestionSetStatisticTableGUI.php';
1082 $this->ctrl, $this->lng, $this,
'showQuestionSelection', $tableId
1085 $gui->setShowNumMarkedQuestionsEnabled($this->object->getShowMarker());
1086 $gui->setShowNumPostponedQuestionsEnabled($this->object->getSequenceSettings());
1093 if( $this->testSequence->trackedQuestionExists() )
1095 return $this->lng->txt(
'tst_resume_dyn_test_with_cur_quest_sel');
1098 return $this->lng->txt(
'tst_start_dyn_test_with_cur_quest_sel');
1103 $questionId = $this->testSession->getCurrentQuestionId();
1104 $activeId = $this->testSession->getActiveId();
1105 $pass = $this->testSession->getPass();
1109 $this->testSequence->setQuestionAnsweredCorrect($questionId);
1113 $this->testSequence->setQuestionAnsweredWrong($questionId);
1119 $this->testSession->setCurrentQuestionId(null);
1121 $this->testSequence->saveToDb();
1122 $this->testSession->saveToDb();
1124 $this->ctrl->setParameter($this,
'sequence', $this->testSession->getCurrentQuestionId());
1134 $label = $this->lng->txt(
'tst_dyn_test_msg_pass_deletion_link');
1136 return "<a href=\"{$href}\">{$label}</a>";
1144 require_once
'Modules/Test/classes/confirmations/class.ilTestPassDeletionConfirmationGUI.php';
1147 $this->ctrl->setParameterByClass(
'ilTestEvaluationGUI',
'active_id', $this->testSession->getActiveId());
1148 $this->ctrl->setParameterByClass(
'ilTestEvaluationGUI',
'pass', $this->testSession->getPass());
1150 return $this->ctrl->getLinkTargetByClass(
'ilTestEvaluationGUI',
'confirmDeletePass');