ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilTestSkillAdministrationGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\HTTP\Services as HTTP;
27use ILIAS\Refinery\Factory as Refinery;
30
41{
42 public function __construct(
43 private ilCtrlInterface $ctrl,
44 private ilAccessHandler $access,
45 private TabsManager $tabs_manager,
46 private ilGlobalTemplateInterface $tpl,
47 private ilLanguage $lng,
48 private Refinery $refinery,
49 private ilDBInterface $db,
50 private TestLogger $logger,
51 private ilTree $tree,
52 private ilComponentRepository $component_repository,
53 private ilObjTest $test_obj,
54 private GeneralQuestionPropertiesRepository $questionrepository,
55 private RequestDataCollector $request_data_collector,
56 private readonly HTTP $http,
57 private readonly ilToolbarGUI $toolbar,
58 private readonly SkillUsageService $skill_usage_service,
59 private readonly Factory $ui_factory,
60 private readonly Renderer $ui_renderer,
61 private readonly ilTabsGUI $tabs,
62 private int $ref_id
63 ) {
64 }
65
66 public function executeCommand()
67 {
68 if ($this->isAccessDenied()) {
69 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
70 $this->ctrl->setParameterByClass(ilObjTestGUI::class, 'ref_id', $this->ref_id);
71 $this->ctrl->redirectByClass(ilObjTestGUI::class);
72 }
73
74 $nextClass = $this->ctrl->getNextClass();
75
76 switch ($nextClass) {
77 case 'ilassquestionskillassignmentsgui':
78 $this->tabs_manager->getQuestionsSubTabs();
79 $this->tabs_manager->activateTab(TabsManager::TAB_ID_QUESTIONS);
80 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_ASSIGN_SKILLS_TO_QUESTIONS);
81
82 $questionContainerId = $this->test_obj->getId();
83
84 $questionList = new ilAssQuestionList($this->db, $this->lng, $this->refinery, $this->component_repository);
85 $questionList->setParentObjId($questionContainerId);
86 $questionList->setQuestionInstanceTypeFilter($this->getRequiredQuestionInstanceTypeFilter());
87 $questionList->load();
88
90 $this->ctrl,
91 $this->access,
92 $this->tpl,
93 $this->lng,
94 $this->db,
95 $this->request_data_collector,
96 $this->skill_usage_service,
97 $this->ui_factory,
98 $this->ui_renderer,
99 $this->refinery,
100 $this->http,
101 $this->toolbar,
102 $this->tabs,
103 $this->test_obj
104 );
105 $gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired());
106 $gui->setQuestionContainerId($questionContainerId);
107 $gui->setQuestionList($questionList);
108
109 if ($this->test_obj->isFixedTest()) {
110 $gui->setQuestionOrderSequence($this->test_obj->getQuestions());
111 } else {
112 $gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage());
113 }
114
115 $this->ctrl->forwardCommand($gui);
116
117 break;
118
119 case 'iltestskilllevelthresholdsgui':
120 $this->tabs_manager->getSettingsSubTabs();
121 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
122 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_ASSIGN_SKILL_TRESHOLDS);
123
125 $this->ctrl,
126 $this->tpl,
127 $this->lng,
128 $this->db,
129 $this->request_data_collector,
130 $this->test_obj->getTestId()
131 );
132 $gui->setQuestionAssignmentColumnsEnabled(!$this->test_obj->isRandomTest());
133 $gui->setQuestionContainerId($this->test_obj->getId());
134 $this->ctrl->forwardCommand($gui);
135 break;
136 }
137 }
138
139 private function isAssignmentEditingRequired(): bool
140 {
141 if (!$this->test_obj->isFixedTest()) {
142 return false;
143 }
144
145 if ($this->test_obj->participantDataExist()) {
146 return false;
147 }
148
149 return true;
150 }
151
152 private function isAccessDenied(): bool
153 {
154 if (!$this->test_obj->isSkillServiceEnabled()) {
155 return true;
156 }
157
159 return true;
160 }
161
162 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
163 return true;
164 }
165
166 return false;
167 }
168
169 private function getRequiredQuestionInstanceTypeFilter(): ?string
170 {
171 if ($this->test_obj->isRandomTest()) {
173 }
174
175 return null;
176 }
177
179 {
180 $question_set_config_factory = new ilTestQuestionSetConfigFactory(
181 $this->tree,
182 $this->db,
183 $this->lng,
184 $this->logger,
185 $this->component_repository,
186 $this->test_obj,
187 $this->questionrepository
188 );
189
190 $question_set_config = $question_set_config_factory->getQuestionSetConfig();
191
192 if ($this->test_obj->isRandomTest()) {
193 $testMode = $this->lng->txt('tst_question_set_type_random');
194 $poolLinks = $question_set_config->getCommaSeparatedSourceQuestionPoolLinks();
195
196 return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_rndquestset'), $testMode, $poolLinks);
197 }
198
199 return '';
200 }
201}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Builds data types.
Definition: Factory.php:36
Class Services.
Definition: Services.php:38
language handling
static isSkillManagementGloballyActivated()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(private ilCtrlInterface $ctrl, private ilAccessHandler $access, private TabsManager $tabs_manager, private ilGlobalTemplateInterface $tpl, private ilLanguage $lng, private Refinery $refinery, private ilDBInterface $db, private TestLogger $logger, private ilTree $tree, private ilComponentRepository $component_repository, private ilObjTest $test_obj, private GeneralQuestionPropertiesRepository $questionrepository, private RequestDataCollector $request_data_collector, private readonly HTTP $http, private readonly ilToolbarGUI $toolbar, private readonly SkillUsageService $skill_usage_service, private readonly Factory $ui_factory, private readonly Renderer $ui_renderer, private readonly ilTabsGUI $tabs, private int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
$http
Definition: deliver.php:30
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
Definition: Renderer.php:31
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
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.
$ref_id
Definition: ltiauth.php:66
static http()
Fetches the global http state from ILIAS.
global $lng
Definition: privfeed.php:31