4 require_once
'Modules/Test/classes/class.ilTestPlayerAbstractGUI.php';
58 $ilTabs->clearTargets();
60 $this->ctrl->saveParameter($this,
"sequence");
61 $this->ctrl->saveParameter($this,
"active_id");
63 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
65 $this->dynamicQuestionSetConfig->loadFromDb();
74 $this->testSequence = $testSequenceFactory->getSequence($this->testSession);
75 $this->testSequence->loadFromDb();
77 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
79 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
81 if( $this->object->getKioskMode() )
83 include_once
'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
89 $cmd = $this->ctrl->getCmd();
90 $nextClass = $this->ctrl->getNextClass($this);
94 case 'ilassquestionpagegui':
96 $questionId = $this->testSequence->getQuestionForSequence( $this->
calculateSequence() );
98 require_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
100 $ret = $this->ctrl->forwardCommand($page_gui);
103 case 'ilassquestionhintrequestgui':
105 $questionGUI = $this->
object->createQuestionGUI(
106 "", $this->testSequenceFactory->getSequence()->getQuestionForSequence( $this->
calculateSequence() )
109 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
112 $this->ctrl->forwardCommand($gui);
116 case 'ildynamicquestionsetstatistictablegui':
122 case 'iltestpasswordprotectiongui':
123 require_once
'Modules/Test/classes/class.ilTestPasswordProtectionGUI.php';
125 $ret = $this->ctrl->forwardCommand($gui);
143 if ($this->object->checkMaximumAllowedUsers() == FALSE)
150 if( $this->dynamicQuestionSetConfig->isAnyQuestionFilterEnabled() )
152 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION_SELECTION);
155 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION);
162 $this->testSession->setCurrentQuestionId(null);
164 $this->testSession->saveToDb();
166 $this->ctrl->setParameter($this,
'active_id', $this->testSession->getActiveId());
168 assQuestion::_updateTestPassResults($this->testSession->getActiveId(), $this->testSession->getPass(),
false, null, $this->
object->id);
170 $_SESSION[
'active_time_id'] = $this->
object->startWorkingTime(
171 $this->testSession->getActiveId(), $this->testSession->getPass()
174 $this->ctrl->saveParameter($this,
'tst_javascript');
176 if( $this->dynamicQuestionSetConfig->isAnyQuestionFilterEnabled() )
178 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION_SELECTION);
181 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION);
188 $questionId = $this->testSession->getCurrentQuestionId();
196 $this->testSequence->unsetQuestionPostponed($questionId);
199 $this->testSequence->loadQuestions(
200 $this->dynamicQuestionSetConfig, $this->testSession->getQuestionSetFilterSelection()
203 $this->testSequence->cleanupQuestions($this->testSession);
205 $this->testSequence->saveToDb();
207 require_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
210 $toolbarGUI->addButton(
212 '',
'',
'',
'',
'submit emphsubmit'
215 if( $this->object->isPassDeletionAllowed() )
217 require_once
'Modules/Test/classes/confirmations/class.ilTestPassDeletionConfirmationGUI.php';
219 $toolbarGUI->addButton(
220 $this->lng->txt(
'tst_dyn_test_pass_deletion_button'),
227 )); #
vd($filteredData);
229 $filteredTableGUI->setData($filteredData);
233 )); #
vd($completeData);
235 $completeTableGUI->setData($completeData);
237 $content = $this->ctrl->getHTML($toolbarGUI);
238 $content .= $this->ctrl->getHTML($filteredTableGUI);
239 $content .= $this->ctrl->getHTML($completeTableGUI);
241 $this->tpl->setVariable(
'TABLE_LIST_OF_QUESTIONS', $content);
243 if( $this->object->getEnableProcessingTime() )
252 $tableGUI->writeFilterToSession();
254 $taxFilterSelection = array();
257 foreach( $tableGUI->getFilterItems() as $item )
259 if( strpos($item->getPostVar(),
'tax_') !==
false )
261 $taxId = substr( $item->getPostVar(), strlen(
'tax_') );
262 $taxFilterSelection[$taxId] = $item->getValue();
264 elseif( $item->getPostVar() ==
'question_answer_status' )
266 $answerStatusFilterSelection = $item->getValue();
270 $this->testSession->getQuestionSetFilterSelection()->setTaxonomySelection($taxFilterSelection);
271 $this->testSession->getQuestionSetFilterSelection()->setAnswerStatusSelection($answerStatusFilterSelection);
272 $this->testSession->saveToDb();
274 $this->testSequence->resetTrackedQuestionList();
275 $this->testSequence->saveToDb();
277 $this->ctrl->redirect($this,
'showQuestionSelection');
283 $tableGUI->resetFilter();
285 $this->testSession->getQuestionSetFilterSelection()->setTaxonomySelection( array() );
286 $this->testSession->getQuestionSetFilterSelection()->setAnswerStatusSelection( null );
287 $this->testSession->saveToDb();
289 $this->testSequence->resetTrackedQuestionList();
290 $this->testSequence->saveToDb();
292 $this->ctrl->redirect($this,
'showQuestionSelection');
297 if( !$this->dynamicQuestionSetConfig->isPreviousQuestionsListEnabled() )
299 $this->ctrl->redirect($this, self::CMD_SHOW_QUESTION);
304 $questionId = $this->testSession->getCurrentQuestionId();
312 $this->testSequence->unsetQuestionPostponed($questionId);
315 $this->testSequence->loadQuestions(
316 $this->dynamicQuestionSetConfig, $this->testSession->getQuestionSetFilterSelection()
319 $this->testSequence->cleanupQuestions($this->testSession);
321 $this->testSequence->saveToDb();
324 $this->testSequence->getTrackedQuestionList( $this->testSession->getCurrentQuestionId() ),
328 include_once
"./Modules/Test/classes/tables/class.ilTrackedQuestionsTableGUI.php";
330 $this,
'showTrackedQuestionList', $this->object->getSequenceSettings(), $this->
object->getShowMarker()
335 $this->tpl->setVariable(
'TABLE_LIST_OF_QUESTIONS', $table_gui->getHTML());
337 if( $this->object->getEnableProcessingTime() )
351 $this->ctrl->redirect($this,
'showQuestion');
356 $questionId = $this->testSession->getCurrentQuestionId();
364 $this->testSequence->unsetQuestionPostponed($questionId);
365 $this->testSequence->saveToDb();
370 $this->ctrl->redirect($this,
'showQuestion');
375 $questionId = $this->testSession->getCurrentQuestionId();
383 $this->testSequence->setQuestionPostponed($questionId);
386 $this->testSession->setCurrentQuestionId(null);
388 $this->testSequence->saveToDb();
389 $this->testSession->saveToDb();
391 $this->ctrl->redirect($this,
'showQuestion');
396 $questionId = $this->testSession->getCurrentQuestionId();
404 $this->testSequence->unsetQuestionPostponed($questionId);
405 $this->testSequence->saveToDb();
409 $this->
object->setQuestionSetSolved(1, $this->testSession->getCurrentQuestionId(), $ilUser->getId());
411 $this->ctrl->redirect($this,
'showQuestion');
416 $questionId = $this->testSession->getCurrentQuestionId();
424 $this->testSequence->unsetQuestionPostponed($questionId);
425 $this->testSequence->saveToDb();
429 $this->
object->setQuestionSetSolved(0, $this->testSession->getCurrentQuestionId(), $ilUser->getId());
431 $this->ctrl->redirect($this,
'showQuestion');
436 $this->testSequence->loadQuestions(
437 $this->dynamicQuestionSetConfig, $this->testSession->getQuestionSetFilterSelection()
440 $this->testSequence->cleanupQuestions($this->testSession);
442 if( isset(
$_GET[
'sequence']) && (
int)
$_GET[
'sequence'] )
444 $this->testSession->setCurrentQuestionId( (
int)$_GET[
'sequence'] );
445 $this->testSession->saveToDb();
447 $this->ctrl->setParameter(
448 $this,
'sequence', $this->testSession->getCurrentQuestionId()
452 $this->ctrl->redirect($this,
'showQuestion');
459 $this->testSequence->loadQuestions(
460 $this->dynamicQuestionSetConfig, $this->testSession->getQuestionSetFilterSelection()
463 $this->testSequence->cleanupQuestions($this->testSession);
465 if( !$this->testSession->getCurrentQuestionId() )
467 $upComingQuestionId = $this->testSequence->getUpcomingQuestionId();
469 $this->testSession->setCurrentQuestionId($upComingQuestionId);
471 if( $this->testSequence->isQuestionChecked($upComingQuestionId) )
473 $this->testSequence->setQuestionUnchecked($upComingQuestionId);
477 if( $this->testSession->getCurrentQuestionId() )
479 $this->ctrl->setParameter(
480 $this,
'sequence', $this->testSession->getCurrentQuestionId()
490 $this->testSequence->saveToDb();
491 $this->testSession->saveToDb();
496 $questionId = $this->testSession->getCurrentQuestionId();
504 $this->testSequence->unsetQuestionPostponed($questionId);
505 $this->testSequence->setQuestionChecked($questionId);
510 $filterSelection = $this->testSession->getQuestionSetFilterSelection();
512 $filterSelection->setForcedQuestionIds(array($this->testSession->getCurrentQuestionId()));
514 $this->testSequence->loadQuestions($this->dynamicQuestionSetConfig, $filterSelection);
516 $this->testSequence->cleanupQuestions($this->testSession);
518 $this->ctrl->setParameter(
519 $this,
'sequence', $this->testSession->getCurrentQuestionId()
524 $this->testSequence->saveToDb();
525 $this->testSession->saveToDb();
530 $questionId = $this->testSession->getCurrentQuestionId();
538 $this->testSequence->unsetQuestionPostponed($questionId);
539 $this->testSequence->saveToDb();
542 $this->ctrl->setParameter(
543 $this,
'sequence', $this->testSession->getCurrentQuestionId()
546 $this->ctrl->redirect($this,
'showQuestion');
556 $_SESSION[
"active_time_id"] = $this->
object->startWorkingTime(
557 $this->testSession->getActiveId(), $this->testSession->getPass()
563 $question_gui = $this->
object->createQuestionGUI(
564 "", $this->testSession->getCurrentQuestionId()
567 if( !is_object($question_gui) )
572 "INV SEQ: active={$this->testSession->getActiveId()} qId={$this->testSession->getCurrentQuestionId()} "
573 .serialize($this->testSequence)
576 $ilLog->logStack(
'INV SEQ');
579 $this->ctrl->redirect($this,
'showQuestion');
582 $question_gui->setTargetGui($this);
584 $question_gui->setQuestionCount(
585 $this->testSequence->getLastPositionIndex()
587 $question_gui->setSequenceNumber( $this->testSequence->getCurrentPositionIndex(
588 $this->testSession->getCurrentQuestionId()
591 $this->ctrl->setParameter($this,
'sequence', $this->testSession->getCurrentQuestionId());
593 if ($this->object->getJavaScriptOutput())
598 $is_postponed = $this->testSequence->isPostponedQuestion($question_gui->object->getId());
599 $formaction = $this->ctrl->getFormAction($this);
602 $user_post_solution = FALSE;
605 $user_post_solution =
$_SESSION[
'previouspost'];
609 global $ilNavigationHistory;
610 $ilNavigationHistory->addItem(
$_GET[
"ref_id"], $this->ctrl->getLinkTarget($this,
"resumePlayer"),
"tst");
615 $answer_feedback = FALSE;
616 if (($directfeedback) && ($this->
object->getSpecificAnswerFeedback()))
618 $answer_feedback = TRUE;
623 $solutionoutput = $question_gui->getSolutionOutput(
624 $this->testSession->getActiveId(), #active_id
626 FALSE, #graphical_output
627 false, #result_output
628 true, #show_question_only
629 $answer_feedback, #show_feedback
630 false, #show_correct_solution
631 FALSE, #show_manual_scoring
632 true #show_question_text
635 $pageoutput = $question_gui->outQuestionPage(
636 "", $this->testSequence->isPostponedQuestion($this->testSession->getCurrentQuestionId()),
637 $this->testSession->getActiveId(),
641 $this->tpl->setVariable(
"QUESTION_OUTPUT", $pageoutput);
642 $this->tpl->setVariable(
"FORMACTION", $formaction);
644 $directfeedback =
true;
650 $question_gui->outQuestionForTest(
651 $formaction, #form_action
652 $this->testSession->getActiveId(), #active_id
654 $is_postponed, #is_postponed
655 $user_post_solution, #user_post_solution
656 $answer_feedback #answer_feedback == inline_specific_feedback
670 if ($this->object->getInstantFeedbackSolution())
675 $solutionoutput = $question_gui->getSolutionOutput(
676 $this->testSession->getActiveId(), #active_id
678 TRUE, #graphical_output
679 $show_question_inline_score, #result_output
680 FALSE, #show_question_only
681 FALSE, #show_feedback
682 TRUE, #show_correct_solution
683 FALSE, #show_manual_scoring
684 FALSE #show_question_text
691 if ($this->object->getAnswerFeedbackPoints())
693 $reachedPoints = $question_gui->object->getAdjustedReachedPoints($this->testSession->getActiveId(), NULL);
694 $maxPoints = $question_gui->object->getMaximumPoints();
701 if ($this->object->getGenericAnswerFeedback())
708 if ($this->object->getSpecificAnswerFeedback())
716 if( $postpone_allowed )
721 if ($this->object->getShowCancel())
728 if ($this->object->getListOfQuestionsEnd())
742 if( $this->dynamicQuestionSetConfig->isAnyQuestionFilterEnabled() )
747 if ($this->object->getShowMarker())
749 include_once
"./Modules/Test/classes/class.ilObjTest.php";
753 if (count ($solved_array) > 0)
755 $solved = array_pop($solved_array);
756 $solved = $solved[
"solved"];
771 if ($this->object->getJavaScriptOutput())
773 $this->tpl->setVariable(
"JAVASCRIPT_TITLE", $this->lng->txt(
"disable_javascript"));
774 $this->ctrl->setParameter($this,
"tst_javascript",
"0");
775 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
779 $this->tpl->setVariable(
"JAVASCRIPT_TITLE", $this->lng->txt(
"enable_javascript"));
780 $this->ctrl->setParameter($this,
"tst_javascript",
"1");
781 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
784 if ($question_gui->object->supportsJavascriptOutput())
786 $this->tpl->touchBlock(
"jsswitch");
791 $this->tpl->setVariable(
"AUTOSAVE_URL", $this->ctrl->getFormAction($this,
"autosave",
"",
true));
793 if ($question_gui->isAutosaveable()&& $this->
object->getAutosave())
795 $this->tpl->touchBlock(
'autosave');
799 $this->tpl->setVariable(
"AUTOSAVEFORMACTION", str_replace(
"&",
"&", $this->ctrl->getLinkTarget($this,
"autosave")));
800 $this->tpl->setVariable(
"AUTOSAVEINTERVAL", $this->object->getAutosaveIval());
805 $this->tpl->touchBlock(
'question_obligatory');
806 $this->tpl->setVariable(
'QUESTION_OBLIGATORY', $this->lng->txt(
'required_field'));
816 if ($this->object->getKioskMode())
821 if ($this->object->getEnableProcessingTime())
826 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
827 $this->tpl->setVariable(
"FORM_TIMESTAMP", time());
829 $this->tpl->setVariable(
"PAGETITLE",
"- " . $this->object->getTitle());
831 if ($this->object->isShowExamIdInTestPassEnabled() && !$this->
object->getKioskMode())
833 $this->tpl->setCurrentBlock(
'exam_id');
835 $this->testSession->getActiveId(), $this->testSession->getPass(), $this->
object->getId()
837 $this->tpl->setVariable(
'EXAM_ID_TXT', $this->lng->txt(
'exam_id'));
838 $this->tpl->parseCurrentBlock();
841 if ($this->object->getShowCancel())
846 if( $this->dynamicQuestionSetConfig->isAnyQuestionFilterEnabled() )
851 if( $this->testSequence->openQuestionExists() )
853 $message = $this->lng->txt(
'tst_dyn_test_msg_currently_finished_selection');
857 $message = $this->lng->txt(
'tst_dyn_test_msg_currently_finished_completely');
858 $message .=
"<br /><br />{$this->buildFinishPagePassDeletionLink()}";
861 $msgHtml = $this->tpl->getMessageHTML($message);
863 $this->tpl->addBlockFile(
864 'QUESTION_OUTPUT',
'test_currently_finished_msg_block',
865 'tpl.test_currently_finished_msg.html',
'Modules/Test'
868 $this->tpl->setCurrentBlock(
'test_currently_finished_msg_block');
869 $this->tpl->setVariable(
'TEST_CURRENTLY_FINISHED_MSG', $msgHtml);
870 $this->tpl->parseCurrentBlock();
876 return !$this->testSequence->trackedQuestionExists();
888 if( isset(
$_GET[
'tst_javascript']) )
890 $ilUser->writePref(
'tst_javascript',
$_GET[
'tst_javascript']);
901 return !$this->
object->endingTimeReached();
912 $formtimestamp =
$_POST[
"formtimestamp"];
913 if (strlen($formtimestamp) == 0) $formtimestamp =
$_GET[
"formtimestamp"];
914 if ($formtimestamp !=
$_SESSION[
"formtimestamp"])
916 $_SESSION[
"formtimestamp"] = $formtimestamp;
926 $qId = $this->testSession->getCurrentQuestionId();
928 if( !$qId || $qId !=
$_GET[
"sequence"])
935 $this->saveResult = FALSE;
941 $questionGUI = $this->
object->createQuestionGUI(
"", $qId);
943 if( $this->object->getJavaScriptOutput() )
948 $activeId = $this->testSession->getActiveId();
950 $this->saveResult = $questionGUI->object->persistWorkingState(
951 $activeId,
$pass = null, $this->object->areObligationsEnabled()
955 if ($this->saveResult == FALSE)
957 $this->ctrl->setParameter($this,
"save_error",
"1");
966 $questionGUI = $this->
object->createQuestionGUI(
"", $questionId);
969 $maxPoints = $questionGUI->object->getMaximumPoints();
971 if($reachedPoints < $maxPoints)
982 if( !$this->dynamicQuestionSetConfig->isPreviousQuestionsListEnabled() )
993 'showTrackedQuestionList',
"<< " . $this->lng->txt(
"save_previous" )
996 'showTrackedQuestionList',
"<< " . $this->lng->txt(
"save_previous" )
1004 foreach($questions as $key => $value )
1006 $this->ctrl->setParameter($this,
'sequence', $value[
'question_id']);
1007 $href = $this->ctrl->getLinkTarget($this,
'gotoQuestion');
1008 $this->ctrl->setParameter($this,
'sequence',
'');
1011 if( $this->object->getListOfQuestionsDescription() )
1013 $description = $value[
"description"];
1017 if( count($marked_questions) )
1019 if( isset($marked_questions[$value[
"question_id"]]) )
1021 if( $marked_questions[$value[
"question_id"]][
"solved"] == 1 )
1028 array_push($data, array(
1030 'title' => $this->object->getQuestionTitle($value[
"title"]),
1031 'description' => $description,
1032 'worked_through' => $this->testSequence->isAnsweredQuestion($value[
"question_id"]),
1033 'postponed' => $this->testSequence->isPostponedQuestion($value[
"question_id"]),
1043 $questionAnswerStats = array(
1044 'total_all' => count($questions),
1046 'non_answered' => 0,
1047 'wrong_answered' => 0,
1048 'correct_answered' => 0,
1053 foreach($questions as $key => $value )
1055 switch( $value[
'question_answer_status'] )
1058 $questionAnswerStats[
'non_answered']++;
1059 $questionAnswerStats[
'total_open']++;
1062 $questionAnswerStats[
'wrong_answered']++;
1063 $questionAnswerStats[
'total_open']++;
1066 $questionAnswerStats[
'correct_answered']++;
1070 if( $this->testSequence->isPostponedQuestion($value[
"question_id"]) )
1072 $questionAnswerStats[
'postponed']++;
1075 if( isset($marked_questions[$value[
"question_id"]]) )
1077 if( $marked_questions[$value[
"question_id"]][
"solved"] == 1 )
1079 $questionAnswerStats[
'marked']++;
1084 return $questionAnswerStats;
1089 require_once
'Modules/Test/classes/tables/class.ilTestDynamicQuestionSetStatisticTableGUI.php';
1094 $gui->initTitle(
'tst_dynamic_question_set_complete');
1095 $gui->initColumns(
'tst_num_all_questions');
1102 require_once
'Modules/Test/classes/tables/class.ilTestDynamicQuestionSetStatisticTableGUI.php';
1107 $gui->initTitle(
'tst_dynamic_question_set_selection');
1108 $gui->initColumns(
'tst_num_selected_questions');
1110 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1112 $this->dynamicQuestionSetConfig->getSourceQuestionPoolId()
1115 $gui->setTaxonomyFilterEnabled($this->dynamicQuestionSetConfig->isTaxonomyFilterEnabled());
1116 $gui->setAnswerStatusFilterEnabled($this->dynamicQuestionSetConfig->isAnswerStatusFilterEnabled());
1119 $gui->setFilterCommand(
'filterQuestionSelection');
1120 $gui->setResetCommand(
'resetQuestionSelection');
1127 require_once
'Modules/Test/classes/tables/class.ilTestDynamicQuestionSetStatisticTableGUI.php';
1129 $this->ctrl, $this->lng, $this,
'showQuestionSelection', $tableId
1132 $gui->setShowNumMarkedQuestionsEnabled($this->object->getShowMarker());
1133 $gui->setShowNumPostponedQuestionsEnabled($this->object->getSequenceSettings());
1140 if( $this->testSequence->trackedQuestionExists() )
1142 return $this->lng->txt(
'tst_resume_dyn_test_with_cur_quest_sel');
1145 return $this->lng->txt(
'tst_start_dyn_test_with_cur_quest_sel');
1150 $questionId = $this->testSession->getCurrentQuestionId();
1151 $activeId = $this->testSession->getActiveId();
1152 $pass = $this->testSession->getPass();
1156 $this->testSequence->setQuestionAnsweredCorrect($questionId);
1160 $this->testSequence->setQuestionAnsweredWrong($questionId);
1166 $this->testSession->setCurrentQuestionId(null);
1168 $this->testSequence->saveToDb();
1169 $this->testSession->saveToDb();
1171 $this->ctrl->setParameter($this,
'sequence', $this->testSession->getCurrentQuestionId());
1181 $label = $this->lng->txt(
'tst_dyn_test_msg_pass_deletion_link');
1183 return "<a href=\"{$href}\">{$label}</a>";
1191 require_once
'Modules/Test/classes/confirmations/class.ilTestPassDeletionConfirmationGUI.php';
1194 $this->ctrl->setParameterByClass(
'ilTestEvaluationGUI',
'active_id', $this->testSession->getActiveId());
1195 $this->ctrl->setParameterByClass(
'ilTestEvaluationGUI',
'pass', $this->testSession->getPass());
1197 return $this->ctrl->getLinkTargetByClass(
'ilTestEvaluationGUI',
'confirmDeletePass');