ILIAS  release_8 Revision v8.24
class.ilTestSkillAdministrationGUI.php
Go to the documentation of this file.
1<?php
2
19use ILIAS\Refinery\Factory as Refinery;
20
31{
32 private ILIAS $ilias;
39 private Refinery $refinery;
40 private ilTree $tree;
43 private $refId;
44
45 public function __construct(
52 Refinery $refinery,
57 $refId
58 ) {
59 $this->ilias = $ilias;
60 $this->ctrl = $ctrl;
61 $this->access = $access;
62 $this->tabs = $tabs;
63 $this->tpl = $tpl;
64 $this->lng = $lng;
65 $this->refinery = $refinery;
66 $this->db = $db;
67 $this->tree = $tree;
68 $this->component_repository = $component_repository;
69 $this->testOBJ = $testOBJ;
70 $this->refId = $refId;
71 }
72
73 public function executeCommand()
74 {
75 if ($this->isAccessDenied()) {
76 $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
77 }
78
79 $nextClass = $this->ctrl->getNextClass();
80
81 $this->manageTabs($nextClass);
82
83 switch ($nextClass) {
84 case 'ilassquestionskillassignmentsgui':
85
86 $questionContainerId = $this->getQuestionContainerId();
87
88 $questionList = new ilAssQuestionList($this->db, $this->lng, $this->refinery, $this->component_repository);
89 $questionList->setParentObjId($questionContainerId);
90 $questionList->setQuestionInstanceTypeFilter($this->getRequiredQuestionInstanceTypeFilter());
91 $questionList->load();
92
93 $gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db);
94 $gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired());
95 $gui->setQuestionContainerId($questionContainerId);
96 $gui->setQuestionList($questionList);
97
98 if ($this->testOBJ->isFixedTest()) {
99 $gui->setQuestionOrderSequence($this->testOBJ->getQuestions());
100 } else {
101 $gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage());
102 }
103
104 $this->ctrl->forwardCommand($gui);
105
106 break;
107
108 case 'iltestskilllevelthresholdsgui':
109
110 $gui = new ilTestSkillLevelThresholdsGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->testOBJ->getTestId());
111 $gui->setQuestionAssignmentColumnsEnabled(!$this->testOBJ->isRandomTest());
112 $gui->setQuestionContainerId($this->getQuestionContainerId());
113 $this->ctrl->forwardCommand($gui);
114 break;
115 }
116 }
117
118 private function isAssignmentEditingRequired(): bool
119 {
120 if (!$this->testOBJ->isFixedTest()) {
121 return false;
122 }
123
124 if ($this->testOBJ->participantDataExist()) {
125 return false;
126 }
127
128 return true;
129 }
130
131 public function manageTabs($activeSubTabId)
132 {
133 $link = $this->ctrl->getLinkTargetByClass(
134 'ilAssQuestionSkillAssignmentsGUI',
136 );
137 $this->tabs->addSubTab(
138 'ilassquestionskillassignmentsgui',
139 $this->lng->txt('qpl_skl_sub_tab_quest_assign'),
140 $link
141 );
142
143 $link = $this->ctrl->getLinkTargetByClass(
144 'ilTestSkillLevelThresholdsGUI',
146 );
147 $this->tabs->addSubTab(
148 'iltestskilllevelthresholdsgui',
149 $this->lng->txt('tst_skl_sub_tab_thresholds'),
150 $link
151 );
152
153 $this->tabs->activateTab('tst_tab_competences');
154 $this->tabs->activateSubTab($activeSubTabId);
155 }
156
157 private function isAccessDenied(): bool
158 {
159 if (!$this->testOBJ->isSkillServiceEnabled()) {
160 return true;
161 }
162
164 return true;
165 }
166
167 if (!$this->access->checkAccess('write', '', $this->refId)) {
168 return true;
169 }
170
171 return false;
172 }
173
174 private function getQuestionContainerId(): ?int
175 {
176 if ($this->testOBJ->isDynamicTest()) {
177 $questionSetConfigFactory = new ilTestQuestionSetConfigFactory(
178 $this->tree,
179 $this->db,
180 $this->component_repository,
181 $this->testOBJ
182 );
183
184 $questionSetConfig = $questionSetConfigFactory->getQuestionSetConfig();
185
186 return $questionSetConfig->getSourceQuestionPoolId();
187 }
188
189 return $this->testOBJ->getId();
190 }
191
192 private function getRequiredQuestionInstanceTypeFilter(): ?string
193 {
194 if ($this->testOBJ->isDynamicTest()) {
196 }
197
198 if ($this->testOBJ->isRandomTest()) {
200 }
201
202 return null;
203 }
204
206 {
207 $questionSetConfigFactory = new ilTestQuestionSetConfigFactory(
208 $this->tree,
209 $this->db,
210 $this->component_repository,
211 $this->testOBJ
212 );
213
214 $questionSetConfig = $questionSetConfigFactory->getQuestionSetConfig();
215
216 if ($this->testOBJ->isRandomTest()) {
217 $testMode = $this->lng->txt('tst_question_set_type_random');
218 $poolLinks = $questionSetConfig->getCommaSeparatedSourceQuestionPoolLinks();
219
220 return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_rndquestset'), $testMode, $poolLinks);
221 }
222
223 return '';
224 }
225}
Builds data types.
Definition: Factory.php:21
Class ilCtrl provides processing control methods.
language handling
static isSkillManagementGloballyActivated()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ILIAS $ilias, ilCtrl $ctrl, ilAccessHandler $access, ilTabsGUI $tabs, ilGlobalTemplateInterface $tpl, ilLanguage $lng, Refinery $refinery, ilDBInterface $db, ilTree $tree, ilComponentRepository $component_repository, ilObjTest $testOBJ, $refId)
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...
Readable part of repository interface to ilComponentDataDB.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
header include for all ilias files.