ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilTestServiceGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
5include_once 'Modules/Test/classes/class.ilTestService.php';
6
22{
23 protected const FIXED_SHUFFLER_SEED_MIN_LENGTH = 8;
24
28 public $object = null;
29
33 public $service = null;
34
38 protected $db;
39
40 public $lng;
42 public $tpl;
43
47 public $ctrl;
48
52 protected $tabs;
53
57 protected $objCache;
58
59 public $ilias;
60 public $tree;
61 public $ref_id;
62
68 protected $testSessionFactory = null;
69
75 protected $testSequenceFactory = null;
76
81
86
88
93 {
95 }
96
101 {
102 $this->contextResultPresentation = $contextResultPresentation;
103 }
104
111 public function __construct(ilObjTest $a_object)
112 {
113 global $DIC;
114 $lng = $DIC['lng'];
115 $tpl = $DIC['tpl'];
116 $ilCtrl = $DIC['ilCtrl'];
117 $ilias = $DIC['ilias'];
118 $tree = $DIC['tree'];
119 $ilDB = $DIC['ilDB'];
120 $ilPluginAdmin = $DIC['ilPluginAdmin'];
121 $ilTabs = $DIC['ilTabs'];
122 $ilObjDataCache = $DIC['ilObjDataCache'];
123
124 $lng->loadLanguageModule('cert');
125
126 $this->db = $ilDB;
127 $this->lng = &$lng;
128 $this->tpl = &$tpl;
129 $this->ctrl = &$ilCtrl;
130 $this->tabs = $ilTabs;
131 $this->objCache = $ilObjDataCache;
132 $this->ilias = &$ilias;
133 $this->object = &$a_object;
134 $this->tree = &$tree;
135 $this->ref_id = $a_object->ref_id;
136
137 $this->service = new ilTestService($a_object);
138
139 require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
140 $this->testSessionFactory = new ilTestSessionFactory($this->object);
141
142 require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
143 $this->testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
144
145 $this->objectiveOrientedContainer = null;
146 }
147
152 {
153 $this->participantData = $participantData;
154 }
155
159 public function getParticipantData()
160 {
162 }
163
169 public function getPassOverviewTableData(ilTestSession $testSession, $passes, $withResults)
170 {
171 $data = array();
172
173 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
174 $considerHiddenQuestions = false;
175
176 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
177 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
178 } else {
179 $considerHiddenQuestions = true;
180 }
181
182 $scoredPass = $this->object->_getResultPass($testSession->getActiveId());
183
184 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
186 $testSession->getActiveId()
187 );
188
189 foreach ($passes as $pass) {
190 $row = array();
191
192 $considerOptionalQuestions = true;
193
194 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
195 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($testSession->getActiveId(), $pass);
196
197 $testSequence->loadFromDb();
198 $testSequence->loadQuestions();
199
200 if ($this->object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed()) {
201 $considerOptionalQuestions = false;
202 }
203
204 $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
205 $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
206
207 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
208 $objectivesList->loadObjectivesTitles();
209
210 $row['objectives'] = $objectivesList->getUniqueObjectivesStringForQuestions($testSequence->getUserSequenceQuestions());
211 }
212
213 if ($withResults) {
214 $result_array = $this->object->getTestResult($testSession->getActiveId(), $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
215
216 foreach ($result_array as $resultStructKEY => $question) {
217 if ($resultStructKEY === 'test' || $resultStructKEY === 'pass') {
218 continue;
219 }
220
221 $requestData = $questionHintRequestRegister->getRequestByTestPassIndexAndQuestionId($pass, $question['qid']);
222
223 if ($requestData instanceof ilAssQuestionHintRequestStatisticData && $result_array[$resultStructKEY]['requested_hints'] === null) {
224 $result_array['pass']['total_requested_hints'] += $requestData->getRequestsCount();
225
226 $result_array[$resultStructKEY]['requested_hints'] = $requestData->getRequestsCount();
227 $result_array[$resultStructKEY]['hint_points'] = $requestData->getRequestsPoints();
228 }
229 }
230
231 if (!$result_array['pass']['total_max_points']) {
232 $percentage = 0;
233 } else {
234 $percentage = ($result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points']) * 100;
235 }
236 $total_max = $result_array['pass']['total_max_points'];
237 $total_reached = $result_array['pass']['total_reached_points'];
238 $total_requested_hints = $result_array['pass']['total_requested_hints'];
239 }
240
241 if ($withResults) {
242 $row['scored'] = ($pass == $scoredPass);
243 }
244
245 $row['pass'] = $pass;
246 $row['date'] = ilObjTest::lookupLastTestPassAccess($testSession->getActiveId(), $pass);
247 if ($withResults) {
248 $row['num_workedthrough_questions'] = $result_array['pass']['num_workedthrough'];
249 $row['num_questions_total'] = $result_array['pass']['num_questions_total'];
250
251 if ($this->object->isOfferingQuestionHintsEnabled()) {
252 $row['hints'] = $total_requested_hints;
253 }
254
255 $row['reached_points'] = $total_reached;
256 $row['max_points'] = $total_max;
257 $row['percentage'] = $percentage;
258 }
259
260 $data[] = $row;
261 }
262
263 return $data;
264 }
265
270 {
271 $this->objectiveOrientedContainer = $objectiveOrientedContainer;
272 }
273
278 {
280 }
281
285 public function executeCommand()
286 {
287 $cmd = $this->ctrl->getCmd();
288 $next_class = $this->ctrl->getNextClass($this);
289
290 $cmd = $this->getCommand($cmd);
291 switch ($next_class) {
292 default:
293 $ret = &$this->$cmd();
294 break;
295 }
296 return $ret;
297 }
298
304 public function getCommand($cmd)
305 {
306 return $cmd;
307 }
308
312 protected function isPdfDeliveryRequest()
313 {
314 if (!isset($_GET['pdf'])) {
315 return false;
316 }
317
318 if (!(bool) $_GET['pdf']) {
319 return false;
320 }
321
322 return true;
323 }
324
328 public function buildPassOverviewTableGUI($targetGUI)
329 {
330 require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
331
332 $table = new ilTestPassOverviewTableGUI($targetGUI, '');
333
334 $table->setPdfPresentationEnabled(
335 isset($_GET['pdf']) && $_GET['pdf'] == 1
336 );
337
338 $table->setObjectiveOrientedPresentationEnabled(
339 $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
340 );
341
342 return $table;
343 }
344
355 public function 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)
356 {
357 $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", true, true, "Modules/Test");
358
359 $counter = 1;
360 // output of questions with solutions
361 foreach ($result_array as $question_data) {
362 if (($question_data["workedthrough"] == 1) || ($only_answered_questions == false)) {
363 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", true, true, "Modules/TestQuestionPool");
364 $question_id = $question_data["qid"];
365 if (is_numeric($question_id)) {
366 $maintemplate->setCurrentBlock("printview_question");
367 $question_gui = $this->object->createQuestionGUI("", $question_id);
368 $question_gui->object->setShuffler($this->buildQuestionAnswerShuffler((string) $question_id, (string) $active_id, (string) $pass));
369 if (is_object($question_gui)) {
370 if ($this->isPdfDeliveryRequest()) {
371 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
372 }
373
374 if ($anchorNav) {
375 $template->setCurrentBlock('block_id');
376 $template->setVariable('BLOCK_ID', "detailed_answer_block_act_{$active_id}_qst_{$question_id}");
377 $template->parseCurrentBlock();
378
379 $template->setCurrentBlock('back_anchor');
380 $template->setVariable('HREF_BACK_ANCHOR', "#pass_details_tbl_row_act_{$active_id}_qst_{$question_id}");
381 $template->setVariable('TXT_BACK_ANCHOR', $this->lng->txt('tst_back_to_question_list'));
382 $template->parseCurrentBlock();
383 }
384
385 if ($show_reached_points) {
386 $template->setCurrentBlock("result_points");
387 $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());
388 $template->parseCurrentBlock();
389 }
390 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
391 $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
392 $template->setVariable("QUESTION_ID", $question_gui->object->getId());
393 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
394
395 if ($objectivesList !== null) {
396 $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
397 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
398 $template->setVariable("OBJECTIVES", $objectives);
399 }
400
401 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
402
403 $showFeedback = $this->isContextResultPresentation() && $this->object->getShowSolutionFeedback();
404 $show_solutions = $this->isContextResultPresentation() && $show_solutions;
405
406 if ($show_solutions) {
407 $compare_template = new ilTemplate('tpl.il_as_tst_answers_compare.html', true, true, 'Modules/Test');
408 $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant'));
409 $compare_template->setVariable("HEADER_SOLUTION", $this->lng->txt('tst_header_solution'));
410 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $showFeedback);
411 $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true);
412
413 $compare_template->setVariable('PARTICIPANT', $result_output);
414 $compare_template->setVariable('SOLUTION', $best_output);
415 if ($question_gui->supportsIntermediateSolutionOutput() && $question_gui->hasIntermediateSolution($active_id, $pass)) {
416 $question_gui->setUseIntermediateSolution(true);
417 $intermediate_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, true, $showFeedback);
418 $question_gui->setUseIntermediateSolution(false);
419 $compare_template->setVariable('TXT_INTERMEDIATE', $this->lng->txt('autosavecontent'));
420 $compare_template->setVariable('INTERMEDIATE', $intermediate_output);
421 }
422 $template->setVariable('SOLUTION_OUTPUT', $compare_template->get());
423 } else {
424 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $showFeedback);
425 if ($question_gui->supportsIntermediateSolutionOutput() && $question_gui->hasIntermediateSolution($active_id, $pass)) {
426 $question_gui->setUseIntermediateSolution(true);
427 $intermediate_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, true, $showFeedback);
428 $question_gui->setUseIntermediateSolution(false);
429 $template->setVariable('TXT_INTERMEDIATE', $this->lng->txt('autosavecontent'));
430 $template->setVariable('INTERMEDIATE', $intermediate_output);
431 }
432 $template->setVariable('SOLUTION_OUTPUT', $result_output);
433 }
434
435 $maintemplate->setCurrentBlock("printview_question");
436 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
437 $maintemplate->parseCurrentBlock();
438 $counter++;
439 }
440 }
441 }
442 }
443
444 if ($testResultHeaderLabelBuilder !== null) {
445 if ($pass !== null) {
446 $headerText = $testResultHeaderLabelBuilder->getListOfAnswersHeaderLabel($pass + 1);
447 } else {
448 $headerText = $testResultHeaderLabelBuilder->getVirtualListOfAnswersHeaderLabel();
449 }
450 } else {
451 $headerText = '';
452 }
453
454 $maintemplate->setVariable("RESULTS_OVERVIEW", $headerText);
455 return $maintemplate->get();
456 }
457
458 protected function buildQuestionAnswerShuffler(string $question_id, string $active_id, string $active_pass) : ilArrayElementShuffler
459 {
460 $shuffler = new ilArrayElementShuffler();
461
462 $fixed_seed = $this->buildFixedShufflerSeedFromBasicSeed($question_id . $active_id . $active_pass);
463 $shuffler->setSeed($fixed_seed);
464
465 return $shuffler;
466 }
467
472 protected function buildFixedShufflerSeedFromBasicSeed(string $basic_seed) : string
473 {
474 $fixed_seed = $basic_seed;
475
476 if (strlen($fixed_seed) < self::FIXED_SHUFFLER_SEED_MIN_LENGTH) {
477 $fixed_seed *= (
478 10 * (self::FIXED_SHUFFLER_SEED_MIN_LENGTH - strlen($fixed_seed))
479 );
480 }
481
482 return $fixed_seed;
483 }
484
497 public function getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions = false)
498 {
499 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
500
501 $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", true, true, "Modules/Test");
502
503 include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
505
506 $counter = 1;
507 // output of questions with solutions
508 foreach ($result_array as $question_data) {
509 $question = $question_data["qid"];
510 if (is_numeric($question)) {
511 $question_gui = $this->object->createQuestionGUI("", $question);
512 if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
513 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", true, true, "Modules/TestQuestionPool");
514 $scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", true, true, "Modules/Test");
515 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
516 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
517 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
518 $points = $question_gui->object->getMaximumPoints();
519 if ($points == 1) {
520 $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
521 } else {
522 $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
523 }
524
525 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
526 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, true);
527
528 $solout = $question_gui->object->getSuggestedSolutionOutput();
529 if (strlen($solout)) {
530 $scoretemplate->setCurrentBlock("suggested_solution");
531 $scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
532 $scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
533 $scoretemplate->parseCurrentBlock();
534 }
535
536 $scoretemplate->setCurrentBlock("feedback");
537 $scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
538 $feedback = $this->object->getSingleManualFeedback($active_id, $question, $pass)['feedback'];
539 $scoretemplate->setVariable("VALUE_FEEDBACK", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, true)));
540 $scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
541 $scoretemplate->parseCurrentBlock();
542
543 $scoretemplate->setVariable("NAME_INPUT", $question);
544 $this->ctrl->setParameter($this, "active_id", $active_id);
545 $this->ctrl->setParameter($this, "pass", $pass);
546 $scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
547 $scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
548 $scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
549 $scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
550
551 $template->setVariable("SOLUTION_OUTPUT", $result_output);
552 $maintemplate->setCurrentBlock("printview_question");
553 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
554 $maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
555 $maintemplate->parseCurrentBlock();
556 }
557 $counter++;
558 }
559 }
560 if ($counter == 1) {
561 // no scorable questions found
562 $maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
563 }
564 $maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass + 1));
565
566 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
568
569 return $maintemplate->get();
570 }
571
572 protected function getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList = null, $multipleObjectivesInvolved = true)
573 {
574 $this->ctrl->setParameter($targetGUI, 'active_id', $active_id);
575 $this->ctrl->setParameter($targetGUI, 'pass', $pass);
576
577 $tableGUI = $this->buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD);
578
579 if (!$this->isPdfDeliveryRequest()) {
580 $tableGUI->setAnswerListAnchorEnabled($questionAnchorNav);
581 }
582
583 $tableGUI->setSingleAnswerScreenCmd($questionDetailsCMD);
584 $tableGUI->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
585
586 if ($objectivesList !== null) {
587 $tableGUI->setQuestionRelatedObjectivesList($objectivesList);
588 $tableGUI->setObjectiveOrientedPresentationEnabled(true);
589 }
590
591 $tableGUI->setMultipleObjectivesInvolved($multipleObjectivesInvolved);
592
593 $tableGUI->setActiveId($active_id);
594 $tableGUI->setShowSuggestedSolution(false);
595
596 $usersQuestionSolutions = array();
597
598 foreach ($result_array as $key => $val) {
599 if ($key === 'test' || $key === 'pass') {
600 continue;
601 }
602
603 if ($this->object->getShowSolutionSuggested() && strlen($val['solution'])) {
604 $tableGUI->setShowSuggestedSolution(true);
605 }
606
607 if (isset($val['pass'])) {
608 $tableGUI->setPassColumnEnabled(true);
609 }
610
611 $usersQuestionSolutions[$key] = $val;
612 }
613
614 $tableGUI->initColumns()->initFilter();
615
616 $tableGUI->setFilterCommand($targetCMD . 'SetTableFilter');
617 $tableGUI->setResetCommand($targetCMD . 'ResetTableFilter');
618
619 $tableGUI->setData($usersQuestionSolutions);
620
621 return $tableGUI;
622 }
623
630 public function getResultsSignature()
631 {
632 if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
633 $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", true, true, "Modules/Test");
634 $template->setVariable("TXT_DATE", $this->lng->txt("date"));
637 $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
639 $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
640 $template->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.png"));
641 return $template->get();
642 } else {
643 return "";
644 }
645 }
646
656 public function getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, $overwrite_anonymity = false)
657 {
658 if (!is_object($testSession)) {
659 throw new TestException();
660 }
661 $template = new ilTemplate("tpl.il_as_tst_results_userdata.html", true, true, "Modules/Test");
662 include_once './Services/User/classes/class.ilObjUser.php';
663 $user_id = $this->object->_getUserIdFromActiveId($active_id);
664 if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
665 $user = new ilObjUser($user_id);
666 } else {
667 $user = new ilObjUser();
668 $user->setLastname($this->lng->txt("deleted_user"));
669 }
670 $t = $testSession->getSubmittedTimestamp();
671 if (!$t) {
672 $t = $this->object->_getLastAccess($testSession->getActiveId());
673 }
674
675 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
676 $uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
677 $template->setCurrentBlock("name");
678 $template->setVariable('TXT_USR_NAME', $this->lng->txt("name"));
679 $template->setVariable('VALUE_USR_NAME', $uname);
680 $template->parseCurrentBlock();
681 }
682
683 $title_matric = "";
684 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false) || ($overwrite_anonymity))) {
685 $template->setCurrentBlock("matriculation");
686 $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
687 $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
688 $template->parseCurrentBlock();
689 $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
690 }
691
692 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
693 if (strlen($invited_user["clientip"])) {
694 $template->setCurrentBlock("client_ip");
695 $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
696 $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
697 $template->parseCurrentBlock();
698 $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
699 }
700
701 $template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
702 $template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
703
704 // change the pagetitle (tab title or title in title bar of window)
705 $pagetitle = $this->object->getTitle() . $title_matric . $title_client;
706 $this->tpl->setHeaderPageTitle($pagetitle);
707
708 return $template->get();
709 }
710
720 public function getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList = null)
721 {
722 global $DIC;
723 $ilUser = $DIC['ilUser'];
724
725 $test_id = $this->object->getTestId();
726 $question_gui = $this->object->createQuestionGUI("", $question_id);
727
728 if ($this->isPdfDeliveryRequest()) {
729 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
730 }
731
732 $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", true, true, "Modules/Test");
733 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
734 $result_output = $question_gui->getSolutionOutput($active_id, $pass, true, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, false, true);
735 $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true, false, false);
736 if ($this->object->getShowSolutionFeedback() && $_GET['cmd'] != 'outCorrectSolution') {
737 $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput(
738 $question_gui->object->fetchIndexedValuesFromValuePairs(
739 $question_gui->object->getSolutionValues($active_id, $pass)
740 )
741 );
742 if (strlen($specificAnswerFeedback)) {
743 $template->setCurrentBlock("outline_specific_feedback");
744 $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
745 $template->parseCurrentBlock();
746 }
747 }
748 if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output)) {
749 $template->setCurrentBlock("best_solution");
750 $template->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is"));
751 $template->setVariable("BEST_OUTPUT", $best_output);
752 $template->parseCurrentBlock();
753 }
754 $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
755 $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
756 // I set both old and new since the old one is set as well in several places.
757 $maxpoints = $question_gui->object->getMaximumPoints();
758 if ($maxpoints == 1) {
759 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
760 } else {
761 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
762 }
763 if ($objectivesList !== null) {
764 $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
765 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
766 $template->setVariable('OBJECTIVES', $objectives);
767 }
768 $template->setVariable("SOLUTION_OUTPUT", $result_output);
769 $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
770 $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
771 $template->setVariable("BACKLINK_TEXT", "&lt;&lt; " . $this->lng->txt("back"));
772 return $template->get();
773 }
774
787 public function getResultsOfUserOutput($testSession, $active_id, $pass, $targetGUI, $show_pass_details = true, $show_answers = true, $show_question_only = false, $show_reached_points = false)
788 {
789 global $DIC;
790 $ilObjDataCache = $DIC['ilObjDataCache'];
791
792 include_once("./Services/UICore/classes/class.ilTemplate.php");
793 $template = new ilTemplate("tpl.il_as_tst_results_participant.html", true, true, "Modules/Test");
794
795 if ($this->participantData instanceof ilTestParticipantData) {
796 $user_id = $this->participantData->getUserIdByActiveId($active_id);
797 $uname = $this->participantData->getConcatedFullnameByActiveId($active_id, false);
798 } else {
799 $user_id = $this->object->_getUserIdFromActiveId($active_id);
800 $uname = $this->object->userLookupFullName($user_id, true);
801 }
802
803 if (((array_key_exists("pass", $_GET)) && (strlen($_GET["pass"]) > 0)) || (!is_null($pass))) {
804 if (is_null($pass)) {
805 $pass = $_GET["pass"];
806 }
807 }
808
809 if (!is_null($pass)) {
810 require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
811 $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
812
813 $objectivesList = null;
814
815 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
816 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
817 $testSequence->loadFromDb();
818 $testSequence->loadQuestions();
819
820 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
821 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
822
823 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
824 $objectivesList->loadObjectivesTitles();
825
826 $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
827 $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
828 $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
829 $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
830 $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
831 }
832
833 $result_array = $this->object->getTestResult(
834 $active_id,
835 $pass,
836 false,
837 !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
838 );
839
840 $user_id = $this->object->_getUserIdFromActiveId($active_id);
841 $showAllAnswers = true;
842 if ($this->object->isExecutable($testSession, $user_id)) {
843 $showAllAnswers = false;
844 }
845 if ($show_answers) {
846 $list_of_answers = $this->getPassListOfAnswers(
847 $result_array,
848 $active_id,
849 $pass,
850 $_SESSION['tst_results_show_best_solutions'],
851 $showAllAnswers,
852 $show_question_only,
853 $show_reached_points,
854 $show_pass_details,
855 $objectivesList,
856 $testResultHeaderLabelBuilder
857 );
858 $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
859 }
860
861 if ($show_pass_details) {
862 $overviewTableGUI = $this->getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, "getResultsOfUserOutput", '', $show_answers, $objectivesList);
863 $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
864 $template->setVariable("PASS_DETAILS", $overviewTableGUI->getHTML());
865 }
866
867 $signature = $this->getResultsSignature();
868 $template->setVariable("SIGNATURE", $signature);
869
870 if ($this->object->isShowExamIdInTestResultsEnabled()) {
871 $template->setCurrentBlock('exam_id_footer');
872 $template->setVariable('EXAM_ID_VAL', ilObjTest::lookupExamId(
873 $testSession->getActiveId(),
874 $pass
875 ));
876 $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
877 $template->parseCurrentBlock();
878 }
879 }
880
881 $template->setCurrentBlock('participant_back_anchor');
882 $template->setVariable("HREF_PARTICIPANT_BACK_ANCHOR", "#tst_results_toolbar");
883 $template->setVariable("TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt('tst_back_to_top'));
884 $template->parseCurrentBlock();
885
886 $template->setCurrentBlock('participant_block_id');
887 $template->setVariable("PARTICIPANT_BLOCK_ID", "participant_active_{$active_id}");
888 $template->parseCurrentBlock();
889
890 if ($this->isGradingMessageRequired()) {
891 $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
892 $gradingMessageBuilder->buildList();
893
894 $template->setCurrentBlock('grading_message');
895 $template->setVariable('GRADING_MESSAGE', $gradingMessageBuilder->getList());
896 $template->parseCurrentBlock();
897 }
898
899
900 $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, true);
901 $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
902 $template->setVariable("USER_DATA", $user_data);
903
904 $this->populateExamId($template, (int) $active_id, (int) $pass);
906
907 return $template->get();
908 }
909
917 public function getResultsHeadUserAndPass($active_id, $pass)
918 {
919 $template = new ilTemplate("tpl.il_as_tst_results_head_user_pass.html", true, true, "Modules/Test");
920 include_once './Services/User/classes/class.ilObjUser.php';
921 $user_id = $this->object->_getUserIdFromActiveId($active_id);
922 if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
923 $user = new ilObjUser($user_id);
924 } else {
925 $user = new ilObjUser();
926 $user->setLastname($this->lng->txt("deleted_user"));
927 }
928 $title_matric = "";
929 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false))) {
930 $template->setCurrentBlock("user_matric");
931 $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
932 $template->parseCurrentBlock();
933 $template->setCurrentBlock("user_matric_value");
934 $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
935 $template->parseCurrentBlock();
936 $template->touchBlock("user_matric_separator");
937 $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
938 }
939
940 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
941 if (strlen($invited_user["clientip"])) {
942 $template->setCurrentBlock("user_clientip");
943 $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
944 $template->parseCurrentBlock();
945 $template->setCurrentBlock("user_clientip_value");
946 $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
947 $template->parseCurrentBlock();
948 $template->touchBlock("user_clientip_separator");
949 $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
950 }
951
952 $template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
953 $uname = $this->object->userLookupFullName($user_id, false);
954 $template->setVariable("VALUE_USR_NAME", $uname);
955 $template->setVariable("TXT_PASS", $this->lng->txt("scored_pass"));
956 $template->setVariable("VALUE_PASS", $pass);
957 return $template->get();
958 }
959
967 public function getQuestionResultForTestUsers($question_id, $test_id)
968 {
969 // prepare generation before contents are processed (for mathjax)
971
972 // REQUIRED, since we call this object regardless of the loop
973 $question_gui = $this->object->createQuestionGUI("", $question_id);
974
975 $this->object->setAccessFilteredParticipantList(
976 $this->object->buildStatisticsAccessFilteredParticipantList()
977 );
978
979 $foundusers = $this->object->getParticipantsForTestAndQuestion($test_id, $question_id);
980 $output = '';
981 foreach ($foundusers as $active_id => $passes) {
982 $resultpass = $this->object->_getResultPass($active_id);
983 for ($i = 0; $i < count($passes); $i++) {
984 if (($resultpass !== null) && ($resultpass == $passes[$i]["pass"])) {
985 if ($output) {
986 $output .= "<br /><br /><br />";
987 }
988
989 // check if re-instantiation is really neccessary
990 $question_gui = $this->object->createQuestionGUI("", $passes[$i]["qid"]);
991 $output .= $this->getResultsHeadUserAndPass($active_id, $resultpass + 1);
992 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
993 $output .= $question_gui->getSolutionOutput(
994 $active_id,
995 $resultpass,
996 $graphicalOutput = false,
997 $result_output = false,
998 $show_question_only = false,
999 $show_feedback = false
1000 );
1001 }
1002 }
1003 }
1004
1005 require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
1006 ilTestPDFGenerator::generatePDF($output, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $question_gui->object->getTitleFilenameCompliant(), PDF_USER_RESULT);
1007 }
1008
1012 protected function buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)
1013 {
1014 if (!isset($targetGUI->object) && method_exists($targetGUI, 'getTestObj')) {
1015 $targetGUI->object = $targetGUI->getTestObj();
1016 }
1017
1018 require_once 'Modules/Test/classes/tables/class.ilTestPassDetailsOverviewTableGUI.php';
1019 $tableGUI = new ilTestPassDetailsOverviewTableGUI($this->ctrl, $targetGUI, $targetCMD);
1020 $tableGUI->setIsPdfGenerationRequest($this->isPdfDeliveryRequest());
1021 return $tableGUI;
1022 }
1023
1024 protected function isGradingMessageRequired()
1025 {
1026 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1027 return false;
1028 }
1029
1030 if ($this->object->isShowGradingStatusEnabled()) {
1031 return true;
1032 }
1033
1034 if ($this->object->isShowGradingMarkEnabled()) {
1035 return true;
1036 }
1037
1038 if ($this->object->areObligationsEnabled()) {
1039 return true;
1040 }
1041
1042 return false;
1043 }
1044
1049 protected function getGradingMessageBuilder($activeId)
1050 {
1051 require_once 'Modules/Test/classes/class.ilTestGradingMessageBuilder.php';
1052 $gradingMessageBuilder = new ilTestGradingMessageBuilder($this->lng, $this->object);
1053
1054 $gradingMessageBuilder->setActiveId($activeId);
1055
1056 return $gradingMessageBuilder;
1057 }
1058
1059 protected function buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
1060 {
1061 require_once 'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
1062 $questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
1063
1064 $objectivesAdapter->buildQuestionRelatedObjectiveList($testSequence, $questionRelatedObjectivesList);
1065
1066 return $questionRelatedObjectivesList;
1067 }
1068
1069 protected function getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
1070 {
1071 global $DIC;
1072 $ilDB = $DIC['ilDB'];
1073 $ilPluginAdmin = $DIC['ilPluginAdmin'];
1074
1075 $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
1076 $table_gui->initFilter();
1077
1078 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1079 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
1080
1081 $questionList->setParentObjIdsFilter(array($this->object->getId()));
1082 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
1083
1084 foreach ($table_gui->getFilterItems() as $item) {
1085 if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
1086 $v = $item->getValue();
1087
1088 if (is_array($v) && count($v) && !(int) $v[0]) {
1089 continue;
1090 }
1091
1092 $taxId = substr($item->getPostVar(), strlen('tax_'));
1093 $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
1094 } elseif ($item->getValue() !== false) {
1095 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1096 }
1097 }
1098
1099 $questionList->load();
1100
1101 $filteredTestResult = array();
1102
1103 $resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
1104
1105 foreach ($resultData as $resultItemKey => $resultItemValue) {
1106 if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
1107 continue;
1108 }
1109
1110 if (!$questionList->isInList($resultItemValue['qid'])) {
1111 continue;
1112 }
1113
1114 $filteredTestResult[] = $resultItemValue;
1115 }
1116
1117 return $filteredTestResult;
1118 }
1119
1123 protected function populateContent($content)
1124 {
1125 if ($this->isPdfDeliveryRequest()) {
1127 $content,
1129 $this->object->getTitleFilenameCompliant(),
1131 );
1132 } else {
1133 $this->tpl->setContent($content);
1134 }
1135 }
1136
1141 {
1142 require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
1143 $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng);
1144
1145 return $toolbar;
1146 }
1147
1148 protected function outCorrectSolutionCmd()
1149 {
1150 $this->outCorrectSolution(); // cannot be named xxxCmd, because it's also called from context without Cmd in names
1151 }
1152
1158 protected function outCorrectSolution()
1159 {
1160 if (!$this->object->getShowSolutionDetails()) {
1161 ilUtil::sendInfo($this->lng->txt("no_permission"), true);
1162 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1163 }
1164
1165 $testSession = $this->testSessionFactory->getSession();
1166 $activeId = $testSession->getActiveId();
1167
1168 if (!($activeId > 0)) {
1169 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1170 }
1171
1172 $this->ctrl->saveParameter($this, "pass");
1173 $pass = (int) $_GET['pass'];
1174
1175 $questionId = (int) $_GET['evaluation'];
1176
1177 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1178 $testSequence->loadFromDb();
1179 $testSequence->loadQuestions();
1180
1181 if (!$testSequence->questionExists($questionId)) {
1183 }
1184
1185 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1186 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1187 $testSequence->loadFromDb();
1188 $testSequence->loadQuestions();
1189
1190 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
1191 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
1192 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
1193 $objectivesList->loadObjectivesTitles();
1194 } else {
1195 $objectivesList = null;
1196 }
1197
1198 global $DIC;
1199 $ilTabs = $DIC['ilTabs'];
1200
1201 if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
1202 $ilTabs->setBackTarget(
1203 $this->lng->txt("tst_back_to_virtual_pass"),
1204 $this->ctrl->getLinkTarget($this, 'showVirtualPass')
1205 );
1206 } else {
1207 $ilTabs->setBackTarget(
1208 $this->lng->txt("tst_back_to_pass_details"),
1209 $this->ctrl->getLinkTarget($this, 'outUserPassDetails')
1210 );
1211 }
1212 $ilTabs->clearSubTabs();
1213
1214 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1215 $this->tpl->setCurrentBlock("ContentStyle");
1216 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
1217 $this->tpl->parseCurrentBlock();
1218
1219 $this->tpl->setCurrentBlock("SyntaxStyle");
1220 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
1221 $this->tpl->parseCurrentBlock();
1222
1223 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1224 if ($this->object->getShowSolutionAnswersOnly()) {
1225 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1226 }
1227
1228 $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList);
1229
1230 $this->tpl->setContent($solution);
1231 }
1232
1237 public function populatePassFinishDate($tpl, $passFinishDate)
1238 {
1241 $passFinishDate = ilDatePresentation::formatDate(new ilDateTime($passFinishDate, IL_CAL_UNIX));
1243 $tpl->setVariable("PASS_FINISH_DATE_LABEL", $this->lng->txt('tst_pass_finished_on'));
1244 $tpl->setVariable("PASS_FINISH_DATE_VALUE", $passFinishDate);
1245 }
1246
1252 public function populateExamId(ilTemplate $tpl, int $activeId, int $pass)
1253 {
1254 if ($this->object->isShowExamIdInTestResultsEnabled()) {
1255 $tpl->setVariable("EXAM_ID_TXT", $this->lng->txt('exam_id'));
1256 $tpl->setVariable('EXAM_ID', ilObjTest::lookupExamId(
1257 $activeId,
1258 $pass
1259 ));
1260 }
1261 }
1262}
1263
1264// internal sort function to sort the result array
1266{
1267 $sort = ($_GET["sort"]) ? ($_GET["sort"]) : "nr";
1268 $sortorder = ($_GET["sortorder"]) ? ($_GET["sortorder"]) : "asc";
1269 if (strcmp($sortorder, "asc")) {
1270 $smaller = 1;
1271 $greater = -1;
1272 } else {
1273 $smaller = -1;
1274 $greater = 1;
1275 }
1276 if ($a[$sort] == $b[$sort]) {
1277 return 0;
1278 }
1279 return ($a[$sort] < $b[$sort]) ? $smaller : $greater;
1280}
$_GET["client_id"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
sortResults($a, $b)
static _getReachedPoints($active_id, $question_id, $pass=null)
Returns the points, a learner has reached answering the question.
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
@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 _getManualScoring()
Retrieve the manual scoring settings.
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static accessViolationRedirect()
static lookupExamId($active_id, $pass)
static lookupLastTestPassAccess($activeId, $passIndex)
static _lookupLogin($a_user_id)
lookup login
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
special template class to simplify handling of ITX/PEAR
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
Class ilTestPassOverviewTableGUI.
Service GUI class for tests.
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.
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)
getQuestionResultForTestUsers($question_id, $test_id)
Creates a HTML representation for the results of a given question in a test.
buildFixedShufflerSeedFromBasicSeed(string $basic_seed)
setContextResultPresentation($contextResultPresentation)
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
getPassOverviewTableData(ilTestSession $testSession, $passes, $withResults)
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.
getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
getResultsHeadUserAndPass($active_id, $pass)
Returns the user and pass data for a test results output.
setParticipantData($participantData)
buildQuestionAnswerShuffler(string $question_id, string $active_id, string $active_pass)
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.
Service class for tests.
Test session handler.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static initDomEvent(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent.
global $ilCtrl
Definition: ilias.php:18
const PDF_USER_RESULT
PDF Purposes.
$i
Definition: metadata.php:24
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
global $ilDB
$data
Definition: storeScorm.php:23
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46