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");
66 $a_safe_commands = array(
"printTest",
"saveTest",
"resetTest",
"savePDF",
"showPaperVersion");
67 $cmd = $this->ctrl->getCmd(
"",$a_safe_commands);
69 $next_class = $this->ctrl->getNextClass($this);
70 $this->ctrl->saveParameter($this,
"sequence");
71 $this->ctrl->saveParameter($this,
"active_id");
72 if (preg_match(
"/^gotoquestion_(\\d+)$/",
$cmd, $matches))
74 $cmd =
"gotoquestion";
75 if (strlen($matches[1]))
77 $this->ctrl->setParameter($this,
'gotosequence', $matches[1]);
81 if (
$_GET[
"active_id"])
83 $this->
object->setTestSession(
$_GET[
"active_id"]);
87 $this->
object->setTestSession();
89 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
109 $this->
object->updateWorkingTime(
$_SESSION[
"active_time_id"]);
119 $this->saveResult = FALSE;
122 $formtimestamp =
$_POST[
"formtimestamp"];
123 if (strlen($formtimestamp) == 0) $formtimestamp =
$_GET[
"formtimestamp"];
124 if ($formtimestamp !=
$_SESSION[
"formtimestamp"])
126 $_SESSION[
"formtimestamp"] = $formtimestamp;
137 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
138 if (is_numeric($q_id))
142 $question_gui = $this->
object->createQuestionGUI(
"", $q_id);
143 if ($this->object->getJavaScriptOutput())
148 $active_id = $this->
object->getTestSession()->getActiveId();
149 if ($this->object->isRandomTest())
151 $pass = $this->
object->_getPass($active_id);
153 $this->saveResult = $question_gui->object->saveWorkingData($active_id,
$pass);
160 if ($this->saveResult == FALSE)
162 $this->ctrl->setParameter($this,
"save_error",
"1");
190 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
204 $active_id = $this->
object->getTestSession()->getActiveId();
205 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
206 if ($starting_time === FALSE)
212 return $this->
object->isMaxProcessingTimeReached($starting_time, $active_id);
224 $question_id = $this->
object->getTestSequence()->getQuestionForSequence(
$sequence);
225 $active_time_id = $this->
object->startWorkingTime($this->object->getTestSession()->getActiveId(), $question_id, $this->
object->getTestSession()->getPass());
226 $_SESSION[
"active_time_id"] = $active_time_id;
228 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
229 $this->tpl->setCurrentBlock(
"ContentStyle");
230 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
232 $this->tpl->parseCurrentBlock();
235 $this->tpl->setCurrentBlock(
"SyntaxStyle");
236 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
238 $this->tpl->parseCurrentBlock();
240 if ($this->object->getListOfQuestions())
242 $show_side_list = $ilUser->getPref(
'side_list_of_questions');
243 $this->tpl->setCurrentBlock(
'view_sidelist');
245 $this->tpl->setVariable(
'TEXT_SIDELIST', ($show_side_list) ? $this->lng->txt(
'tst_hide_side_list') : $this->lng->txt(
'tst_show_side_list'));
246 $this->tpl->parseCurrentBlock();
254 $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
255 if ($this->object->getJavaScriptOutput())
260 $is_postponed = $this->
object->getTestSequence()->isPostponedQuestion($question_gui->object->getId());
261 $this->ctrl->setParameter($this,
"sequence",
"$sequence");
262 $formaction = $this->ctrl->getFormAction($this,
"gotoQuestion");
264 $question_gui->setSequenceNumber($this->object->getTestSequence()->getPositionOfSequence(
$sequence));
265 $question_gui->setQuestionCount($this->object->getTestSequence()->getUserQuestionCount());
267 $user_post_solution = FALSE;
268 if (array_key_exists(
"previouspost",
$_SESSION))
270 $user_post_solution =
$_SESSION[
"previouspost"];
273 $answer_feedback = FALSE;
274 if (($directfeedback) && ($this->object->getAnswerFeedback()))
276 $answer_feedback = TRUE;
278 global $ilNavigationHistory;
279 $ilNavigationHistory->addItem(
$_GET[
"ref_id"], $this->ctrl->getLinkTarget($this,
"resume"),
"tst");
280 $question_gui->outQuestionForTest($formaction, $this->object->getTestSession()->getActiveId(), NULL, $is_postponed, $user_post_solution, $answer_feedback);
283 if ($this->object->getInstantFeedbackSolution())
285 $solutionoutput = $question_gui->getSolutionOutput($this->object->getTestSession()->getActiveId(), NULL, FALSE, FALSE, FALSE, FALSE, TRUE);
286 $this->tpl->setCurrentBlock(
"solution_output");
287 $this->tpl->setVariable(
"CORRECT_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
288 $this->tpl->setVariable(
"QUESTION_FEEDBACK", $solutionoutput);
289 $this->tpl->parseCurrentBlock();
291 if ($this->object->getAnswerFeedbackPoints())
293 $this->tpl->setCurrentBlock(
"solution_output");
294 $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()));
295 $this->tpl->parseCurrentBlock();
297 if ($this->object->getAnswerFeedback())
299 $this->tpl->setCurrentBlock(
"answer_feedback");
300 $this->tpl->setVariable(
"ANSWER_FEEDBACK", $question_gui->getAnswerFeedbackOutput($this->object->getTestSession()->getActiveId(), NULL));
301 $this->tpl->parseCurrentBlock();
305 if (
$sequence == $this->object->getTestSequence()->getFirstSequence())
317 $this->tpl->setCurrentBlock(
"prev");
318 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_previous"));
319 $this->tpl->parseCurrentBlock();
320 $this->tpl->setCurrentBlock(
"prev_bottom");
321 $this->tpl->setVariable(
"BTN_PREV",
"<< " . $this->lng->txt(
"save_previous"));
322 $this->tpl->parseCurrentBlock();
325 if ($postpone_allowed)
331 $this->tpl->setCurrentBlock(
"postpone");
332 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone"));
333 $this->tpl->parseCurrentBlock();
334 $this->tpl->setCurrentBlock(
"postpone_bottom");
335 $this->tpl->setVariable(
"BTN_POSTPONE", $this->lng->txt(
"postpone"));
336 $this->tpl->parseCurrentBlock();
341 if ($this->object->getListOfQuestions())
343 if (!(($finish) && ($this->object->getListOfQuestionsEnd())))
345 $this->tpl->setCurrentBlock(
"summary");
346 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary"));
347 $this->tpl->parseCurrentBlock();
348 $this->tpl->setCurrentBlock(
"summary_bottom");
349 $this->tpl->setVariable(
"BTN_SUMMARY", $this->lng->txt(
"question_summary"));
350 $this->tpl->parseCurrentBlock();
354 if ($this->object->getShowCancel())
356 $this->tpl->setCurrentBlock(
"cancel_test");
357 $this->tpl->setVariable(
"TEXT_CANCELTEST", $this->lng->txt(
"cancel_test"));
358 $this->tpl->setVariable(
"TEXT_ALTCANCELTEXT", $this->lng->txt(
"cancel_test"));
359 $this->tpl->setVariable(
"TEXT_TITLECANCELTEXT", $this->lng->txt(
"cancel_test"));
360 $this->tpl->setVariable(
"HREF_IMGCANCELTEST", $this->ctrl->getLinkTargetByClass(get_class($this),
"outIntroductionPage") .
"&cancelTest=true");
361 $this->tpl->setVariable(
"HREF_CANCELTEXT", $this->ctrl->getLinkTargetByClass(get_class($this),
"outIntroductionPage") .
"&cancelTest=true");
363 $this->tpl->parseCurrentBlock();
366 if ($this->object->getTestSequence()->getQuestionForSequence($this->object->getTestSequence()->getLastSequence()) == $question_gui->object->getId())
368 if ($this->object->getListOfQuestionsEnd())
370 $this->tpl->setCurrentBlock(
"next");
371 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"question_summary") .
" >>");
372 $this->tpl->parseCurrentBlock();
373 $this->tpl->setCurrentBlock(
"next_bottom");
374 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"question_summary") .
" >>");
375 $this->tpl->parseCurrentBlock();
379 $this->tpl->setCurrentBlock(
"next");
380 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_finish") .
" >>");
381 $this->tpl->parseCurrentBlock();
382 $this->tpl->setCurrentBlock(
"next_bottom");
383 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_finish") .
" >>");
384 $this->tpl->parseCurrentBlock();
389 $this->tpl->setCurrentBlock(
"next");
390 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_next") .
" >>");
391 $this->tpl->parseCurrentBlock();
392 $this->tpl->setCurrentBlock(
"next_bottom");
393 $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"save_next") .
" >>");
394 $this->tpl->parseCurrentBlock();
397 if ($this->object->getShowMarker())
399 include_once
"./Modules/Test/classes/class.ilObjTest.php";
403 if (count ($solved_array) > 0)
405 $solved = array_pop($solved_array);
406 $solved = $solved[
"solved"];
411 $this->tpl->setCurrentBlock(
"ismarked");
413 $this->tpl->setVariable(
"TEXT_SET", $this->lng->txt(
"tst_remove_mark"));
414 $this->tpl->parseCurrentBlock();
418 $this->tpl->setCurrentBlock(
"isnotmarked");
420 $this->tpl->setVariable(
"TEXT_UNSET", $this->lng->txt(
"tst_question_mark"));
421 $this->tpl->parseCurrentBlock();
425 if ($this->object->getShowSerial() && !($this->
object->getKioskMode() && $this->
object->getShowKioskModeParticipant()))
427 $this->tpl->setCurrentBlock(
"tst_serial");
428 $this->tpl->setVariable(
"VALUE_SERIAL", $this->object->getSerial());
429 $this->tpl->setVariable(
"TXT_SERIAL", $this->lng->txt(
'tst_serial'));
430 $this->tpl->parseCurrentBlock();
433 if ($this->object->getJavaScriptOutput())
436 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"disable_javascript"));
437 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"disable_javascript"));
438 $this->ctrl->setParameter($this,
"tst_javascript",
"0");
439 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
444 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"enable_javascript"));
445 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"enable_javascript"));
446 $this->ctrl->setParameter($this,
"tst_javascript",
"1");
447 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
450 if ($question_gui->object->supportsJavascriptOutput())
452 $this->tpl->touchBlock(
"jsswitch");
456 $this->tpl->setVariable(
"AUTOSAVE_URL", $this->ctrl->getFormAction($this,
"autosave",
"",
true));
458 if ($this->object->getAutosave())
460 $this->tpl->setCurrentBlock(
"autosave");
464 $this->tpl->setVariable(
"AUTOSAVEFORMACTION", $this->ctrl->getFormAction($this,
"autosave",
"",
true));
465 $this->tpl->parseCurrentBlock();
476 $template =
new ilTemplate(
"tpl.il_as_tst_password_protection.html", TRUE, TRUE,
"Modules/Test");
477 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"checkPassword"));
478 $template->setVariable(
"PASSWORD_INTRODUCTION", $this->lng->txt(
"tst_password_introduction"));
479 $template->setVariable(
"TEXT_PASSWORD", $this->lng->txt(
"tst_password"));
480 $template->setVariable(
"SUBMIT", $this->lng->txt(
"submit"));
491 if (strcmp($this->object->getPassword(),
$_POST[
"password"]) == 0)
494 if (
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID)
496 $ilUser->setPref(
"tst_password_".$this->object->getTestId(), $this->
object->getPassword());
497 $ilUser->writePref(
"tst_password_".$this->object->getTestId(), $this->
object->getPassword());
499 $this->ctrl->redirect($this,
"start");
504 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
517 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
519 $this->
object->setAccessCodeSession(
$_POST[
"anonymous_id"]);
521 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
538 $this->ctrl->redirect($this,
"startTest");
542 $this->ctrl->redirectByClass(
"ilobjtestgui",
"redirectToInfoScreen");
553 if ($this->object->checkMaximumAllowedUsers() == FALSE)
557 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
559 $this->
object->setAccessCodeSession($this->object->createNewAccessCode());
563 $this->
object->unsetAccessCodeSession();
565 if (strlen($this->object->getPassword()))
570 $pwd = $ilUser->getPref(
"tst_password_".$this->object->getTestId());
571 if ((strcmp($pwd, $this->object->getPassword()) != 0) && (!$rbacsystem->checkAccess(
"write", $this->object->getRefId())))
576 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
578 $this->ctrl->redirect($this,
"displayCode");
582 $this->ctrl->setParameter($this,
"activecommand",
"start");
583 $this->ctrl->redirect($this,
"redirectQuestion");
589 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_anonymous_code_presentation.html",
"Modules/Test");
590 $this->tpl->setCurrentBlock(
"adm_content");
591 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE_CREATED", $this->lng->txt(
"tst_access_code_created"));
592 $this->tpl->setVariable(
"TEXT_ANONYMOUS_CODE", $this->object->getAccessCodeSession());
593 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
594 $this->tpl->setVariable(
"CONTINUE", $this->lng->txt(
"continue_work"));
595 $this->tpl->parseCurrentBlock();
600 $this->ctrl->setParameter($this,
"activecommand",
"start");
601 $this->ctrl->redirect($this,
"redirectQuestion");
613 if ($this->object->checkMaximumAllowedUsers() == FALSE)
618 $this->ctrl->setParameter($this,
"activecommand",
"resume");
619 $this->ctrl->redirect($this,
"redirectQuestion");
629 if (
$_POST[
"chb_javascript"])
631 $ilUser->writePref(
"tst_javascript", 1);
635 $ilUser->writePref(
"tst_javascript", 0);
639 if ($this->object->getNrOfTries() != 1)
641 if ($this->object->getUsePreviousAnswers() == 1)
643 if (
$_POST[
"chb_use_previous_answers"])
645 $ilUser->writePref(
"tst_use_previous_answers", 1);
649 $ilUser->writePref(
"tst_use_previous_answers", 0);
673 $executable = $this->
object->isExecutable($ilUser->getId());
674 if (!$executable[
"executable"])
677 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
679 switch (
$_GET[
"activecommand"])
683 if ($this->sequence === FALSE)
685 if ($this->object->getListOfQuestionsEnd())
691 $this->ctrl->redirect($this,
"finishTest");
696 $this->
object->getTestSession()->setLastSequence($this->sequence);
697 $this->
object->getTestSession()->saveToDb();
703 $this->
object->getTestSession()->setLastSequence($this->sequence);
704 $this->
object->getTestSession()->saveToDb();
705 if ($this->sequence === FALSE)
707 $this->ctrl->redirect($this,
"outIntroductionPage");
716 $nextSequence = $this->
object->getTestSequence()->getNextSequence($this->sequence);
717 $this->
object->getTestSequence()->postponeSequence($this->sequence);
718 $this->
object->getTestSequence()->saveToDb();
719 $this->
object->getTestSession()->setLastSequence($nextSequence);
720 $this->
object->getTestSession()->saveToDb();
721 $this->sequence = $nextSequence;
726 $this->
object->getTestSession()->setLastSequence($this->sequence);
727 $this->
object->getTestSession()->saveToDb();
728 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
729 $this->
object->setQuestionSetSolved(1, $q_id, $ilUser->getId());
734 $this->
object->getTestSession()->setLastSequence($this->sequence);
735 $this->
object->getTestSession()->saveToDb();
736 $q_id = $this->
object->getTestSequence()->getQuestionForSequence(
$_GET[
"sequence"]);
737 $this->
object->setQuestionSetSolved(0, $q_id, $ilUser->getId());
740 case "directfeedback":
742 $this->
object->getTestSession()->setLastSequence($this->sequence);
743 $this->
object->getTestSession()->saveToDb();
746 case "selectImagemapRegion":
748 $this->
object->getTestSession()->setLastSequence($this->sequence);
749 $this->
object->getTestSession()->saveToDb();
753 $this->ctrl->redirect($this,
"outQuestionSummary");
757 $this->
object->createTestSession();
758 $active_id = $this->
object->getTestSession()->getActiveId();
759 $this->ctrl->setParameter($this,
"active_id", $active_id);
760 $shuffle = $this->
object->getShuffleQuestions();
761 if ($this->object->isRandomTest())
763 $this->
object->generateRandomQuestions($this->object->getTestSession()->getActiveId());
764 $this->
object->loadQuestions();
767 $this->
object->createTestSequence($active_id, 0, $shuffle);
768 $question_id = $this->
object->getTestSequence()->getQuestionForSequence($this->sequence);
769 $active_time_id = $this->
object->startWorkingTime($this->object->getTestSession()->getActiveId(), $question_id, $this->
object->getTestSession()->getPass());
770 $_SESSION[
"active_time_id"] = $active_time_id;
771 if ($this->object->getListOfQuestionsStart())
773 $this->ctrl->setParameter($this,
"activecommand",
"summary");
774 $this->ctrl->redirect($this,
"redirectQuestion");
778 $this->ctrl->setParameter($this,
"sequence", $this->sequence);
779 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
780 $this->ctrl->saveParameter($this,
"tst_javascript");
781 $this->ctrl->redirect($this,
"redirectQuestion");
786 $active_id = $this->
object->getTestSession()->getActiveId();
787 $this->ctrl->setParameter($this,
"active_id", $active_id);
789 if ($this->object->isRandomTest())
791 if (!$this->object->hasRandomQuestionsForPass($active_id, $this->object->getTestSession()->getPass()))
794 $this->
object->generateRandomQuestions($active_id, $this->object->getTestSession()->getPass());
797 $shuffle = $this->
object->getShuffleQuestions();
798 if ($this->object->isRandomTest())
802 $this->
object->createTestSequence($active_id, $this->object->getTestSession()->getPass(), $shuffle);
804 $this->sequence = $this->
object->getTestSession()->getLastSequence();
805 $question_id = $this->
object->getTestSequence()->getQuestionForSequence(
$sequence);
806 $active_time_id = $this->
object->startWorkingTime($active_id, $question_id, $this->object->getTestSession()->getPass());
807 $_SESSION[
"active_time_id"] = $active_time_id;
808 if ($this->object->getListOfQuestionsStart())
810 $this->ctrl->setParameter($this,
"activecommand",
"summary");
811 $this->ctrl->redirect($this,
"redirectQuestion");
815 $this->ctrl->setParameter($this,
"sequence", $this->sequence);
816 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
817 $this->ctrl->saveParameter($this,
"tst_javascript");
818 $this->ctrl->redirect($this,
"redirectQuestion");
825 if (array_key_exists(
"tst_javascript",
$_GET))
827 $ilUser->writePref(
"tst_javascript",
$_GET[
"tst_javascript"]);
830 if (strlen(
$_GET[
'gotosequence'])) $this->sequence =
$_GET[
'gotosequence'];
831 $this->
object->getTestSession()->setLastSequence($this->sequence);
832 $this->
object->getTestSession()->saveToDb();
847 if (array_key_exists(
"save_error",
$_GET))
849 if (
$_GET[
"save_error"] == 1)
854 switch (
$_GET[
"activecommand"])
868 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_redirect_autosave.html",
"Modules/Test");
869 $this->tpl->setVariable(
"TEXT_REDIRECT", $this->lng->txt(
"redirectAfterSave"));
870 $this->tpl->setCurrentBlock(
"HeadContent");
871 $this->tpl->setVariable(
"CONTENT_BLOCK",
"<meta http-equiv=\"refresh\" content=\"5; url=" . $this->ctrl->getLinkTarget($this,
"redirectBack") .
"\">");
872 $this->tpl->parseCurrentBlock();
884 $result = $this->lng->txt(
"autosave_success");
888 $result = $this->lng->txt(
"autosave_failed");
894 $result = $this->ctrl->getLinkTarget($this,
"redirectAfterAutosave",
"",
true);
907 $show_side_list = $ilUser->getPref(
'side_list_of_questions');
908 $ilUser->writePref(
'side_list_of_questions', !$show_side_list);
910 $this->ctrl->redirect($this,
"redirectQuestion");
923 $this->ctrl->setParameter($this,
"activecommand",
"next");
924 $this->ctrl->redirect($this,
"redirectQuestion");
937 $this->ctrl->setParameter($this,
"activecommand",
"previous");
938 $this->ctrl->redirect($this,
"redirectQuestion");
951 $this->ctrl->setParameter($this,
"activecommand",
"postpone");
952 $this->ctrl->redirect($this,
"redirectQuestion");
965 if ($this->saveResult == FALSE)
967 $this->ctrl->setParameter($this,
"activecommand",
"");
968 $this->ctrl->redirect($this,
"redirectQuestion");
972 $this->ctrl->setParameter($this,
"activecommand",
"summary");
973 $this->ctrl->redirect($this,
"redirectQuestion");
987 $this->ctrl->setParameter($this,
"activecommand",
"setmarked");
988 $this->ctrl->redirect($this,
"redirectQuestion");
1001 $this->ctrl->setParameter($this,
"activecommand",
"resetmarked");
1002 $this->ctrl->redirect($this,
"redirectQuestion");
1015 $this->ctrl->setParameter($this,
"activecommand",
"directfeedback");
1016 $this->ctrl->redirect($this,
"redirectQuestion");
1029 $activecommand =
"selectImagemapRegion";
1030 if (array_key_exists(
'cmd',
$_POST))
1032 $activecommand = key(
$_POST[
"cmd"]);
1034 if (preg_match(
"/^gotoquestion_(\\d+)$/", $activecommand, $matches))
1036 $activecommand =
"gotoquestion";
1037 if (strlen($matches[1]))
1039 $this->ctrl->setParameter($this,
'gotosequence', $matches[1]);
1042 if (strcmp($activecommand,
"togglesidelist") == 0)
1048 $this->ctrl->setParameter($this,
"activecommand", $activecommand);
1049 $this->ctrl->redirect($this,
"redirectQuestion");
1069 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1070 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
1071 $this->ctrl->saveParameter($this,
"tst_javascript");
1073 $this->ctrl->redirect($this,
"redirectQuestion");
1085 $this->ctrl->setParameter($this,
"activecommand",
"back");
1086 $this->ctrl->redirect($this,
"redirectQuestion");
1112 $template =
new ilTemplate(
"tpl.il_as_tst_finish_confirmation.html", TRUE, TRUE,
"Modules/Test");
1113 $template->setVariable(
"FINISH_QUESTION", $this->lng->txt(
"tst_finish_confirmation_question"));
1114 $template->setVariable(
"BUTTON_CONFIRM", $this->lng->txt(
"tst_finish_confirm_button"));
1115 if ($this->object->getShowSolutionAnwersBeforeFinish())
1117 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"tst_finish_confirm_list_of_answers_button"));
1121 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"tst_finish_confirm_cancel_button"));
1123 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1142 $active_id = $this->
object->getTestSession()->getActiveId();
1143 $actualpass = $this->
object->_getPass($active_id);
1144 if (($actualpass == $this->object->getNrOfTries() - 1) && (!$confirm))
1146 $this->
object->setActiveTestSubmitted($ilUser->getId());
1147 $ilAuth->setIdle($ilias->ini->readVariable(
"session",
"expire"),
false);
1148 $ilAuth->setExpire(0);
1149 switch ($this->object->getMailNotification())
1152 $this->
object->sendSimpleNotification($active_id);
1155 $this->
object->sendAdvancedNotification($active_id);
1160 if (($confirm) && ($actualpass == $this->object->getNrOfTries() - 1))
1162 if ($this->object->getShowSolutionAnwersBeforeFinish())
1164 $template =
new ilTemplate(
"tpl.il_as_tst_finish_navigation.html", TRUE, TRUE,
"Modules/Test");
1165 $template->setVariable(
"BUTTON_FINISH", $this->lng->txt(
"btn_next"));
1166 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"btn_previous"));
1168 $template_top =
new ilTemplate(
"tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE,
"Modules/Test");
1169 $template_top->setCurrentBlock(
"button_print");
1170 $template_top->setVariable(
"BUTTON_PRINT", $this->lng->txt(
"print"));
1171 $template_top->parseCurrentBlock();
1173 $this->
showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
1186 if ($this->object->getMailNotificationType() == 1)
1188 switch ($this->object->getMailNotification())
1191 $this->
object->sendSimpleNotification($active_id);
1194 $this->
object->sendAdvancedNotification($active_id);
1198 $this->
object->getTestSession()->increaseTestPass();
1203 $exam_pdf = $this->
object->getExamPdf();
1205 $active = $this->
object->getTestSession($active_id);
1206 $ra_date = date(
"Y-m-d");
1208 $ra_test_filename = $ra_date.
"_".$active->test_id.
"_".$ilUser->login;
1209 $ra_test_file =
"resarchiver/output_html/".$ra_test_filename;
1214 $active->test_id.
";"
1215 .$this->object->getTitle().
";"
1216 .$active->user_id.
";"
1218 .$ilUser->fullname.
";"
1219 .$ilUser->matriculation.
";"
1221 .$ra_test_filename.
".pdf\r\n";
1223 $ra_metafile = fopen(
"resarchiver/output_html/".$ra_date.
"_".$active->test_id.
".metafile",
"a");
1225 fwrite ( $ra_metafile, $ra_meta_data);
1227 fclose($ra_metafile);
1230 $result_output_stream .=
"
1233 <title>Online-Klausur-System</title>
1234 <!--<link rel=\"stylesheet\" type=\"text/css\" href=\"./templates/default/delos.css\" />-->
1235 <!--<link rel=\"stylesheet\" type=\"text/css\" href=\"./templates/default/delos_cont.css\" />-->
1236 <!--<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Modules/Test/templates/default/test_print.css\" media=\"print\"/>-->
1237 <link rel=\"stylesheet\" type=\"text/css\" href=\"" .
1239 <link rel=\"stylesheet\" type=\"text/css\" href=\"" .
1241 <script type=\"text/javascript\" src=\"./templates/default/functions.js\"></script>
1248 $result_output_stream .=
"<p>Test: "
1249 .iconv(
"UTF-8",
"ISO-8859-1", $this->object->getTitle())
1250 .
" (Test-ID = ".$active->test_id.
")"
1251 .
"<br>Name: ".iconv(
"UTF-8",
"ISO-8859-1", $ilUser->fullname)
1252 .
"<br>Loginname: ".$ilUser->login.
" (User-ID = ".$active->user_id.
")"
1253 .
"<br>Matrikelnummer: ".$ilUser->matriculation
1254 .
"<br>E-Mail: ".$ilUser->email
1255 .
"<br>Abgabezeitpunkt: ".date(
'c (=U)')
1259 $cache_file = $ra_test_file.
".cache";
1260 if (file_exists($cache_file))
1262 $cache_handle = fopen($cache_file,
"r");
1263 $content = fread($cache_handle,filesize($cache_file));
1264 fclose($cache_handle);
1266 $result_output_stream .= $content;
1267 $result_output_stream .=
"</body></html>";
1268 $filehandle = fopen($ra_test_file .
".html",
"w");
1269 fwrite($filehandle,$result_output_stream);
1270 fclose($filehandle);
1271 unlink($cache_file);
1275 $redirect_after_exam = $this->
object->getRedirectAfterExam();
1277 if ($redirect_after_exam !=
"" && !$this->object->canViewResults())
1279 if (!$this->object->getRedirectOnlyKioskMode())
1298 if (!
$_GET[
"skipfinalstatement"])
1300 if ($this->object->getShowFinalStatement())
1302 $this->ctrl->redirect($this,
"showFinalStatement");
1305 if(
$_GET[
'crs_show_result'])
1307 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToCourse");
1310 if (!$this->object->canViewResults())
1316 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1325 $template =
new ilTemplate(
"tpl.il_as_tst_final_statement.html", TRUE, TRUE,
"Modules/Test");
1326 $this->ctrl->setParameter($this,
"crs_show_result",
$_GET[
'crs_show_result']);
1327 $this->ctrl->setParameter($this,
"skipfinalstatement", 1);
1328 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"redirectBack"));
1329 $template->setVariable(
"FINALSTATEMENT", $this->object->getFinalStatement());
1330 $template->setVariable(
"BUTTON_CONTINUE", $this->lng->txt(
"btn_next"));
1338 $template =
new ilTemplate(
'tpl.il_as_tst_kiosk_head.html',
true,
true,
'Modules/Test');
1339 if ($this->object->getShowKioskModeTitle())
1341 $template->setCurrentBlock(
"kiosk_show_title");
1342 $template->setVariable(
"TEST_TITLE", $this->object->getTitle());
1343 $template->parseCurrentBlock();
1345 if ($this->object->getShowKioskModeParticipant())
1347 if ($this->object->getShowSerial())
1349 $template->setCurrentBlock(
"tst_serial");
1350 $template->setVariable(
"TXT_SERIAL", $this->lng->txt(
"tst_serial"));
1351 $template->setVariable(
"VALUE_SERIAL", $this->object->getSerial());
1352 $template->parseCurrentBlock();
1354 $template->setCurrentBlock(
"kiosk_show_participant");
1355 $template->setVariable(
"TXT_PARTICIPANT_NAME", $this->lng->txt(
"login_as"));
1356 $template->setVariable(
"PARTICIPANT_NAME", $ilUser->getFullname());
1357 $template->setVariable(
"TXT_PARTICIPANT_LOGIN", $this->lng->txt(
"login"));
1358 $template->setVariable(
"PARTICIPANT_LOGIN", $ilUser->getLogin());
1359 $template->setVariable(
"PARTICIPANT_MATRICULATION", $ilUser->getMatriculation());
1360 $template->parseCurrentBlock();
1362 return $template->get();
1370 global $rbacsystem, $ilUser;
1372 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_output.html",
"Modules/Test");
1373 if (!$rbacsystem->checkAccess(
"read", $this->object->getRefId()))
1376 $this->ilias->raiseError($this->lng->txt(
"cannot_execute_test"),$this->ilias->error_obj->MESSAGE);
1385 if ($this->object->endingTimeReached())
1391 if ($this->object->getKioskMode())
1397 $this->tpl->setCurrentBlock(
"kiosk_options");
1398 $this->tpl->setVariable(
"KIOSK_HEAD", $head);
1399 $this->tpl->parseCurrentBlock();
1403 if (($this->object->getInstantFeedbackSolution() == 1) || ($this->object->getAnswerFeedback() == 1) || ($this->object->getAnswerFeedbackPoints() == 1))
1405 $this->tpl->setCurrentBlock(
"direct_feedback");
1406 $this->tpl->setVariable(
"TEXT_DIRECT_FEEDBACK", $this->lng->txt(
"check"));
1407 $this->tpl->parseCurrentBlock();
1416 if ($this->object->getEnableProcessingTime())
1421 $this->tpl->setVariable(
"FORM_TIMESTAMP", time());
1422 $directfeedback = 0;
1423 if (strcmp(
$_GET[
"activecommand"],
"directfeedback") == 0) $directfeedback = 1;
1424 $this->
outWorkingForm($this->sequence, $this->object->getTestId(), $postpone, $directfeedback, $show_summary);
1425 $this->tpl->setVariable(
"PAGETITLE",
"- " . $this->object->getTitle());
1440 $user = $this->
object->getInvitedUsers($ilUser->getId());
1441 if (!is_array ($user) || count($user)!=1)
1444 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1447 $user = array_pop($user);
1449 if (strcmp($user[
"clientip"],
"")!=0 && strcmp($user[
"clientip"],$_SERVER[
"REMOTE_ADDR"])!=0)
1452 $this->ctrl->redirectByClass(
"ilobjtestgui",
"backToRepository");
1464 and $this->
object->startingTimeReached()
1465 and !$this->
object->endingTimeReached();
1473 return $this->
object->hasNrOfTriesRestriction() && $this->
object->isNrOfTriesReached($this->object->getTestSession()->getPass());
1485 if (array_key_exists(
"pass",
$_GET) && (strlen(
$_GET[
"pass"]) > 0))
1487 $this->ctrl->saveParameter($this,
"pass");
1488 $this->ctrl->saveParameter($this,
"active_id");
1489 $this->outTestResults(
false,
$_GET[
"pass"]);
1493 $this->outTestResults(
false);
1505 $this->
object->getTestSession()->increasePass();
1506 $this->
object->getTestSession()->setLastSequence(0);
1507 $this->
object->getTestSession()->saveToDb();
1508 if (!$this->object->canViewResults())
1514 $this->ctrl->redirectByClass(
"ilTestEvaluationGUI",
"outUserResultsOverview");
1537 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_submit_answers_confirm.html",
"Modules/Test");
1538 $this->tpl->setCurrentBlock(
"adm_content");
1539 if ($this->object->isTestFinished($this->object->getTestSession()->getActiveId()))
1541 $this->tpl->setCurrentBlock(
"not_submit_allowed");
1542 $this->tpl->setVariable(
"TEXT_ALREADY_SUBMITTED", $this->lng->txt(
"tst_already_submitted"));
1543 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_show_answer_sheet"));
1546 $this->tpl->setCurrentBlock(
"submit_allowed");
1547 $this->tpl->setVariable(
"TEXT_CONFIRM_SUBMIT_RESULTS", $this->lng->txt(
"tst_confirm_submit_answers"));
1548 $this->tpl->setVariable(
"BTN_OK", $this->lng->txt(
"tst_submit_results"));
1550 $this->tpl->setVariable(
"BTN_BACK", $this->lng->txt(
"back"));
1551 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"finalSubmission"));
1552 $this->tpl->parseCurrentBlock();
1559 $starting_time = $this->
object->getStartingTimeOfUser($active_id);
1560 $processing_time = $this->
object->getProcessingTimeInSeconds($active_id);
1561 $processing_time_minutes = floor($processing_time / 60);
1562 $processing_time_seconds = $processing_time - $processing_time_minutes * 60;
1563 $str_processing_time =
"";
1564 if ($processing_time_minutes > 0)
1566 $str_processing_time = $processing_time_minutes .
" " . $this->lng->txt(
"minutes");
1568 if ($processing_time_seconds > 0)
1570 if (strlen($str_processing_time) > 0) $str_processing_time .=
" " . $this->lng->txt(
"and") .
" ";
1571 $str_processing_time .= $processing_time_seconds .
" " . $this->lng->txt(
"seconds");
1573 $time_left = $starting_time + $processing_time - mktime();
1574 $time_left_minutes = floor($time_left / 60);
1575 $time_left_seconds = $time_left - $time_left_minutes * 60;
1576 $str_time_left =
"";
1577 if ($time_left_minutes > 0)
1579 $str_time_left = $time_left_minutes .
" " . $this->lng->txt(
"minutes");
1581 if ($time_left < 300)
1583 if ($time_left_seconds > 0)
1585 if (strlen($str_time_left) > 0) $str_time_left .=
" " . $this->lng->txt(
"and") .
" ";
1586 $str_time_left .= $time_left_seconds .
" " . $this->lng->txt(
"seconds");
1589 $date = getdate($starting_time);
1601 $datenow = getdate();
1602 $this->tpl->setCurrentBlock(
"enableprocessingtime");
1603 $this->tpl->setVariable(
"USER_WORKING_TIME",
1605 $this->lng->txt(
"tst_time_already_spent"),
1606 $formattedStartingTime,
1607 $str_processing_time
1610 $this->tpl->setVariable(
"USER_REMAINING_TIME", sprintf($this->lng->txt(
"tst_time_already_spent_left"), $str_time_left));
1611 $this->tpl->parseCurrentBlock();
1612 $template =
new ilTemplate(
"tpl.workingtime.js.html", TRUE, TRUE, TRUE);
1613 $template->setVariable(
"STRING_MINUTE", $this->lng->txt(
"minute"));
1614 $template->setVariable(
"STRING_MINUTES", $this->lng->txt(
"minutes"));
1615 $template->setVariable(
"STRING_SECOND", $this->lng->txt(
"second"));
1616 $template->setVariable(
"STRING_SECONDS", $this->lng->txt(
"seconds"));
1617 $template->setVariable(
"STRING_TIMELEFT", $this->lng->txt(
"tst_time_already_spent_left"));
1618 $template->setVariable(
"AND", strtolower($this->lng->txt(
"and")));
1619 $template->setVariable(
"YEAR", $date[
"year"]);
1620 $template->setVariable(
"MONTH", $date[
"mon"]-1);
1621 $template->setVariable(
"DAY", $date[
"mday"]);
1622 $template->setVariable(
"HOUR", $date[
"hours"]);
1623 $template->setVariable(
"MINUTE", $date[
"minutes"]);
1624 $template->setVariable(
"SECOND", $date[
"seconds"]);
1625 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->object->getEndingTime(), $matches))
1627 $template->setVariable(
"ENDYEAR", $matches[1]);
1628 $template->setVariable(
"ENDMONTH", $matches[2]-1);
1629 $template->setVariable(
"ENDDAY", $matches[3]);
1630 $template->setVariable(
"ENDHOUR", $matches[4]);
1631 $template->setVariable(
"ENDMINUTE", $matches[5]);
1632 $template->setVariable(
"ENDSECOND", $matches[6]);
1634 $template->setVariable(
"YEARNOW", $datenow[
"year"]);
1635 $template->setVariable(
"MONTHNOW", $datenow[
"mon"]-1);
1636 $template->setVariable(
"DAYNOW", $datenow[
"mday"]);
1637 $template->setVariable(
"HOURNOW", $datenow[
"hours"]);
1638 $template->setVariable(
"MINUTENOW", $datenow[
"minutes"]);
1639 $template->setVariable(
"SECONDNOW", $datenow[
"seconds"]);
1640 $template->setVariable(
"PTIME_M", $processing_time_minutes);
1641 $template->setVariable(
"PTIME_S", $processing_time_seconds);
1643 $this->tpl->setCurrentBlock(
"HeadContent");
1644 $this->tpl->setVariable(
"CONTENT_BLOCK", $template->get());
1645 $this->tpl->parseCurrentBlock();
1653 if ($fullpage) $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_question_summary.html",
"Modules/Test");
1654 $active_id = $this->
object->getTestSession()->getActiveId();
1655 $result_array = & $this->
object->getTestSequence()->getSequenceSummary();
1656 $marked_questions = array();
1657 if ($this->object->getKioskMode() && $fullpage)
1662 $this->tpl->setCurrentBlock(
"kiosk_options");
1663 $this->tpl->setVariable(
"KIOSK_HEAD", $head);
1664 $this->tpl->parseCurrentBlock();
1667 if ($this->object->getShowMarker())
1669 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1673 foreach ($result_array as $key => $value)
1675 $this->ctrl->setParameter($this,
"sequence", $value[
"sequence"]);
1676 $href = $this->ctrl->getLinkTargetByClass(get_class($this),
"gotoQuestion");
1677 $this->tpl->setVariable(
"VALUE_QUESTION_TITLE",
"<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this),
"gotoQuestion").
"\">" . $this->
object->getQuestionTitle($value[
"title"]) .
"</a>");
1678 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1680 if ($this->object->getListOfQuestionsDescription())
1682 $description = $value[
"description"];
1685 if (!$this->object->getTitleOutput())
1687 $points = $value[
"points"].
" ".$this->lng->txt(
"points_short");
1690 if (count($marked_questions))
1692 if (array_key_exists($value[
"qid"], $marked_questions))
1694 $obj = $marked_questions[$value[
"qid"]];
1695 if ($obj[
"solved"] == 1)
1701 array_push(
$data, array(
1702 'order' => $value[
"nr"],
1704 'title' => $this->object->getQuestionTitle($value[
"title"]),
1705 'description' => $description,
1706 'worked_through' => ($value[
"worked_through"]) ?
true :
false,
1707 'postponed' => ($value[
"postponed"]) ? $this->lng->txt(
"postponed") :
'',
1709 'marked' => $marked,
1710 'sequence' => $value[
"sequence"]
1713 $this->ctrl->setParameter($this,
"sequence",
$_GET[
"sequence"]);
1716 include_once
"./Modules/Test/classes/tables/class.ilListOfQuestionsTableGUI.php";
1717 $table_gui =
new ilListOfQuestionsTableGUI($this,
'backFromSummary', !$this->object->getTitleOutput(), $this->
object->getShowMarker());
1719 $this->tpl->setVariable(
'TABLE_LIST_OF_QUESTIONS', $table_gui->getHTML());
1720 if ($this->object->getEnableProcessingTime()) $this->
outProcessingTime($active_id);
1724 $template =
new ilTemplate(
'tpl.il_as_tst_list_of_questions_short.html',
true,
true,
'Modules/Test');
1727 if (strlen($row[
'description']))
1729 $template->setCurrentBlock(
'description');
1730 $template->setVariable(
"DESCRIPTION", $row[
'description']);
1731 $template->parseCurrentBlock();
1733 $template->setCurrentBlock(
'item');
1735 $template->setVariable(
'CLASS', ($row[
'walked_through']) ? (
'answered'.$active) : (
'unanswered'.$active));
1737 $template->setVariable(
'SEQUENCE', $row[
'sequence']);
1738 $template->parseCurrentBlock();
1740 $template->setVariable(
'LIST_OF_QUESTIONS', $this->lng->txt(
'list_of_questions'));
1741 $this->tpl->setVariable(
'LIST_OF_QUESTIONS', $template->get());
1747 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_max_allowed_users_reached.html",
"Modules/Test");
1748 $this->tpl->setCurrentBlock(
"adm_content");
1749 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_MESSAGE", sprintf($this->lng->txt(
"tst_max_allowed_users_message"), $this->
object->getAllowedUsersTimeGap()));
1750 $this->tpl->setVariable(
"MAX_ALLOWED_USERS_HEADING", sprintf($this->lng->txt(
"tst_max_allowed_users_heading"), $this->
object->getAllowedUsersTimeGap()));
1751 $this->tpl->setVariable(
"BACK_TO_INTRODUCTION", $this->lng->txt(
"tst_results_back_introduction"));
1752 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1753 $this->tpl->parseCurrentBlock();
1759 if ($this->object->getShowSolutionAnwersBeforeFinish())
1761 $template =
new ilTemplate(
"tpl.il_as_tst_finish_navigation.html", TRUE, TRUE,
"Modules/Test");
1762 $template->setVariable(
"BUTTON_FINISH", $this->lng->txt(
"btn_next"));
1763 $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"btn_previous"));
1765 $template_top =
new ilTemplate(
"tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE,
"Modules/Test");
1766 $template_top->setCurrentBlock(
"button_print");
1767 $template_top->setVariable(
"BUTTON_PRINT", $this->lng->txt(
"print"));
1768 $template_top->parseCurrentBlock();
1769 $active_id = $this->
object->getTestSession()->getActiveId();
1770 return $this->
showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
1774 $this->ctrl->redirect($this,
'gotoQuestion');
1790 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_correct_solution.html",
"Modules/Test");
1792 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1793 $this->tpl->setCurrentBlock(
"ContentStyle");
1795 $this->tpl->parseCurrentBlock();
1797 $this->tpl->setCurrentBlock(
"SyntaxStyle");
1799 $this->tpl->parseCurrentBlock();
1802 if ($this->object->getShowSolutionAnswersOnly())
1807 $this->tpl->setCurrentBlock(
"adm_content");
1809 $this->tpl->setVariable(
"OUTPUT_SOLUTION", $solution);
1810 $this->tpl->setVariable(
"TEXT_BACK", $this->lng->txt(
"back"));
1811 $this->ctrl->saveParameter($this,
"pass");
1812 $this->ctrl->saveParameter($this,
"active_id");
1813 $this->tpl->setVariable(
"URL_BACK", $this->ctrl->getLinkTarget($this,
"outUserResultsOverview"));
1814 $this->tpl->parseCurrentBlock();
1830 $this->tpl->addBlockFile($this->
getContentBlockName(),
"adm_content",
"tpl.il_as_tst_finish_list_of_answers.html",
"Modules/Test");
1832 $result_array =& $this->
object->getTestResult($active_id,
$pass, FALSE);
1837 $exam_pdf = $this->
object->getExamPdf();
1852 $active = $this->
object->getTestSession();
1856 $ra_date = date(
"Y-m-d");
1857 $ra_test_filename = $ra_date.
"_".$active->test_id.
"_".$ilUser->login;
1858 $ra_test_file =
"resarchiver/output_html/".$ra_test_filename;
1859 $result_output_file = fopen ($ra_test_file.
".cache",
"w");
1862 foreach ($result_array as $question_data)
1864 $question = $question_data[
"qid"];
1865 if (is_numeric($question))
1867 $this->tpl->setCurrentBlock(
"printview_question");
1868 $question_gui = $this->
object->createQuestionGUI(
"", $question);
1870 $this->tpl->setVariable(
"COUNTER_QUESTION", $counter.
". ");
1873 $result_output_stream .=
"<br><hr><div class=\"questionMetadata\"><br>Titel: " . htmlentities($question_gui->object->getTitle(), ENT_QUOTES,
"UTF-8") .
"<br>Frage Nr. ".$counter.
"<br>QID " .($question) .
"</div>";
1876 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1877 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
1878 $template->setVariable(
"QUESTION_ID", $question);
1879 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitleOutput()== 2 ? $this->lng->txt(
"ass_question") :$question_gui->object->getTitle());
1881 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
1882 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
1883 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
1884 $this->tpl->setVariable(
"QUESTION_OUTPUT", $template->get());
1885 $this->tpl->parseCurrentBlock();
1891 $result_output_clean = $result_output;
1893 $result_output_clean = preg_replace(
'/xmlns:xhtml=\".*?\"/i',
'',$result_output_clean);
1898 $result_output_clean = preg_replace(
1899 '/([\xc0-\xdf].)/se',
1900 "'&#' . ((ord(substr('$1', 0, 1)) - 192) * 64 + (ord(substr('$1', 1, 1)) - 128)) . ';'",
1901 $result_output_clean
1903 $result_output_clean = preg_replace(
1904 '/([\xe0-\xef]..)/se',
1905 "'&#' . ((ord(substr('$1', 0, 1)) - 224) * 4096 + (ord(substr('$1', 1, 1)) - 128) * 64 + (ord(substr('$1', 2, 1)) - 128)) . ';'",
1906 $result_output_clean
1908 $result_output_stream .= iconv(
"UTF-8",
"ISO-8859-1", $result_output_clean);
1914 fwrite($result_output_file, $result_output_stream);
1915 fclose($result_output_file);
1941 if ($this->object->getShowSolutionAnswersOnly())
1945 if (strlen($top_data))
1947 $this->tpl->setCurrentBlock(
"top_data");
1948 $this->tpl->setVariable(
"TOP_DATA", $top_data);
1949 $this->tpl->parseCurrentBlock();
1952 if (strlen($bottom_data))
1954 $this->tpl->setCurrentBlock(
"bottom_data");
1955 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1956 $this->tpl->setVariable(
"BOTTOM_DATA", $bottom_data);
1957 $this->tpl->parseCurrentBlock();
1960 $this->tpl->setCurrentBlock(
"adm_content");
1961 $this->tpl->setVariable(
"TXT_ANSWER_SHEET", $this->lng->txt(
"tst_list_of_answers"));
1964 $this->tpl->setVariable(
"USER_DETAILS", $user_data);
1965 $this->tpl->setVariable(
"SIGNATURE", $signature);
1966 $this->tpl->setVariable(
"TITLE", $this->object->getTitle());
1967 $this->tpl->setVariable(
"TXT_TEST_PROLOG", $this->lng->txt(
"tst_your_answers"));
1968 $invited_user =& $this->
object->getInvitedUsers($ilUser->getId());
1969 $pagetitle = $this->
object->getTitle() .
" - " . $this->lng->txt(
"clientip") .
1970 ": " . $invited_user[$ilUser->getId()][
"clientip"] .
" - " .
1971 $this->lng->txt(
"matriculation") .
": " .
1972 $invited_user[$ilUser->getId()][
"matriculation"];
1973 $this->tpl->setVariable(
"PAGETITLE", $pagetitle);
1974 $this->tpl->parseCurrentBlock();
1985 if ($this->object->getKioskMode())
1987 $this->tpl->setBodyClass(
"kiosk");
1988 $this->tpl->setAddFooter(FALSE);
1993 return "ADM_CONTENT";
1999 $this->ctrl->redirectByClass(
"iltestevaluationgui",
"outUserResultsOverview");
2004 $this->ctrl->redirectByClass(
"iltestevaluationgui",
"outUserListOfAnswerPasses");