21 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
22 include_once
'Modules/Test/classes/class.ilTestService.php';
139 $ilCtrl = $DIC[
'ilCtrl'];
141 $tree = $DIC[
'tree'];
142 $ilDB = $DIC[
'ilDB'];
143 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
144 $ilTabs = $DIC[
'ilTabs'];
145 $ilObjDataCache = $DIC[
'ilObjDataCache'];
147 $lng->loadLanguageModule(
'cert');
153 $this->ctrl = &$ilCtrl;
154 $this->tabs = $ilTabs;
155 $this->objCache = $ilObjDataCache;
157 $this->
object = &$a_object;
158 $this->tree = &
$tree;
159 $this->ref_id = $a_object->ref_id;
163 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
166 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
168 $this->objectiveOrientedContainer = null;
197 $considerHiddenQuestions =
false;
199 require_once
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
202 $considerHiddenQuestions =
true;
205 $scoredPass = $this->
object->_getResultPass($testSession->
getActiveId());
207 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
212 foreach ($passes as
$pass) {
215 $considerOptionalQuestions =
true;
218 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($testSession->
getActiveId(),
$pass);
220 $testSequence->loadFromDb();
221 $testSequence->loadQuestions();
223 if ($this->object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed()) {
224 $considerOptionalQuestions =
false;
227 $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
228 $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
231 $objectivesList->loadObjectivesTitles();
233 $row[
'objectives'] = $objectivesList->getUniqueObjectivesStringForQuestions($testSequence->getUserSequenceQuestions());
237 $result_array = $this->
object->getTestResult($testSession->
getActiveId(),
$pass,
false, $considerHiddenQuestions, $considerOptionalQuestions);
239 foreach ($result_array as $resultStructKEY => $question) {
240 if ($resultStructKEY ===
'test' || $resultStructKEY ===
'pass') {
244 $requestData = $questionHintRequestRegister->getRequestByTestPassIndexAndQuestionId($pass, $question[
'qid']);
247 $result_array[
'pass'][
'total_requested_hints'] += $requestData->getRequestsCount();
249 $result_array[$resultStructKEY][
'requested_hints'] = $requestData->getRequestsCount();
250 $result_array[$resultStructKEY][
'hint_points'] = $requestData->getRequestsPoints();
254 if (!$result_array[
'pass'][
'total_max_points']) {
257 $percentage = ($result_array[
'pass'][
'total_reached_points'] / $result_array[
'pass'][
'total_max_points']) * 100;
259 $total_max = $result_array[
'pass'][
'total_max_points'];
260 $total_reached = $result_array[
'pass'][
'total_reached_points'];
261 $total_requested_hints = $result_array[
'pass'][
'total_requested_hints'];
265 $row[
'scored'] = ($pass == $scoredPass);
268 $row[
'pass'] =
$pass;
271 $row[
'num_workedthrough_questions'] = $result_array[
'pass'][
'num_workedthrough'];
272 $row[
'num_questions_total'] = $result_array[
'pass'][
'num_questions_total'];
274 if ($this->object->isOfferingQuestionHintsEnabled()) {
275 $row[
'hints'] = $total_requested_hints;
278 $row[
'reached_points'] = $total_reached;
279 $row[
'max_points'] = $total_max;
280 $row[
'percentage'] = $percentage;
310 $cmd = $this->ctrl->getCmd();
311 $next_class = $this->ctrl->getNextClass($this);
314 switch ($next_class) {
316 $ret = &$this->$cmd();
337 if (!isset(
$_GET[
'pdf'])) {
341 if (!(
bool)
$_GET[
'pdf']) {
353 require_once
'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
357 $table->setPdfPresentationEnabled(
361 $table->setObjectiveOrientedPresentationEnabled(
380 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html",
true,
true,
"Modules/Test");
384 foreach ($result_array as $question_data) {
385 if (($question_data[
"workedthrough"] == 1) || ($only_answered_questions ==
false)) {
386 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html",
true,
true,
"Modules/TestQuestionPool");
387 $question_id = $question_data[
"qid"];
388 if (is_numeric($question_id)) {
389 $maintemplate->setCurrentBlock(
"printview_question");
390 $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
392 if (is_object($question_gui)) {
398 $template->setCurrentBlock(
'block_id');
399 $template->setVariable(
'BLOCK_ID',
"detailed_answer_block_act_{$active_id}_qst_{$question_id}");
400 $template->parseCurrentBlock();
402 $template->setCurrentBlock(
'back_anchor');
403 $template->setVariable(
'HREF_BACK_ANCHOR',
"#pass_details_tbl_row_act_{$active_id}_qst_{$question_id}");
404 $template->setVariable(
'TXT_BACK_ANCHOR', $this->lng->txt(
'tst_back_to_question_list'));
405 $template->parseCurrentBlock();
408 if ($show_reached_points) {
409 $template->setCurrentBlock(
"result_points");
410 $template->setVariable(
"RESULT_POINTS", $this->lng->txt(
"tst_reached_points") .
": " . $question_gui->object->getReachedPoints($active_id, $pass) .
" " . $this->lng->txt(
"of") .
" " . $question_gui->object->getMaximumPoints());
411 $template->parseCurrentBlock();
413 $template->setVariable(
"COUNTER_QUESTION", $counter .
". ");
414 $template->setVariable(
"TXT_QUESTION_ID", $this->lng->txt(
'question_id_short'));
415 $template->setVariable(
"QUESTION_ID", $question_gui->object->getId());
416 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
418 if ($objectivesList !== null) {
419 $objectives = $this->lng->txt(
'tst_res_lo_objectives_header') .
': ';
420 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
421 $template->setVariable(
"OBJECTIVES", $objectives);
424 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ?
true :
false;
430 if ($show_best_solution) {
431 $compare_template =
new ilTemplate(
'tpl.il_as_tst_answers_compare.html',
true,
true,
'Modules/Test');
432 $test_session = $this->testSessionFactory->getSession($active_id);
433 if ($pass <= $test_session->getLastFinishedPass()) {
434 $compare_template->setVariable(
"HEADER_PARTICIPANT", $this->lng->txt(
'tst_header_participant'));
436 $compare_template->setVariable(
"HEADER_PARTICIPANT", $this->lng->txt(
'tst_header_participant_no_answer'));
439 $compare_template->setVariable(
"HEADER_SOLUTION", $this->lng->txt(
'tst_header_solution'));
440 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output,
false, $show_question_only, $show_feedback);
441 $best_output = $question_gui->getSolutionOutput($active_id, $pass,
false,
false, $show_question_only,
false,
true);
443 $compare_template->setVariable(
'PARTICIPANT', $result_output);
444 $compare_template->setVariable(
'SOLUTION', $best_output);
445 if ($question_gui->supportsIntermediateSolutionOutput() && $question_gui->hasIntermediateSolution($active_id, $pass)) {
446 $question_gui->setUseIntermediateSolution(
true);
447 $intermediate_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output,
false,
true, $show_feedback);
448 $question_gui->setUseIntermediateSolution(
false);
449 $compare_template->setVariable(
'TXT_INTERMEDIATE', $this->lng->txt(
'autosavecontent'));
450 $compare_template->setVariable(
'INTERMEDIATE', $intermediate_output);
452 $template->setVariable(
'SOLUTION_OUTPUT', $compare_template->get());
454 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output,
false, $show_question_only, $show_feedback);
455 if ($question_gui->supportsIntermediateSolutionOutput() && $question_gui->hasIntermediateSolution($active_id, $pass)) {
456 $question_gui->setUseIntermediateSolution(
true);
457 $intermediate_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output,
false,
true, $show_feedback);
458 $question_gui->setUseIntermediateSolution(
false);
459 $template->setVariable(
'TXT_INTERMEDIATE', $this->lng->txt(
'autosavecontent'));
460 $template->setVariable(
'INTERMEDIATE', $intermediate_output);
462 $template->setVariable(
'SOLUTION_OUTPUT', $result_output);
465 $maintemplate->setCurrentBlock(
"printview_question");
466 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
467 $maintemplate->parseCurrentBlock();
474 if ($testResultHeaderLabelBuilder !== null) {
475 if (
$pass !== null) {
476 $headerText = $testResultHeaderLabelBuilder->getListOfAnswersHeaderLabel(
$pass + 1);
478 $headerText = $testResultHeaderLabelBuilder->getVirtualListOfAnswersHeaderLabel();
484 $maintemplate->setVariable(
"RESULTS_OVERVIEW", $headerText);
485 return $maintemplate->get();
493 $shuffler->setSeed($fixed_seed);
504 $fixed_seed = $basic_seed;
506 if (strlen($fixed_seed) < self::FIXED_SHUFFLER_SEED_MIN_LENGTH) {
508 10 * (self::FIXED_SHUFFLER_SEED_MIN_LENGTH - strlen($fixed_seed))
529 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
531 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html",
true,
true,
"Modules/Test");
533 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
538 foreach ($result_array as $question_data) {
539 $question = $question_data[
"qid"];
540 if (is_numeric($question)) {
541 $question_gui = $this->
object->createQuestionGUI(
"", $question);
542 if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
543 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html",
true,
true,
"Modules/TestQuestionPool");
544 $scoretemplate =
new ilTemplate(
"tpl.il_as_tst_manual_scoring_points.html",
true,
true,
"Modules/Test");
545 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question"); 546 $template->setVariable(
"COUNTER_QUESTION", $counter .
". ");
547 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
548 $points = $question_gui->object->getMaximumPoints();
550 $template->setVariable(
"QUESTION_POINTS", $points .
" " . $this->lng->txt(
"point"));
552 $template->setVariable(
"QUESTION_POINTS", $points .
" " . $this->lng->txt(
"points"));
555 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ?
true :
false;
556 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions,
false, $show_question_only, $this->object->getShowSolutionFeedback(),
false,
true);
558 $solout = $question_gui->object->getSuggestedSolutionOutput();
559 if (strlen($solout)) {
560 $scoretemplate->setCurrentBlock(
"suggested_solution");
561 $scoretemplate->setVariable(
"TEXT_SUGGESTED_SOLUTION", $this->lng->txt(
"solution_hint"));
562 $scoretemplate->setVariable(
"VALUE_SUGGESTED_SOLUTION", $solout);
563 $scoretemplate->parseCurrentBlock();
566 $scoretemplate->setCurrentBlock(
"feedback");
567 $scoretemplate->setVariable(
"FEEDBACK_NAME_INPUT", $question);
568 $feedback = $this->
object->getSingleManualFeedback($active_id, $question,
$pass)[
'feedback'];
569 $scoretemplate->setVariable(
"VALUE_FEEDBACK",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback,
true)));
570 $scoretemplate->setVariable(
"TEXT_MANUAL_FEEDBACK", $this->lng->txt(
"set_manual_feedback"));
571 $scoretemplate->parseCurrentBlock();
573 $scoretemplate->setVariable(
"NAME_INPUT", $question);
574 $this->ctrl->setParameter($this,
"active_id", $active_id);
575 $this->ctrl->setParameter($this,
"pass",
$pass);
576 $scoretemplate->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"manscoring"));
577 $scoretemplate->setVariable(
"LABEL_INPUT", $this->lng->txt(
"tst_change_points_for_question"));
579 $scoretemplate->setVariable(
"VALUE_SAVE", $this->lng->txt(
"save"));
581 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
582 $maintemplate->setCurrentBlock(
"printview_question");
583 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
584 $maintemplate->setVariable(
"QUESTION_SCORING", $scoretemplate->get());
585 $maintemplate->parseCurrentBlock();
592 $maintemplate->setVariable(
"NO_QUESTIONS_FOUND", $this->lng->txt(
"manscoring_questions_not_found"));
594 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"manscoring_results_pass"),
$pass + 1));
596 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
599 return $maintemplate->get();
604 $this->ctrl->setParameter($targetGUI,
'active_id', $active_id);
605 $this->ctrl->setParameter($targetGUI,
'pass',
$pass);
610 $tableGUI->setAnswerListAnchorEnabled($questionAnchorNav);
613 $tableGUI->setSingleAnswerScreenCmd($questionDetailsCMD);
614 $tableGUI->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
616 if ($objectivesList !== null) {
617 $tableGUI->setQuestionRelatedObjectivesList($objectivesList);
618 $tableGUI->setObjectiveOrientedPresentationEnabled(
true);
621 $tableGUI->setMultipleObjectivesInvolved($multipleObjectivesInvolved);
623 $tableGUI->setActiveId($active_id);
624 $tableGUI->setShowSuggestedSolution(
false);
626 $usersQuestionSolutions = array();
628 foreach ($result_array as $key => $val) {
629 if ($key ===
'test' || $key ===
'pass') {
633 if ($this->object->getShowSolutionSuggested() && strlen($val[
'solution'])) {
634 $tableGUI->setShowSuggestedSolution(
true);
637 if (isset($val[
'pass'])) {
638 $tableGUI->setPassColumnEnabled(
true);
641 $usersQuestionSolutions[$key] = $val;
644 $tableGUI->initColumns()->initFilter();
646 $tableGUI->setFilterCommand($targetCMD .
'SetTableFilter');
647 $tableGUI->setResetCommand($targetCMD .
'ResetTableFilter');
649 $tableGUI->setData($usersQuestionSolutions);
662 if ($this->object->getShowSolutionSignature() && !$this->
object->getAnonymity()) {
663 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata_signature.html",
true,
true,
"Modules/Test");
664 $template->setVariable(
"TXT_DATE", $this->lng->txt(
"date"));
669 $template->setVariable(
"TXT_SIGNATURE", $this->lng->txt(
"tst_signature"));
671 return $template->get();
688 if (!is_object($testSession)) {
689 throw new TestException();
691 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata.html",
true,
true,
"Modules/Test");
692 include_once
'./Services/User/classes/class.ilObjUser.php';
693 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
698 $user->setLastname($this->lng->txt(
"deleted_user"));
700 $t = $testSession->getSubmittedTimestamp();
702 $t = $this->
object->_getLastAccess($testSession->getActiveId());
706 $uname = $this->
object->userLookupFullName($user_id, $overwrite_anonymity);
707 $template->setCurrentBlock(
"name");
708 $template->setVariable(
'TXT_USR_NAME', $this->lng->txt(
"name"));
709 $template->setVariable(
'VALUE_USR_NAME', $uname);
710 $template->parseCurrentBlock();
714 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() ==
false) || ($overwrite_anonymity))) {
715 $template->setCurrentBlock(
"matriculation");
716 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
717 $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
718 $template->parseCurrentBlock();
719 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " . $user->getMatriculation();
722 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
723 if (strlen($invited_user[
"clientip"])) {
724 $template->setCurrentBlock(
"client_ip");
725 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
726 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
727 $template->parseCurrentBlock();
728 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user[
"clientip"];
731 $template->setVariable(
"TXT_TEST_TITLE", $this->lng->txt(
"title"));
732 $template->setVariable(
"VALUE_TEST_TITLE", $this->object->getTitle());
735 $pagetitle = $this->
object->getTitle() . $title_matric . $title_client;
736 $this->tpl->setHeaderPageTitle($pagetitle);
738 return $template->get();
755 $test_id = $this->
object->getTestId();
756 $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
762 $template =
new ilTemplate(
"tpl.il_as_tst_correct_solution_output.html",
true,
true,
"Modules/Test");
763 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ?
true :
false;
764 $result_output = $question_gui->getSolutionOutput($active_id,
$pass,
true,
false, $show_question_only, $this->object->getShowSolutionFeedback(),
false,
false,
true);
765 $best_output = $question_gui->getSolutionOutput($active_id,
$pass,
false,
false, $show_question_only,
false,
true,
false,
false);
766 if ($this->object->getShowSolutionFeedback() &&
$_GET[
'cmd'] !=
'outCorrectSolution') {
767 $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput(
768 $question_gui->object->fetchIndexedValuesFromValuePairs(
769 $question_gui->object->getSolutionValues($active_id,
$pass)
772 if (strlen($specificAnswerFeedback)) {
773 $template->setCurrentBlock(
"outline_specific_feedback");
774 $template->setVariable(
"OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
775 $template->parseCurrentBlock();
778 if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output)) {
779 $template->setCurrentBlock(
"best_solution");
780 $template->setVariable(
"TEXT_BEST_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
781 $template->setVariable(
"BEST_OUTPUT", $best_output);
782 $template->parseCurrentBlock();
784 $template->setVariable(
"TEXT_YOUR_SOLUTION", $this->lng->txt(
"tst_your_answer_was"));
785 $template->setVariable(
"TEXT_SOLUTION_OUTPUT", $this->lng->txt(
"tst_your_answer_was"));
787 $maxpoints = $question_gui->object->getMaximumPoints();
788 if ($maxpoints == 1) {
789 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"point") .
")");
791 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"points") .
")");
793 if ($objectivesList !== null) {
794 $objectives = $this->lng->txt(
'tst_res_lo_objectives_header') .
': ';
795 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
796 $template->setVariable(
'OBJECTIVES', $objectives);
798 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
799 $template->setVariable(
"RECEIVED_POINTS", sprintf($this->lng->txt(
"you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id,
$pass), $maxpoints));
800 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
801 $template->setVariable(
"BACKLINK_TEXT",
"<< " . $this->lng->txt(
"back"));
802 return $template->get();
817 public function getResultsOfUserOutput($testSession, $active_id,
$pass, $targetGUI, $show_pass_details =
true, $show_answers =
true, $show_question_only =
false, $show_reached_points =
false)
820 $ilObjDataCache = $DIC[
'ilObjDataCache'];
822 include_once(
"./Services/UICore/classes/class.ilTemplate.php");
823 $template =
new ilTemplate(
"tpl.il_as_tst_results_participant.html",
true,
true,
"Modules/Test");
826 $user_id = $this->participantData->getUserIdByActiveId($active_id);
827 $uname = $this->participantData->getConcatedFullnameByActiveId($active_id,
false);
829 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
830 $uname = $this->
object->userLookupFullName($user_id,
true);
833 if ($this->object->getAnonymity()) {
834 $uname = $this->lng->txt(
'anonymous');
837 if (((array_key_exists(
"pass",
$_GET)) && (strlen(
$_GET[
"pass"]) > 0)) || (!is_null(
$pass))) {
838 if (is_null(
$pass)) {
843 if (!is_null(
$pass)) {
844 require_once
'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
846 $objectivesList = null;
849 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id,
$pass);
850 $testSequence->loadFromDb();
851 $testSequence->loadQuestions();
853 require_once
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
857 $objectivesList->loadObjectivesTitles();
859 $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
860 $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
861 $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
862 $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
863 $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
866 $result_array = $this->
object->getTestResult(
873 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
874 $showAllAnswers =
true;
875 if ($this->object->isExecutable($testSession, $user_id)) {
876 $showAllAnswers =
false;
883 $_SESSION[
'tst_results_show_best_solutions'],
886 $show_reached_points,
889 $testResultHeaderLabelBuilder
891 $template->setVariable(
"LIST_OF_ANSWERS", $list_of_answers);
894 if ($show_pass_details) {
896 $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel(
$pass + 1));
897 $template->setVariable(
"PASS_DETAILS", $overviewTableGUI->getHTML());
901 $template->setVariable(
"SIGNATURE", $signature);
903 if ($this->object->isShowExamIdInTestResultsEnabled()) {
904 $template->setCurrentBlock(
'exam_id_footer');
906 $testSession->getActiveId(),
909 $template->setVariable(
'EXAM_ID_TXT', $this->lng->txt(
'exam_id'));
910 $template->parseCurrentBlock();
914 $template->setCurrentBlock(
'participant_back_anchor');
915 $template->setVariable(
"HREF_PARTICIPANT_BACK_ANCHOR",
"#tst_results_toolbar");
916 $template->setVariable(
"TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt(
'tst_back_to_top'));
917 $template->parseCurrentBlock();
919 $template->setCurrentBlock(
'participant_block_id');
920 $template->setVariable(
"PARTICIPANT_BLOCK_ID",
"participant_active_{$active_id}");
921 $template->parseCurrentBlock();
925 $gradingMessageBuilder->buildList();
927 $template->setCurrentBlock(
'grading_message');
928 $template->setVariable(
'GRADING_MESSAGE', $gradingMessageBuilder->getList());
929 $template->parseCurrentBlock();
934 $template->setVariable(
"TEXT_HEADING", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
935 $template->setVariable(
"USER_DATA", $user_data);
940 return $template->get();
952 $template =
new ilTemplate(
"tpl.il_as_tst_results_head_user_pass.html",
true,
true,
"Modules/Test");
953 include_once
'./Services/User/classes/class.ilObjUser.php';
954 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
959 $user->setLastname($this->lng->txt(
"deleted_user"));
962 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() ==
false))) {
963 $template->setCurrentBlock(
"user_matric");
964 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
965 $template->parseCurrentBlock();
966 $template->setCurrentBlock(
"user_matric_value");
967 $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
968 $template->parseCurrentBlock();
969 $template->touchBlock(
"user_matric_separator");
970 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " . $user->getMatriculation();
973 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
974 if (strlen($invited_user[
"clientip"])) {
975 $template->setCurrentBlock(
"user_clientip");
976 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
977 $template->parseCurrentBlock();
978 $template->setCurrentBlock(
"user_clientip_value");
979 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
980 $template->parseCurrentBlock();
981 $template->touchBlock(
"user_clientip_separator");
982 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user[
"clientip"];
985 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
986 $uname = $this->
object->userLookupFullName($user_id,
false);
987 $template->setVariable(
"VALUE_USR_NAME", $uname);
988 $template->setVariable(
"TXT_PASS", $this->lng->txt(
"scored_pass"));
989 $template->setVariable(
"VALUE_PASS",
$pass);
990 return $template->get();
1006 $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
1008 $this->
object->setAccessFilteredParticipantList(
1009 $this->object->buildStatisticsAccessFilteredParticipantList()
1012 $foundusers = $this->
object->getParticipantsForTestAndQuestion($test_id, $question_id);
1014 foreach ($foundusers as $active_id => $passes) {
1015 $resultpass = $this->
object->_getResultPass($active_id);
1016 for (
$i = 0;
$i < count($passes);
$i++) {
1017 if (($resultpass !== null) && ($resultpass == $passes[
$i][
"pass"])) {
1019 $output .=
"<br /><br /><br />";
1023 $question_gui = $this->
object->createQuestionGUI(
"", $passes[
$i][
"qid"]);
1026 $output .= $question_gui->getSolutionOutput(
1029 $graphicalOutput =
false,
1030 $result_output =
false,
1031 $show_question_only =
false,
1032 $show_feedback =
false 1038 require_once
'./Modules/Test/classes/class.ilTestPDFGenerator.php';
1047 if (!isset($targetGUI->object) && method_exists($targetGUI,
'getTestObj')) {
1048 $targetGUI->object = $targetGUI->getTestObj();
1051 require_once
'Modules/Test/classes/tables/class.ilTestPassDetailsOverviewTableGUI.php';
1063 if ($this->object->isShowGradingStatusEnabled()) {
1067 if ($this->object->isShowGradingMarkEnabled()) {
1071 if ($this->object->areObligationsEnabled()) {
1084 require_once
'Modules/Test/classes/class.ilTestGradingMessageBuilder.php';
1087 $gradingMessageBuilder->setActiveId($activeId);
1089 return $gradingMessageBuilder;
1094 require_once
'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
1099 return $questionRelatedObjectivesList;
1105 $ilDB = $DIC[
'ilDB'];
1106 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
1109 $table_gui->initFilter();
1111 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1114 $questionList->setParentObjIdsFilter(array($this->object->getId()));
1117 foreach ($table_gui->getFilterItems() as $item) {
1118 if (substr($item->getPostVar(), 0, strlen(
'tax_')) ==
'tax_') {
1119 $v = $item->getValue();
1121 if (is_array($v) && count($v) && !(
int) $v[0]) {
1125 $taxId = substr($item->getPostVar(), strlen(
'tax_'));
1126 $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->
object->getId(),
'tst');
1127 } elseif ($item->getValue() !==
false) {
1128 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1132 $questionList->load();
1134 $filteredTestResult = array();
1136 $resultData = $this->
object->getTestResult($active_id,
$pass,
false, $considerHiddenQuestions, $considerOptionalQuestions);
1138 foreach ($resultData as $resultItemKey => $resultItemValue) {
1139 if ($resultItemKey ===
'test' || $resultItemKey ===
'pass') {
1143 if (!$questionList->isInList($resultItemValue[
'qid'])) {
1147 $filteredTestResult[] = $resultItemValue;
1150 return $filteredTestResult;
1162 $this->object->getTitleFilenameCompliant(),
1166 $this->tpl->setContent($content);
1175 require_once
'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
1193 if (!$this->object->getShowSolutionDetails()) {
1195 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
1198 $testSession = $this->testSessionFactory->getSession();
1199 $activeId = $testSession->getActiveId();
1201 if (!($activeId > 0)) {
1202 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
1205 $this->ctrl->saveParameter($this,
"pass");
1208 $questionId = (int)
$_GET[
'evaluation'];
1210 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId,
$pass);
1211 $testSequence->loadFromDb();
1212 $testSequence->loadQuestions();
1214 if (!$testSequence->questionExists($questionId)) {
1219 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId,
$pass);
1220 $testSequence->loadFromDb();
1221 $testSequence->loadQuestions();
1223 require_once
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
1226 $objectivesList->loadObjectivesTitles();
1228 $objectivesList = null;
1232 $ilTabs = $DIC[
'ilTabs'];
1235 $ilTabs->setBackTarget(
1236 $this->lng->txt(
"tst_back_to_virtual_pass"),
1237 $this->ctrl->getLinkTarget($this,
'showVirtualPass')
1240 $ilTabs->setBackTarget(
1241 $this->lng->txt(
"tst_back_to_pass_details"),
1242 $this->ctrl->getLinkTarget($this,
'outUserPassDetails')
1245 $ilTabs->clearSubTabs();
1247 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1248 $this->tpl->setCurrentBlock(
"ContentStyle");
1250 $this->tpl->parseCurrentBlock();
1252 $this->tpl->setCurrentBlock(
"SyntaxStyle");
1254 $this->tpl->parseCurrentBlock();
1257 if ($this->object->getShowSolutionAnswersOnly()) {
1263 $this->tpl->setContent($solution);
1276 $tpl->setVariable(
"PASS_FINISH_DATE_LABEL", $this->lng->txt(
'tst_pass_finished_on'));
1277 $tpl->setVariable(
"PASS_FINISH_DATE_VALUE", $passFinishDate);
1287 if ($this->object->isShowExamIdInTestResultsEnabled()) {
1288 $tpl->
setVariable(
"EXAM_ID_TXT", $this->lng->txt(
'exam_id'));
1300 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) :
"nr";
1301 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) :
"asc";
1302 if (strcmp($sortorder,
"asc")) {
1309 if (
$a[$sort] ==
$b[$sort]) {
1312 return (
$a[$sort] <
$b[$sort]) ? $smaller : $greater;
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static _lookupLogin($a_user_id)
lookup login
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, $overwrite_anonymity=false)
Returns the user data for a test results output.
setContextResultPresentation($contextResultPresentation)
isContextResultPresentation()
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
getObjectiveOrientedContainer()
const PDF_USER_RESULT
PDF Purposes.
buildFixedShufflerSeedFromBasicSeed(string $basic_seed)
static setUseRelativeDates($a_status)
set use relative dates
getResultsSignature()
Returns HTML code for a signature field.
const QUESTION_INSTANCE_TYPE_DUPLICATES
static accessViolationRedirect()
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
static useRelativeDates()
check if relative dates are used
isGradingMessageRequired()
buildUserTestResultsToolbarGUI()
getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList=null)
Returns an output of the solution to an answer compared to the correct solution.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
const FIXED_SHUFFLER_SEED_MIN_LENGTH
static getInstance(ilTestSession $a_test_session)
getResultsHeadUserAndPass($active_id, $pass)
Returns the user and pass data for a test results output.
setVariable($variable, $value='')
Sets a variable value.
getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
buildPassOverviewTableGUI($targetGUI)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
populateContent($content)
getCommand($cmd)
Retrieves the ilCtrl command.
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
setParticipantData($participantData)
outCorrectSolution()
Creates an output of the solution of an answer compared to the correct solution.
redirection script todo: (a better solution should control the processing via a xml file) ...
Class ilTestPassOverviewTableGUI.
static initDomEvent(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent.
static getSyntaxStylePath()
get syntax style path
static lookupLastTestPassAccess($activeId, $passIndex)
getResultsOfUserOutput($testSession, $active_id, $pass, $targetGUI, $show_pass_details=true, $show_answers=true, $show_question_only=false, $show_reached_points=false)
Output of the pass overview for a test called by a test participant.
$contextResultPresentation
$objectiveOrientedContainer
buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)
static _getManualScoring()
Retrieve the manual scoring settings.
getGradingMessageBuilder($activeId)
__construct(ilObjTest $a_object)
The constructor takes the test object reference as parameter.
populatePassFinishDate($tpl, $passFinishDate)
populateExamId(ilTemplate $tpl, int $activeId, int $pass)
executeCommand()
execute command
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
const RENDER_PURPOSE_PRINT_PDF
setObjectiveOrientedContainer(ilTestObjectiveOrientedContainer $objectiveOrientedContainer)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
static _getReachedPoints($active_id, $question_id, $pass=null)
Returns the points, a learner has reached answering the question.
const PDF_OUTPUT_DOWNLOAD
getPassListOfAnswers(&$result_array, $active_id, $pass, $show_solutions=false, $only_answered_questions=false, $show_question_only=false, $show_reached_points=false, $anchorNav=false, ilTestQuestionRelatedObjectivesList $objectivesList=null, ilTestResultHeaderLabelBuilder $testResultHeaderLabelBuilder=null)
Returns the list of answers of a users test pass.
getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions=false)
Returns the list of answers of a users test pass and offers a scoring option.
buildQuestionAnswerShuffler(string $question_id, string $active_id, string $active_pass)
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
getPassOverviewTableData(ilTestSession $testSession, $passes, $withResults)
getQuestionResultForTestUsers($question_id, $test_id)
Creates a HTML representation for the results of a given question in a test.
static lookupExamId($active_id, $pass)