ILIAS  release_8 Revision v8.24
class.ilTestServiceGUI.php
Go to the documentation of this file.
1<?php
2
19use ILIAS\Refinery\Factory as Refinery;
22use ILIAS\Refinery\Random\Group as RandomGroup;
23
24include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
25
41{
42 protected \ILIAS\Test\InternalRequestService $testrequest;
46 public $object = null;
47
51 public $service = null;
52
56 protected $db;
57
58 protected Refinery $refinery;
59
60 public $lng;
62 public $tpl;
63
67 public $ctrl;
68
72 protected $tabs;
73
77 protected $objCache;
78
79 public $ilias;
80 public $tree;
81 public $ref_id;
82
88 protected $testSessionFactory = null;
89
95 protected $testSequenceFactory = null;
96
101
102 private RandomGroup $randomGroup;
103
108
110
114 public function isContextResultPresentation(): bool
115 {
117 }
118
123 {
124 $this->contextResultPresentation = $contextResultPresentation;
125 }
126
133 public function __construct(ilObjTest $a_object)
134 {
135 global $DIC;
136 $lng = $DIC['lng'];
137 $refinery = $DIC['refinery'];
138 $tpl = $DIC['tpl'];
139 $ilCtrl = $DIC['ilCtrl'];
140 $ilias = $DIC['ilias'];
141 $tree = $DIC['tree'];
142 $ilDB = $DIC['ilDB'];
143 $component_repository = $DIC['component.repository'];
144 $ilTabs = $DIC['ilTabs'];
145 $ilObjDataCache = $DIC['ilObjDataCache'];
146
147 $lng->loadLanguageModule('cert');
148
149 $this->db = $ilDB;
150 $this->lng = &$lng;
151 $this->refinery = &$refinery;
152 $this->tpl = &$tpl;
153 $this->ctrl = &$ilCtrl;
154 $this->tabs = $ilTabs;
155 $this->objCache = $ilObjDataCache;
156 $this->ilias = &$ilias;
157 $this->object = &$a_object;
158 $this->tree = &$tree;
159 $this->ref_id = $a_object->getRefId();
160
161 $this->service = new ilTestService($a_object);
162 $this->testrequest = $DIC->test()->internal()->request();
163 $this->testSessionFactory = new ilTestSessionFactory($this->object);
164
165 $this->testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $refinery, $component_repository, $this->object);
166 $this->randomGroup = $DIC->refinery()->random();
167 $this->objectiveOrientedContainer = null;
168 }
169
174 {
175 $this->participantData = $participantData;
176 }
177
182 {
184 }
185
194 public function getPassOverviewTableData(ilTestSession $testSession, $passes, $withResults): array
195 {
196 $data = array();
197
198 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
199 $considerHiddenQuestions = false;
200
201 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
202 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
203 } else {
204 $considerHiddenQuestions = true;
205 }
206
207 $scoredPass = $this->object->_getResultPass($testSession->getActiveId());
208
209 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
211 $testSession->getActiveId()
212 );
213
214 foreach ($passes as $pass) {
215 $row = [
216 'scored' => false,
217 'pass' => $pass,
218 'date' => ilObjTest::lookupLastTestPassAccess($testSession->getActiveId(), $pass)
219 ];
220 $considerOptionalQuestions = true;
221
222 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
223 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($testSession->getActiveId(), $pass);
224 $testSequence->loadFromDb();
225 $testSequence->loadQuestions();
226
227 if ($this->object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed()) {
228 $considerOptionalQuestions = false;
229 }
230
231 $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
232 $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
233
234 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
235 $objectivesList->loadObjectivesTitles();
236
237 $row['objectives'] = $objectivesList->getUniqueObjectivesStringForQuestions($testSequence->getUserSequenceQuestions());
238 }
239
240 if ($withResults) {
241 $result_array = $this->object->getTestResult($testSession->getActiveId(), $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
242
243 foreach ($result_array as $resultStructKEY => $question) {
244 if ($resultStructKEY === 'test' || $resultStructKEY === 'pass') {
245 continue;
246 }
247
248 $requestData = $questionHintRequestRegister->getRequestByTestPassIndexAndQuestionId($pass, $question['qid']);
249
250 if ($requestData instanceof ilAssQuestionHintRequestStatisticData && $result_array[$resultStructKEY]['requested_hints'] === null) {
251 $result_array['pass']['total_requested_hints'] += $requestData->getRequestsCount();
252
253 $result_array[$resultStructKEY]['requested_hints'] = $requestData->getRequestsCount();
254 $result_array[$resultStructKEY]['hint_points'] = $requestData->getRequestsPoints();
255 }
256 }
257
258 if (!$result_array['pass']['total_max_points']) {
259 $row['percentage'] = 0;
260 } else {
261 $row['percentage'] = ($result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points']) * 100;
262 }
263
264 $row['max_points'] = $result_array['pass']['total_max_points'];
265 $row['reached_points'] = $result_array['pass']['total_reached_points'];
266 $row['scored'] = ($pass == $scoredPass);
267 $row['num_workedthrough_questions'] = $result_array['pass']['num_workedthrough'];
268 $row['num_questions_total'] = $result_array['pass']['num_questions_total'];
269
270 if ($this->object->isOfferingQuestionHintsEnabled()) {
271 $row['hints'] = $result_array['pass']['total_requested_hints'];
272 }
273 }
274
275 $data[] = $row;
276 }
277
278 return $data;
279 }
280
285 {
286 $this->objectiveOrientedContainer = $objectiveOrientedContainer;
287 }
288
293 {
295 }
296
300 public function executeCommand()
301 {
302 $cmd = $this->ctrl->getCmd();
303 $next_class = $this->ctrl->getNextClass($this);
304
305 $cmd = $this->getCommand($cmd);
306 switch ($next_class) {
307 default:
308 $ret = &$this->$cmd();
309 break;
310 }
311 return $ret;
312 }
313
319 public function getCommand($cmd)
320 {
321 return $cmd;
322 }
323
327 protected function isPdfDeliveryRequest(): bool
328 {
329 if (!$this->testrequest->isset('pdf')) {
330 return false;
331 }
332
333 if (!(bool) $this->testrequest->raw('pdf')) {
334 return false;
335 }
336
337 return true;
338 }
339
344 {
345 require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
346
347 $table = new ilTestPassOverviewTableGUI($targetGUI, '');
348
349 $table->setPdfPresentationEnabled(
350 $this->testrequest->isset('pdf') && $this->testrequest->raw('pdf') == 1
351 );
352
353 $table->setObjectiveOrientedPresentationEnabled(
354 $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
355 );
356
357 return $table;
358 }
359
370 public function getPassListOfAnswers(
371 &$result_array,
372 $active_id,
373 $pass,
374 $show_solutions = false,
375 $only_answered_questions = false,
376 $show_question_only = false,
377 $show_reached_points = false,
378 $anchorNav = false,
379 ilTestQuestionRelatedObjectivesList $objectivesList = null,
380 ilTestResultHeaderLabelBuilder $testResultHeaderLabelBuilder = null
381 ): string {
382 $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", true, true, "Modules/Test");
383
384 $counter = 1;
385 // output of questions with solutions
386 foreach ($result_array as $question_data) {
387 if (!array_key_exists('workedthrough', $question_data)) {
388 $question_data['workedthrough'] = 0;
389 }
390 if (!array_key_exists('qid', $question_data)) {
391 $question_data['qid'] = -1;
392 }
393
394 if (($question_data["workedthrough"] == 1) || ($only_answered_questions == false)) {
395 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", true, true, "Modules/TestQuestionPool");
396 $question_id = $question_data["qid"] ?? null;
397 if ($question_id !== null
398 && $question_id !== -1
399 && is_numeric($question_id)) {
400 $maintemplate->setCurrentBlock("printview_question");
401 $question_gui = $this->object->createQuestionGUI("", $question_id);
402 $question_gui->object->setShuffler($this->buildQuestionAnswerShuffler(
403 (int) $question_id,
404 (int) $active_id,
405 (int) $pass
406 ));
407 if (is_object($question_gui)) {
408 if ($this->isPdfDeliveryRequest()) {
409 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
410 }
411
412 if ($anchorNav) {
413 $template->setCurrentBlock('block_id');
414 $template->setVariable('BLOCK_ID', "detailed_answer_block_act_{$active_id}_qst_{$question_id}");
415 $template->parseCurrentBlock();
416
417 $template->setCurrentBlock('back_anchor');
418 $template->setVariable('HREF_BACK_ANCHOR', "#pass_details_tbl_row_act_{$active_id}_qst_{$question_id}");
419 $template->setVariable('TXT_BACK_ANCHOR', $this->lng->txt('tst_back_to_question_list'));
420 $template->parseCurrentBlock();
421 }
422
423 if ($show_reached_points) {
424 $template->setCurrentBlock("result_points");
425 $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());
426 $template->parseCurrentBlock();
427 }
428 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
429 $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
430 $template->setVariable("QUESTION_ID", $question_gui->object->getId());
431 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()));
432
433 if ($objectivesList !== null) {
434 $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
435 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
436 $template->setVariable("OBJECTIVES", $objectives);
437 }
438
439 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
440
441 $show_feedback = $this->isContextResultPresentation() && $this->object->getShowSolutionFeedback();
442 $show_best_solution = $this->isContextResultPresentation() && $show_solutions;
443 $show_graphical_output = $this->isContextResultPresentation();
444
445 if ($show_best_solution) {
446 $compare_template = new ilTemplate('tpl.il_as_tst_answers_compare.html', true, true, 'Modules/Test');
447 $test_session = $this->testSessionFactory->getSession($active_id);
448 if ($pass <= $test_session->getLastFinishedPass()) {
449 $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant'));
450 } else {
451 $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant_no_answer'));
452 }
453
454 $compare_template->setVariable("HEADER_SOLUTION", $this->lng->txt('tst_header_solution'));
455 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output, false, $show_question_only, $show_feedback);
456 $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true);
457
458 $compare_template->setVariable('PARTICIPANT', $result_output);
459 $compare_template->setVariable('SOLUTION', $best_output);
460 if ($question_gui instanceof assTextQuestionGUI && $this->object->getAutosave()) {
461 $intermediate_output = $question_gui->getAutoSavedSolutionOutput(
462 $active_id,
463 $pass,
464 false,
465 false,
466 false,
467 false,
468 false,
469 false,
470 false
471 );
472 $compare_template->setVariable('TXT_INTERMEDIATE', $this->lng->txt('autosavecontent'));
473 $compare_template->setVariable('INTERMEDIATE', $intermediate_output);
474 }
475 $template->setVariable('SOLUTION_OUTPUT', $compare_template->get());
476 } else {
477 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output, false, $show_question_only, $show_feedback);
478 if ($question_gui instanceof assTextQuestionGUI && $this->object->getAutosave()) {
479 $intermediate_output = $question_gui->getAutoSavedSolutionOutput(
480 $active_id,
481 $pass,
482 false,
483 false,
484 false,
485 false,
486 false,
487 false,
488 false
489 );
490 $template->setVariable('TXT_INTERMEDIATE', $this->lng->txt('autosavecontent'));
491 $template->setVariable('INTERMEDIATE', $intermediate_output);
492 }
493 $template->setVariable('SOLUTION_OUTPUT', $result_output);
494 }
495
496 $maintemplate->setCurrentBlock("printview_question");
497 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
498 $maintemplate->parseCurrentBlock();
499 $counter++;
500 }
501 }
502 }
503 }
504
505 if ($testResultHeaderLabelBuilder !== null) {
506 if ($pass !== null) {
507 $headerText = $testResultHeaderLabelBuilder->getListOfAnswersHeaderLabel($pass + 1);
508 } else {
509 $headerText = $testResultHeaderLabelBuilder->getVirtualListOfAnswersHeaderLabel();
510 }
511 } else {
512 $headerText = '';
513 }
514
515 $maintemplate->setVariable("RESULTS_OVERVIEW", $headerText);
516 return $maintemplate->get();
517 }
518
519 protected function buildQuestionAnswerShuffler(
520 int $question_id,
521 int $active_id,
522 int $pass_id
523 ): Transformation {
524 $fixedSeed = $this->buildFixedShufflerSeed($question_id, $pass_id, $active_id);
525
526 return $this->randomGroup->shuffleArray(new GivenSeed($fixedSeed));
527 }
528
529 protected function buildFixedShufflerSeed(int $question_id, int $pass_id, int $active_id): int
530 {
531 $seed = ($question_id + $pass_id) * $active_id;
532
533 if (is_float($seed) && is_float($seed = $active_id + $pass_id)) {
534 $seed = $active_id;
535 }
536
537 $div = ceil((10 ** (ilTestPlayerAbstractGUI::FIXED_SHUFFLER_SEED_MIN_LENGTH - 1)) / $seed);
538
539 if ($div > 1) {
540 $seed = $seed * ($div + $seed % 10);
541 }
542
543 return (int) $seed;
544 }
545
558 public function getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions = false): string
559 {
560 $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", true, true, "Modules/Test");
562
563 $counter = 1;
564 // output of questions with solutions
565 foreach ($result_array as $question_data) {
566 $question = $question_data["qid"];
567 if (is_numeric($question)) {
568 $question_gui = $this->object->createQuestionGUI("", $question);
569 if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
570 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", true, true, "Modules/TestQuestionPool");
571 $scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", true, true, "Modules/Test");
572 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
573 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
574 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()));
575 $points = $question_gui->object->getMaximumPoints();
576 if ($points == 1) {
577 $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
578 } else {
579 $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
580 }
581
582 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
583 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, true);
584
585 $solout = $question_gui->object->getSuggestedSolutionOutput();
586 if (strlen($solout)) {
587 $scoretemplate->setCurrentBlock("suggested_solution");
588 $scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
589 $scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
590 $scoretemplate->parseCurrentBlock();
591 }
592
593 $scoretemplate->setCurrentBlock("feedback");
594 $scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
595 $feedback = ilObjTest::getSingleManualFeedback((int) $active_id, (int) $question, (int) $pass)['feedback'] ?? '';
596 $scoretemplate->setVariable(
597 "VALUE_FEEDBACK",
599 $this->object->prepareTextareaOutput($feedback, true)
600 )
601 );
602 $scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
603 $scoretemplate->parseCurrentBlock();
604
605 $scoretemplate->setVariable("NAME_INPUT", $question);
606 $this->ctrl->setParameter($this, "active_id", $active_id);
607 $this->ctrl->setParameter($this, "pass", $pass);
608 $scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
609 $scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
610 $scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
611 $scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
612
613 $template->setVariable("SOLUTION_OUTPUT", $result_output);
614 $maintemplate->setCurrentBlock("printview_question");
615 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
616 $maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
617 $maintemplate->parseCurrentBlock();
618 }
619 $counter++;
620 }
621 }
622 if ($counter == 1) {
623 // no scorable questions found
624 $maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
625 }
626 $maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass + 1));
627
628 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
630
631 return $maintemplate->get();
632 }
633
635 $result_array,
636 $active_id,
637 $pass,
638 $targetGUI,
639 $targetCMD,
640 $questionDetailsCMD,
641 $questionAnchorNav,
642 ilTestQuestionRelatedObjectivesList $objectivesList = null,
643 $multipleObjectivesInvolved = true
645 $this->ctrl->setParameter($targetGUI, 'active_id', $active_id);
646 $this->ctrl->setParameter($targetGUI, 'pass', $pass);
647
648 $tableGUI = $this->buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD);
649
650 if (!$this->isPdfDeliveryRequest()) {
651 $tableGUI->setAnswerListAnchorEnabled($questionAnchorNav);
652 }
653
654 $tableGUI->setSingleAnswerScreenCmd($questionDetailsCMD);
655 $tableGUI->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
656
657 if ($objectivesList !== null) {
658 $tableGUI->setQuestionRelatedObjectivesList($objectivesList);
659 $tableGUI->setObjectiveOrientedPresentationEnabled(true);
660 }
661
662 $tableGUI->setMultipleObjectivesInvolved($multipleObjectivesInvolved);
663
664 $tableGUI->setActiveId($active_id);
665 $tableGUI->setShowSuggestedSolution(false);
666
667 $usersQuestionSolutions = array();
668
669 foreach ($result_array as $key => $val) {
670 if ($key === 'test' || $key === 'pass') {
671 continue;
672 }
673
674 if ($this->object->getShowSolutionSuggested() && strlen($val['solution'])) {
675 $tableGUI->setShowSuggestedSolution(true);
676 }
677
678 if (isset($val['pass'])) {
679 $tableGUI->setPassColumnEnabled(true);
680 }
681
682 $usersQuestionSolutions[$key] = $val;
683 }
684
685 $tableGUI->initColumns();
686 $tableGUI->initFilter();
687
688 $tableGUI->setFilterCommand($targetCMD . 'SetTableFilter');
689 $tableGUI->setResetCommand($targetCMD . 'ResetTableFilter');
690
691 $tableGUI->setData($usersQuestionSolutions);
692
693 return $tableGUI;
694 }
695
702 public function getResultsSignature(): string
703 {
704 if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
705 $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", true, true, "Modules/Test");
706 $template->setVariable("TXT_DATE", $this->lng->txt("date"));
709 $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
711 $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
712 $template->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.png"));
713 return $template->get();
714 } else {
715 return "";
716 }
717 }
718
728 public function getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, $overwrite_anonymity = false): string
729 {
730 if (!is_object($testSession)) {
731 throw new InvalidArgumentException('Not an object, expected ilTestSession|ilTestSessionDynamicQuestionSet');
732 }
733 $template = new ilTemplate("tpl.il_as_tst_results_userdata.html", true, true, "Modules/Test");
734 include_once './Services/User/classes/class.ilObjUser.php';
735 $user_id = $this->object->_getUserIdFromActiveId($active_id);
736 if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
737 $user = new ilObjUser($user_id);
738 } else {
739 $user = new ilObjUser();
740 $user->setLastname($this->lng->txt("deleted_user"));
741 }
742 $t = $testSession->getSubmittedTimestamp();
743 if (!$t) {
744 $t = $this->object->_getLastAccess($testSession->getActiveId());
745 }
746
747 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
748 $uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
749 $template->setCurrentBlock("name");
750 $template->setVariable('TXT_USR_NAME', $this->lng->txt("name"));
751 $template->setVariable('VALUE_USR_NAME', $uname);
752 $template->parseCurrentBlock();
753 }
754
755 $title_matric = "";
756 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false) || ($overwrite_anonymity))) {
757 $template->setCurrentBlock("matriculation");
758 $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
759 $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
760 $template->parseCurrentBlock();
761 $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
762 }
763
764 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
765 $title_client = '';
766 if ($invited_user != null && strlen($invited_user["clientip"])) {
767 $template->setCurrentBlock("client_ip");
768 $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
769 $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
770 $template->parseCurrentBlock();
771 $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
772 }
773
774 $template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
775 $template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
776
777 // change the pagetitle (tab title or title in title bar of window)
778 $pagetitle = $this->object->getTitle() . $title_matric . $title_client;
779 $this->tpl->setHeaderPageTitle($pagetitle);
780
781 return $template->get();
782 }
783
793 public function getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList = null): string
794 {
795 $question_gui = $this->object->createQuestionGUI("", $question_id);
796
797 if ($this->isPdfDeliveryRequest()) {
798 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
799 }
800
801 $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", true, true, "Modules/Test");
802 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
803 $result_output = $question_gui->getSolutionOutput($active_id, $pass, true, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, false, true);
804 if ($question_gui instanceof assTextQuestionGUI && $this->object->getAutosave()) {
805 $result_output .= $question_gui->getAutoSavedSolutionOutput(
806 $active_id,
807 $pass,
808 false,
809 false,
810 false,
811 false,
812 false,
813 false,
814 false,
815 true
816 );
817 }
818 $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true, false, false);
819 if ($this->object->getShowSolutionFeedback() && $this->testrequest->raw('cmd') != 'outCorrectSolution') {
820 $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput(
821 $question_gui->object->fetchIndexedValuesFromValuePairs(
822 $question_gui->object->getSolutionValues($active_id, $pass)
823 )
824 );
825 if (strlen($specificAnswerFeedback)) {
826 $template->setCurrentBlock("outline_specific_feedback");
827 $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
828 $template->parseCurrentBlock();
829 }
830 }
831 if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output)) {
832 $template->setCurrentBlock("best_solution");
833 $template->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is"));
834 $template->setVariable("BEST_OUTPUT", $best_output);
835 $template->parseCurrentBlock();
836 }
837 $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
838 $template->setVariable("TEXT_SOLUTION_OUTPUT", $this->lng->txt("tst_your_answer_was")); // Mantis 28646. I don't really know why Ingmar renamed the placeholder, so
839 // I set both old and new since the old one is set as well in several places.
840 $maxpoints = $question_gui->object->getMaximumPoints();
841 if ($maxpoints == 1) {
842 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
843 } else {
844 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
845 }
846 if ($objectivesList !== null) {
847 $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
848 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
849 $template->setVariable('OBJECTIVES', $objectives);
850 }
851 $template->setVariable("SOLUTION_OUTPUT", $result_output);
852 $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
853 $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
854 $template->setVariable("BACKLINK_TEXT", "&lt;&lt; " . $this->lng->txt("back"));
855 return $template->get();
856 }
857
870 public function getResultsOfUserOutput($testSession, $active_id, $pass, $targetGUI, $show_pass_details = true, $show_answers = true, $show_question_only = false, $show_reached_points = false): string
871 {
872 global $DIC;
873 $ilObjDataCache = $DIC['ilObjDataCache'];
874
875 include_once("./Services/UICore/classes/class.ilTemplate.php");
876 $template = new ilTemplate("tpl.il_as_tst_results_participant.html", true, true, "Modules/Test");
877
878 if ($this->participantData instanceof ilTestParticipantData) {
879 $user_id = $this->participantData->getUserIdByActiveId($active_id);
880 $uname = $this->participantData->getConcatedFullnameByActiveId($active_id, false);
881 } else {
882 $user_id = $this->object->_getUserIdFromActiveId($active_id);
883 $uname = $this->object->userLookupFullName($user_id, true);
884 }
885
886 if ($this->object->getAnonymity()) {
887 $uname = $this->lng->txt('anonymous');
888 }
889
890 if ((($this->testrequest->isset('pass')) && (strlen($this->testrequest->raw("pass")) > 0)) || (!is_null($pass))) {
891 if (is_null($pass)) {
892 $pass = $this->testrequest->raw("pass");
893 }
894 }
895
896 if (!is_null($pass)) {
897 require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
898 $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
899 $objectivesList = null;
900
901 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
902 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
903 $testSequence->loadFromDb();
904 $testSequence->loadQuestions();
905
906 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
907 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
908
909 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
910 $objectivesList->loadObjectivesTitles();
911
912 $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
913 $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
914 $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
915 $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
916 $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
917 }
918
919 $result_array = $this->object->getTestResult(
920 $active_id,
921 $pass,
922 false,
923 !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
924 );
925
926 $user_id = $this->object->_getUserIdFromActiveId($active_id);
927 $showAllAnswers = true;
928 if ($this->object->isExecutable($testSession, $user_id)) {
929 $showAllAnswers = false;
930 }
931 if ($show_answers) {
932 $list_of_answers = $this->getPassListOfAnswers(
933 $result_array,
934 $active_id,
935 $pass,
936 ilSession::get('tst_results_show_best_solutions'),
937 $showAllAnswers,
938 $show_question_only,
939 $show_reached_points,
940 $show_pass_details,
941 $objectivesList,
942 $testResultHeaderLabelBuilder
943 );
944 $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
945 }
946
947 if ($show_pass_details) {
948 $overviewTableGUI = $this->getPassDetailsOverviewTableGUI(
949 $result_array,
950 $active_id,
951 $pass,
952 $targetGUI,
953 "getResultsOfUserOutput",
954 '',
955 $show_answers,
956 $objectivesList
957 );
958 $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
959 $template->setVariable("PASS_DETAILS", $overviewTableGUI->getHTML());
960 }
961
962 $signature = $this->getResultsSignature();
963 $template->setVariable("SIGNATURE", $signature);
964
965 if ($this->object->isShowExamIdInTestResultsEnabled()) {
966 $template->setCurrentBlock('exam_id_footer');
967 $template->setVariable('EXAM_ID_VAL', ilObjTest::lookupExamId(
968 $testSession->getActiveId(),
969 $pass
970 ));
971 $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
972 $template->parseCurrentBlock();
973 }
974 }
975
976 $template->setCurrentBlock('participant_back_anchor');
977 $template->setVariable("HREF_PARTICIPANT_BACK_ANCHOR", "#tst_results_toolbar");
978 $template->setVariable("TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt('tst_back_to_top'));
979 $template->parseCurrentBlock();
980
981 $template->setCurrentBlock('participant_block_id');
982 $template->setVariable("PARTICIPANT_BLOCK_ID", "participant_active_{$active_id}");
983 $template->parseCurrentBlock();
984
985 if ($this->isGradingMessageRequired()) {
986 $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
987 $gradingMessageBuilder->buildList();
988
989 $template->setCurrentBlock('grading_message');
990 $template->setVariable('GRADING_MESSAGE', $gradingMessageBuilder->getList());
991 $template->parseCurrentBlock();
992 }
993
994
995 $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, true);
996 $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
997 $template->setVariable("USER_DATA", $user_data);
998
999 $this->populateExamId($template, (int) $active_id, (int) $pass);
1000 $this->populatePassFinishDate($template, ilObjTest::lookupLastTestPassAccess($active_id, $pass));
1001
1002 return $template->get();
1003 }
1004
1012 public function getResultsHeadUserAndPass($active_id, $pass): string
1013 {
1014 $template = new ilTemplate("tpl.il_as_tst_results_head_user_pass.html", true, true, "Modules/Test");
1015 include_once './Services/User/classes/class.ilObjUser.php';
1016 $user_id = $this->object->_getUserIdFromActiveId($active_id);
1017 if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
1018 $user = new ilObjUser($user_id);
1019 } else {
1020 $user = new ilObjUser();
1021 $user->setLastname($this->lng->txt("deleted_user"));
1022 }
1023 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false))) {
1024 $template->setCurrentBlock("user_matric");
1025 $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
1026 $template->parseCurrentBlock();
1027 $template->setCurrentBlock("user_matric_value");
1028 $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
1029 $template->parseCurrentBlock();
1030 $template->touchBlock("user_matric_separator");
1031 }
1032
1033 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
1034 if (strlen($invited_user["clientip"] ?? '')) {
1035 $template->setCurrentBlock("user_clientip");
1036 $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
1037 $template->parseCurrentBlock();
1038 $template->setCurrentBlock("user_clientip_value");
1039 $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
1040 $template->parseCurrentBlock();
1041 $template->touchBlock("user_clientip_separator");
1042 }
1043
1044 $template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
1045 $uname = $this->object->userLookupFullName($user_id, false);
1046 $template->setVariable("VALUE_USR_NAME", $uname);
1047 $template->setVariable("TXT_PASS", $this->lng->txt("scored_pass"));
1048 $template->setVariable("VALUE_PASS", $pass);
1049 return $template->get();
1050 }
1051
1058 public function getQuestionResultForTestUsers($question_id, $test_id)
1059 {
1060 // prepare generation before contents are processed (for mathjax)
1062
1063 // REQUIRED, since we call this object regardless of the loop
1064 $question_gui = $this->object->createQuestionGUI("", $question_id);
1065
1066 $this->object->setAccessFilteredParticipantList(
1067 $this->object->buildStatisticsAccessFilteredParticipantList()
1068 );
1069
1070 $foundusers = $this->object->getParticipantsForTestAndQuestion($test_id, $question_id);
1071 $output = '';
1072 foreach ($foundusers as $active_id => $passes) {
1073 $resultpass = $this->object->_getResultPass($active_id);
1074 for ($i = 0; $i < count($passes); $i++) {
1075 if (($resultpass !== null) && ($resultpass == $passes[$i]["pass"])) {
1076 if ($output) {
1077 $output .= "<br /><br /><br />";
1078 }
1079
1080 // check if re-instantiation is really neccessary
1081 $question_gui = $this->object->createQuestionGUI("", $passes[$i]["qid"]);
1082 $output .= $this->getResultsHeadUserAndPass($active_id, $resultpass + 1);
1083 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
1084 $output .= $question_gui->getSolutionOutput(
1085 $active_id,
1086 $resultpass,
1087 $graphicalOutput = false,
1088 $result_output = false,
1089 $show_question_only = false,
1090 $show_feedback = false
1091 );
1092 }
1093 }
1094 }
1095
1096 require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
1097 ilTestPDFGenerator::generatePDF($output, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $question_gui->object->getTitleFilenameCompliant(), PDF_USER_RESULT);
1098 }
1099
1104 {
1105 if (!isset($targetGUI->object) && method_exists($targetGUI, 'getTestObj')) {
1106 $targetGUI->object = $targetGUI->getTestObj();
1107 }
1108
1109 $tableGUI = new ilTestPassDetailsOverviewTableGUI($this->ctrl, $targetGUI, $targetCMD);
1110 $tableGUI->setIsPdfGenerationRequest($this->isPdfDeliveryRequest());
1111 return $tableGUI;
1112 }
1113
1114 protected function isGradingMessageRequired(): bool
1115 {
1116 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1117 return false;
1118 }
1119
1120 if ($this->object->isShowGradingStatusEnabled()) {
1121 return true;
1122 }
1123
1124 if ($this->object->isShowGradingMarkEnabled()) {
1125 return true;
1126 }
1127
1128 return false;
1129 }
1130
1136 {
1137 require_once 'Modules/Test/classes/class.ilTestGradingMessageBuilder.php';
1138 $gradingMessageBuilder = new ilTestGradingMessageBuilder($this->lng, $this->object);
1139
1140 $gradingMessageBuilder->setActiveId($activeId);
1141
1142 return $gradingMessageBuilder;
1143 }
1144
1146 {
1147 require_once 'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
1148 $questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
1149
1150 $objectivesAdapter->buildQuestionRelatedObjectiveList($testSequence, $questionRelatedObjectivesList);
1151
1152 return $questionRelatedObjectivesList;
1153 }
1154
1155 protected function getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions): array
1156 {
1157 global $DIC;
1158 $ilDB = $DIC['ilDB'];
1159 $component_repository = $DIC['component.repository'];
1160
1161 $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
1162 $table_gui->initFilter();
1163
1164 $questionList = new ilAssQuestionList($ilDB, $this->lng, $this->refinery, $component_repository);
1165
1166 $questionList->setParentObjIdsFilter(array($this->object->getId()));
1167 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
1168
1169 foreach ($table_gui->getFilterItems() as $item) {
1170 if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
1171 $v = $item->getValue();
1172
1173 if (is_array($v) && count($v) && !(int) $v[0]) {
1174 continue;
1175 }
1176
1177 $taxId = substr($item->getPostVar(), strlen('tax_'));
1178 $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
1179 } elseif ($item->getValue() !== false) {
1180 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1181 }
1182 }
1183
1184 $questionList->load();
1185
1186 $filteredTestResult = array();
1187
1188 $resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
1189
1190 foreach ($resultData as $resultItemKey => $resultItemValue) {
1191 if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
1192 continue;
1193 }
1194
1195 if (!$questionList->isInList($resultItemValue['qid'])) {
1196 continue;
1197 }
1198
1199 $filteredTestResult[] = $resultItemValue;
1200 }
1201
1202 return $filteredTestResult;
1203 }
1204
1208 protected function populateContent($content)
1209 {
1210 if ($this->isPdfDeliveryRequest()) {
1212 $content,
1214 $this->object->getTitleFilenameCompliant(),
1216 );
1217 } else {
1218 $this->tpl->setContent($content);
1219 }
1220 }
1221
1226 {
1227 require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
1228 $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng);
1229
1230 return $toolbar;
1231 }
1232
1233 protected function outCorrectSolutionCmd()
1234 {
1235 $this->outCorrectSolution(); // cannot be named xxxCmd, because it's also called from context without Cmd in names
1236 }
1237
1243 protected function outCorrectSolution()
1244 {
1245 if (!$this->object->getShowSolutionDetails()) {
1246 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"), true);
1247 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1248 }
1249
1250 $testSession = $this->testSessionFactory->getSession();
1251 $activeId = $testSession->getActiveId();
1252
1253 if (!($activeId > 0)) {
1254 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1255 }
1256
1257 $this->ctrl->saveParameter($this, "pass");
1258 $pass = (int) $this->testrequest->raw("pass");
1259
1260 $questionId = (int) $this->testrequest->raw('evaluation');
1261
1262 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1263 $testSequence->loadFromDb();
1264 $testSequence->loadQuestions();
1265
1266 if (!$testSequence->questionExists($questionId)) {
1268 }
1269
1270 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1271 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1272 $testSequence->loadFromDb();
1273 $testSequence->loadQuestions();
1274
1275 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
1276 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
1277 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
1278 $objectivesList->loadObjectivesTitles();
1279 } else {
1280 $objectivesList = null;
1281 }
1282
1283 global $DIC;
1284 $ilTabs = $DIC['ilTabs'];
1285
1286 if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
1287 $ilTabs->setBackTarget(
1288 $this->lng->txt("tst_back_to_virtual_pass"),
1289 $this->ctrl->getLinkTarget($this, 'showVirtualPass')
1290 );
1291 } else {
1292 $ilTabs->setBackTarget(
1293 $this->lng->txt("tst_back_to_pass_details"),
1294 $this->ctrl->getLinkTarget($this, 'outUserPassDetails')
1295 );
1296 }
1297 $ilTabs->clearSubTabs();
1298
1299 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1300 $this->tpl->setCurrentBlock("ContentStyle");
1301 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
1302 $this->tpl->parseCurrentBlock();
1303
1304 $this->tpl->setCurrentBlock("SyntaxStyle");
1305 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
1306 $this->tpl->parseCurrentBlock();
1307
1308 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1309 if ($this->object->getShowSolutionAnswersOnly()) {
1310 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1311 }
1312
1313 $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList);
1314
1315 $this->tpl->setContent($solution);
1316 }
1317
1322 public function populatePassFinishDate($tpl, $passFinishDate)
1323 {
1326 $passFinishDate = ilDatePresentation::formatDate(new ilDateTime($passFinishDate, IL_CAL_UNIX));
1328 $tpl->setVariable("PASS_FINISH_DATE_LABEL", $this->lng->txt('tst_pass_finished_on'));
1329 $tpl->setVariable("PASS_FINISH_DATE_VALUE", $passFinishDate);
1330 }
1331
1337 public function populateExamId(ilTemplate $tpl, int $activeId, int $pass)
1338 {
1339 if ($this->object->isShowExamIdInTestResultsEnabled()) {
1340 $tpl->setVariable("EXAM_ID_TXT", $this->lng->txt('exam_id'));
1341 $tpl->setVariable('EXAM_ID', ilObjTest::lookupExamId(
1342 $activeId,
1343 $pass
1344 ));
1345 }
1346 }
1347
1348 public function getObject()
1349 {
1350 return $this->object;
1351 }
1352}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
Builds data types.
Definition: Factory.php:21
const IL_CAL_UNIX
return true
static _getReachedPoints(int $active_id, int $question_id, int $pass)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
Class for single dates.
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
static getInstance(ilTestSession $a_test_session)
static prepareFormOutput($a_str, bool $a_strip=false)
static _getManualScoring()
Retrieve the manual scoring settings.
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static accessViolationRedirect()
static lookupExamId($active_id, $pass)
static lookupLastTestPassAccess($activeId, $passIndex)
static getSingleManualFeedback(int $active_id, int $question_id, int $pass)
User class.
static _lookupLogin(int $a_user_id)
static prepareGenerationRequest(string $service, string $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
static get(string $a_var)
special template class to simplify handling of ITX/PEAR
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Service GUI class for tests.
ILIAS Test InternalRequestService $testrequest
getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
outCorrectSolution()
Creates an output of the solution of an answer compared to the correct solution.
getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList=null)
Returns an output of the solution to an answer compared to the correct solution.
populateExamId(ilTemplate $tpl, int $activeId, int $pass)
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.
getPassDetailsOverviewTableGUI( $result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
setObjectiveOrientedContainer(ilTestObjectiveOrientedContainer $objectiveOrientedContainer)
executeCommand()
execute command
populatePassFinishDate($tpl, $passFinishDate)
__construct(ilObjTest $a_object)
The constructor takes the test object reference as parameter.
getResultsSignature()
Returns HTML code for a signature field.
getCommand($cmd)
Retrieves the ilCtrl command.
buildPassOverviewTableGUI($targetGUI)
buildQuestionAnswerShuffler(int $question_id, int $active_id, int $pass_id)
getQuestionResultForTestUsers($question_id, $test_id)
Creates a HTML representation for the results of a given question in a test.
buildFixedShufflerSeed(int $question_id, int $pass_id, int $active_id)
setContextResultPresentation($contextResultPresentation)
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
getPassOverviewTableData(ilTestSession $testSession, $passes, $withResults)
This method uses the data of a given test pass to create an evaluation for displaying into a table us...
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.
getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, $overwrite_anonymity=false)
Returns the user data for a test results output.
getResultsHeadUserAndPass($active_id, $pass)
Returns the user and pass data for a test results output.
setParticipantData($participantData)
buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)
getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions=false)
Returns the list of answers of a users test pass and offers a scoring option.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static initDomEvent(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent used in Services/Calendar, Modules/Session, Modules/Test (Jan 2022)
global $DIC
Definition: feed.php:28
const PDF_USER_RESULT
PDF Purposes.
A transformation is a function from one datatype to another.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:41
string $key
Consumer key/client ID value.
Definition: System.php:193
header include for all ilias files.
$objectives