24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
25 include_once
"./Modules/Test/classes/class.ilTestServiceGUI.php";
60 $this->ref_id =
$_GET[
"ref_id"];
71 include_once(
"./Services/Tagging/classes/class.ilTaggingGUI.php");
73 $tagging_gui->setObject($this->object->getId(), $this->
object->getType());
74 $tagging_gui->saveInput();
75 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
84 $cmd = $this->ctrl->getCmd();
85 $next_class = $this->ctrl->getNextClass($this);
86 $this->ctrl->saveParameter($this,
"sequence");
87 $this->ctrl->saveParameter($this,
"active_id");
89 if (
$_GET[
"active_id"])
91 $this->
object->setTestSession(
$_GET[
"active_id"]);
95 $this->
object->setTestSession();
97 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
117 $this->
object->updateWorkingTime(
$_SESSION[
"active_time_id"]);
127 $this->saveResult = FALSE;
130 $formtimestamp = $_POST[
"formtimestamp"];
131 if (strlen($formtimestamp) == 0) $formtimestamp =
$_GET[
"formtimestamp"];
132 if ($formtimestamp !=
$_SESSION[
"formtimestamp"])
134 $_SESSION[
"formtimestamp"] = $formtimestamp;
145 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
146 if (is_numeric($q_id))
150 $question_gui = $this->
object->createQuestionGUI(
"", $q_id);
151 if ($this->object->getJavaScriptOutput())
156 $active_id = $this->
object->getTestSession()->getActiveId();
157 if ($this->object->isRandomTest())
159 $pass = $this->
object->_getPass($active_id);
161 $this->saveResult = $question_gui->object->saveWorkingData($active_id,
$pass);
164 if ($this->saveResult == FALSE)
166 $this->ctrl->setParameter($this,
"save_error",
"1");
194 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
208 $active_id = $this->
object->getTestSession()->getActiveId();
209 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
210 if ($starting_time === FALSE)
216 return $this->
object->isMaxProcessingTimeReached($starting_time);
232 $active_time_id = $this->
object->startWorkingTime($this->object->getTestSession()->getActiveId(), $this->
object->getTestSession()->getPass());
233 $_SESSION[
"active_time_id"] = $active_time_id;
235 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
236 $this->tpl->setCurrentBlock(
"ContentStyle");
237 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
239 $this->tpl->parseCurrentBlock();
242 $this->tpl->setCurrentBlock(
"SyntaxStyle");
243 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
245 $this->tpl->parseCurrentBlock();
246 $question_gui = $this->
object->createQuestionGUI(
"", $this->object->getTestSequence()->getQuestionForSequence(
$sequence));
247 if ($this->object->getJavaScriptOutput())
252 $is_postponed = $this->
object->getTestSequence()->isPostponedQuestion($question_gui->object->getId());
254 $this->ctrl->setParameter($this,
"sequence",
"$sequence");
255 $formaction = $this->ctrl->getFormAction($this,
"gotoQuestion");
257 $question_gui->setSequenceNumber($this->object->getTestSequence()->getPositionOfSequence(
$sequence));
258 $question_gui->setQuestionCount($this->object->getTestSequence()->getUserQuestionCount());
260 $user_post_solution = FALSE;
261 if (array_key_exists(
"previouspost",
$_SESSION))
263 $user_post_solution =
$_SESSION[
"previouspost"];
266 $answer_feedback = FALSE;
267 if (($directfeedback) && ($this->object->getAnswerFeedback()))
269 $answer_feedback = TRUE;
271 global $ilNavigationHistory;
272 $ilNavigationHistory->addItem(
$_GET[
"ref_id"], $this->ctrl->getLinkTarget($this,
"resume"),
"tst");
273 $question_gui->outQuestionForTest($formaction, $this->object->getTestSession()->getActiveId(), NULL, $is_postponed, $user_post_solution, $answer_feedback);
276 if ($this->object->getInstantFeedbackSolution())
278 $solutionoutput = $question_gui->getSolutionOutput($this->object->getTestSession()->getActiveId(), NULL, FALSE, FALSE, FALSE, FALSE, TRUE);
279 $this->tpl->setCurrentBlock(
"solution_output");
280 $this->tpl->setVariable(
"CORRECT_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
281 $this->tpl->setVariable(
"QUESTION_FEEDBACK", $solutionoutput);
282 $this->tpl->parseCurrentBlock();
284 if ($this->object->getAnswerFeedbackPoints())
286 $this->tpl->setCurrentBlock(
"solution_output");
287 $this->tpl->setVariable(
"RECEIVED_POINTS_INFORMATION", sprintf($this->lng->txt(
"you_received_a_of_b_points"), $question_gui->object->calculateReachedPoints($this->object->getTestSession()->getActiveId(), NULL), $question_gui->object->getMaximumPoints()));
288 $this->tpl->parseCurrentBlock();
290 if ($this->object->getAnswerFeedback())
292 $this->tpl->setCurrentBlock(
"answer_feedback");
293 $this->tpl->setVariable(
"ANSWER_FEEDBACK", $question_gui->getAnswerFeedbackOutput($this->object->getTestSession()->getActiveId(), NULL));
294 $this->tpl->parseCurrentBlock();
298 if (
$sequence == $this->object->getTestSequence()->getFirstSequence())
300 $this->tpl->setCurrentBlock(
"prev");
301 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_introduction"));
302 $this->tpl->parseCurrentBlock();
303 $this->tpl->setCurrentBlock(
"prev_bottom");
304 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_introduction"));
305 $this->tpl->parseCurrentBlock();
309 $this->tpl->setCurrentBlock(
"prev");
310 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_previous"));
311 $this->tpl->parseCurrentBlock();
312 $this->tpl->setCurrentBlock(
"prev_bottom");
313 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_previous"));
314 $this->tpl->parseCurrentBlock();
317 if ($postpone_allowed)
323 $this->tpl->setCurrentBlock(
"postpone");
324 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone"));
325 $this->tpl->parseCurrentBlock();
326 $this->tpl->setCurrentBlock(
"postpone_bottom");
327 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone"));
328 $this->tpl->parseCurrentBlock();
333 if ($this->object->getListOfQuestions())
335 if (!(($finish) && ($this->object->getListOfQuestionsEnd())))
337 $this->tpl->setCurrentBlock(
"summary");
338 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary"));
339 $this->tpl->parseCurrentBlock();
340 $this->tpl->setCurrentBlock(
"summary_bottom");
341 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary"));
342 $this->tpl->parseCurrentBlock();
346 if ($this->object->getShowCancel())
348 $this->tpl->setCurrentBlock(
"cancel_test");
349 $this->tpl->setVariable(
"TEXT_CANCELTEST", $this->lng->txt(
"cancel_test"));
350 $this->tpl->setVariable(
"TEXT_ALTCANCELTEXT", $this->lng->txt(
"cancel_test"));
351 $this->tpl->setVariable(
"TEXT_TITLECANCELTEXT", $this->lng->txt(
"cancel_test"));
352 $this->tpl->setVariable(
"HREF_IMGCANCELTEST", $this->ctrl->getLinkTargetByClass(get_class($this),
"outIntroductionPage") .
"&cancelTest=true");
353 $this->tpl->setVariable(
"HREF_CANCELTEXT", $this->ctrl->getLinkTargetByClass(get_class($this),
"outIntroductionPage") .
"&cancelTest=true");
355 $this->tpl->parseCurrentBlock();
358 if ($this->object->getTestSequence()->getQuestionForSequence($this->object->getTestSequence()->getLastSequence()) == $question_gui->object->getId())
360 if ($this->object->getListOfQuestionsEnd())
362 $this->tpl->setCurrentBlock(
"next");
363 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"question_summary") .
" >>");
364 $this->tpl->parseCurrentBlock();
365 $this->tpl->setCurrentBlock(
"next_bottom");
366 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"question_summary") .
" >>");
367 $this->tpl->parseCurrentBlock();
371 $this->tpl->setCurrentBlock(
"next");
372 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_finish") .
" >>");
373 $this->tpl->parseCurrentBlock();
374 $this->tpl->setCurrentBlock(
"next_bottom");
375 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_finish") .
" >>");
376 $this->tpl->parseCurrentBlock();
381 $this->tpl->setCurrentBlock(
"next");
382 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_next") .
" >>");
383 $this->tpl->parseCurrentBlock();
384 $this->tpl->setCurrentBlock(
"next_bottom");
385 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_next") .
" >>");
386 $this->tpl->parseCurrentBlock();
389 if ($this->object->getShowMarker())
391 include_once
"./Modules/Test/classes/class.ilObjTest.php";
395 if (count ($solved_array) > 0)
397 $solved = array_pop($solved_array);
398 $solved = $solved->solved;
403 $this->tpl->setCurrentBlock(
"ismarked");
404 $this->tpl->setVariable(
"TEXT_QUESTION_STATUS_LABEL", $this->lng->txt(
"tst_question_marked").
":");
405 $this->tpl->setVariable(
"TEXT_RESET_MARK", $this->lng->txt(
"remove"));
406 $this->tpl->setVariable(
"ALT_MARKED", $this->lng->txt(
"tst_question_marked"));
407 $this->tpl->setVariable(
"TITLE_MARKED", $this->lng->txt(
"tst_question_marked"));
409 $this->tpl->parseCurrentBlock();
413 $this->tpl->setCurrentBlock(
"ismarked");
414 $this->tpl->setVariable(
"TEXT_MARK_QUESTION", $this->lng->txt(
"tst_question_mark"));
415 $this->tpl->parseCurrentBlock();
419 if ($this->object->getJavaScriptOutput())
422 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"disable_javascript"));
423 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"disable_javascript"));
424 $this->ctrl->setParameter($this,
"tst_javascript",
"0");
425 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
430 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"enable_javascript"));
431 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"enable_javascript"));
432 $this->ctrl->setParameter($this,
"tst_javascript",
"1");
433 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
436 if ($question_gui->object->supportsJavascriptOutput())
438 $this->tpl->touchBlock(
"jsswitch");
442 $this->tpl->setVariable(
"AUTOSAVE_URL", $this->ctrl->getLinkTarget($this,
"autosave"));
444 $this->tpl->setCurrentBlock(
"adm_content");
446 $this->tpl->parseCurrentBlock();
458 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_password_protection.html",
"Modules/Test");
459 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"checkPassword"));
460 $this->tpl->setVariable(
"PASSWORD_INTRODUCTION", $this->lng->txt(
"tst_password_introduction"));
461 $this->tpl->setVariable(
"TEXT_PASSWORD", $this->lng->txt(
"tst_password"));
462 $this->tpl->setVariable(
"SUBMIT", $this->lng->txt(
"submit"));
463 $this->tpl->parseCurrentBlock();
475 if (strcmp($this->object->getPassword(), $_POST[
"password"]) == 0)
478 if (
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID)
480 $ilUser->setPref(
"tst_password_".$this->object->getTestId(), $this->
object->getPassword());
481 $ilUser->writePref(
"tst_password_".$this->object->getTestId(), $this->
object->getPassword());
483 $this->ctrl->redirect($this,
"start");
487 ilUtil::sendInfo($this->lng->txt(
"tst_password_entered_wrong_password"),
true);
488 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
501 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
503 $this->
object->setAccessCodeSession($_POST[
"anonymous_id"]);
505 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
518 if (strcmp(
$_SESSION[
"lock"], $_POST[
"lock"]) != 0)
522 $this->ctrl->redirect($this,
"startTest");
526 $this->ctrl->redirectByClass(
"ilobjtestgui",
"redirectToInfoScreen");
537 if ($this->object->checkMaximumAllowedUsers() == FALSE)
541 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
543 $this->
object->setAccessCodeSession($this->object->createNewAccessCode());
547 $this->
object->unsetAccessCodeSession();
549 if (strlen($this->object->getPassword()))
554 $pwd = $ilUser->getPref(
"tst_password_".$this->object->getTestId());
555 if ((strcmp($pwd, $this->object->getPassword()) != 0) && (!$rbacsystem->checkAccess(
"write", $this->object->getRefId())))
560 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
562 $this->ctrl->redirect($this,
"displayCode");
566 $this->ctrl->setParameter($this,
"activecommand",
"start");
567 $this->ctrl->redirect($this,
"redirectQuestion");
573 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_anonymous_code_presentation.html",
"Modules/Test");
574 $this->tpl->setCurrentBlock(
"adm_content");
575 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE_CREATED", $this->lng->txt(
"tst_access_code_created"));
576 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE", $this->object->getAccessCodeSession());
577 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
578 $this->tpl->setVariable(
"CONTINUE", $this->lng->txt(
"continue_work"));
579 $this->tpl->parseCurrentBlock();
584 $this->ctrl->setParameter($this,
"activecommand",
"start");
585 $this->ctrl->redirect($this,
"redirectQuestion");
597 if ($this->object->checkMaximumAllowedUsers() == FALSE)
602 $this->ctrl->setParameter($this,
"activecommand",
"resume");
603 $this->ctrl->redirect($this,
"redirectQuestion");
617 if ($_POST[
"chb_javascript"])
619 $ilUser->writePref(
"tst_javascript", 1);
623 $ilUser->writePref(
"tst_javascript", 0);
627 if ($this->object->getNrOfTries() != 1)
629 if ($this->object->getUsePreviousAnswers() == 1)
631 if ($_POST[
"chb_use_previous_answers"])
633 $ilUser->writePref(
"tst_use_previous_answers", 1);
637 $ilUser->writePref(
"tst_use_previous_answers", 0);
663 $executable = $this->
object->isExecutable($ilUser->getId());
664 if (!$executable[
"executable"])
667 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
669 switch (
$_GET[
"activecommand"])
673 if ($this->sequence === FALSE)
675 if ($this->object->getListOfQuestionsEnd())
681 $this->ctrl->redirect($this,
"finishTest");
686 $this->
object->getTestSession()->setLastSequence($this->sequence);
687 $this->
object->getTestSession()->saveToDb();
693 $this->
object->getTestSession()->setLastSequence($this->sequence);
694 $this->
object->getTestSession()->saveToDb();
695 if ($this->sequence === FALSE)
697 $this->ctrl->redirect($this,
"outIntroductionPage");
706 $nextSequence = $this->
object->getTestSequence()->getNextSequence($this->sequence);
707 $this->
object->getTestSequence()->postponeSequence($this->sequence);
708 $this->
object->getTestSequence()->saveToDb();
709 $this->
object->getTestSession()->setLastSequence($nextSequence);
710 $this->
object->getTestSession()->saveToDb();
711 $this->sequence = $nextSequence;
716 $this->
object->getTestSession()->setLastSequence($this->sequence);
717 $this->
object->getTestSession()->saveToDb();
718 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
719 $this->
object->setQuestionSetSolved(1, $q_id, $ilUser->getId());
724 $this->
object->getTestSession()->setLastSequence($this->sequence);
725 $this->
object->getTestSession()->saveToDb();
726 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
727 $this->
object->setQuestionSetSolved(0, $q_id, $ilUser->getId());
730 case "directfeedback":
732 $this->
object->getTestSession()->setLastSequence($this->sequence);
733 $this->
object->getTestSession()->saveToDb();
736 case "selectImagemapRegion":
738 $this->
object->getTestSession()->setLastSequence($this->sequence);
739 $this->
object->getTestSession()->saveToDb();
743 $this->ctrl->redirect($this,
"outQuestionSummary");
747 $this->
object->createTestSession();
748 $active_id = $this->
object->getTestSession()->getActiveId();
749 $this->ctrl->setParameter($this,
"active_id", $active_id);
750 $shuffle = $this->
object->getShuffleQuestions();
751 if ($this->object->isRandomTest())
753 $this->
object->generateRandomQuestions($this->object->getTestSession()->getActiveId());
754 $this->
object->loadQuestions();
757 $this->
object->createTestSequence($active_id, 0, $shuffle);
758 $active_time_id = $this->
object->startWorkingTime($this->object->getTestSession()->getActiveId(), $this->
object->getTestSession()->getPass());
759 $_SESSION[
"active_time_id"] = $active_time_id;
760 if ($this->object->getListOfQuestionsStart())
762 $this->ctrl->setParameter($this,
"activecommand",
"summary");
763 $this->ctrl->redirect($this,
"redirectQuestion");
767 $this->ctrl->setParameter($this,
"sequence", $this->sequence);
768 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
769 $this->ctrl->saveParameter($this,
"tst_javascript");
770 $this->ctrl->redirect($this,
"redirectQuestion");
775 $active_id = $this->
object->getTestSession()->getActiveId();
776 $this->ctrl->setParameter($this,
"active_id", $active_id);
778 if ($this->object->isRandomTest())
780 if (!$this->object->hasRandomQuestionsForPass($active_id, $this->object->getTestSession()->getPass()))
783 $this->
object->generateRandomQuestions($active_id, $this->object->getTestSession()->getPass());
787 $shuffle = $this->
object->getShuffleQuestions();
788 if ($this->object->isRandomTest())
792 $this->
object->createTestSequence($active_id, $this->object->getTestSession()->getPass(), $shuffle);
794 $this->sequence = $this->
object->getTestSession()->getLastSequence();
795 $active_time_id = $this->
object->startWorkingTime($active_id, $this->object->getTestSession()->getPass());
796 $_SESSION[
"active_time_id"] = $active_time_id;
797 if ($this->object->getListOfQuestionsStart())
799 $this->ctrl->setParameter($this,
"activecommand",
"summary");
800 $this->ctrl->redirect($this,
"redirectQuestion");
804 $this->ctrl->setParameter($this,
"sequence", $this->sequence);
805 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
806 $this->ctrl->saveParameter($this,
"tst_javascript");
807 $this->ctrl->redirect($this,
"redirectQuestion");
814 if (array_key_exists(
"tst_javascript",
$_GET))
816 $ilUser->writePref(
"tst_javascript",
$_GET[
"tst_javascript"]);
819 $this->
object->getTestSession()->setLastSequence($this->sequence);
820 $this->
object->getTestSession()->saveToDb();
837 if (array_key_exists(
"save_error",
$_GET))
839 if (
$_GET[
"save_error"] == 1)
844 switch (
$_GET[
"activecommand"])
858 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_redirect_autosave.html",
"Modules/Test");
859 $this->tpl->setVariable(
"TEXT_REDIRECT", $this->lng->txt(
"redirectAfterSave"));
860 $this->tpl->setCurrentBlock(
"HeadContent");
861 $this->tpl->setVariable(
"CONTENT_BLOCK",
"<meta http-equiv=\"refresh\" content=\"5; url=" . $this->ctrl->getLinkTarget($this,
"redirectBack") .
"\">");
862 $this->tpl->parseCurrentBlock();
869 if (is_array($_POST) && count($_POST) > 0)
874 $result = $this->lng->txt(
"autosave_success");
878 $result = $this->lng->txt(
"autosave_failed");
884 $result = $this->ctrl->getLinkTarget($this,
"redirectAfterAutosave");
900 $this->ctrl->setParameter($this,
"activecommand",
"next");
901 $this->ctrl->redirect($this,
"redirectQuestion");
914 $this->ctrl->setParameter($this,
"activecommand",
"previous");
915 $this->ctrl->redirect($this,
"redirectQuestion");
928 $this->ctrl->setParameter($this,
"activecommand",
"postpone");
929 $this->ctrl->redirect($this,
"redirectQuestion");
942 if ($this->saveResult == FALSE)
944 $this->ctrl->setParameter($this,
"activecommand",
"");
945 $this->ctrl->redirect($this,
"redirectQuestion");
949 $this->ctrl->setParameter($this,
"activecommand",
"summary");
950 $this->ctrl->redirect($this,
"redirectQuestion");
964 $this->ctrl->setParameter($this,
"activecommand",
"setmarked");
965 $this->ctrl->redirect($this,
"redirectQuestion");
978 $this->ctrl->setParameter($this,
"activecommand",
"resetmarked");
979 $this->ctrl->redirect($this,
"redirectQuestion");
992 $this->ctrl->setParameter($this,
"activecommand",
"directfeedback");
993 $this->ctrl->redirect($this,
"redirectQuestion");
1006 $activecommand =
"selectImagemapRegion";
1007 if (array_key_exists(
"cmd", $_POST))
1009 $activecommand = key($_POST[
"cmd"]);
1011 $this->ctrl->setParameter($this,
"activecommand", $activecommand);
1012 $this->ctrl->redirect($this,
"redirectQuestion");
1025 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1026 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
1027 $this->ctrl->saveParameter($this,
"tst_javascript");
1028 $this->ctrl->redirect($this,
"redirectQuestion");
1040 $this->ctrl->setParameter($this,
"activecommand",
"back");
1041 $this->ctrl->redirect($this,
"redirectQuestion");
1067 $template =
new ilTemplate(
"tpl.il_as_tst_finish_confirmation.html", TRUE, TRUE,
"Modules/Test");
1068 $template->setVariable(
"FINISH_QUESTION", $this->lng->txt(
"tst_finish_confirmation_question"));
1069 $template->setVariable(
"BUTTON_CONFIRM", $this->lng->txt(
"tst_finish_confirm_button"));
1070 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
1072 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"tst_finish_confirm_list_of_answers_button"));
1076 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"tst_finish_confirm_cancel_button"));
1078 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1097 $active_id = $this->
object->getTestSession()->getActiveId();
1098 $actualpass = $this->
object->_getPass($active_id);
1099 if (($actualpass == $this->object->getNrOfTries() - 1) && (!$confirm))
1101 $this->
object->setActiveTestSubmitted($ilUser->getId());
1102 $ilAuth->setIdle($ilias->ini->readVariable(
"session",
"expire"),
false);
1103 $ilAuth->setExpire(0);
1106 if (($confirm) && ($actualpass == $this->object->getNrOfTries() - 1))
1108 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
1110 $template =
new ilTemplate(
"tpl.il_as_tst_finish_navigation.html", TRUE, TRUE,
"Modules/Test");
1111 $template->setVariable(
"BUTTON_FINISH", $this->lng->txt(
"btn_next"));
1112 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"btn_previous"));
1114 $template_top =
new ilTemplate(
"tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE,
"Modules/Test");
1115 $template_top->setCurrentBlock(
"button_print");
1116 $template_top->setVariable(
"BUTTON_PRINT", $this->lng->txt(
"print"));
1117 $template_top->parseCurrentBlock();
1119 $this->
showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
1132 $this->
object->getTestSession()->increasePass();
1133 $this->
object->getTestSession()->setLastSequence(0);
1134 $this->
object->getTestSession()->saveToDb();
1141 if (!
$_GET[
"skipfinalstatement"])
1143 if ($this->object->getShowFinalStatement())
1145 $this->ctrl->redirect($this,
"showFinalStatement");
1148 if(
$_GET[
'crs_show_result'])
1150 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToCourse");
1153 if (!$this->object->canViewResults())
1159 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1168 $template =
new ilTemplate(
"tpl.il_as_tst_final_statement.html", TRUE, TRUE,
"Modules/Test");
1169 $this->ctrl->setParameter($this,
"crs_show_result",
$_GET[
'crs_show_result']);
1170 $this->ctrl->setParameter($this,
"skipfinalstatement", 1);
1171 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"redirectBack"));
1172 $template->setVariable(
"FINALSTATEMENT", $this->object->getFinalStatement());
1173 $template->setVariable(
"BUTTON_CONTINUE", $this->lng->txt(
"btn_next"));
1186 global $rbacsystem, $ilUser;
1187 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_output.html",
"Modules/Test");
1188 if (!$rbacsystem->checkAccess(
"read", $this->object->getRefId()))
1191 $this->ilias->raiseError($this->lng->txt(
"cannot_execute_test"),$this->ilias->error_obj->MESSAGE);
1200 if ($this->object->endingTimeReached())
1206 if ($this->object->getKioskMode())
1209 if ($this->object->getShowKioskModeTitle())
1211 $this->tpl->setCurrentBlock(
"kiosk_show_title");
1212 $this->tpl->setVariable(
"TEST_TITLE", $this->object->getTitle());
1213 $this->tpl->parseCurrentBlock();
1215 if ($this->object->getShowKioskModeParticipant())
1217 $this->tpl->setCurrentBlock(
"kiosk_show_participant");
1218 $this->tpl->setVariable(
"PARTICIPANT_NAME", $this->lng->txt(
"login_as") .
" " . $ilUser->getFullname());
1219 $this->tpl->parseCurrentBlock();
1223 if (($this->object->getInstantFeedbackSolution() == 1) || ($this->object->getAnswerFeedback() == 1) || ($this->object->getAnswerFeedbackPoints() == 1))
1225 $this->tpl->setCurrentBlock(
"direct_feedback");
1226 $this->tpl->setVariable(
"TEXT_DIRECT_FEEDBACK", $this->lng->txt(
"check"));
1227 $this->tpl->parseCurrentBlock();
1236 if ($this->object->getEnableProcessingTime())
1241 $this->tpl->setVariable(
"FORM_TIMESTAMP", time());
1242 $directfeedback = 0;
1243 if (strcmp(
$_GET[
"activecommand"],
"directfeedback") == 0) $directfeedback = 1;
1244 $this->
outWorkingForm($this->sequence, $this->object->getTestId(), $postpone, $directfeedback, $show_summary);
1245 $this->tpl->setVariable(
"PAGETITLE",
"- " . $this->object->getTitle());
1260 $user = $this->
object->getInvitedUsers($ilUser->getId());
1264 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1269 if (strcmp(
$user->clientip,
"")!=0 && strcmp(
$user->clientip,$_SERVER[
"REMOTE_ADDR"])!=0)
1272 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1284 and $this->
object->startingTimeReached()
1285 and !$this->
object->endingTimeReached();
1293 return $this->
object->hasNrOfTriesRestriction() && $this->
object->isNrOfTriesReached($this->object->getTestSession()->getPass());
1305 if (array_key_exists(
"pass",
$_GET) && (strlen(
$_GET[
"pass"]) > 0))
1307 $this->ctrl->saveParameter($this,
"pass");
1308 $this->ctrl->saveParameter($this,
"active_id");
1309 $this->outTestResults(
false,
$_GET[
"pass"]);
1313 $this->outTestResults(
false);
1325 $this->
object->getTestSession()->increasePass();
1326 $this->
object->getTestSession()->setLastSequence(0);
1327 $this->
object->getTestSession()->saveToDb();
1328 if (!$this->object->canViewResults())
1334 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1357 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_submit_answers_confirm.html",
"Modules/Test");
1358 $this->tpl->setCurrentBlock(
"adm_content");
1359 if ($this->object->isActiveTestSubmitted())
1361 $this->tpl->setCurrentBlock(
"not_submit_allowed");
1362 $this->tpl->setVariable(
"TEXT_ALREADY_SUBMITTED", $this->lng->txt(
"tst_already_submitted"));
1363 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_show_answer_sheet"));
1366 $this->tpl->setCurrentBlock(
"submit_allowed");
1367 $this->tpl->setVariable(
"TEXT_CONFIRM_SUBMIT_RESULTS", $this->lng->txt(
"tst_confirm_submit_answers"));
1368 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_submit_results"));
1370 $this->tpl->setVariable(
"BTN_BACK", $this->lng->txt(
"back"));
1371 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"finalSubmission"));
1372 $this->tpl->parseCurrentBlock();
1379 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
1380 $processing_time = $this->
object->getProcessingTimeInSeconds();
1381 $processing_time_minutes = floor($processing_time / 60);
1382 $processing_time_seconds = $processing_time - $processing_time_minutes * 60;
1383 $str_processing_time =
"";
1384 if ($processing_time_minutes > 0)
1386 $str_processing_time = $processing_time_minutes .
" " . $this->lng->txt(
"minutes");
1388 if ($processing_time_seconds > 0)
1390 if (strlen($str_processing_time) > 0) $str_processing_time .=
" " . $this->lng->txt(
"and") .
" ";
1391 $str_processing_time .= $processing_time_seconds .
" " . $this->lng->txt(
"seconds");
1393 $time_left = $starting_time + $processing_time - mktime();
1394 $time_left_minutes = floor($time_left / 60);
1395 $time_left_seconds = $time_left - $time_left_minutes * 60;
1396 $str_time_left =
"";
1397 if ($time_left_minutes > 0)
1399 $str_time_left = $time_left_minutes .
" " . $this->lng->txt(
"minutes");
1401 if ($time_left < 300)
1403 if ($time_left_seconds > 0)
1405 if (strlen($str_time_left) > 0) $str_time_left .=
" " . $this->lng->txt(
"and") .
" ";
1406 $str_time_left .= $time_left_seconds .
" " . $this->lng->txt(
"seconds");
1409 $date = getdate($starting_time);
1421 $datenow = getdate();
1422 $this->tpl->setCurrentBlock(
"enableprocessingtime");
1423 $this->tpl->setVariable(
"USER_WORKING_TIME",
1425 $this->lng->txt(
"tst_time_already_spent"),
1426 $formattedStartingTime,
1427 $str_processing_time
1430 $this->tpl->setVariable(
"USER_REMAINING_TIME", sprintf($this->lng->txt(
"tst_time_already_spent_left"), $str_time_left));
1431 $this->tpl->parseCurrentBlock();
1432 $template =
new ilTemplate(
"tpl.workingtime.js.html", TRUE, TRUE, TRUE);
1433 $template->setVariable(
"STRING_MINUTE", $this->lng->txt(
"minute"));
1434 $template->setVariable(
"STRING_MINUTES", $this->lng->txt(
"minutes"));
1435 $template->setVariable(
"STRING_SECOND", $this->lng->txt(
"second"));
1436 $template->setVariable(
"STRING_SECONDS", $this->lng->txt(
"seconds"));
1437 $template->setVariable(
"STRING_TIMELEFT", $this->lng->txt(
"tst_time_already_spent_left"));
1438 $template->setVariable(
"AND", strtolower($this->lng->txt(
"and")));
1439 $template->setVariable(
"YEAR", $date[
"year"]);
1440 $template->setVariable(
"MONTH", $date[
"mon"]-1);
1441 $template->setVariable(
"DAY", $date[
"mday"]);
1442 $template->setVariable(
"HOUR", $date[
"hours"]);
1443 $template->setVariable(
"MINUTE", $date[
"minutes"]);
1444 $template->setVariable(
"SECOND", $date[
"seconds"]);
1445 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->object->getEndingTime(), $matches))
1447 $template->setVariable(
"ENDYEAR", $matches[1]);
1448 $template->setVariable(
"ENDMONTH", $matches[2]-1);
1449 $template->setVariable(
"ENDDAY", $matches[3]);
1450 $template->setVariable(
"ENDHOUR", $matches[4]);
1451 $template->setVariable(
"ENDMINUTE", $matches[5]);
1452 $template->setVariable(
"ENDSECOND", $matches[6]);
1454 $template->setVariable(
"YEARNOW", $datenow[
"year"]);
1455 $template->setVariable(
"MONTHNOW", $datenow[
"mon"]-1);
1456 $template->setVariable(
"DAYNOW", $datenow[
"mday"]);
1457 $template->setVariable(
"HOURNOW", $datenow[
"hours"]);
1458 $template->setVariable(
"MINUTENOW", $datenow[
"minutes"]);
1459 $template->setVariable(
"SECONDNOW", $datenow[
"seconds"]);
1460 $template->setVariable(
"PTIME_M", $processing_time_minutes);
1461 $template->setVariable(
"PTIME_S", $processing_time_seconds);
1463 $this->tpl->setCurrentBlock(
"HeadContent");
1464 $this->tpl->setVariable(
"CONTENT_BLOCK", $template->get());
1465 $this->tpl->parseCurrentBlock();
1475 $active_id = $this->
object->getTestSession()->getActiveId();
1476 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_question_summary.html",
"Modules/Test");
1477 $color_class = array (
"tblrow1",
"tblrow2");
1480 $result_array = & $this->
object->getTestSequence()->getSequenceSummary();
1481 $marked_questions = array();
1482 if ($this->object->getShowMarker())
1484 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1487 foreach ($result_array as $key => $value)
1489 if (preg_match(
"/\d+/", $key))
1491 $this->tpl->setCurrentBlock(
"question");
1492 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1493 $this->tpl->setVariable(
"VALUE_QUESTION_COUNTER", $value[
"nr"]);
1494 $this->ctrl->setParameter($this,
"sequence", $value[
"sequence"]);
1495 $this->tpl->setVariable(
"VALUE_QUESTION_TITLE",
"<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this),
"gotoQuestion").
"\">" . $this->
object->getQuestionTitle($value[
"title"]) .
"</a>");
1496 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1497 if ($this->object->getListOfQuestionsDescription())
1499 $this->tpl->setVariable(
"VALUE_QUESTION_DESCRIPTION", $value[
"description"]);
1501 if ($value[
"worked_through"])
1504 $this->tpl->setVariable(
"ALT_WORKED_THROUGH", $this->lng->txt(
"worked_through"));
1509 $this->tpl->setVariable(
"ALT_WORKED_THROUGH", $this->lng->txt(
"not_worked_through"));
1511 if ($value[
"postponed"])
1513 $this->tpl->setVariable(
"VALUE_POSTPONED", $this->lng->txt(
"postponed"));
1515 if (!$this->object->getTitleOutput())
1517 $this->tpl->setVariable(
"VALUE_QUESTION_POINTS", $value[
"points"].
" ".$this->lng->txt(
"points_short"));
1519 if (count($marked_questions))
1521 if (array_key_exists($value[
"qid"], $marked_questions))
1523 $obj = $marked_questions[$value[
"qid"]];
1524 if ($obj->solved == 1)
1526 $this->tpl->setVariable(
"ALT_MARKED_IMAGE", $this->lng->txt(
"tst_question_marked"));
1527 $this->tpl->setVariable(
"TITLE_MARKED_IMAGE", $this->lng->txt(
"tst_question_marked"));
1532 $this->tpl->parseCurrentBlock();
1537 $this->tpl->setVariable(
"QUESTION_ACTION",
"actions");
1538 $this->tpl->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_qst_order"));
1539 $this->tpl->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
1540 if (!$this->object->getTitleOutput())
1542 $this->tpl->setVariable(
"QUESTION_POINTS", $this->lng->txt(
"tst_maximum_points"));
1544 if ($this->object->getShowMarker())
1546 $this->tpl->setVariable(
"TEXT_MARKED", $this->lng->txt(
"tst_question_marker"));
1548 $this->tpl->setVariable(
"WORKED_THROUGH", $this->lng->txt(
"worked_through"));
1549 $this->tpl->setVariable(
"USER_FEEDBACK", $this->lng->txt(
"tst_qst_summary_text"));
1550 $this->tpl->setVariable(
"TXT_BACK", $this->lng->txt(
"back"));
1551 $this->tpl->setVariable(
"TXT_SHOW_AND_SUBMIT_ANSWERS", $this->lng->txt(
"save_finish"));
1552 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"backFromSummary"));
1553 $this->tpl->setVariable(
"TEXT_RESULTS", $this->lng->txt(
"question_summary"));
1555 if ($this->object->getEnableProcessingTime())
1561 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_max_allowed_users_reached.html",
"Modules/Test");
1562 $this->tpl->setCurrentBlock(
"adm_content");
1563 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_MESSAGE", sprintf($this->lng->txt(
"tst_max_allowed_users_message"), $this->
object->getAllowedUsersTimeGap()));
1564 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_HEADING", sprintf($this->lng->txt(
"tst_max_allowed_users_heading"), $this->
object->getAllowedUsersTimeGap()));
1565 $this->tpl->setVariable(
"BACK_TO_INTRODUCTION", $this->lng->txt(
"tst_results_back_introduction"));
1566 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1567 $this->tpl->parseCurrentBlock();
1573 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
1575 $template =
new ilTemplate(
"tpl.il_as_tst_finish_navigation.html", TRUE, TRUE,
"Modules/Test");
1576 $template->setVariable(
"BUTTON_FINISH", $this->lng->txt(
"btn_next"));
1577 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"btn_previous"));
1579 $template_top =
new ilTemplate(
"tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE,
"Modules/Test");
1580 $template_top->setCurrentBlock(
"button_print");
1581 $template_top->setVariable(
"BUTTON_PRINT", $this->lng->txt(
"print"));
1582 $template_top->parseCurrentBlock();
1583 $active_id = $this->
object->getTestSession()->getActiveId();
1584 return $this->
showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
1588 $this->ctrl->redirect($this,
"redirectQuestion");
1604 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_correct_solution.html",
"Modules/Test");
1606 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1607 $this->tpl->setCurrentBlock(
"ContentStyle");
1609 $this->tpl->parseCurrentBlock();
1611 $this->tpl->setCurrentBlock(
"SyntaxStyle");
1613 $this->tpl->parseCurrentBlock();
1616 if ($this->object->getShowSolutionAnswersOnly())
1621 $this->tpl->setCurrentBlock(
"adm_content");
1623 $this->tpl->setVariable(
"OUTPUT_SOLUTION", $solution);
1624 $this->tpl->setVariable(
"TEXT_BACK", $this->lng->txt(
"back"));
1625 $this->ctrl->saveParameter($this,
"pass");
1626 $this->ctrl->saveParameter($this,
"active_id");
1627 $this->tpl->setVariable(
"URL_BACK", $this->ctrl->getLinkTarget($this,
"outUserResultsOverview"));
1628 $this->tpl->parseCurrentBlock();
1644 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_finish_list_of_answers.html",
"Modules/Test");
1646 $result_array =& $this->
object->getTestResult($active_id,
$pass);
1650 foreach ($result_array as $question_data)
1652 $question = $question_data[
"qid"];
1653 if (is_numeric($question))
1655 $this->tpl->setCurrentBlock(
"printview_question");
1656 $question_gui = $this->
object->createQuestionGUI(
"", $question);
1657 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1658 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
1659 $template->setVariable(
"QUESTION_TITLE", $question_gui->object->getTitle());
1661 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
1662 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
1663 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
1664 $this->tpl->setVariable(
"QUESTION_OUTPUT", $template->get());
1665 $this->tpl->parseCurrentBlock();
1671 if ($this->object->getShowSolutionAnswersOnly())
1675 if (strlen($top_data))
1677 $this->tpl->setCurrentBlock(
"top_data");
1678 $this->tpl->setVariable(
"TOP_DATA", $top_data);
1679 $this->tpl->parseCurrentBlock();
1682 if (strlen($bottom_data))
1684 $this->tpl->setCurrentBlock(
"bottom_data");
1685 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1686 $this->tpl->setVariable(
"BOTTOM_DATA", $bottom_data);
1687 $this->tpl->parseCurrentBlock();
1690 $this->tpl->setCurrentBlock(
"adm_content");
1691 $this->tpl->setVariable(
"TXT_ANSWER_SHEET", $this->lng->txt(
"tst_list_of_answers"));
1694 $this->tpl->setVariable(
"USER_DETAILS", $user_data);
1695 $this->tpl->setVariable(
"SIGNATURE", $signature);
1696 $this->tpl->setVariable(
"TITLE", $this->object->getTitle());
1697 $this->tpl->setVariable(
"TXT_TEST_PROLOG", $this->lng->txt(
"tst_your_answers"));
1698 $invited_user =& $this->
object->getInvitedUsers($ilUser->getId());
1699 $pagetitle = $this->
object->getTitle() .
" - " . $this->lng->txt(
"clientip") .
1700 ": " . $invited_user[$ilUser->getId()]->clientip .
" - " .
1701 $this->lng->txt(
"matriculation") .
": " .
1702 $invited_user[$ilUser->getId()]->matriculation;
1703 $this->tpl->setVariable(
"PAGETITLE", $pagetitle);
1704 $this->tpl->parseCurrentBlock();
1715 if ($this->object->getKioskMode())
1717 $this->tpl->setVariable(
"BODY_CLASS",
"kiosk");
1718 $this->tpl->setAddFooter(FALSE);
1723 return "ADM_CONTENT";
1729 $this->ctrl->redirectByClass(
"iltestevaluationgui",
"outUserResultsOverview");
1734 $this->ctrl->redirectByClass(
"iltestevaluationgui",
"outUserListOfAnswerPasses");