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");
88 if (preg_match(
"/^gotoquestion_(\\d+)$/",
$cmd, $matches))
90 $cmd =
"gotoquestion";
91 if (strlen($matches[1]))
93 $this->ctrl->setParameter($this,
'gotosequence', $matches[1]);
97 if (
$_GET[
"active_id"])
99 $this->
object->setTestSession(
$_GET[
"active_id"]);
103 $this->
object->setTestSession();
105 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
125 $this->
object->updateWorkingTime(
$_SESSION[
"active_time_id"]);
135 $this->saveResult = FALSE;
138 $formtimestamp =
$_POST[
"formtimestamp"];
139 if (strlen($formtimestamp) == 0) $formtimestamp =
$_GET[
"formtimestamp"];
140 if ($formtimestamp !=
$_SESSION[
"formtimestamp"])
142 $_SESSION[
"formtimestamp"] = $formtimestamp;
153 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
154 if (is_numeric($q_id))
158 $question_gui = $this->
object->createQuestionGUI(
"", $q_id);
159 if ($this->object->getJavaScriptOutput())
164 $active_id = $this->
object->getTestSession()->getActiveId();
165 if ($this->object->isRandomTest())
167 $pass = $this->
object->_getPass($active_id);
169 $this->saveResult = $question_gui->object->saveWorkingData($active_id,
$pass);
172 if ($this->saveResult == FALSE)
174 $this->ctrl->setParameter($this,
"save_error",
"1");
202 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
216 $active_id = $this->
object->getTestSession()->getActiveId();
217 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
218 if ($starting_time === FALSE)
224 return $this->
object->isMaxProcessingTimeReached($starting_time);
236 $active_time_id = $this->
object->startWorkingTime($this->object->getTestSession()->getActiveId(), $this->
object->getTestSession()->getPass());
237 $_SESSION[
"active_time_id"] = $active_time_id;
239 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
240 $this->tpl->setCurrentBlock(
"ContentStyle");
241 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
243 $this->tpl->parseCurrentBlock();
246 $this->tpl->setCurrentBlock(
"SyntaxStyle");
247 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
249 $this->tpl->parseCurrentBlock();
251 if ($this->object->getListOfQuestions())
253 $show_side_list = $ilUser->getPref(
'side_list_of_questions');
254 $this->tpl->setCurrentBlock(
'view_sidelist');
256 $this->tpl->setVariable(
'TEXT_SIDELIST', ($show_side_list) ? $this->lng->txt(
'tst_hide_side_list') : $this->lng->txt(
'tst_show_side_list'));
257 $this->tpl->parseCurrentBlock();
265 $question_gui = $this->
object->createQuestionGUI(
"", $this->object->getTestSequence()->getQuestionForSequence(
$sequence));
266 if ($this->object->getJavaScriptOutput())
271 $is_postponed = $this->
object->getTestSequence()->isPostponedQuestion($question_gui->object->getId());
272 $this->ctrl->setParameter($this,
"sequence",
"$sequence");
273 $formaction = $this->ctrl->getFormAction($this,
"gotoQuestion");
275 $question_gui->setSequenceNumber($this->object->getTestSequence()->getPositionOfSequence(
$sequence));
276 $question_gui->setQuestionCount($this->object->getTestSequence()->getUserQuestionCount());
278 $user_post_solution = FALSE;
279 if (array_key_exists(
"previouspost",
$_SESSION))
281 $user_post_solution =
$_SESSION[
"previouspost"];
284 $answer_feedback = FALSE;
285 if (($directfeedback) && ($this->object->getAnswerFeedback()))
287 $answer_feedback = TRUE;
289 global $ilNavigationHistory;
290 $ilNavigationHistory->addItem(
$_GET[
"ref_id"], $this->ctrl->getLinkTarget($this,
"resume"),
"tst");
291 $question_gui->outQuestionForTest($formaction, $this->object->getTestSession()->getActiveId(), NULL, $is_postponed, $user_post_solution, $answer_feedback);
294 if ($this->object->getInstantFeedbackSolution())
296 $solutionoutput = $question_gui->getSolutionOutput($this->object->getTestSession()->getActiveId(), NULL, FALSE, FALSE, FALSE, FALSE, TRUE);
297 $this->tpl->setCurrentBlock(
"solution_output");
298 $this->tpl->setVariable(
"CORRECT_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
299 $this->tpl->setVariable(
"QUESTION_FEEDBACK", $solutionoutput);
300 $this->tpl->parseCurrentBlock();
302 if ($this->object->getAnswerFeedbackPoints())
304 $this->tpl->setCurrentBlock(
"solution_output");
305 $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()));
306 $this->tpl->parseCurrentBlock();
308 if ($this->object->getAnswerFeedback())
310 $this->tpl->setCurrentBlock(
"answer_feedback");
311 $this->tpl->setVariable(
"ANSWER_FEEDBACK", $question_gui->getAnswerFeedbackOutput($this->object->getTestSession()->getActiveId(), NULL));
312 $this->tpl->parseCurrentBlock();
316 if (
$sequence == $this->object->getTestSequence()->getFirstSequence())
318 $this->tpl->setCurrentBlock(
"prev");
319 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_introduction"));
320 $this->tpl->parseCurrentBlock();
321 $this->tpl->setCurrentBlock(
"prev_bottom");
322 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_introduction"));
323 $this->tpl->parseCurrentBlock();
327 $this->tpl->setCurrentBlock(
"prev");
328 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_previous"));
329 $this->tpl->parseCurrentBlock();
330 $this->tpl->setCurrentBlock(
"prev_bottom");
331 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_previous"));
332 $this->tpl->parseCurrentBlock();
335 if ($postpone_allowed)
341 $this->tpl->setCurrentBlock(
"postpone");
342 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone"));
343 $this->tpl->parseCurrentBlock();
344 $this->tpl->setCurrentBlock(
"postpone_bottom");
345 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone"));
346 $this->tpl->parseCurrentBlock();
351 if ($this->object->getListOfQuestions())
353 if (!(($finish) && ($this->object->getListOfQuestionsEnd())))
355 $this->tpl->setCurrentBlock(
"summary");
356 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary"));
357 $this->tpl->parseCurrentBlock();
358 $this->tpl->setCurrentBlock(
"summary_bottom");
359 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary"));
360 $this->tpl->parseCurrentBlock();
364 if ($this->object->getShowCancel())
366 $this->tpl->setCurrentBlock(
"cancel_test");
367 $this->tpl->setVariable(
"TEXT_CANCELTEST", $this->lng->txt(
"cancel_test"));
368 $this->tpl->setVariable(
"TEXT_ALTCANCELTEXT", $this->lng->txt(
"cancel_test"));
369 $this->tpl->setVariable(
"TEXT_TITLECANCELTEXT", $this->lng->txt(
"cancel_test"));
370 $this->tpl->setVariable(
"HREF_IMGCANCELTEST", $this->ctrl->getLinkTargetByClass(get_class($this),
"outIntroductionPage") .
"&cancelTest=true");
371 $this->tpl->setVariable(
"HREF_CANCELTEXT", $this->ctrl->getLinkTargetByClass(get_class($this),
"outIntroductionPage") .
"&cancelTest=true");
373 $this->tpl->parseCurrentBlock();
376 if ($this->object->getTestSequence()->getQuestionForSequence($this->object->getTestSequence()->getLastSequence()) == $question_gui->object->getId())
378 if ($this->object->getListOfQuestionsEnd())
380 $this->tpl->setCurrentBlock(
"next");
381 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"question_summary") .
" >>");
382 $this->tpl->parseCurrentBlock();
383 $this->tpl->setCurrentBlock(
"next_bottom");
384 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"question_summary") .
" >>");
385 $this->tpl->parseCurrentBlock();
389 $this->tpl->setCurrentBlock(
"next");
390 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_finish") .
" >>");
391 $this->tpl->parseCurrentBlock();
392 $this->tpl->setCurrentBlock(
"next_bottom");
393 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_finish") .
" >>");
394 $this->tpl->parseCurrentBlock();
399 $this->tpl->setCurrentBlock(
"next");
400 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_next") .
" >>");
401 $this->tpl->parseCurrentBlock();
402 $this->tpl->setCurrentBlock(
"next_bottom");
403 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_next") .
" >>");
404 $this->tpl->parseCurrentBlock();
407 if ($this->object->getShowMarker())
409 include_once
"./Modules/Test/classes/class.ilObjTest.php";
413 if (count ($solved_array) > 0)
415 $solved = array_pop($solved_array);
416 $solved = $solved[
"solved"];
421 $this->tpl->setCurrentBlock(
"ismarked");
423 $this->tpl->setVariable(
"TEXT_SET", $this->lng->txt(
"tst_remove_mark"));
424 $this->tpl->parseCurrentBlock();
428 $this->tpl->setCurrentBlock(
"isnotmarked");
430 $this->tpl->setVariable(
"TEXT_UNSET", $this->lng->txt(
"tst_question_mark"));
431 $this->tpl->parseCurrentBlock();
435 if ($this->object->getJavaScriptOutput())
438 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"disable_javascript"));
439 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"disable_javascript"));
440 $this->ctrl->setParameter($this,
"tst_javascript",
"0");
441 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
446 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"enable_javascript"));
447 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"enable_javascript"));
448 $this->ctrl->setParameter($this,
"tst_javascript",
"1");
449 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
452 if ($question_gui->object->supportsJavascriptOutput())
454 $this->tpl->touchBlock(
"jsswitch");
458 $this->tpl->setVariable(
"AUTOSAVE_URL", $this->ctrl->getLinkTarget($this,
"autosave"));
468 $template =
new ilTemplate(
"tpl.il_as_tst_password_protection.html", TRUE, TRUE,
"Modules/Test");
469 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"checkPassword"));
470 $template->setVariable(
"PASSWORD_INTRODUCTION", $this->lng->txt(
"tst_password_introduction"));
471 $template->setVariable(
"TEXT_PASSWORD", $this->lng->txt(
"tst_password"));
472 $template->setVariable(
"SUBMIT", $this->lng->txt(
"submit"));
483 if (strcmp($this->object->getPassword(),
$_POST[
"password"]) == 0)
486 if (
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID)
488 $ilUser->setPref(
"tst_password_".$this->object->getTestId(), $this->
object->getPassword());
489 $ilUser->writePref(
"tst_password_".$this->object->getTestId(), $this->
object->getPassword());
491 $this->ctrl->redirect($this,
"start");
496 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
509 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
511 $this->
object->setAccessCodeSession(
$_POST[
"anonymous_id"]);
513 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
530 $this->ctrl->redirect($this,
"startTest");
534 $this->ctrl->redirectByClass(
"ilobjtestgui",
"redirectToInfoScreen");
545 if ($this->object->checkMaximumAllowedUsers() == FALSE)
549 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
551 $this->
object->setAccessCodeSession($this->object->createNewAccessCode());
555 $this->
object->unsetAccessCodeSession();
557 if (strlen($this->object->getPassword()))
562 $pwd = $ilUser->getPref(
"tst_password_".$this->object->getTestId());
563 if ((strcmp($pwd, $this->object->getPassword()) != 0) && (!$rbacsystem->checkAccess(
"write", $this->object->getRefId())))
568 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
570 $this->ctrl->redirect($this,
"displayCode");
574 $this->ctrl->setParameter($this,
"activecommand",
"start");
575 $this->ctrl->redirect($this,
"redirectQuestion");
581 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_anonymous_code_presentation.html",
"Modules/Test");
582 $this->tpl->setCurrentBlock(
"adm_content");
583 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE_CREATED", $this->lng->txt(
"tst_access_code_created"));
584 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE", $this->object->getAccessCodeSession());
585 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
586 $this->tpl->setVariable(
"CONTINUE", $this->lng->txt(
"continue_work"));
587 $this->tpl->parseCurrentBlock();
592 $this->ctrl->setParameter($this,
"activecommand",
"start");
593 $this->ctrl->redirect($this,
"redirectQuestion");
605 if ($this->object->checkMaximumAllowedUsers() == FALSE)
610 $this->ctrl->setParameter($this,
"activecommand",
"resume");
611 $this->ctrl->redirect($this,
"redirectQuestion");
621 if (
$_POST[
"chb_javascript"])
623 $ilUser->writePref(
"tst_javascript", 1);
627 $ilUser->writePref(
"tst_javascript", 0);
631 if ($this->object->getNrOfTries() != 1)
633 if ($this->object->getUsePreviousAnswers() == 1)
635 if (
$_POST[
"chb_use_previous_answers"])
637 $ilUser->writePref(
"tst_use_previous_answers", 1);
641 $ilUser->writePref(
"tst_use_previous_answers", 0);
667 $executable = $this->
object->isExecutable($ilUser->getId());
668 if (!$executable[
"executable"])
671 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
673 switch (
$_GET[
"activecommand"])
677 if ($this->sequence === FALSE)
679 if ($this->object->getListOfQuestionsEnd())
685 $this->ctrl->redirect($this,
"finishTest");
690 $this->
object->getTestSession()->setLastSequence($this->sequence);
691 $this->
object->getTestSession()->saveToDb();
697 $this->
object->getTestSession()->setLastSequence($this->sequence);
698 $this->
object->getTestSession()->saveToDb();
699 if ($this->sequence === FALSE)
701 $this->ctrl->redirect($this,
"outIntroductionPage");
710 $nextSequence = $this->
object->getTestSequence()->getNextSequence($this->sequence);
711 $this->
object->getTestSequence()->postponeSequence($this->sequence);
712 $this->
object->getTestSequence()->saveToDb();
713 $this->
object->getTestSession()->setLastSequence($nextSequence);
714 $this->
object->getTestSession()->saveToDb();
715 $this->sequence = $nextSequence;
720 $this->
object->getTestSession()->setLastSequence($this->sequence);
721 $this->
object->getTestSession()->saveToDb();
722 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
723 $this->
object->setQuestionSetSolved(1, $q_id, $ilUser->getId());
728 $this->
object->getTestSession()->setLastSequence($this->sequence);
729 $this->
object->getTestSession()->saveToDb();
730 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
731 $this->
object->setQuestionSetSolved(0, $q_id, $ilUser->getId());
734 case "directfeedback":
736 $this->
object->getTestSession()->setLastSequence($this->sequence);
737 $this->
object->getTestSession()->saveToDb();
740 case "selectImagemapRegion":
742 $this->
object->getTestSession()->setLastSequence($this->sequence);
743 $this->
object->getTestSession()->saveToDb();
747 $this->ctrl->redirect($this,
"outQuestionSummary");
751 $this->
object->createTestSession();
752 $active_id = $this->
object->getTestSession()->getActiveId();
753 $this->ctrl->setParameter($this,
"active_id", $active_id);
754 $shuffle = $this->
object->getShuffleQuestions();
755 if ($this->object->isRandomTest())
757 $this->
object->generateRandomQuestions($this->object->getTestSession()->getActiveId());
758 $this->
object->loadQuestions();
761 $this->
object->createTestSequence($active_id, 0, $shuffle);
762 $active_time_id = $this->
object->startWorkingTime($this->object->getTestSession()->getActiveId(), $this->
object->getTestSession()->getPass());
763 $_SESSION[
"active_time_id"] = $active_time_id;
764 if ($this->object->getListOfQuestionsStart())
766 $this->ctrl->setParameter($this,
"activecommand",
"summary");
767 $this->ctrl->redirect($this,
"redirectQuestion");
771 $this->ctrl->setParameter($this,
"sequence", $this->sequence);
772 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
773 $this->ctrl->saveParameter($this,
"tst_javascript");
774 $this->ctrl->redirect($this,
"redirectQuestion");
779 $active_id = $this->
object->getTestSession()->getActiveId();
780 $this->ctrl->setParameter($this,
"active_id", $active_id);
782 if ($this->object->isRandomTest())
784 if (!$this->object->hasRandomQuestionsForPass($active_id, $this->object->getTestSession()->getPass()))
787 $this->
object->generateRandomQuestions($active_id, $this->object->getTestSession()->getPass());
790 $shuffle = $this->
object->getShuffleQuestions();
791 if ($this->object->isRandomTest())
795 $this->
object->createTestSequence($active_id, $this->object->getTestSession()->getPass(), $shuffle);
797 $this->sequence = $this->
object->getTestSession()->getLastSequence();
798 $active_time_id = $this->
object->startWorkingTime($active_id, $this->object->getTestSession()->getPass());
799 $_SESSION[
"active_time_id"] = $active_time_id;
800 if ($this->object->getListOfQuestionsStart())
802 $this->ctrl->setParameter($this,
"activecommand",
"summary");
803 $this->ctrl->redirect($this,
"redirectQuestion");
807 $this->ctrl->setParameter($this,
"sequence", $this->sequence);
808 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
809 $this->ctrl->saveParameter($this,
"tst_javascript");
810 $this->ctrl->redirect($this,
"redirectQuestion");
817 if (array_key_exists(
"tst_javascript",
$_GET))
819 $ilUser->writePref(
"tst_javascript",
$_GET[
"tst_javascript"]);
822 if (strlen(
$_GET[
'gotosequence'])) $this->sequence =
$_GET[
'gotosequence'];
823 $this->
object->getTestSession()->setLastSequence($this->sequence);
824 $this->
object->getTestSession()->saveToDb();
841 if (array_key_exists(
"save_error",
$_GET))
843 if (
$_GET[
"save_error"] == 1)
848 switch (
$_GET[
"activecommand"])
862 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_redirect_autosave.html",
"Modules/Test");
863 $this->tpl->setVariable(
"TEXT_REDIRECT", $this->lng->txt(
"redirectAfterSave"));
864 $this->tpl->setCurrentBlock(
"HeadContent");
865 $this->tpl->setVariable(
"CONTENT_BLOCK",
"<meta http-equiv=\"refresh\" content=\"5; url=" . $this->ctrl->getLinkTarget($this,
"redirectBack") .
"\">");
866 $this->tpl->parseCurrentBlock();
878 $result = $this->lng->txt(
"autosave_success");
882 $result = $this->lng->txt(
"autosave_failed");
888 $result = $this->ctrl->getLinkTarget($this,
"redirectAfterAutosave");
901 $show_side_list = $ilUser->getPref(
'side_list_of_questions');
902 $ilUser->writePref(
'side_list_of_questions', !$show_side_list);
904 $this->ctrl->redirect($this,
"redirectQuestion");
917 $this->ctrl->setParameter($this,
"activecommand",
"next");
918 $this->ctrl->redirect($this,
"redirectQuestion");
931 $this->ctrl->setParameter($this,
"activecommand",
"previous");
932 $this->ctrl->redirect($this,
"redirectQuestion");
945 $this->ctrl->setParameter($this,
"activecommand",
"postpone");
946 $this->ctrl->redirect($this,
"redirectQuestion");
959 if ($this->saveResult == FALSE)
961 $this->ctrl->setParameter($this,
"activecommand",
"");
962 $this->ctrl->redirect($this,
"redirectQuestion");
966 $this->ctrl->setParameter($this,
"activecommand",
"summary");
967 $this->ctrl->redirect($this,
"redirectQuestion");
981 $this->ctrl->setParameter($this,
"activecommand",
"setmarked");
982 $this->ctrl->redirect($this,
"redirectQuestion");
995 $this->ctrl->setParameter($this,
"activecommand",
"resetmarked");
996 $this->ctrl->redirect($this,
"redirectQuestion");
1009 $this->ctrl->setParameter($this,
"activecommand",
"directfeedback");
1010 $this->ctrl->redirect($this,
"redirectQuestion");
1023 $activecommand =
"selectImagemapRegion";
1024 if (array_key_exists(
"cmd",
$_POST))
1026 $activecommand = key(
$_POST[
"cmd"]);
1028 $this->ctrl->setParameter($this,
"activecommand", $activecommand);
1029 $this->ctrl->redirect($this,
"redirectQuestion");
1042 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1043 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
1044 $this->ctrl->saveParameter($this,
"tst_javascript");
1046 $this->ctrl->redirect($this,
"redirectQuestion");
1058 $this->ctrl->setParameter($this,
"activecommand",
"back");
1059 $this->ctrl->redirect($this,
"redirectQuestion");
1085 $template =
new ilTemplate(
"tpl.il_as_tst_finish_confirmation.html", TRUE, TRUE,
"Modules/Test");
1086 $template->setVariable(
"FINISH_QUESTION", $this->lng->txt(
"tst_finish_confirmation_question"));
1087 $template->setVariable(
"BUTTON_CONFIRM", $this->lng->txt(
"tst_finish_confirm_button"));
1088 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
1090 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"tst_finish_confirm_list_of_answers_button"));
1094 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"tst_finish_confirm_cancel_button"));
1096 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1115 $active_id = $this->
object->getTestSession()->getActiveId();
1116 $actualpass = $this->
object->_getPass($active_id);
1117 if (($actualpass == $this->object->getNrOfTries() - 1) && (!$confirm))
1119 $this->
object->setActiveTestSubmitted($ilUser->getId());
1120 $ilAuth->setIdle($ilias->ini->readVariable(
"session",
"expire"),
false);
1121 $ilAuth->setExpire(0);
1122 switch ($this->object->getMailNotification())
1125 $this->
object->sendSimpleNotification($active_id);
1128 $this->
object->sendAdvancedNotification($active_id);
1133 if (($confirm) && ($actualpass == $this->object->getNrOfTries() - 1))
1135 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
1137 $template =
new ilTemplate(
"tpl.il_as_tst_finish_navigation.html", TRUE, TRUE,
"Modules/Test");
1138 $template->setVariable(
"BUTTON_FINISH", $this->lng->txt(
"btn_next"));
1139 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"btn_previous"));
1141 $template_top =
new ilTemplate(
"tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE,
"Modules/Test");
1142 $template_top->setCurrentBlock(
"button_print");
1143 $template_top->setVariable(
"BUTTON_PRINT", $this->lng->txt(
"print"));
1144 $template_top->parseCurrentBlock();
1146 $this->
showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
1159 $this->
object->getTestSession()->increaseTestPass();
1166 if (!
$_GET[
"skipfinalstatement"])
1168 if ($this->object->getShowFinalStatement())
1170 $this->ctrl->redirect($this,
"showFinalStatement");
1173 if(
$_GET[
'crs_show_result'])
1175 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToCourse");
1178 if (!$this->object->canViewResults())
1184 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1193 $template =
new ilTemplate(
"tpl.il_as_tst_final_statement.html", TRUE, TRUE,
"Modules/Test");
1194 $this->ctrl->setParameter($this,
"crs_show_result",
$_GET[
'crs_show_result']);
1195 $this->ctrl->setParameter($this,
"skipfinalstatement", 1);
1196 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"redirectBack"));
1197 $template->setVariable(
"FINALSTATEMENT", $this->object->getFinalStatement());
1198 $template->setVariable(
"BUTTON_CONTINUE", $this->lng->txt(
"btn_next"));
1206 $template =
new ilTemplate(
'tpl.il_as_tst_kiosk_head.html',
true,
true,
'Modules/Test');
1207 if ($this->object->getShowKioskModeTitle())
1209 $template->setCurrentBlock(
"kiosk_show_title");
1210 $template->setVariable(
"TEST_TITLE", $this->object->getTitle());
1211 $template->parseCurrentBlock();
1213 if ($this->object->getShowKioskModeParticipant())
1215 $template->setCurrentBlock(
"kiosk_show_participant");
1216 $template->setVariable(
"PARTICIPANT_NAME", $this->lng->txt(
"login_as") .
" " . $ilUser->getFullname());
1217 $template->parseCurrentBlock();
1219 return $template->get();
1227 global $rbacsystem, $ilUser;
1229 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_output.html",
"Modules/Test");
1230 if (!$rbacsystem->checkAccess(
"read", $this->object->getRefId()))
1233 $this->ilias->raiseError($this->lng->txt(
"cannot_execute_test"),$this->ilias->error_obj->MESSAGE);
1242 if ($this->object->endingTimeReached())
1248 if ($this->object->getKioskMode())
1254 $this->tpl->setCurrentBlock(
"kiosk_options");
1255 $this->tpl->setVariable(
"KIOSK_HEAD", $head);
1256 $this->tpl->parseCurrentBlock();
1260 if (($this->object->getInstantFeedbackSolution() == 1) || ($this->object->getAnswerFeedback() == 1) || ($this->object->getAnswerFeedbackPoints() == 1))
1262 $this->tpl->setCurrentBlock(
"direct_feedback");
1263 $this->tpl->setVariable(
"TEXT_DIRECT_FEEDBACK", $this->lng->txt(
"check"));
1264 $this->tpl->parseCurrentBlock();
1273 if ($this->object->getEnableProcessingTime())
1278 $this->tpl->setVariable(
"FORM_TIMESTAMP", time());
1279 $directfeedback = 0;
1280 if (strcmp(
$_GET[
"activecommand"],
"directfeedback") == 0) $directfeedback = 1;
1281 $this->
outWorkingForm($this->sequence, $this->object->getTestId(), $postpone, $directfeedback, $show_summary);
1282 $this->tpl->setVariable(
"PAGETITLE",
"- " . $this->object->getTitle());
1297 $user = $this->
object->getInvitedUsers($ilUser->getId());
1301 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1306 if (strcmp(
$user[
"clientip"],
"")!=0 && strcmp(
$user[
"clientip"],$_SERVER[
"REMOTE_ADDR"])!=0)
1309 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1321 and $this->
object->startingTimeReached()
1322 and !$this->
object->endingTimeReached();
1330 return $this->
object->hasNrOfTriesRestriction() && $this->
object->isNrOfTriesReached($this->object->getTestSession()->getPass());
1342 if (array_key_exists(
"pass",
$_GET) && (strlen(
$_GET[
"pass"]) > 0))
1344 $this->ctrl->saveParameter($this,
"pass");
1345 $this->ctrl->saveParameter($this,
"active_id");
1346 $this->outTestResults(
false,
$_GET[
"pass"]);
1350 $this->outTestResults(
false);
1362 $this->
object->getTestSession()->increasePass();
1363 $this->
object->getTestSession()->setLastSequence(0);
1364 $this->
object->getTestSession()->saveToDb();
1365 if (!$this->object->canViewResults())
1371 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1394 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_submit_answers_confirm.html",
"Modules/Test");
1395 $this->tpl->setCurrentBlock(
"adm_content");
1396 if ($this->object->isTestFinished($this->object->getTestSession()->getActiveId()))
1398 $this->tpl->setCurrentBlock(
"not_submit_allowed");
1399 $this->tpl->setVariable(
"TEXT_ALREADY_SUBMITTED", $this->lng->txt(
"tst_already_submitted"));
1400 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_show_answer_sheet"));
1403 $this->tpl->setCurrentBlock(
"submit_allowed");
1404 $this->tpl->setVariable(
"TEXT_CONFIRM_SUBMIT_RESULTS", $this->lng->txt(
"tst_confirm_submit_answers"));
1405 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_submit_results"));
1407 $this->tpl->setVariable(
"BTN_BACK", $this->lng->txt(
"back"));
1408 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"finalSubmission"));
1409 $this->tpl->parseCurrentBlock();
1416 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
1417 $processing_time = $this->
object->getProcessingTimeInSeconds();
1418 $processing_time_minutes = floor($processing_time / 60);
1419 $processing_time_seconds = $processing_time - $processing_time_minutes * 60;
1420 $str_processing_time =
"";
1421 if ($processing_time_minutes > 0)
1423 $str_processing_time = $processing_time_minutes .
" " . $this->lng->txt(
"minutes");
1425 if ($processing_time_seconds > 0)
1427 if (strlen($str_processing_time) > 0) $str_processing_time .=
" " . $this->lng->txt(
"and") .
" ";
1428 $str_processing_time .= $processing_time_seconds .
" " . $this->lng->txt(
"seconds");
1430 $time_left = $starting_time + $processing_time - mktime();
1431 $time_left_minutes = floor($time_left / 60);
1432 $time_left_seconds = $time_left - $time_left_minutes * 60;
1433 $str_time_left =
"";
1434 if ($time_left_minutes > 0)
1436 $str_time_left = $time_left_minutes .
" " . $this->lng->txt(
"minutes");
1438 if ($time_left < 300)
1440 if ($time_left_seconds > 0)
1442 if (strlen($str_time_left) > 0) $str_time_left .=
" " . $this->lng->txt(
"and") .
" ";
1443 $str_time_left .= $time_left_seconds .
" " . $this->lng->txt(
"seconds");
1446 $date = getdate($starting_time);
1458 $datenow = getdate();
1459 $this->tpl->setCurrentBlock(
"enableprocessingtime");
1460 $this->tpl->setVariable(
"USER_WORKING_TIME",
1462 $this->lng->txt(
"tst_time_already_spent"),
1463 $formattedStartingTime,
1464 $str_processing_time
1467 $this->tpl->setVariable(
"USER_REMAINING_TIME", sprintf($this->lng->txt(
"tst_time_already_spent_left"), $str_time_left));
1468 $this->tpl->parseCurrentBlock();
1469 $template =
new ilTemplate(
"tpl.workingtime.js.html", TRUE, TRUE, TRUE);
1470 $template->setVariable(
"STRING_MINUTE", $this->lng->txt(
"minute"));
1471 $template->setVariable(
"STRING_MINUTES", $this->lng->txt(
"minutes"));
1472 $template->setVariable(
"STRING_SECOND", $this->lng->txt(
"second"));
1473 $template->setVariable(
"STRING_SECONDS", $this->lng->txt(
"seconds"));
1474 $template->setVariable(
"STRING_TIMELEFT", $this->lng->txt(
"tst_time_already_spent_left"));
1475 $template->setVariable(
"AND", strtolower($this->lng->txt(
"and")));
1476 $template->setVariable(
"YEAR", $date[
"year"]);
1477 $template->setVariable(
"MONTH", $date[
"mon"]-1);
1478 $template->setVariable(
"DAY", $date[
"mday"]);
1479 $template->setVariable(
"HOUR", $date[
"hours"]);
1480 $template->setVariable(
"MINUTE", $date[
"minutes"]);
1481 $template->setVariable(
"SECOND", $date[
"seconds"]);
1482 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->object->getEndingTime(), $matches))
1484 $template->setVariable(
"ENDYEAR", $matches[1]);
1485 $template->setVariable(
"ENDMONTH", $matches[2]-1);
1486 $template->setVariable(
"ENDDAY", $matches[3]);
1487 $template->setVariable(
"ENDHOUR", $matches[4]);
1488 $template->setVariable(
"ENDMINUTE", $matches[5]);
1489 $template->setVariable(
"ENDSECOND", $matches[6]);
1491 $template->setVariable(
"YEARNOW", $datenow[
"year"]);
1492 $template->setVariable(
"MONTHNOW", $datenow[
"mon"]-1);
1493 $template->setVariable(
"DAYNOW", $datenow[
"mday"]);
1494 $template->setVariable(
"HOURNOW", $datenow[
"hours"]);
1495 $template->setVariable(
"MINUTENOW", $datenow[
"minutes"]);
1496 $template->setVariable(
"SECONDNOW", $datenow[
"seconds"]);
1497 $template->setVariable(
"PTIME_M", $processing_time_minutes);
1498 $template->setVariable(
"PTIME_S", $processing_time_seconds);
1500 $this->tpl->setCurrentBlock(
"HeadContent");
1501 $this->tpl->setVariable(
"CONTENT_BLOCK", $template->get());
1502 $this->tpl->parseCurrentBlock();
1510 if ($fullpage) $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_question_summary.html",
"Modules/Test");
1511 $active_id = $this->
object->getTestSession()->getActiveId();
1512 $result_array = & $this->
object->getTestSequence()->getSequenceSummary();
1513 $marked_questions = array();
1514 if ($this->object->getKioskMode() && $fullpage)
1519 $this->tpl->setCurrentBlock(
"kiosk_options");
1520 $this->tpl->setVariable(
"KIOSK_HEAD", $head);
1521 $this->tpl->parseCurrentBlock();
1524 if ($this->object->getShowMarker())
1526 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1530 foreach ($result_array as
$key => $value)
1532 $this->ctrl->setParameter($this,
"sequence", $value[
"sequence"]);
1533 $href = $this->ctrl->getLinkTargetByClass(get_class($this),
"gotoQuestion");
1534 $this->tpl->setVariable(
"VALUE_QUESTION_TITLE",
"<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this),
"gotoQuestion").
"\">" . $this->
object->getQuestionTitle($value[
"title"]) .
"</a>");
1535 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1537 if ($this->object->getListOfQuestionsDescription())
1539 $description = $value[
"description"];
1542 if (!$this->object->getTitleOutput())
1544 $points = $value[
"points"].
" ".$this->lng->txt(
"points_short");
1547 if (count($marked_questions))
1549 if (array_key_exists($value[
"qid"], $marked_questions))
1551 $obj = $marked_questions[$value[
"qid"]];
1552 if ($obj[
"solved"] == 1)
1558 array_push(
$data, array(
1559 'order' => $value[
"nr"],
1561 'title' => $this->object->getQuestionTitle($value[
"title"]),
1562 'description' => $description,
1563 'worked_through' => ($value[
"worked_through"]) ?
true :
false,
1564 'postponed' => ($value[
"postponed"]) ? $this->lng->txt(
"postponed") :
'',
1566 'marked' => $marked,
1567 'sequence' => $value[
"sequence"]
1570 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1573 include_once
"./Modules/Test/classes/tables/class.ilListOfQuestionsTableGUI.php";
1574 $table_gui =
new ilListOfQuestionsTableGUI($this,
'backFromSummary', !$this->object->getTitleOutput(), $this->
object->getShowMarker());
1576 $this->tpl->setVariable(
'TABLE_LIST_OF_QUESTIONS', $table_gui->getHTML());
1577 if ($this->object->getEnableProcessingTime()) $this->
outProcessingTime($active_id);
1581 $template =
new ilTemplate(
'tpl.il_as_tst_list_of_questions_short.html',
true,
true,
'Modules/Test');
1584 if (strlen($row[
'description']))
1586 $template->setCurrentBlock(
'description');
1587 $template->setVariable(
"DESCRIPTION", $row[
'description']);
1588 $template->parseCurrentBlock();
1590 $template->setCurrentBlock(
'item');
1592 $template->setVariable(
'CLASS', ($row[
'walked_through']) ? (
'answered'.$active) : (
'unanswered'.$active));
1594 $template->setVariable(
'SEQUENCE', $row[
'sequence']);
1595 $template->parseCurrentBlock();
1597 $template->setVariable(
'LIST_OF_QUESTIONS', $this->lng->txt(
'list_of_questions'));
1598 $this->tpl->setVariable(
'LIST_OF_QUESTIONS', $template->get());
1604 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_max_allowed_users_reached.html",
"Modules/Test");
1605 $this->tpl->setCurrentBlock(
"adm_content");
1606 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_MESSAGE", sprintf($this->lng->txt(
"tst_max_allowed_users_message"), $this->
object->getAllowedUsersTimeGap()));
1607 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_HEADING", sprintf($this->lng->txt(
"tst_max_allowed_users_heading"), $this->
object->getAllowedUsersTimeGap()));
1608 $this->tpl->setVariable(
"BACK_TO_INTRODUCTION", $this->lng->txt(
"tst_results_back_introduction"));
1609 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1610 $this->tpl->parseCurrentBlock();
1616 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
1618 $template =
new ilTemplate(
"tpl.il_as_tst_finish_navigation.html", TRUE, TRUE,
"Modules/Test");
1619 $template->setVariable(
"BUTTON_FINISH", $this->lng->txt(
"btn_next"));
1620 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"btn_previous"));
1622 $template_top =
new ilTemplate(
"tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE,
"Modules/Test");
1623 $template_top->setCurrentBlock(
"button_print");
1624 $template_top->setVariable(
"BUTTON_PRINT", $this->lng->txt(
"print"));
1625 $template_top->parseCurrentBlock();
1626 $active_id = $this->
object->getTestSession()->getActiveId();
1627 return $this->
showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
1631 $this->ctrl->redirect($this,
'gotoQuestion');
1647 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_correct_solution.html",
"Modules/Test");
1649 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1650 $this->tpl->setCurrentBlock(
"ContentStyle");
1652 $this->tpl->parseCurrentBlock();
1654 $this->tpl->setCurrentBlock(
"SyntaxStyle");
1656 $this->tpl->parseCurrentBlock();
1659 if ($this->object->getShowSolutionAnswersOnly())
1664 $this->tpl->setCurrentBlock(
"adm_content");
1666 $this->tpl->setVariable(
"OUTPUT_SOLUTION", $solution);
1667 $this->tpl->setVariable(
"TEXT_BACK", $this->lng->txt(
"back"));
1668 $this->ctrl->saveParameter($this,
"pass");
1669 $this->ctrl->saveParameter($this,
"active_id");
1670 $this->tpl->setVariable(
"URL_BACK", $this->ctrl->getLinkTarget($this,
"outUserResultsOverview"));
1671 $this->tpl->parseCurrentBlock();
1687 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_finish_list_of_answers.html",
"Modules/Test");
1689 $result_array =& $this->
object->getTestResult($active_id,
$pass);
1693 foreach ($result_array as $question_data)
1695 $question = $question_data[
"qid"];
1696 if (is_numeric($question))
1698 $this->tpl->setCurrentBlock(
"printview_question");
1699 $question_gui = $this->
object->createQuestionGUI(
"", $question);
1700 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1701 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
1702 $template->setVariable(
"QUESTION_TITLE", $question_gui->object->getTitle());
1704 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
1705 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
1706 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
1707 $this->tpl->setVariable(
"QUESTION_OUTPUT", $template->get());
1708 $this->tpl->parseCurrentBlock();
1714 if ($this->object->getShowSolutionAnswersOnly())
1718 if (strlen($top_data))
1720 $this->tpl->setCurrentBlock(
"top_data");
1721 $this->tpl->setVariable(
"TOP_DATA", $top_data);
1722 $this->tpl->parseCurrentBlock();
1725 if (strlen($bottom_data))
1727 $this->tpl->setCurrentBlock(
"bottom_data");
1728 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1729 $this->tpl->setVariable(
"BOTTOM_DATA", $bottom_data);
1730 $this->tpl->parseCurrentBlock();
1733 $this->tpl->setCurrentBlock(
"adm_content");
1734 $this->tpl->setVariable(
"TXT_ANSWER_SHEET", $this->lng->txt(
"tst_list_of_answers"));
1737 $this->tpl->setVariable(
"USER_DETAILS", $user_data);
1738 $this->tpl->setVariable(
"SIGNATURE", $signature);
1739 $this->tpl->setVariable(
"TITLE", $this->object->getTitle());
1740 $this->tpl->setVariable(
"TXT_TEST_PROLOG", $this->lng->txt(
"tst_your_answers"));
1741 $invited_user =& $this->
object->getInvitedUsers($ilUser->getId());
1742 $pagetitle = $this->
object->getTitle() .
" - " . $this->lng->txt(
"clientip") .
1743 ": " . $invited_user[$ilUser->getId()][
"clientip"] .
" - " .
1744 $this->lng->txt(
"matriculation") .
": " .
1745 $invited_user[$ilUser->getId()][
"matriculation"];
1746 $this->tpl->setVariable(
"PAGETITLE", $pagetitle);
1747 $this->tpl->parseCurrentBlock();
1758 if ($this->object->getKioskMode())
1760 $this->tpl->setBodyClass(
"kiosk");
1761 $this->tpl->setAddFooter(FALSE);
1766 return "ADM_CONTENT";
1772 $this->ctrl->redirectByClass(
"iltestevaluationgui",
"outUserResultsOverview");
1777 $this->ctrl->redirectByClass(
"iltestevaluationgui",
"outUserListOfAnswerPasses");