ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilQuestionPoolSkillAdministrationGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use ILIAS\HTTP\Services as HTTP;
23use ILIAS\Refinery\Factory as Refinery;
29
39{
40 public function __construct(
41 private readonly ilCtrl $ctrl,
42 private readonly Factory $ui_factory,
43 private readonly Renderer $ui_renderer,
44 private readonly GlobalHttpState $http_state,
45 private readonly Refinery $refinery,
46 private readonly ilAccessHandler $access,
47 private readonly ilTabsGUI $tabs,
48 private readonly ilGlobalTemplateInterface $tpl,
49 private readonly ilLanguage $lng,
50 private readonly ilDBInterface $db,
51 private readonly ilComponentRepository $component_repository,
52 private readonly ilObjQuestionPool $pool_obj,
53 private readonly HTTP $http,
54 private readonly ilToolbarGUI $toolbar,
55 private readonly SkillUsageService $skill_usage_service,
56 private readonly RequestDataCollector $request_data_collector,
57 private readonly int $ref_id
58 ) {
59 }
60
61 private function isAccessDenied(): bool
62 {
63 return
64 !$this->pool_obj->isSkillServiceEnabled()
66 || !$this->access->checkAccess('write', '', $this->ref_id);
67 }
68
69 public function manageTabs($activeSubTabId): void
70 {
71 $link = $this->ctrl->getLinkTargetByClass(
72 ilAssQuestionSkillAssignmentsGUI::class,
74 );
75 $this->tabs->addSubTab(
76 strtolower(ilAssQuestionSkillAssignmentsGUI::class),
77 $this->lng->txt('qpl_skl_sub_tab_quest_assign'),
78 $link
79 );
80
81 $link = $this->ctrl->getLinkTargetByClass(
82 ilAssQuestionSkillUsagesGUI::class,
83 ilAssQuestionSkillUsagesGUI::CMD_SHOW
84 );
85 $this->tabs->addSubTab(
86 strtolower(ilAssQuestionSkillUsagesGUI::class),
87 $this->lng->txt('qpl_skl_sub_tab_usages'),
88 $link
89 );
90
91 $this->tabs->activateTab('qpl_tab_competences');
92 $this->tabs->activateSubTab($activeSubTabId);
93 }
94
95 public function executeCommand(): void
96 {
97 if ($this->isAccessDenied()) {
98 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_permission'), true);
99 $this->ctrl->setParameterByClass(ilObjQuestionPoolGUI::class, 'ref_id', $this->ref_id);
100 $this->ctrl->redirectByClass(ilObjQuestionPoolGUI::class);
101 }
102
103 $next_class = $this->ctrl->getNextClass();
104
105 $this->manageTabs($next_class);
106
107 switch (strtolower($next_class)) {
108 case strtolower(ilAssQuestionSkillAssignmentsGUI::class):
109 $question_list = new ilAssQuestionList($this->db, $this->lng, $this->refinery, $this->component_repository);
110 $question_list->setParentObjId($this->pool_obj->getId());
111 $question_list->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
112 $question_list->load();
113
115 $this->ctrl,
116 $this->access,
117 $this->tpl,
118 $this->lng,
119 $this->db,
120 $this->request_data_collector,
121 $this->skill_usage_service,
122 $this->ui_factory,
123 $this->ui_renderer,
124 $this->refinery,
125 $this->http,
126 $this->toolbar,
127 $this->tabs
128 );
129 $gui->setAssignmentEditingEnabled(true);
130 $gui->setQuestionContainerId($this->pool_obj->getId());
131 $gui->setQuestionList($question_list);
132
133 $this->ctrl->forwardCommand($gui);
134 break;
135
136 case strtolower(ilAssQuestionSkillUsagesGUI::class):
137 $this->ctrl->forwardCommand(
139 $this->ui_factory,
140 $this->ui_renderer,
141 $this->http_state,
142 $this->lng,
143 $this->tpl,
144 $this->db,
145 $this->pool_obj->getId()
146 )
147 );
148 break;
149 }
150 }
151}
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
Class ilCtrl provides processing control methods.
language handling
__construct(private readonly ilCtrl $ctrl, private readonly Factory $ui_factory, private readonly Renderer $ui_renderer, private readonly GlobalHttpState $http_state, private readonly Refinery $refinery, private readonly ilAccessHandler $access, private readonly ilTabsGUI $tabs, private readonly ilGlobalTemplateInterface $tpl, private readonly ilLanguage $lng, private readonly ilDBInterface $db, private readonly ilComponentRepository $component_repository, private readonly ilObjQuestionPool $pool_obj, private readonly HTTP $http, private readonly ilToolbarGUI $toolbar, private readonly SkillUsageService $skill_usage_service, private readonly RequestDataCollector $request_data_collector, private readonly int $ref_id)
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...
$http
Definition: deliver.php:30
Interface GlobalHttpState.
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.
Interface ilDBInterface.
$ref_id
Definition: ltiauth.php:66
static http()
Fetches the global http state from ILIAS.
global $lng
Definition: privfeed.php:31