5 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
6 include_once
"./Modules/Test/classes/class.ilTestServiceGUI.php";
41 $this->ref_id =
$_GET[
"ref_id"];
52 include_once(
"./Services/Tagging/classes/class.ilTaggingGUI.php");
54 $tagging_gui->setObject($this->object->getId(), $this->
object->getType());
55 $tagging_gui->saveInput();
56 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
65 $cmd = $this->ctrl->getCmd();
66 $next_class = $this->ctrl->getNextClass($this);
67 $this->ctrl->saveParameter($this,
"sequence");
68 $this->ctrl->saveParameter($this,
"active_id");
69 if (preg_match(
"/^gotoquestion_(\\d+)$/",
$cmd, $matches))
71 $cmd =
"gotoquestion";
72 if (strlen($matches[1]))
74 $this->ctrl->setParameter($this,
'gotosequence', $matches[1]);
78 if (
$_GET[
"active_id"])
80 $this->
object->setTestSession(
$_GET[
"active_id"]);
84 $this->
object->setTestSession();
86 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
106 $this->
object->updateWorkingTime(
$_SESSION[
"active_time_id"]);
116 $this->saveResult = FALSE;
119 $formtimestamp =
$_POST[
"formtimestamp"];
120 if (strlen($formtimestamp) == 0) $formtimestamp =
$_GET[
"formtimestamp"];
121 if ($formtimestamp !=
$_SESSION[
"formtimestamp"])
123 $_SESSION[
"formtimestamp"] = $formtimestamp;
134 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
135 if (is_numeric($q_id))
139 $question_gui = $this->
object->createQuestionGUI(
"", $q_id);
140 if ($this->object->getJavaScriptOutput())
145 $active_id = $this->
object->getTestSession()->getActiveId();
146 if ($this->object->isRandomTest())
148 $pass = $this->
object->_getPass($active_id);
150 $this->saveResult = $question_gui->object->saveWorkingData($active_id,
$pass);
157 if ($this->saveResult == FALSE)
159 $this->ctrl->setParameter($this,
"save_error",
"1");
187 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
201 $active_id = $this->
object->getTestSession()->getActiveId();
202 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
203 if ($starting_time === FALSE)
209 return $this->
object->isMaxProcessingTimeReached($starting_time);
221 $active_time_id = $this->
object->startWorkingTime($this->object->getTestSession()->getActiveId(), $this->
object->getTestSession()->getPass());
222 $_SESSION[
"active_time_id"] = $active_time_id;
224 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
225 $this->tpl->setCurrentBlock(
"ContentStyle");
226 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
228 $this->tpl->parseCurrentBlock();
231 $this->tpl->setCurrentBlock(
"SyntaxStyle");
232 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
234 $this->tpl->parseCurrentBlock();
236 if ($this->object->getListOfQuestions())
238 $show_side_list = $ilUser->getPref(
'side_list_of_questions');
239 $this->tpl->setCurrentBlock(
'view_sidelist');
241 $this->tpl->setVariable(
'TEXT_SIDELIST', ($show_side_list) ? $this->lng->txt(
'tst_hide_side_list') : $this->lng->txt(
'tst_show_side_list'));
242 $this->tpl->parseCurrentBlock();
250 $question_gui = $this->
object->createQuestionGUI(
"", $this->object->getTestSequence()->getQuestionForSequence(
$sequence));
251 if ($this->object->getJavaScriptOutput())
256 $is_postponed = $this->
object->getTestSequence()->isPostponedQuestion($question_gui->object->getId());
257 $this->ctrl->setParameter($this,
"sequence",
"$sequence");
258 $formaction = $this->ctrl->getFormAction($this,
"gotoQuestion");
260 $question_gui->setSequenceNumber($this->object->getTestSequence()->getPositionOfSequence(
$sequence));
261 $question_gui->setQuestionCount($this->object->getTestSequence()->getUserQuestionCount());
263 $user_post_solution = FALSE;
264 if (array_key_exists(
"previouspost",
$_SESSION))
266 $user_post_solution =
$_SESSION[
"previouspost"];
269 $answer_feedback = FALSE;
270 if (($directfeedback) && ($this->object->getAnswerFeedback()))
272 $answer_feedback = TRUE;
274 global $ilNavigationHistory;
275 $ilNavigationHistory->addItem(
$_GET[
"ref_id"], $this->ctrl->getLinkTarget($this,
"resume"),
"tst");
276 $question_gui->outQuestionForTest($formaction, $this->object->getTestSession()->getActiveId(), NULL, $is_postponed, $user_post_solution, $answer_feedback);
279 if ($this->object->getInstantFeedbackSolution())
281 $solutionoutput = $question_gui->getSolutionOutput($this->object->getTestSession()->getActiveId(), NULL, FALSE, FALSE, FALSE, FALSE, TRUE);
282 $this->tpl->setCurrentBlock(
"solution_output");
283 $this->tpl->setVariable(
"CORRECT_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
284 $this->tpl->setVariable(
"QUESTION_FEEDBACK", $solutionoutput);
285 $this->tpl->parseCurrentBlock();
287 if ($this->object->getAnswerFeedbackPoints())
289 $this->tpl->setCurrentBlock(
"solution_output");
290 $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()));
291 $this->tpl->parseCurrentBlock();
293 if ($this->object->getAnswerFeedback())
295 $this->tpl->setCurrentBlock(
"answer_feedback");
296 $this->tpl->setVariable(
"ANSWER_FEEDBACK", $question_gui->getAnswerFeedbackOutput($this->object->getTestSession()->getActiveId(), NULL));
297 $this->tpl->parseCurrentBlock();
301 if (
$sequence == $this->object->getTestSequence()->getFirstSequence())
303 $this->tpl->setCurrentBlock(
"prev");
304 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_introduction"));
305 $this->tpl->parseCurrentBlock();
306 $this->tpl->setCurrentBlock(
"prev_bottom");
307 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_introduction"));
308 $this->tpl->parseCurrentBlock();
312 $this->tpl->setCurrentBlock(
"prev");
313 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_previous"));
314 $this->tpl->parseCurrentBlock();
315 $this->tpl->setCurrentBlock(
"prev_bottom");
316 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_previous"));
317 $this->tpl->parseCurrentBlock();
320 if ($postpone_allowed)
326 $this->tpl->setCurrentBlock(
"postpone");
327 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone"));
328 $this->tpl->parseCurrentBlock();
329 $this->tpl->setCurrentBlock(
"postpone_bottom");
330 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone"));
331 $this->tpl->parseCurrentBlock();
336 if ($this->object->getListOfQuestions())
338 if (!(($finish) && ($this->object->getListOfQuestionsEnd())))
340 $this->tpl->setCurrentBlock(
"summary");
341 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary"));
342 $this->tpl->parseCurrentBlock();
343 $this->tpl->setCurrentBlock(
"summary_bottom");
344 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary"));
345 $this->tpl->parseCurrentBlock();
349 if ($this->object->getShowCancel())
351 $this->tpl->setCurrentBlock(
"cancel_test");
352 $this->tpl->setVariable(
"TEXT_CANCELTEST", $this->lng->txt(
"cancel_test"));
353 $this->tpl->setVariable(
"TEXT_ALTCANCELTEXT", $this->lng->txt(
"cancel_test"));
354 $this->tpl->setVariable(
"TEXT_TITLECANCELTEXT", $this->lng->txt(
"cancel_test"));
355 $this->tpl->setVariable(
"HREF_IMGCANCELTEST", $this->ctrl->getLinkTargetByClass(get_class($this),
"outIntroductionPage") .
"&cancelTest=true");
356 $this->tpl->setVariable(
"HREF_CANCELTEXT", $this->ctrl->getLinkTargetByClass(get_class($this),
"outIntroductionPage") .
"&cancelTest=true");
358 $this->tpl->parseCurrentBlock();
361 if ($this->object->getTestSequence()->getQuestionForSequence($this->object->getTestSequence()->getLastSequence()) == $question_gui->object->getId())
363 if ($this->object->getListOfQuestionsEnd())
365 $this->tpl->setCurrentBlock(
"next");
366 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"question_summary") .
" >>");
367 $this->tpl->parseCurrentBlock();
368 $this->tpl->setCurrentBlock(
"next_bottom");
369 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"question_summary") .
" >>");
370 $this->tpl->parseCurrentBlock();
374 $this->tpl->setCurrentBlock(
"next");
375 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_finish") .
" >>");
376 $this->tpl->parseCurrentBlock();
377 $this->tpl->setCurrentBlock(
"next_bottom");
378 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_finish") .
" >>");
379 $this->tpl->parseCurrentBlock();
384 $this->tpl->setCurrentBlock(
"next");
385 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_next") .
" >>");
386 $this->tpl->parseCurrentBlock();
387 $this->tpl->setCurrentBlock(
"next_bottom");
388 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_next") .
" >>");
389 $this->tpl->parseCurrentBlock();
392 if ($this->object->getShowMarker())
394 include_once
"./Modules/Test/classes/class.ilObjTest.php";
398 if (count ($solved_array) > 0)
400 $solved = array_pop($solved_array);
401 $solved = $solved[
"solved"];
406 $this->tpl->setCurrentBlock(
"ismarked");
408 $this->tpl->setVariable(
"TEXT_SET", $this->lng->txt(
"tst_remove_mark"));
409 $this->tpl->parseCurrentBlock();
413 $this->tpl->setCurrentBlock(
"isnotmarked");
415 $this->tpl->setVariable(
"TEXT_UNSET", $this->lng->txt(
"tst_question_mark"));
416 $this->tpl->parseCurrentBlock();
420 if ($this->object->getJavaScriptOutput())
423 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"disable_javascript"));
424 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"disable_javascript"));
425 $this->ctrl->setParameter($this,
"tst_javascript",
"0");
426 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
431 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"enable_javascript"));
432 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"enable_javascript"));
433 $this->ctrl->setParameter($this,
"tst_javascript",
"1");
434 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
437 if ($question_gui->object->supportsJavascriptOutput())
439 $this->tpl->touchBlock(
"jsswitch");
443 $this->tpl->setVariable(
"AUTOSAVE_URL", $this->ctrl->getFormAction($this,
"autosave",
"",
true));
453 $template =
new ilTemplate(
"tpl.il_as_tst_password_protection.html", TRUE, TRUE,
"Modules/Test");
454 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"checkPassword"));
455 $template->setVariable(
"PASSWORD_INTRODUCTION", $this->lng->txt(
"tst_password_introduction"));
456 $template->setVariable(
"TEXT_PASSWORD", $this->lng->txt(
"tst_password"));
457 $template->setVariable(
"SUBMIT", $this->lng->txt(
"submit"));
468 if (strcmp($this->object->getPassword(),
$_POST[
"password"]) == 0)
471 if (
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID)
473 $ilUser->setPref(
"tst_password_".$this->object->getTestId(), $this->
object->getPassword());
474 $ilUser->writePref(
"tst_password_".$this->object->getTestId(), $this->
object->getPassword());
478 $_SESSION[
'tst_password_'.$this->object->getTestId()] = $this->
object->getPassword();
480 $this->ctrl->redirect($this,
"start");
485 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
498 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
500 $this->
object->setAccessCodeSession(
$_POST[
"anonymous_id"]);
502 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
519 $this->ctrl->redirect($this,
"startTest");
523 $this->ctrl->redirectByClass(
"ilobjtestgui",
"redirectToInfoScreen");
534 if ($this->object->checkMaximumAllowedUsers() == FALSE)
538 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
540 $this->
object->setAccessCodeSession($this->object->createNewAccessCode());
544 $this->
object->unsetAccessCodeSession();
546 if (strlen($this->object->getPassword()))
552 if(
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID )
554 $pwd = $ilUser->getPref(
"tst_password_".$this->object->getTestId());
556 elseif( isset(
$_SESSION[
'tst_password_'.$this->object->getTestId()]) )
558 $pwd =
$_SESSION[
'tst_password_'.$this->object->getTestId()];
561 if ((strcmp($pwd, $this->object->getPassword()) != 0) && (!$rbacsystem->checkAccess(
"write", $this->object->getRefId())))
566 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
568 $this->ctrl->redirect($this,
"displayCode");
572 $this->ctrl->setParameter($this,
"activecommand",
"start");
573 $this->ctrl->redirect($this,
"redirectQuestion");
579 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_anonymous_code_presentation.html",
"Modules/Test");
580 $this->tpl->setCurrentBlock(
"adm_content");
581 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE_CREATED", $this->lng->txt(
"tst_access_code_created"));
582 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE", $this->object->getAccessCodeSession());
583 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
584 $this->tpl->setVariable(
"CONTINUE", $this->lng->txt(
"continue_work"));
585 $this->tpl->parseCurrentBlock();
590 $this->ctrl->setParameter($this,
"activecommand",
"start");
591 $this->ctrl->redirect($this,
"redirectQuestion");
603 if ($this->object->checkMaximumAllowedUsers() == FALSE)
608 $this->ctrl->setParameter($this,
"activecommand",
"resume");
609 $this->ctrl->redirect($this,
"redirectQuestion");
619 if (
$_POST[
"chb_javascript"])
621 $ilUser->writePref(
"tst_javascript", 1);
625 $ilUser->writePref(
"tst_javascript", 0);
629 if ($this->object->getNrOfTries() != 1)
631 if ($this->object->getUsePreviousAnswers() == 1)
633 if (
$_POST[
"chb_use_previous_answers"])
635 $ilUser->writePref(
"tst_use_previous_answers", 1);
639 $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());
786 $shuffle = $this->
object->getShuffleQuestions();
787 if ($this->object->isRandomTest())
791 $this->
object->createTestSequence($active_id, $this->object->getTestSession()->getPass(), $shuffle);
793 $this->sequence = $this->
object->getTestSession()->getLastSequence();
794 $active_time_id = $this->
object->startWorkingTime($active_id, $this->object->getTestSession()->getPass());
795 $_SESSION[
"active_time_id"] = $active_time_id;
796 if ($this->object->getListOfQuestionsStart())
798 $this->ctrl->setParameter($this,
"activecommand",
"summary");
799 $this->ctrl->redirect($this,
"redirectQuestion");
803 $this->ctrl->setParameter($this,
"sequence", $this->sequence);
804 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
805 $this->ctrl->saveParameter($this,
"tst_javascript");
806 $this->ctrl->redirect($this,
"redirectQuestion");
813 if (array_key_exists(
"tst_javascript",
$_GET))
815 $ilUser->writePref(
"tst_javascript",
$_GET[
"tst_javascript"]);
818 if (strlen(
$_GET[
'gotosequence'])) $this->sequence =
$_GET[
'gotosequence'];
819 $this->
object->getTestSession()->setLastSequence($this->sequence);
820 $this->
object->getTestSession()->saveToDb();
835 if (array_key_exists(
"save_error",
$_GET))
837 if (
$_GET[
"save_error"] == 1)
842 switch (
$_GET[
"activecommand"])
856 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_redirect_autosave.html",
"Modules/Test");
857 $this->tpl->setVariable(
"TEXT_REDIRECT", $this->lng->txt(
"redirectAfterSave"));
858 $this->tpl->setCurrentBlock(
"HeadContent");
859 $this->tpl->setVariable(
"CONTENT_BLOCK",
"<meta http-equiv=\"refresh\" content=\"5; url=" . $this->ctrl->getLinkTarget($this,
"redirectBack") .
"\">");
860 $this->tpl->parseCurrentBlock();
872 $result = $this->lng->txt(
"autosave_success");
876 $result = $this->lng->txt(
"autosave_failed");
882 $result = $this->ctrl->getLinkTarget($this,
"redirectAfterAutosave",
"",
true);
895 $show_side_list = $ilUser->getPref(
'side_list_of_questions');
896 $ilUser->writePref(
'side_list_of_questions', !$show_side_list);
898 $this->ctrl->redirect($this,
"redirectQuestion");
911 $this->ctrl->setParameter($this,
"activecommand",
"next");
912 $this->ctrl->redirect($this,
"redirectQuestion");
925 $this->ctrl->setParameter($this,
"activecommand",
"previous");
926 $this->ctrl->redirect($this,
"redirectQuestion");
939 $this->ctrl->setParameter($this,
"activecommand",
"postpone");
940 $this->ctrl->redirect($this,
"redirectQuestion");
953 if ($this->saveResult == FALSE)
955 $this->ctrl->setParameter($this,
"activecommand",
"");
956 $this->ctrl->redirect($this,
"redirectQuestion");
960 $this->ctrl->setParameter($this,
"activecommand",
"summary");
961 $this->ctrl->redirect($this,
"redirectQuestion");
975 $this->ctrl->setParameter($this,
"activecommand",
"setmarked");
976 $this->ctrl->redirect($this,
"redirectQuestion");
989 $this->ctrl->setParameter($this,
"activecommand",
"resetmarked");
990 $this->ctrl->redirect($this,
"redirectQuestion");
1003 $this->ctrl->setParameter($this,
"activecommand",
"directfeedback");
1004 $this->ctrl->redirect($this,
"redirectQuestion");
1017 $activecommand =
"selectImagemapRegion";
1018 if (array_key_exists(
'cmd',
$_POST))
1020 $activecommand = key(
$_POST[
"cmd"]);
1022 if (preg_match(
"/^gotoquestion_(\\d+)$/", $activecommand, $matches))
1024 $activecommand =
"gotoquestion";
1025 if (strlen($matches[1]))
1027 $this->ctrl->setParameter($this,
'gotosequence', $matches[1]);
1030 if (strcmp($activecommand,
"togglesidelist") == 0)
1036 $this->ctrl->setParameter($this,
"activecommand", $activecommand);
1037 $this->ctrl->redirect($this,
"redirectQuestion");
1051 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1052 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
1053 $this->ctrl->saveParameter($this,
"tst_javascript");
1055 $this->ctrl->redirect($this,
"redirectQuestion");
1067 $this->ctrl->setParameter($this,
"activecommand",
"back");
1068 $this->ctrl->redirect($this,
"redirectQuestion");
1094 $template =
new ilTemplate(
"tpl.il_as_tst_finish_confirmation.html", TRUE, TRUE,
"Modules/Test");
1095 $template->setVariable(
"FINISH_QUESTION", $this->lng->txt(
"tst_finish_confirmation_question"));
1096 $template->setVariable(
"BUTTON_CONFIRM", $this->lng->txt(
"tst_finish_confirm_button"));
1097 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
1099 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"tst_finish_confirm_list_of_answers_button"));
1103 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"tst_finish_confirm_cancel_button"));
1105 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1124 $active_id = $this->
object->getTestSession()->getActiveId();
1125 $actualpass = $this->
object->_getPass($active_id);
1126 if (($actualpass == $this->object->getNrOfTries() - 1) && (!$confirm))
1128 $this->
object->setActiveTestSubmitted($ilUser->getId());
1129 $ilAuth->setIdle($ilias->ini->readVariable(
"session",
"expire"),
false);
1130 $ilAuth->setExpire(0);
1131 switch ($this->object->getMailNotification())
1134 $this->
object->sendSimpleNotification($active_id);
1137 $this->
object->sendAdvancedNotification($active_id);
1142 if (($confirm) && ($actualpass == $this->object->getNrOfTries() - 1))
1144 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
1146 $template =
new ilTemplate(
"tpl.il_as_tst_finish_navigation.html", TRUE, TRUE,
"Modules/Test");
1147 $template->setVariable(
"BUTTON_FINISH", $this->lng->txt(
"btn_next"));
1148 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"btn_previous"));
1150 $template_top =
new ilTemplate(
"tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE,
"Modules/Test");
1151 $template_top->setCurrentBlock(
"button_print");
1152 $template_top->setVariable(
"BUTTON_PRINT", $this->lng->txt(
"print"));
1153 $template_top->parseCurrentBlock();
1155 $this->
showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
1168 if ($this->object->getMailNotificationType() == 1)
1170 switch ($this->object->getMailNotification())
1173 $this->
object->sendSimpleNotification($active_id);
1176 $this->
object->sendAdvancedNotification($active_id);
1180 $this->
object->getTestSession()->increaseTestPass();
1187 if (!
$_GET[
"skipfinalstatement"])
1189 if ($this->object->getShowFinalStatement())
1191 $this->ctrl->redirect($this,
"showFinalStatement");
1194 if(
$_GET[
'crs_show_result'])
1196 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToCourse");
1199 if (!$this->object->canViewResults())
1205 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1214 $template =
new ilTemplate(
"tpl.il_as_tst_final_statement.html", TRUE, TRUE,
"Modules/Test");
1215 $this->ctrl->setParameter($this,
"crs_show_result",
$_GET[
'crs_show_result']);
1216 $this->ctrl->setParameter($this,
"skipfinalstatement", 1);
1217 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"redirectBack"));
1218 $template->setVariable(
"FINALSTATEMENT", $this->object->getFinalStatement());
1219 $template->setVariable(
"BUTTON_CONTINUE", $this->lng->txt(
"btn_next"));
1227 $template =
new ilTemplate(
'tpl.il_as_tst_kiosk_head.html',
true,
true,
'Modules/Test');
1228 if ($this->object->getShowKioskModeTitle())
1230 $template->setCurrentBlock(
"kiosk_show_title");
1231 $template->setVariable(
"TEST_TITLE", $this->object->getTitle());
1232 $template->parseCurrentBlock();
1234 if ($this->object->getShowKioskModeParticipant())
1236 $template->setCurrentBlock(
"kiosk_show_participant");
1237 $template->setVariable(
"PARTICIPANT_NAME", $this->lng->txt(
"login_as") .
" " . $ilUser->getFullname());
1238 $template->parseCurrentBlock();
1240 return $template->get();
1248 global $rbacsystem, $ilUser;
1250 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_output.html",
"Modules/Test");
1251 if (!$rbacsystem->checkAccess(
"read", $this->object->getRefId()))
1254 $this->ilias->raiseError($this->lng->txt(
"cannot_execute_test"),$this->ilias->error_obj->MESSAGE);
1263 if ($this->object->endingTimeReached())
1269 if ($this->object->getKioskMode())
1275 $this->tpl->setCurrentBlock(
"kiosk_options");
1276 $this->tpl->setVariable(
"KIOSK_HEAD", $head);
1277 $this->tpl->parseCurrentBlock();
1281 if (($this->object->getInstantFeedbackSolution() == 1) || ($this->object->getAnswerFeedback() == 1) || ($this->object->getAnswerFeedbackPoints() == 1))
1283 $this->tpl->setCurrentBlock(
"direct_feedback");
1284 $this->tpl->setVariable(
"TEXT_DIRECT_FEEDBACK", $this->lng->txt(
"check"));
1285 $this->tpl->parseCurrentBlock();
1294 if ($this->object->getEnableProcessingTime())
1299 $this->tpl->setVariable(
"FORM_TIMESTAMP", time());
1300 $directfeedback = 0;
1301 if (strcmp(
$_GET[
"activecommand"],
"directfeedback") == 0) $directfeedback = 1;
1302 $this->
outWorkingForm($this->sequence, $this->object->getTestId(), $postpone, $directfeedback, $show_summary);
1303 $this->tpl->setVariable(
"PAGETITLE",
"- " . $this->object->getTitle());
1318 $user = $this->
object->getInvitedUsers($ilUser->getId());
1322 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1327 if (strcmp(
$user[
"clientip"],
"")!=0 && strcmp(
$user[
"clientip"],$_SERVER[
"REMOTE_ADDR"])!=0)
1330 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1342 and $this->
object->startingTimeReached()
1343 and !$this->
object->endingTimeReached();
1351 return $this->
object->hasNrOfTriesRestriction() && $this->
object->isNrOfTriesReached($this->object->getTestSession()->getPass());
1363 if (array_key_exists(
"pass",
$_GET) && (strlen(
$_GET[
"pass"]) > 0))
1365 $this->ctrl->saveParameter($this,
"pass");
1366 $this->ctrl->saveParameter($this,
"active_id");
1367 $this->outTestResults(
false,
$_GET[
"pass"]);
1371 $this->outTestResults(
false);
1383 $this->
object->getTestSession()->increasePass();
1384 $this->
object->getTestSession()->setLastSequence(0);
1385 $this->
object->getTestSession()->saveToDb();
1386 if (!$this->object->canViewResults())
1392 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1415 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_submit_answers_confirm.html",
"Modules/Test");
1416 $this->tpl->setCurrentBlock(
"adm_content");
1417 if ($this->object->isTestFinished($this->object->getTestSession()->getActiveId()))
1419 $this->tpl->setCurrentBlock(
"not_submit_allowed");
1420 $this->tpl->setVariable(
"TEXT_ALREADY_SUBMITTED", $this->lng->txt(
"tst_already_submitted"));
1421 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_show_answer_sheet"));
1424 $this->tpl->setCurrentBlock(
"submit_allowed");
1425 $this->tpl->setVariable(
"TEXT_CONFIRM_SUBMIT_RESULTS", $this->lng->txt(
"tst_confirm_submit_answers"));
1426 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_submit_results"));
1428 $this->tpl->setVariable(
"BTN_BACK", $this->lng->txt(
"back"));
1429 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"finalSubmission"));
1430 $this->tpl->parseCurrentBlock();
1437 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
1438 $processing_time = $this->
object->getProcessingTimeInSeconds();
1439 $processing_time_minutes = floor($processing_time / 60);
1440 $processing_time_seconds = $processing_time - $processing_time_minutes * 60;
1441 $str_processing_time =
"";
1442 if ($processing_time_minutes > 0)
1444 $str_processing_time = $processing_time_minutes .
" " . $this->lng->txt(
"minutes");
1446 if ($processing_time_seconds > 0)
1448 if (strlen($str_processing_time) > 0) $str_processing_time .=
" " . $this->lng->txt(
"and") .
" ";
1449 $str_processing_time .= $processing_time_seconds .
" " . $this->lng->txt(
"seconds");
1451 $time_left = $starting_time + $processing_time - mktime();
1452 $time_left_minutes = floor($time_left / 60);
1453 $time_left_seconds = $time_left - $time_left_minutes * 60;
1454 $str_time_left =
"";
1455 if ($time_left_minutes > 0)
1457 $str_time_left = $time_left_minutes .
" " . $this->lng->txt(
"minutes");
1459 if ($time_left < 300)
1461 if ($time_left_seconds > 0)
1463 if (strlen($str_time_left) > 0) $str_time_left .=
" " . $this->lng->txt(
"and") .
" ";
1464 $str_time_left .= $time_left_seconds .
" " . $this->lng->txt(
"seconds");
1467 $date = getdate($starting_time);
1479 $datenow = getdate();
1480 $this->tpl->setCurrentBlock(
"enableprocessingtime");
1481 $this->tpl->setVariable(
"USER_WORKING_TIME",
1483 $this->lng->txt(
"tst_time_already_spent"),
1484 $formattedStartingTime,
1485 $str_processing_time
1488 $this->tpl->setVariable(
"USER_REMAINING_TIME", sprintf($this->lng->txt(
"tst_time_already_spent_left"), $str_time_left));
1489 $this->tpl->parseCurrentBlock();
1490 $template =
new ilTemplate(
"tpl.workingtime.js.html", TRUE, TRUE, TRUE);
1491 $template->setVariable(
"STRING_MINUTE", $this->lng->txt(
"minute"));
1492 $template->setVariable(
"STRING_MINUTES", $this->lng->txt(
"minutes"));
1493 $template->setVariable(
"STRING_SECOND", $this->lng->txt(
"second"));
1494 $template->setVariable(
"STRING_SECONDS", $this->lng->txt(
"seconds"));
1495 $template->setVariable(
"STRING_TIMELEFT", $this->lng->txt(
"tst_time_already_spent_left"));
1496 $template->setVariable(
"AND", strtolower($this->lng->txt(
"and")));
1497 $template->setVariable(
"YEAR", $date[
"year"]);
1498 $template->setVariable(
"MONTH", $date[
"mon"]-1);
1499 $template->setVariable(
"DAY", $date[
"mday"]);
1500 $template->setVariable(
"HOUR", $date[
"hours"]);
1501 $template->setVariable(
"MINUTE", $date[
"minutes"]);
1502 $template->setVariable(
"SECOND", $date[
"seconds"]);
1503 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->object->getEndingTime(), $matches))
1505 $template->setVariable(
"ENDYEAR", $matches[1]);
1506 $template->setVariable(
"ENDMONTH", $matches[2]-1);
1507 $template->setVariable(
"ENDDAY", $matches[3]);
1508 $template->setVariable(
"ENDHOUR", $matches[4]);
1509 $template->setVariable(
"ENDMINUTE", $matches[5]);
1510 $template->setVariable(
"ENDSECOND", $matches[6]);
1512 $template->setVariable(
"YEARNOW", $datenow[
"year"]);
1513 $template->setVariable(
"MONTHNOW", $datenow[
"mon"]-1);
1514 $template->setVariable(
"DAYNOW", $datenow[
"mday"]);
1515 $template->setVariable(
"HOURNOW", $datenow[
"hours"]);
1516 $template->setVariable(
"MINUTENOW", $datenow[
"minutes"]);
1517 $template->setVariable(
"SECONDNOW", $datenow[
"seconds"]);
1518 $template->setVariable(
"PTIME_M", $processing_time_minutes);
1519 $template->setVariable(
"PTIME_S", $processing_time_seconds);
1521 $this->tpl->setCurrentBlock(
"HeadContent");
1522 $this->tpl->setVariable(
"CONTENT_BLOCK", $template->get());
1523 $this->tpl->parseCurrentBlock();
1531 if ($fullpage) $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_question_summary.html",
"Modules/Test");
1532 $active_id = $this->
object->getTestSession()->getActiveId();
1533 $result_array = & $this->
object->getTestSequence()->getSequenceSummary();
1534 $marked_questions = array();
1535 if ($this->object->getKioskMode() && $fullpage)
1540 $this->tpl->setCurrentBlock(
"kiosk_options");
1541 $this->tpl->setVariable(
"KIOSK_HEAD", $head);
1542 $this->tpl->parseCurrentBlock();
1545 if ($this->object->getShowMarker())
1547 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1551 foreach ($result_array as $key => $value)
1553 $this->ctrl->setParameter($this,
"sequence", $value[
"sequence"]);
1554 $href = $this->ctrl->getLinkTargetByClass(get_class($this),
"gotoQuestion");
1555 $this->tpl->setVariable(
"VALUE_QUESTION_TITLE",
"<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this),
"gotoQuestion").
"\">" . $this->
object->getQuestionTitle($value[
"title"]) .
"</a>");
1556 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1558 if ($this->object->getListOfQuestionsDescription())
1560 $description = $value[
"description"];
1563 if (!$this->object->getTitleOutput())
1565 $points = $value[
"points"].
" ".$this->lng->txt(
"points_short");
1568 if (count($marked_questions))
1570 if (array_key_exists($value[
"qid"], $marked_questions))
1572 $obj = $marked_questions[$value[
"qid"]];
1573 if ($obj[
"solved"] == 1)
1579 array_push(
$data, array(
1580 'order' => $value[
"nr"],
1582 'title' => $this->object->getQuestionTitle($value[
"title"]),
1583 'description' => $description,
1584 'worked_through' => ($value[
"worked_through"]) ?
true :
false,
1585 'postponed' => ($value[
"postponed"]) ? $this->lng->txt(
"postponed") :
'',
1586 'points' => $points,
1587 'marked' => $marked,
1588 'sequence' => $value[
"sequence"]
1591 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1594 include_once
"./Modules/Test/classes/tables/class.ilListOfQuestionsTableGUI.php";
1595 $table_gui =
new ilListOfQuestionsTableGUI($this,
'backFromSummary', !$this->object->getTitleOutput(), $this->
object->getShowMarker());
1597 $this->tpl->setVariable(
'TABLE_LIST_OF_QUESTIONS', $table_gui->getHTML());
1598 if ($this->object->getEnableProcessingTime()) $this->
outProcessingTime($active_id);
1602 $template =
new ilTemplate(
'tpl.il_as_tst_list_of_questions_short.html',
true,
true,
'Modules/Test');
1605 if (strlen($row[
'description']))
1607 $template->setCurrentBlock(
'description');
1608 $template->setVariable(
"DESCRIPTION", $row[
'description']);
1609 $template->parseCurrentBlock();
1611 $template->setCurrentBlock(
'item');
1613 $template->setVariable(
'CLASS', ($row[
'walked_through']) ? (
'answered'.$active) : (
'unanswered'.$active));
1615 $template->setVariable(
'SEQUENCE', $row[
'sequence']);
1616 $template->parseCurrentBlock();
1618 $template->setVariable(
'LIST_OF_QUESTIONS', $this->lng->txt(
'list_of_questions'));
1619 $this->tpl->setVariable(
'LIST_OF_QUESTIONS', $template->get());
1625 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_max_allowed_users_reached.html",
"Modules/Test");
1626 $this->tpl->setCurrentBlock(
"adm_content");
1627 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_MESSAGE", sprintf($this->lng->txt(
"tst_max_allowed_users_message"), $this->
object->getAllowedUsersTimeGap()));
1628 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_HEADING", sprintf($this->lng->txt(
"tst_max_allowed_users_heading"), $this->
object->getAllowedUsersTimeGap()));
1629 $this->tpl->setVariable(
"BACK_TO_INTRODUCTION", $this->lng->txt(
"tst_results_back_introduction"));
1630 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1631 $this->tpl->parseCurrentBlock();
1637 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
1639 $template =
new ilTemplate(
"tpl.il_as_tst_finish_navigation.html", TRUE, TRUE,
"Modules/Test");
1640 $template->setVariable(
"BUTTON_FINISH", $this->lng->txt(
"btn_next"));
1641 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"btn_previous"));
1643 $template_top =
new ilTemplate(
"tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE,
"Modules/Test");
1644 $template_top->setCurrentBlock(
"button_print");
1645 $template_top->setVariable(
"BUTTON_PRINT", $this->lng->txt(
"print"));
1646 $template_top->parseCurrentBlock();
1647 $active_id = $this->
object->getTestSession()->getActiveId();
1648 return $this->
showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
1652 $this->ctrl->redirect($this,
'gotoQuestion');
1668 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_correct_solution.html",
"Modules/Test");
1670 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1671 $this->tpl->setCurrentBlock(
"ContentStyle");
1673 $this->tpl->parseCurrentBlock();
1675 $this->tpl->setCurrentBlock(
"SyntaxStyle");
1677 $this->tpl->parseCurrentBlock();
1680 if ($this->object->getShowSolutionAnswersOnly())
1685 $this->tpl->setCurrentBlock(
"adm_content");
1687 $this->tpl->setVariable(
"OUTPUT_SOLUTION", $solution);
1688 $this->tpl->setVariable(
"TEXT_BACK", $this->lng->txt(
"back"));
1689 $this->ctrl->saveParameter($this,
"pass");
1690 $this->ctrl->saveParameter($this,
"active_id");
1691 $this->tpl->setVariable(
"URL_BACK", $this->ctrl->getLinkTarget($this,
"outUserResultsOverview"));
1692 $this->tpl->parseCurrentBlock();
1708 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_finish_list_of_answers.html",
"Modules/Test");
1710 $result_array =& $this->
object->getTestResult($active_id,
$pass);
1714 foreach ($result_array as $question_data)
1716 $question = $question_data[
"qid"];
1717 if (is_numeric($question))
1719 $this->tpl->setCurrentBlock(
"printview_question");
1720 $question_gui = $this->
object->createQuestionGUI(
"", $question);
1721 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1722 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
1723 $template->setVariable(
"QUESTION_TITLE", $question_gui->object->getTitle());
1725 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
1726 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
1727 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
1728 $this->tpl->setVariable(
"QUESTION_OUTPUT", $template->get());
1729 $this->tpl->parseCurrentBlock();
1735 if ($this->object->getShowSolutionAnswersOnly())
1739 if (strlen($top_data))
1741 $this->tpl->setCurrentBlock(
"top_data");
1742 $this->tpl->setVariable(
"TOP_DATA", $top_data);
1743 $this->tpl->parseCurrentBlock();
1746 if (strlen($bottom_data))
1748 $this->tpl->setCurrentBlock(
"bottom_data");
1749 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1750 $this->tpl->setVariable(
"BOTTOM_DATA", $bottom_data);
1751 $this->tpl->parseCurrentBlock();
1754 $this->tpl->setCurrentBlock(
"adm_content");
1755 $this->tpl->setVariable(
"TXT_ANSWER_SHEET", $this->lng->txt(
"tst_list_of_answers"));
1758 $this->tpl->setVariable(
"USER_DETAILS", $user_data);
1759 $this->tpl->setVariable(
"SIGNATURE", $signature);
1760 $this->tpl->setVariable(
"TITLE", $this->object->getTitle());
1761 $this->tpl->setVariable(
"TXT_TEST_PROLOG", $this->lng->txt(
"tst_your_answers"));
1762 $invited_user =& $this->
object->getInvitedUsers($ilUser->getId());
1763 $pagetitle = $this->
object->getTitle() .
" - " . $this->lng->txt(
"clientip") .
1764 ": " . $invited_user[$ilUser->getId()][
"clientip"] .
" - " .
1765 $this->lng->txt(
"matriculation") .
": " .
1766 $invited_user[$ilUser->getId()][
"matriculation"];
1767 $this->tpl->setVariable(
"PAGETITLE", $pagetitle);
1768 $this->tpl->parseCurrentBlock();
1779 if ($this->object->getKioskMode())
1781 $this->tpl->setBodyClass(
"kiosk");
1782 $this->tpl->setAddFooter(FALSE);
1787 return "ADM_CONTENT";
1793 $this->ctrl->redirectByClass(
"iltestevaluationgui",
"outUserResultsOverview");
1798 $this->ctrl->redirectByClass(
"iltestevaluationgui",
"outUserListOfAnswerPasses");