ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTestEvalObjectiveOrientedGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Test\Results\Presentation\TitlesBuilder as ResultsTitlesBuilder;
22
32{
33 public function executeCommand()
34 {
35 $this->ctrl->saveParameter($this, "active_id");
36
37 switch ($this->ctrl->getNextClass($this)) {
38 case 'ilassquestionpagegui':
39 $forwarder = new ilAssQuestionPageCommandForwarder(
40 $this->object,
41 $this->lng,
42 $this->ctrl,
43 $this->tpl,
44 $this->questionrepository,
45 $this->testrequest
46 );
47 $forwarder->forward();
48 break;
49
50 default:
51 $cmd = $this->ctrl->getCmd('showVirtualPass') . 'Cmd';
52 $this->$cmd();
53 }
54 }
55
57 {
58 $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'showVirtualPass');
59 $tableGUI->resetOffset();
60 $tableGUI->writeFilterToSession();
61 $this->showVirtualPassCmd();
62 }
63
65 {
66 $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'showVirtualPass');
67 $tableGUI->resetOffset();
68 $tableGUI->resetFilter();
69 $this->showVirtualPassCmd();
70 }
71
72 private function showVirtualPassCmd()
73 {
74 $test_session = $this->test_session_factory->getSession();
75
76 if (!$this->object->getShowPassDetails()) {
77 $executable = $this->object->isExecutable($test_session, $test_session->getUserId());
78
79 if ($executable['executable']) {
80 $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
81 }
82 }
83
84 $this->toolbar->addComponent(
85 $this->ui_factory->button()->standard($this->lng->txt('print'), '')
86 ->withOnLoadCode(fn($id) => "$('#$id').on('click', ()=>{window.print();})")
87 );
88
89 $virtual_sequence = $this->service->buildVirtualSequence($test_session);
90 $user_results = $this->service->getVirtualSequenceUserResults($virtual_sequence);
91
92 $objectives_adapter = ilLOTestQuestionAdapter::getInstance($test_session);
93
94 $objectives_list = $this->buildQuestionRelatedObjectivesList($objectives_adapter, $virtual_sequence);
95 $objectives_list->loadObjectivesTitles();
96
97 $test_result_header_label_builder = new ResultsTitlesBuilder($this->lng, $this->obj_cache);
98
99 $test_result_header_label_builder->setObjectiveOrientedContainerId($test_session->getObjectiveOrientedContainerId());
100 $test_result_header_label_builder->setUserId($test_session->getUserId());
101 $test_result_header_label_builder->setTestObjId($this->object->getId());
102 $test_result_header_label_builder->setTestRefId($this->object->getRefId());
103 $test_result_header_label_builder->initObjectiveOrientedMode();
104
105 $tpl = new ilTemplate('tpl.il_as_tst_virtual_pass_details.html', false, false, 'components/ILIAS/Test');
106
107 foreach (array_keys($objectives_list->getObjectives()) as $lo_id) {
108 $user_results_for_lo = $objectives_list->filterResultsByObjective($user_results, $lo_id);
109
110 $overview_table_gui = $this->getPassDetailsOverviewTableGUI(
111 $user_results_for_lo,
112 $test_session->getActiveId(),
113 $test_session->getPass(),
114 $this,
115 "showVirtualPass",
116 $objectives_list,
117 false
118 );
119 $overview_table_gui->setTitle(
120 $test_result_header_label_builder->getVirtualPassDetailsHeaderLabel(
121 $objectives_list->getObjectiveTitleById($lo_id)
122 )
123 );
124
125 $lo_status = new ilTestLearningObjectivesStatusGUI(
126 $this->lng,
127 $this->ctrl,
128 $this->ui_factory,
129 $this->ui_renderer,
130 $this->testrequest
131 );
132 $lo_status->setCrsObjId($this->getObjectiveOrientedContainer()->getObjId());
133 $lo_status->setUsrId($test_session->getUserId());
134 $lo_status_html = $lo_status->getHTML($lo_id);
135
136 $tpl->setCurrentBlock('pass_details');
137 $tpl->setVariable("PASS_DETAILS", $overview_table_gui->getHTML());
138 $tpl->setVariable("LO_STATUS", $lo_status_html);
140 }
141
142 $this->populateContent($tpl->get());
143 }
144}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getInstance(ilTestSession $a_test_session)
special template class to simplify handling of ITX/PEAR
Service GUI class for tests.
buildPassDetailsOverviewTableGUI(ilTestServiceGUI $target_gui, string $target_cmd)
populateContent(string $content)
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectives_adapter, ilTestQuestionSequence $test_sequence)
ilGlobalTemplateInterface ilTemplate $tpl
sk 2023-08-01: We need this union type, even if it is wrong! To change this
getPassDetailsOverviewTableGUI(array $result_array, int $active_id, int $pass, ilTestServiceGUI $target_gui, string $target_cmd, ?ilTestQuestionRelatedObjectivesList $objectives_list=null, bool $multiple_objectives_involved=true)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.