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