ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 );
104 $gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired());
105 $gui->setQuestionContainerId($questionContainerId);
106 $gui->setQuestionList($questionList);
107
108 if ($this->test_obj->isFixedTest()) {
109 $gui->setQuestionOrderSequence($this->test_obj->getQuestions());
110 } else {
111 $gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage());
112 }
113
114 $this->ctrl->forwardCommand($gui);
115
116 break;
117
118 case 'iltestskilllevelthresholdsgui':
119 $this->tabs_manager->getSettingsSubTabs();
120 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
121 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_ASSIGN_SKILL_TRESHOLDS);
122
124 $this->ctrl,
125 $this->tpl,
126 $this->lng,
127 $this->db,
128 $this->request_data_collector,
129 $this->test_obj->getTestId()
130 );
131 $gui->setQuestionAssignmentColumnsEnabled(!$this->test_obj->isRandomTest());
132 $gui->setQuestionContainerId($this->test_obj->getId());
133 $this->ctrl->forwardCommand($gui);
134 break;
135 }
136 }
137
138 private function isAssignmentEditingRequired(): bool
139 {
140 if (!$this->test_obj->isFixedTest()) {
141 return false;
142 }
143
144 if ($this->test_obj->participantDataExist()) {
145 return false;
146 }
147
148 return true;
149 }
150
151 private function isAccessDenied(): bool
152 {
153 if (!$this->test_obj->isSkillServiceEnabled()) {
154 return true;
155 }
156
158 return true;
159 }
160
161 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
162 return true;
163 }
164
165 return false;
166 }
167
168 private function getRequiredQuestionInstanceTypeFilter(): ?string
169 {
170 if ($this->test_obj->isRandomTest()) {
172 }
173
174 return null;
175 }
176
178 {
179 $question_set_config_factory = new ilTestQuestionSetConfigFactory(
180 $this->tree,
181 $this->db,
182 $this->lng,
183 $this->logger,
184 $this->component_repository,
185 $this->test_obj,
186 $this->questionrepository
187 );
188
189 $question_set_config = $question_set_config_factory->getQuestionSetConfig();
190
191 if ($this->test_obj->isRandomTest()) {
192 $testMode = $this->lng->txt('tst_question_set_type_random');
193 $poolLinks = $question_set_config->getCommaSeparatedSourceQuestionPoolLinks();
194
195 return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_rndquestset'), $testMode, $poolLinks);
196 }
197
198 return '';
199 }
200}
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