4 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
5 require_once
'./Modules/Test/classes/class.ilTestServiceGUI.php';
6 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
7 require_once
'./Services/UIComponent/Button/classes/class.ilSubmitButton.php';
57 $this->ref_id =
$_GET[
"ref_id"];
60 require_once
'Modules/Test/classes/class.ilTestPasswordChecker.php';
63 $this->processLocker = null;
64 $this->testSession = null;
76 $testSession->
setUserId($ilUser->getId());
97 require_once
'Modules/Test/classes/class.ilTestProcessLockerFactory.php';
100 $processLockerFactory->setActiveId($activeId);
102 $this->processLocker = $processLockerFactory->getLocker();
113 include_once(
"./Services/Tagging/classes/class.ilTaggingGUI.php");
115 $tagging_gui->setObject($this->object->getId(), $this->
object->getType());
116 $tagging_gui->saveInput();
117 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
123 $ilCtrl->redirectByClass(
'ilTestToplistGUI',
'outResultsToplist');
133 $this->
object->updateWorkingTime(
$_SESSION[
"active_time_id"]);
144 abstract protected function outWorkingForm(
$sequence =
"", $test_id, $postpone_allowed, $directfeedback =
false);
158 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
171 $active_id = $this->testSession->getActiveId();
172 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
173 if ($starting_time === FALSE)
179 return $this->
object->isMaxProcessingTimeReached($starting_time, $active_id);
185 $show_question_inline_score = FALSE;
186 if ($this->object->getAnswerFeedbackPoints())
188 $show_question_inline_score = TRUE;
189 return $show_question_inline_score;
191 return $show_question_inline_score;
208 $this->tpl->setCurrentBlock(
"isnotmarked" );
209 $this->tpl->setVariable(
"CMD_UNMARKED",
'markQuestion' );
211 $this->tpl->setVariable(
"TEXT_UNMARKED", $this->lng->txt(
"tst_question_mark" ) );
212 $this->tpl->parseCurrentBlock();
217 $this->tpl->setCurrentBlock(
"ismarked" );
218 $this->tpl->setVariable(
"CMD_MARKED",
'unmarkQuestion' );
220 $this->tpl->setVariable(
"TEXT_MARKED", $this->lng->txt(
"tst_remove_mark" ) );
221 $this->tpl->parseCurrentBlock();
233 $button->setPrimary(
true );
234 $button->setCommand(
'nextQuestion' );
235 $button->setCaption(
'save_next' );
236 $button->setId(
'bottomnextbutton' );
238 $this->tpl->setCurrentBlock(
"next_bottom" );
239 $this->tpl->setVariable(
"BTN_NEXT", $button->render());
240 $this->tpl->parseCurrentBlock();
246 $button->setPrimary(
true );
247 $button->setCommand(
'nextQuestion' );
248 $button->setCaption(
'save_next' );
249 $button->setId(
'nextbutton' );
251 $this->tpl->setCurrentBlock(
"next" );
252 $this->tpl->setVariable(
"BTN_NEXT", $button->render());
253 $this->tpl->parseCurrentBlock();
265 $button->setPrimary(
true );
266 $button->setCommand(
'nextQuestion' );
267 $button->setCaption(
'save_finish' );
268 $button->setId(
'bottomnextbutton' );
270 $this->tpl->setCurrentBlock(
"next_bottom" );
271 $this->tpl->setVariable(
"BTN_NEXT", $button->render());
272 $this->tpl->parseCurrentBlock();
278 $button->setPrimary(
true );
279 $button->setCommand(
'nextQuestion' );
280 $button->setCaption(
'save_finish' );
281 $button->setId(
'nextbutton' );
283 $this->tpl->setCurrentBlock(
"next" );
284 $this->tpl->setVariable(
"BTN_NEXT", $button->render());
285 $this->tpl->parseCurrentBlock();
297 $button->setPrimary(
true );
298 $button->setCommand(
'nextQuestion' );
299 $button->setCaption(
'question_summary' );
300 $button->setId(
'bottomnextbutton' );
302 $this->tpl->setCurrentBlock(
"next_bottom" );
303 $this->tpl->setVariable(
"BTN_NEXT", $button->render());
304 $this->tpl->parseCurrentBlock();
310 $button->setPrimary(
true );
311 $button->setCommand(
'nextQuestion' );
312 $button->setCaption(
'question_summary' );
313 $button->setId(
'nextbutton' );
315 $this->tpl->setCurrentBlock(
"next" );
316 $this->tpl->setVariable(
"BTN_NEXT", $button->render());
317 $this->tpl->parseCurrentBlock();
322 $this->tpl->setCurrentBlock(
'cancel_test');
323 $this->tpl->setVariable(
'TEXT_CANCELTEST', $this->lng->txt(
'cancel_test'));
324 $this->ctrl->setParameterByClass(get_class($this),
'cancelTest',
'true');
325 $this->tpl->setVariable(
'HREF_CANCELTEXT', $this->ctrl->getLinkTargetByClass(get_class($this),
'outIntroductionPage'));
326 $this->ctrl->setParameterByClass(get_class($this),
'cancelTest', null);
327 $this->tpl->parseCurrentBlock();
338 $this->tpl->setCurrentBlock(
"summary_bottom" );
339 $this->tpl->setVariable(
"CMD_SUMMARY",
'showQuestionList' );
340 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary" ) );
341 $this->tpl->parseCurrentBlock();
346 $this->tpl->setCurrentBlock(
"summary" );
347 $this->tpl->setVariable(
"CMD_SUMMARY",
'showQuestionList' );
348 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary" ) );
349 $this->tpl->parseCurrentBlock();
360 $this->tpl->setCurrentBlock(
"summary_bottom" );
361 $this->tpl->setVariable(
"CMD_SUMMARY",
'showQuestionSelection' );
362 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"tst_change_dyn_test_question_selection" ) );
363 $this->tpl->parseCurrentBlock();
368 $this->tpl->setCurrentBlock(
"summary" );
369 $this->tpl->setVariable(
"CMD_SUMMARY",
'showQuestionSelection' );
370 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"tst_change_dyn_test_question_selection" ) );
371 $this->tpl->parseCurrentBlock();
382 $this->tpl->setCurrentBlock(
"postpone_bottom" );
383 $this->tpl->setVariable(
"CMD_POSTPONE",
'postponeQuestion' );
384 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone" ) );
385 $this->tpl->parseCurrentBlock();
390 $this->tpl->setCurrentBlock(
"postpone" );
391 $this->tpl->setVariable(
"CMD_POSTPONE",
'postponeQuestion' );
392 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone" ) );
393 $this->tpl->parseCurrentBlock();
399 'previousQuestion', $this->lng->txt(
"save_previous" )
402 'previousQuestion', $this->lng->txt(
"save_previous" )
418 $this->tpl->setCurrentBlock(
"prev_bottom" );
419 $this->tpl->setVariable(
"CMD_PREV",
$cmd);
420 $this->tpl->setVariable(
"BTN_PREV", $label);
421 $this->tpl->parseCurrentBlock();
426 $this->tpl->setCurrentBlock(
"prev" );
427 $this->tpl->setVariable(
"CMD_PREV",
$cmd);
428 $this->tpl->setVariable(
"BTN_PREV", $label);
429 $this->tpl->parseCurrentBlock();
434 $this->tpl->setCurrentBlock(
"specific_feedback" );
435 $this->tpl->setVariable(
"SPECIFIC_FEEDBACK",
436 $question_gui->getSpecificFeedbackOutput(
437 $this->testSession->getActiveId(),
441 $this->tpl->parseCurrentBlock();
446 $this->tpl->setCurrentBlock(
"answer_feedback" );
447 $this->tpl->setVariable(
"ANSWER_FEEDBACK",
448 $question_gui->getAnswerFeedbackOutput( $this->testSession->getActiveId(),
452 $this->tpl->parseCurrentBlock();
457 $scoreInformation = sprintf(
458 $this->lng->txt(
"you_received_a_of_b_points" ), $reachedPoints, $maxPoints
461 $this->tpl->setCurrentBlock(
"received_points_information" );
462 $this->tpl->setVariable(
"RECEIVED_POINTS_INFORMATION", $scoreInformation);
463 $this->tpl->parseCurrentBlock();
468 $this->tpl->setCurrentBlock(
"solution_output" );
469 $this->tpl->setVariable(
"CORRECT_SOLUTION", $this->lng->txt(
"tst_best_solution_is" ) );
470 $this->tpl->setVariable(
"QUESTION_FEEDBACK", $solutionoutput );
471 $this->tpl->parseCurrentBlock();
477 if ($ilSetting->get(
'char_selector_availability') > 0)
479 require_once
'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
483 $char_selector->addToPage();
484 $this->tpl->setCurrentBlock(
'char_selector');
485 $this->tpl->setVariable(
"CHAR_SELECTOR_IMAGE",
ilUtil::getImagePath(
'icon_omega_test.svg',
'Services/UIComponent/CharSelector'));
486 $this->tpl->setVariable(
"CHAR_SELECTOR_TEXT", $this->lng->txt(
'char_selector'));
487 $this->tpl->setVariable(
"CHAR_SELECTOR_TEMPLATE", $char_selector->getSelectorHtml());
488 $this->tpl->parseCurrentBlock();
497 $show_side_list = $ilUser->getPref(
'side_list_of_questions');
498 $this->tpl->setCurrentBlock(
'view_sidelist');
499 $this->tpl->setVariable(
'IMAGE_SIDELIST',
503 $this->tpl->setVariable(
'TEXT_SIDELIST',
504 ($show_side_list) ? $this->lng->txt(
'tst_hide_side_list'
505 ) : $this->lng->txt(
'tst_show_side_list')
507 $this->tpl->parseCurrentBlock();
517 $this->tpl->setCurrentBlock(
"SyntaxStyle" );
518 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
521 $this->tpl->parseCurrentBlock();
526 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
527 $this->tpl->setCurrentBlock(
"ContentStyle" );
528 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
531 $this->tpl->parseCurrentBlock();
541 if( $this->testSession->isAnonymousUser() )
543 $this->testSession->setAccessCodeToSession(
$_POST[
'anonymous_id']);
546 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
558 $isFirstTestStartRequest =
false;
560 $this->processLocker->requestTestStartLockCheckLock();
562 if( $this->testSession->lookupTestStartLock() != $testStartLock )
564 $this->testSession->persistTestStartLock($testStartLock);
565 $isFirstTestStartRequest =
true;
568 $this->processLocker->releaseTestStartLockCheckLock();
570 if( $isFirstTestStartRequest )
573 $this->ctrl->redirect($this,
"initTest");
576 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'lock', $testStartLock);
577 $this->ctrl->redirectByClass(
"ilobjtestgui",
"redirectToInfoScreen");
586 elseif( isset(
$_GET[
'lock']) && strlen(
$_GET[
'lock']) )
588 return $_GET[
'lock'];
601 $this->ctrl->setParameter($this,
"activecommand",
"resume");
602 $this->ctrl->redirect($this,
"redirectQuestion");
610 if ($this->object->checkMaximumAllowedUsers() == FALSE)
615 if( $this->testSession->isAnonymousUser() && !$this->testSession->getActiveId() )
617 $accessCode = $this->testSession->createNewAccessCode();
619 $this->testSession->setAccessCodeToSession($accessCode);
620 $this->testSession->setAnonymousId($accessCode);
621 $this->testSession->saveToDb();
623 $this->ctrl->redirect($this,
'displayCode');
626 $this->ctrl->redirect($this,
'startTest');
631 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_anonymous_code_presentation.html",
"Modules/Test");
632 $this->tpl->setCurrentBlock(
"adm_content");
633 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE_CREATED", $this->lng->txt(
"tst_access_code_created"));
634 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE", $this->testSession->getAccessCodeFromSession());
635 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
636 $this->tpl->setVariable(
"CONTINUE", $this->lng->txt(
"continue_work"));
637 $this->tpl->parseCurrentBlock();
642 $this->ctrl->setParameter($this,
"activecommand",
"start");
643 $this->ctrl->redirect($this,
"redirectQuestion");
653 if (
$_POST[
"chb_javascript"])
655 $ilUser->writePref(
"tst_javascript", 1);
659 $ilUser->writePref(
"tst_javascript", 0);
663 if ($this->object->getNrOfTries() != 1)
665 if ($this->object->getUsePreviousAnswers() == 1)
667 if (
$_POST[
"chb_use_previous_answers"])
669 $ilUser->writePref(
"tst_use_previous_answers", 1);
673 $ilUser->writePref(
"tst_use_previous_answers", 0);
686 if (array_key_exists(
"save_error",
$_GET))
688 if (
$_GET[
"save_error"] == 1)
693 switch (
$_GET[
"activecommand"])
707 $active_id = $this->testSession->getActiveId();
708 $actualpass = $this->
object->_getPass($active_id);
712 $this->testSession->setLastFinishedPass($this->testSession->getPass());
713 $this->testSession->increaseTestPass();
715 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_redirect_autosave.html",
"Modules/Test");
716 $this->tpl->setVariable(
"TEXT_REDIRECT", $this->lng->txt(
"redirectAfterSave"));
717 $this->tpl->setCurrentBlock(
"HeadContent");
718 $this->tpl->setVariable(
"CONTENT_BLOCK",
"<meta http-equiv=\"refresh\" content=\"5; url=" . $this->ctrl->getLinkTarget($this,
"afterTestPassFinished") .
"\">");
719 $this->tpl->parseCurrentBlock();
730 $result = $this->lng->txt(
"autosave_success");
734 $result = $this->lng->txt(
"autosave_failed");
740 $result = $this->ctrl->getLinkTarget($this,
"redirectAfterAutosave",
"",
true);
753 $show_side_list = $ilUser->getPref(
'side_list_of_questions');
754 $ilUser->writePref(
'side_list_of_questions', !$show_side_list);
756 $this->ctrl->redirect($this,
"redirectQuestion");
765 $this->ctrl->setParameter($this,
"activecommand",
"setmarked");
766 $this->ctrl->redirect($this,
"redirectQuestion");
775 $this->ctrl->setParameter($this,
"activecommand",
"resetmarked");
776 $this->ctrl->redirect($this,
"redirectQuestion");
785 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
786 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
787 $this->ctrl->saveParameter($this,
"tst_javascript");
789 $this->ctrl->redirect($this,
"redirectQuestion");
799 $this->ctrl->setParameter($this,
"activecommand",
"back");
800 $this->ctrl->redirect($this,
"redirectQuestion");
814 protected function confirmFinishTestCmd()
821 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
823 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'confirmFinish'));
824 $confirmation->setHeaderText($this->lng->txt(
"tst_finish_confirmation_question"));
825 $confirmation->setConfirm($this->lng->txt(
"tst_finish_confirm_button"),
'confirmFinish');
826 $confirmation->setCancel($this->lng->txt(
"tst_finish_confirm_cancel_button"),
'backConfirmFinish');
828 if($this->object->getKioskMode())
830 $this->tpl->addBlockfile($this->
getContentBlockName(),
'content',
"tpl.il_as_tst_kiosk_mode_content.html",
"Modules/Test");
831 $this->tpl->setContent($confirmation->getHtml());
845 $active_id = $this->testSession->getActiveId();
846 $actualpass = $this->
object->_getPass($active_id);
863 if( $this->object->areObligationsEnabled() && !$allObligationsAnswered )
865 if( $this->object->getListOfQuestions() )
867 $_GET[
'activecommand'] =
'summary_obligations';
871 $_GET[
'activecommand'] =
'summary_obligations_only';
874 $this->redirectQuestionCmd();
879 if ($this->object->getEnableExamview() && !isset(
$_GET[
'reviewed']) && $requires_confirmation)
881 $_GET[
'activecommand'] =
'test_submission_overview';
882 $this->redirectQuestionCmd();
887 if (($requires_confirmation) && ($actualpass == $this->object->getNrOfTries() - 1))
890 return $this->confirmFinishTestCmd();
894 if(($actualpass == $this->object->getNrOfTries() - 1) && (!$requires_confirmation))
897 $ilAuth->setExpire(0);
898 switch($this->object->getMailNotification())
901 $this->
object->sendSimpleNotification($active_id);
904 $this->
object->sendAdvancedNotification($active_id);
913 if($this->object->getMailNotificationType() == 1)
915 switch($this->object->getMailNotification())
918 $this->
object->sendSimpleNotification($active_id);
921 $this->
object->sendAdvancedNotification($active_id);
931 $this->testSession->setLastFinishedPass($this->testSession->getPass());
932 $this->testSession->increaseTestPass();
934 $this->ctrl->redirect($this,
'afterTestPassFinished');
939 if( !$this->testSession->isSubmitted() )
941 $this->testSession->setSubmitted(1);
942 $this->testSession->setSubmittedTimestamp(date(
'Y-m-d H:i:s'));
943 $this->testSession->saveToDb();
946 if( $this->object->getEnableArchiving() )
954 $activeId = $this->testSession->getActiveId();
955 $lastFinishedPass = $this->testSession->getLastFinishedPass();
961 $this->ctrl->redirectByClass(
'ilTestSignatureGUI',
'invokeSignaturePlugin');
964 if(!
$_GET[
'skipfinalstatement'])
966 if ($this->object->getShowFinalStatement())
968 $this->ctrl->redirect($this,
'showFinalStatement');
973 $redirection_mode = $this->
object->getRedirectionMode();
974 $redirection_url = $this->
object->getRedirectionUrl();
975 if( $redirection_url && $redirection_mode && !$this->object->canViewResults() )
979 if( $this->object->getKioskMode() )
1002 if( !$this->object->getSignSubmission() )
1007 if( !is_null(
ilSession::get(
"signed_{$activeId}_{$lastFinishedPass}")) )
1012 global $ilPluginAdmin;
1014 $activePlugins = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
'Test',
'tsig');
1016 if( !count($activePlugins) )
1031 require_once
'class.ilTestEvaluationGUI.php';
1034 $results_output = $testevaluationgui->getPassListOfAnswers(
$results, $active,
$pass,
false,
false,
false,
false);
1036 require_once
'./Modules/Test/classes/class.ilTestArchiver.php';
1038 $inst_id = $ilSetting->get(
'inst_id', null);
1046 $filename = $path .
'/exam_N' . $inst_id .
'-' . $this->
object->getId()
1047 .
'-' . $active .
'-' .
$pass .
'.pdf';
1049 require_once
'class.ilTestPDFGenerator.php';
1053 $archiver->handInParticipantSubmission( $active,
$pass,
$filename, $results_output );
1058 $questions = $this->
object->getQuestions();
1059 foreach ($questions as $question_id)
1061 $question_object = $this->
object->getQuestionDataset( $question_id );
1062 if ($question_object->type_tag ==
'assFileUpload')
1082 $handle = opendir( $candidate_path );
1083 while ($handle !==
false && (
$file = readdir( $handle )) !==
false)
1087 $filename_start =
'file_' . $active .
'_' .
$pass .
'_';
1089 if (strpos(
$file, $filename_start ) === 0)
1091 $archiver->handInParticipantQuestionMaterial( $active,
$pass, $question_id,
$file,
$file );
1097 $passdata = $this->
object->getTestResult($active,
$pass);
1098 $overview = $testevaluationgui->getPassListOfAnswers($passdata, $active,
$pass,
true,
false,
false,
true);
1109 if(!$this->object->canViewResults())
1115 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1124 $template =
new ilTemplate(
"tpl.il_as_tst_final_statement.html", TRUE, TRUE,
"Modules/Test");
1125 $this->ctrl->setParameter($this,
"skipfinalstatement", 1);
1126 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"afterTestPassFinished"));
1127 $template->setVariable(
"FINALSTATEMENT", $this->object->prepareTextareaOutput($this->object->getFinalStatement(),
true));
1128 $template->setVariable(
"BUTTON_CONTINUE", $this->lng->txt(
"btn_next"));
1136 $template =
new ilTemplate(
'tpl.il_as_tst_kiosk_head.html',
true,
true,
'Modules/Test');
1137 if ($this->object->getShowKioskModeTitle())
1139 $template->setCurrentBlock(
"kiosk_show_title");
1140 $template->setVariable(
"TEST_TITLE", $this->object->getTitle());
1141 $template->parseCurrentBlock();
1143 if ($this->object->getShowKioskModeParticipant())
1145 $template->setCurrentBlock(
"kiosk_show_participant");
1146 $template->setVariable(
"PARTICIPANT_NAME_TXT", $this->lng->txt(
"login_as"));
1147 $template->setVariable(
"PARTICIPANT_NAME", $ilUser->getFullname());
1148 $template->setVariable(
"PARTICIPANT_LOGIN", $ilUser->getLogin());
1149 $template->setVariable(
"PARTICIPANT_MATRICULATION", $ilUser->getMatriculation());
1150 $template->setVariable(
"PARTICIPANT_EMAIL", $ilUser->getEmail());
1151 $template->parseCurrentBlock();
1153 if ($this->object->isShowExamIdInTestPassEnabled())
1156 $this->testSession->getActiveId() , $this->testSession->getPass(), $this->
object->getId()
1159 $template->setCurrentBlock(
"kiosk_show_exam_id");
1160 $template->setVariable(
"EXAM_ID_TXT", $this->lng->txt(
"exam_id"));
1161 $template->setVariable(
"EXAM_ID", $exam_id);
1162 $template->parseCurrentBlock();
1164 return $template->get();
1176 if (!$rbacsystem->checkAccess(
"read", $this->object->getRefId()))
1179 $this->ilias->raiseError($this->lng->txt(
"cannot_execute_test"),$this->ilias->error_obj->MESSAGE);
1188 if ($this->object->endingTimeReached())
1194 if ($this->object->getKioskMode())
1199 $this->tpl->setVariable(
"TEST_ID", $this->object->getTestId());
1200 $this->tpl->setVariable(
"LOGIN", $ilUser->getLogin());
1201 $this->tpl->setVariable(
"SEQ_ID", $this->sequence);
1202 $this->tpl->setVariable(
"QUEST_ID", $this->testSequence->questions[$this->sequence]);
1204 if ($this->object->getEnableProcessingTime())
1209 $this->tpl->setVariable(
"FORM_TIMESTAMP", time());
1211 $this->tpl->setVariable(
"PAGETITLE",
"- " . $this->object->getTitle());
1213 $postpone = ( $this->
object->getSequenceSettings() ==
TEST_POSTPONE );
1215 if ($this->object->isShowExamIdInTestPassEnabled() && !$this->
object->getKioskMode())
1217 $this->tpl->setCurrentBlock(
'exam_id_footer');
1219 $this->testSession->getActiveId(), $this->testSession->getPass(), $this->
object->getId()
1221 $this->tpl->setVariable(
'EXAM_ID_TXT', $this->lng->txt(
'exam_id'));
1222 $this->tpl->parseCurrentBlock();
1225 $this->
outWorkingForm($this->sequence, $this->object->getTestId(), $postpone, $directfeedback);
1240 $user = $this->
object->getInvitedUsers($ilUser->getId());
1241 if (!is_array ($user) || count($user)!=1)
1244 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1247 $user = array_pop($user);
1249 if (strcmp($user[
"clientip"],
"")!=0 && strcmp($user[
"clientip"],$_SERVER[
"REMOTE_ADDR"])!=0)
1252 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1264 and $this->
object->startingTimeReached()
1265 and !$this->
object->endingTimeReached();
1273 return $this->
object->hasNrOfTriesRestriction() && $this->
object->isNrOfTriesReached($this->testSession->getPass());
1285 if (array_key_exists(
"pass",
$_GET) && (strlen(
$_GET[
"pass"]) > 0))
1287 $this->ctrl->saveParameter($this,
"pass");
1288 $this->ctrl->saveParameter($this,
"active_id");
1289 $this->outTestResults(
false,
$_GET[
"pass"]);
1293 $this->outTestResults(
false);
1305 $this->testSession->increasePass();
1306 $this->testSession->setLastSequence(0);
1307 $this->testSession->saveToDb();
1308 if (!$this->object->canViewResults())
1310 $this->outIntroductionPage();
1314 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1327 $this->outIntroductionPage();
1337 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_submit_answers_confirm.html",
"Modules/Test");
1338 $this->tpl->setCurrentBlock(
"adm_content");
1339 if ($this->object->isTestFinished($this->testSession->getActiveId()))
1341 $this->tpl->setCurrentBlock(
"not_submit_allowed");
1342 $this->tpl->setVariable(
"TEXT_ALREADY_SUBMITTED", $this->lng->txt(
"tst_already_submitted"));
1343 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_show_answer_sheet"));
1346 $this->tpl->setCurrentBlock(
"submit_allowed");
1347 $this->tpl->setVariable(
"TEXT_CONFIRM_SUBMIT_RESULTS", $this->lng->txt(
"tst_confirm_submit_answers"));
1348 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_submit_results"));
1350 $this->tpl->setVariable(
"BTN_BACK", $this->lng->txt(
"back"));
1351 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"finalSubmission"));
1352 $this->tpl->parseCurrentBlock();
1359 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
1360 $processing_time = $this->
object->getProcessingTimeInSeconds($active_id);
1361 $processing_time_minutes = floor($processing_time / 60);
1362 $processing_time_seconds = $processing_time - $processing_time_minutes * 60;
1363 $str_processing_time =
"";
1364 if ($processing_time_minutes > 0)
1366 $str_processing_time = $processing_time_minutes .
" " . ($processing_time_minutes == 1 ? $this->lng->txt(
"minute") : $this->lng->txt(
"minutes"));
1368 if ($processing_time_seconds > 0)
1370 if (strlen($str_processing_time) > 0) $str_processing_time .=
" " . $this->lng->txt(
"and") .
" ";
1371 $str_processing_time .= $processing_time_seconds .
" " . ($processing_time_seconds == 1 ? $this->lng->txt(
"second") : $this->lng->txt(
"seconds"));
1373 $time_left = $starting_time + $processing_time - mktime();
1374 $time_left_minutes = floor($time_left / 60);
1375 $time_left_seconds = $time_left - $time_left_minutes * 60;
1376 $str_time_left =
"";
1377 if ($time_left_minutes > 0)
1379 $str_time_left = $time_left_minutes .
" " . ($time_left_minutes == 1 ? $this->lng->txt(
"minute") : $this->lng->txt(
"minutes"));
1381 if ($time_left < 300)
1383 if ($time_left_seconds > 0)
1385 if (strlen($str_time_left) > 0) $str_time_left .=
" " . $this->lng->txt(
"and") .
" ";
1386 $str_time_left .= $time_left_seconds .
" " . ($time_left_seconds == 1 ? $this->lng->txt(
"second") : $this->lng->txt(
"seconds"));
1389 $date = getdate($starting_time);
1401 $datenow = getdate();
1402 $this->tpl->setCurrentBlock(
"enableprocessingtime");
1403 $this->tpl->setVariable(
"USER_WORKING_TIME",
1405 $this->lng->txt(
"tst_time_already_spent"),
1406 $formattedStartingTime,
1407 $str_processing_time
1410 $this->tpl->setVariable(
"USER_REMAINING_TIME", sprintf($this->lng->txt(
"tst_time_already_spent_left"), $str_time_left));
1411 $this->tpl->parseCurrentBlock();
1412 $template =
new ilTemplate(
"tpl.workingtime.js.html", TRUE, TRUE,
'Modules/Test');
1413 $template->setVariable(
"STRING_MINUTE", $this->lng->txt(
"minute"));
1414 $template->setVariable(
"STRING_MINUTES", $this->lng->txt(
"minutes"));
1415 $template->setVariable(
"STRING_SECOND", $this->lng->txt(
"second"));
1416 $template->setVariable(
"STRING_SECONDS", $this->lng->txt(
"seconds"));
1417 $template->setVariable(
"STRING_TIMELEFT", $this->lng->txt(
"tst_time_already_spent_left"));
1418 $template->setVariable(
"AND", strtolower($this->lng->txt(
"and")));
1419 $template->setVariable(
"YEAR", $date[
"year"]);
1420 $template->setVariable(
"MONTH", $date[
"mon"]-1);
1421 $template->setVariable(
"DAY", $date[
"mday"]);
1422 $template->setVariable(
"HOUR", $date[
"hours"]);
1423 $template->setVariable(
"MINUTE", $date[
"minutes"]);
1424 $template->setVariable(
"SECOND", $date[
"seconds"]);
1425 if ($this->object->isEndingTimeEnabled() && preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->object->getEndingTime(), $matches))
1427 $template->setVariable(
"ENDYEAR", $matches[1]);
1428 $template->setVariable(
"ENDMONTH", $matches[2]-1);
1429 $template->setVariable(
"ENDDAY", $matches[3]);
1430 $template->setVariable(
"ENDHOUR", $matches[4]);
1431 $template->setVariable(
"ENDMINUTE", $matches[5]);
1432 $template->setVariable(
"ENDSECOND", $matches[6]);
1434 $template->setVariable(
"YEARNOW", $datenow[
"year"]);
1435 $template->setVariable(
"MONTHNOW", $datenow[
"mon"]-1);
1436 $template->setVariable(
"DAYNOW", $datenow[
"mday"]);
1437 $template->setVariable(
"HOURNOW", $datenow[
"hours"]);
1438 $template->setVariable(
"MINUTENOW", $datenow[
"minutes"]);
1439 $template->setVariable(
"SECONDNOW", $datenow[
"seconds"]);
1440 $template->setVariable(
"PTIME_M", $processing_time_minutes);
1441 $template->setVariable(
"PTIME_S", $processing_time_seconds);
1443 $this->tpl->setCurrentBlock(
"HeadContent");
1444 $this->tpl->setVariable(
"CONTENT_BLOCK", $template->get());
1445 $this->tpl->parseCurrentBlock();
1451 public function outQuestionSummaryCmd($fullpage =
true, $contextFinishTest =
false, $obligationsNotAnswered =
false, $obligationsFilter =
false)
1455 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_question_summary.html",
"Modules/Test");
1458 if( $obligationsNotAnswered )
1463 $active_id = $this->testSession->getActiveId();
1464 $result_array = & $this->testSequence->getSequenceSummary($obligationsFilter);
1466 $marked_questions = array();
1468 if( $this->object->getKioskMode() && $fullpage )
1473 $this->tpl->setCurrentBlock(
"kiosk_options");
1474 $this->tpl->setVariable(
"KIOSK_HEAD", $head);
1475 $this->tpl->parseCurrentBlock();
1479 if( $this->object->getShowMarker() )
1481 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1487 foreach( $result_array as $key => $value )
1489 $this->ctrl->setParameter($this,
"sequence", $value[
"sequence"]);
1491 $href = $this->ctrl->getLinkTargetByClass(get_class($this),
"gotoQuestion");
1493 $this->tpl->setVariable(
"VALUE_QUESTION_TITLE",
"<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this),
"gotoQuestion").
"\">" . $this->
object->getQuestionTitle($value[
"title"]) .
"</a>");
1495 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1498 if( $this->object->getListOfQuestionsDescription() )
1500 $description = $value[
"description"];
1504 if( !$this->object->getTitleOutput() )
1506 $points = $value[
"points"].
" ".$this->lng->txt(
"points_short");
1510 if( count($marked_questions) )
1512 if( array_key_exists($value[
"qid"], $marked_questions) )
1514 $obj = $marked_questions[$value[
"qid"]];
1515 if( $obj[
"solved"] == 1 )
1522 array_push($data, array(
1523 'order' => $value[
"nr"],
1525 'title' => $this->object->getQuestionTitle($value[
"title"]),
1526 'description' => $description,
1527 'worked_through' => ($value[
"worked_through"]) ?
true :
false,
1528 'postponed' => ($value[
"postponed"]) ? $this->lng->txt(
"postponed") :
'',
1529 'points' => $points,
1530 'marked' => $marked,
1531 'sequence' => $value[
"sequence"],
1532 'obligatory' => $value[
'obligatory'],
1533 'isAnswered' => $value[
'isAnswered']
1537 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1541 include_once
"./Modules/Test/classes/tables/class.ilListOfQuestionsTableGUI.php";
1544 $table_gui->setShowPointsEnabled( !$this->object->getTitleOutput() );
1545 $table_gui->setShowMarkerEnabled( $this->object->getShowMarker() );
1546 $table_gui->setObligationsNotAnswered( $obligationsNotAnswered );
1547 $table_gui->setShowObligationsEnabled( $this->object->areObligationsEnabled() );
1548 $table_gui->setObligationsFilterEnabled( $obligationsFilter );
1552 $table_gui->setData($data);
1554 $this->tpl->setVariable(
'TABLE_LIST_OF_QUESTIONS', $table_gui->getHTML());
1556 if( $this->object->getEnableProcessingTime() )
1563 $template =
new ilTemplate(
'tpl.il_as_tst_list_of_questions_short.html',
true,
true,
'Modules/Test');
1565 foreach( $data as
$row )
1567 if( strlen($row[
'description']) )
1569 $template->setCurrentBlock(
'description');
1570 $template->setVariable(
"DESCRIPTION", $row[
'description']);
1571 $template->parseCurrentBlock();
1576 $template->setCurrentBlock(
'item');
1577 $template->setVariable(
'CLASS', ($row[
'walked_through']) ? (
'answered'.$active) : (
'unanswered'.$active));
1579 $template->setVariable(
'SEQUENCE', $row[
'sequence']);
1580 $template->parseCurrentBlock();
1583 require_once
'Services/UIComponent/Panel/classes/class.ilPanelGUI.php';
1587 $panel->setHeading($this->lng->txt(
'list_of_questions'));
1588 $panel->setBody($template->get());
1590 $this->tpl->setVariable(
'LIST_OF_QUESTIONS', $panel->getHTML());
1606 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_max_allowed_users_reached.html",
"Modules/Test");
1607 $this->tpl->setCurrentBlock(
"adm_content");
1608 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_MESSAGE", sprintf($this->lng->txt(
"tst_max_allowed_users_message"), $this->
object->getAllowedUsersTimeGap()));
1609 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_HEADING", sprintf($this->lng->txt(
"tst_max_allowed_users_heading"), $this->
object->getAllowedUsersTimeGap()));
1610 $this->tpl->setVariable(
"BACK_TO_INTRODUCTION", $this->lng->txt(
"tst_results_back_introduction"));
1611 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1612 $this->tpl->parseCurrentBlock();
1617 $this->ctrl->redirect($this,
'gotoQuestion');
1627 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_correct_solution.html",
"Modules/Test");
1629 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1630 $this->tpl->setCurrentBlock(
"ContentStyle");
1632 $this->tpl->parseCurrentBlock();
1634 $this->tpl->setCurrentBlock(
"SyntaxStyle");
1636 $this->tpl->parseCurrentBlock();
1639 if ($this->object->getShowSolutionAnswersOnly())
1644 $this->tpl->setCurrentBlock(
"adm_content");
1646 $this->tpl->setVariable(
"OUTPUT_SOLUTION", $solution);
1647 $this->tpl->setVariable(
"TEXT_BACK", $this->lng->txt(
"back"));
1648 $this->ctrl->saveParameter($this,
"pass");
1649 $this->ctrl->saveParameter($this,
"active_id");
1650 $this->tpl->setVariable(
"URL_BACK", $this->ctrl->getLinkTarget($this,
"outUserResultsOverview"));
1651 $this->tpl->parseCurrentBlock();
1667 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_finish_list_of_answers.html",
"Modules/Test");
1669 $result_array =& $this->
object->getTestResult($active_id,
$pass);
1673 foreach ($result_array as $question_data)
1675 $question = $question_data[
"qid"];
1676 if (is_numeric($question))
1678 $this->tpl->setCurrentBlock(
"printview_question");
1679 $question_gui = $this->
object->createQuestionGUI(
"", $question);
1680 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1681 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
1682 $template->setVariable(
"QUESTION_TITLE", $question_gui->object->getTitle());
1684 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
1685 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
1686 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
1687 $this->tpl->setVariable(
"QUESTION_OUTPUT", $template->get());
1688 $this->tpl->parseCurrentBlock();
1694 if ($this->object->getShowSolutionAnswersOnly())
1698 if (strlen($top_data))
1700 $this->tpl->setCurrentBlock(
"top_data");
1701 $this->tpl->setVariable(
"TOP_DATA", $top_data);
1702 $this->tpl->parseCurrentBlock();
1705 if (strlen($bottom_data))
1707 $this->tpl->setCurrentBlock(
"bottom_data");
1708 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1709 $this->tpl->setVariable(
"BOTTOM_DATA", $bottom_data);
1710 $this->tpl->parseCurrentBlock();
1713 $this->tpl->setCurrentBlock(
"adm_content");
1714 $this->tpl->setVariable(
"TXT_ANSWER_SHEET", $this->lng->txt(
"tst_list_of_answers"));
1717 $this->tpl->setVariable(
"USER_DETAILS", $user_data);
1718 $this->tpl->setVariable(
"SIGNATURE", $signature);
1719 $this->tpl->setVariable(
"TITLE", $this->object->getTitle());
1720 $this->tpl->setVariable(
"TXT_TEST_PROLOG", $this->lng->txt(
"tst_your_answers"));
1721 $invited_user =& $this->
object->getInvitedUsers($ilUser->getId());
1722 $pagetitle = $this->
object->getTitle() .
" - " . $this->lng->txt(
"clientip") .
1723 ": " . $invited_user[$ilUser->getId()][
"clientip"] .
" - " .
1724 $this->lng->txt(
"matriculation") .
": " .
1725 $invited_user[$ilUser->getId()][
"matriculation"];
1726 $this->tpl->setVariable(
"PAGETITLE", $pagetitle);
1727 $this->tpl->parseCurrentBlock();
1737 if ($this->object->getKioskMode())
1739 $this->tpl->setBodyClass(
"kiosk");
1740 $this->tpl->setAddFooter(FALSE);
1745 return "ADM_CONTENT";
1751 $this->ctrl->redirectByClass(
1752 array(
'ilRepositoryGUI',
'ilObjTestGUI',
'ilTestEvaluationGUI'),
"outUserResultsOverview"
1758 $this->ctrl->redirectByClass(
1759 array(
'ilRepositoryGUI',
'ilObjTestGUI',
'ilTestEvaluationGUI'),
"outUserListOfAnswerPasses"
1770 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
1781 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
1797 $parseQuestionRelatedNavigation =
false;
1801 case $this->
object->getSpecificAnswerFeedback():
1802 case $this->
object->getGenericAnswerFeedback():
1803 case $this->
object->getAnswerFeedbackPoints():
1804 case $this->
object->getInstantFeedbackSolution():
1806 $tpl->setCurrentBlock(
"direct_feedback");
1807 $tpl->setVariable(
"CMD_SHOW_INSTANT_RESPONSE",
'showInstantResponse');
1808 $tpl->setVariable(
"TEXT_SHOW_INSTANT_RESPONSE", $lng->txt(
"check"));
1809 $tpl->parseCurrentBlock();
1811 $parseQuestionRelatedNavigation =
true;
1814 if( $this->object->isOfferingQuestionHintsEnabled() )
1816 $questionId = $questionGUI->object->getId();
1817 $activeId = $this->testSession->getActiveId();
1818 $pass = $this->testSession->getPass();
1820 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
1823 $requestsExist = $questionHintTracking->requestsExist();
1824 $requestsPossible = $questionHintTracking->requestsPossible();
1826 if( $requestsPossible )
1828 if( $requestsExist )
1830 $buttonText = $lng->txt(
"button_request_next_question_hint");
1834 $buttonText = $lng->txt(
"button_request_question_hint");
1837 $tpl->setCurrentBlock(
"button_request_next_question_hint");
1838 $tpl->setVariable(
"CMD_REQUEST_NEXT_QUESTION_HINT",
'confirmHintRequest');
1839 $tpl->setVariable(
"TEXT_REQUEST_NEXT_QUESTION_HINT", $buttonText);
1840 $tpl->parseCurrentBlock();
1842 $parseQuestionRelatedNavigation =
true;
1845 if( $requestsExist )
1847 $tpl->setCurrentBlock(
"button_show_requested_question_hints");
1848 $tpl->setVariable(
"CMD_SHOW_REQUESTED_QUESTION_HINTS",
'showRequestedHintList');
1849 $tpl->setVariable(
"TEXT_SHOW_REQUESTED_QUESTION_HINTS", $lng->txt(
"button_show_requested_question_hints"));
1850 $tpl->parseCurrentBlock();
1852 $parseQuestionRelatedNavigation =
true;
1856 if( $parseQuestionRelatedNavigation )
1858 $tpl->setCurrentBlock(
"question_related_navigation");
1859 $tpl->parseCurrentBlock();
1882 if( $this->object->getShowMarker() )
1884 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1889 $marked_questions = array();
1892 return $marked_questions;
1897 $this->tpl->addBlockFile(
1898 $this->
getContentBlockName(),
'adm_content',
'tpl.il_as_tst_question_summary.html',
'Modules/Test'
1901 if ($this->object->getShowCancel())
1906 if ($this->object->getKioskMode())
1914 $this->tpl->addBlockFile(
1927 $this->tpl->setCurrentBlock(
"kiosk_options");
1928 $this->tpl->setVariable(
"KIOSK_HEAD", $head);
1929 $this->tpl->parseCurrentBlock();
1935 if( $this->ctrl->getNextClass() ==
'iltestpasswordprotectiongui' )
1940 if( !$this->passwordChecker->isPasswordProtectionPageRedirectRequired() )
1947 $nextCommand = $this->ctrl->getCmdClass().
'::'.$this->ctrl->getCmd();
1948 $this->ctrl->setParameterByClass(
'ilTestPasswordProtectionGUI',
'nextCommand', $nextCommand);
1949 $this->ctrl->redirectByClass(
'ilTestPasswordProtectionGUI',
'showPasswordForm');
1954 if( !$this->object->isInstantFeedbackAnswerFixationEnabled() )
1959 if( !$this->testSequence->isQuestionChecked($questionId) )
1982 if( $this->testSession->isObjectiveOriented() )
1984 return $this->lng->txt(
"save_back_to_objective_container");
1987 return $this->lng->txt(
"save_introduction");