ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilMDSettingsControllerGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 protected const string OER_SETTINGS_TAB = 'md_oer_settings';
28 protected const string PUBLISHING_SETTINGS_TAB = 'publishing_settings';
29 protected const string COPYRIGHT_CONFIG_TAB = 'md_copyright_config';
30 protected const string VOCABULARIES_TAB = 'md_vocabularies';
31
32 protected ilCtrl $ctrl;
33 protected ilLanguage $lng;
37
39 {
40 global $DIC;
41
42 $this->ctrl = $DIC->ctrl();
43 $this->lng = $DIC->language();
44 $this->tabs_gui = $DIC->tabs();
45 $this->parent_obj_gui = $parent_obj_gui;
46
47 $this->access_service = new ilMDSettingsAccessService(
48 $this->parent_obj_gui->getRefId(),
49 $DIC->access()
50 );
51
52 $this->lng->loadLanguageModule("meta");
53 }
54
55 public function executeCommand(): void
56 {
57 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
59
60 $this->setTabs();
61
62 if (!$this->access_service->hasCurrentUserReadAccess()) {
63 throw new ilPermissionException($this->lng->txt('no_permission'));
64 }
65
66 switch ($next_class) {
67 case strtolower(ilMDCopyrightConfigurationGUI::class):
68 $this->tabs_gui->activateSubTab(self::COPYRIGHT_CONFIG_TAB);
69 $gui = new ilMDCopyrightConfigurationGUI($this->parent_obj_gui);
70 $this->ctrl->forwardCommand($gui);
71 break;
72
73 case strtolower(ilMDOERSettingsGUI::class):
74 $this->tabs_gui->activateSubTab(self::OER_SETTINGS_TAB);
75 $gui = new ilMDOERSettingsGUI($this->parent_obj_gui);
76 $this->ctrl->forwardCommand($gui);
77 break;
78
79 case strtolower(ilMDVocabulariesGUI::class):
80 $this->tabs_gui->activateSubTab(self::VOCABULARIES_TAB);
81 $gui = new ilMDVocabulariesGUI($this->parent_obj_gui);
82 $this->ctrl->forwardCommand($gui);
83 break;
84
85 case strtolower(ilMDPublishingSettingsGUI::class):
86 $this->tabs_gui->activateSubTab(self::PUBLISHING_SETTINGS_TAB);
87 $gui = new ilMDPublishingSettingsGUI($this->parent_obj_gui);
88 $this->ctrl->forwardCommand($gui);
89 break;
90
91 default:
92 $this->tabs_gui->activateSubTab(self::OER_SETTINGS_TAB);
93 $this->ctrl->redirectByClass(
94 ilMDOERSettingsGUI::class,
95 'showOERSettings'
96 );
97 break;
98 }
99 }
100
101 protected function setTabs(): void
102 {
103 if (!$this->access_service->hasCurrentUserReadAccess()) {
104 return;
105 }
106
107 $this->tabs_gui->addSubTab(
108 self::OER_SETTINGS_TAB,
109 $this->lng->txt('md_settings'),
110 $this->ctrl->getLinkTargetByClass(
111 ilMDOERSettingsGUI::class,
112 'showOERSettings'
113 )
114 );
115
116 $this->tabs_gui->addSubTab(
117 self::PUBLISHING_SETTINGS_TAB,
118 $this->lng->txt('md_publishing'),
119 $this->ctrl->getLinkTargetByClass(
120 ilMDPublishingSettingsGUI::class,
121 'showPublishingSettings'
122 )
123 );
124
125 $this->tabs_gui->addSubTab(
126 self::COPYRIGHT_CONFIG_TAB,
127 $this->lng->txt('md_copyright_selection'),
128 $this->ctrl->getLinkTargetByClass(
129 ilMDCopyrightConfigurationGUI::class,
130 'showCopyrightSelection'
131 )
132 );
133
134 $this->tabs_gui->addSubTab(
135 self::VOCABULARIES_TAB,
136 $this->lng->txt('md_vocabularies_config'),
137 $this->ctrl->getLinkTargetByClass(
138 ilMDVocabulariesGUI::class,
139 'showVocabularies'
140 )
141 );
142 }
143}
Class ilCtrl provides processing control methods.
language handling
@ilCtrl_Calls ilMDCopyrightConfigurationGUI: ilMDCopyrightUsageGUI, ilMDCopyrightImageUploadHandlerGU...
@ilCtrl_Calls ilMDPublishingSettingsGUI: ilPropertyFormGUI
@ilCtrl_Calls ilMDSettingsControllerGUI: ilMDCopyrightConfigurationGUI, ilMDOERSettingsGUI,...
ilMDSettingsAccessService $access_service
__construct(ilObjMDSettingsGUI $parent_obj_gui)
@ilCtrl_Calls ilMDVocabulariesGUI: ilMDVocabularyUploadHandlerGUI
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26