ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjAccessibilitySettingsGUI.php
Go to the documentation of this file.
1<?php
2
26{
29 protected \ILIAS\DI\Container $dic;
30 protected ilTabsGUI $tabs;
31
32 public function __construct(
33 $a_data,
34 int $a_id,
35 bool $a_call_by_reference = true,
36 bool $a_prepare_output = true
37 ) {
38 global $DIC;
39
40 $this->dic = $DIC;
41 $this->rbacsystem = $DIC->rbac()->system();
42 $this->access = $DIC->access();
43 $this->tabs = $DIC->tabs();
44 $this->tpl = $DIC["tpl"];
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $this->type = 'accs';
48 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
49
50 $this->lng->loadLanguageModule('acc');
51 $this->lng->loadLanguageModule('adm');
52 $this->lng->loadLanguageModule('meta');
53 }
54
55 public function executeCommand(): void
56 {
58
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
61
62 $this->prepareOutput();
63
64 if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) {
65 throw new ilPermissionException($this->lng->txt('no_permission'));
66 }
67
68 switch ($next_class) {
69 case 'ilpermissiongui':
70 $this->tabs_gui->setTabActive('perm_settings');
71 $perm_gui = new ilPermissionGUI($this);
72 $ret = $this->ctrl->forwardCommand($perm_gui);
73 break;
74
75 case 'ilaccessibilitydocumentgui':
76 $this->tabs_gui->activateTab('acc_ctrl_cpt');
77
78 $tableDataProviderFactory = new ilAccessibilityTableDataProviderFactory();
79 $tableDataProviderFactory->setDatabaseAdapter($this->dic->database());
80
83 $documentGui = new ilAccessibilityDocumentGUI(
85 $this->dic['acc.criteria.type.factory'],
86 $this->dic->ui()->mainTemplate(),
87 $this->dic->user(),
88 $this->dic->ctrl(),
89 $this->dic->language(),
90 $this->dic->rbac()->system(),
91 $this->dic['ilErr'],
92 $this->dic->logger()->acc(),
93 $this->dic->toolbar(),
94 $this->dic->http(),
95 $this->dic->ui()->factory(),
96 $this->dic->ui()->renderer(),
97 $this->dic->filesystem(),
98 $this->dic->upload(),
99 $tableDataProviderFactory,
101 );
102
103 $this->ctrl->forwardCommand($documentGui);
104 break;
105
106 default:
107 if (!$cmd || $cmd == 'view') {
108 $cmd = "editAccessibilitySettings";
109 }
110
111 $this->$cmd();
112 break;
113 }
114 }
115
116 protected function getSettingsForm(): ilPropertyFormGUI
117 {
118 $writable = $this->rbacsystem->checkAccess('write', $this->object->getRefId());
119
120 $this->form = new ilPropertyFormGUI();
121 $this->form->setTitle($this->lng->txt('settings'));
122
123 $cb = new ilCheckboxInputGUI($this->lng->txt('adm_acc_ctrl_cpt_enable'), 'acc_ctrl_cpt_status');
124 $cb->setValue(1);
126 $cb->setInfo($this->lng->txt('adm_acc_ctrl_cpt_desc'));
127 $cb->setDisabled(!$writable);
128 $this->form->addItem($cb);
129
130 $ti = new ilTextInputGUI($this->lng->txt("adm_accessibility_contacts"), "accessibility_support_contacts");
131 $ti->setMaxLength(500);
133 $ti->setInfo($this->lng->txt("adm_accessibility_contacts_info"));
134 $ti->setDisabled(!$writable);
135 $this->form->addItem($ti);
136
139 $this->form,
140 $this
141 );
142
143 if ($writable) {
144 $this->form->addCommandButton("saveAccessibilitySettings", $this->lng->txt("save"));
145 $this->form->setFormAction($this->ctrl->getFormAction($this));
146 }
147
148 return $this->form;
149 }
150
154 public function saveAccessibilitySettings(): void
155 {
158 $ilCtrl = $this->ctrl;
160
161 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
162 throw new ilPermissionException($this->lng->txt('permission_denied'));
163 }
164
165 $this->getSettingsForm();
166 if ($this->form->checkInput()) {
167 // Accessibility Control Concept status
168 ilObjAccessibilitySettings::saveControlConceptStatus((bool) $this->form->getInput('acc_ctrl_cpt_status'));
169 // Accessibility support contacts
171 $this->form->getInput("accessibility_support_contacts")
172 );
173
174 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
175 $ilCtrl->redirect($this, "editAccessibilitySettings");
176 } else {
177 $this->form->setValuesByPost();
178 $tpl->setContent($this->form->getHTML());
179 }
180 }
181
182 protected function editAccessibilitySettings(?ilPropertyFormGUI $form = null): void
183 {
184 $this->tabs_gui->setTabActive('acc_settings');
185 if (!$form) {
186 $this->form = $this->getSettingsForm();
187 }
188
189 $this->tpl->setContent($this->form->getHTML());
190 }
191
192 public function getAdminTabs(): void
193 {
195 $ilTabs = $this->tabs;
196
197 if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
198 $ilTabs->addTab('acc_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'editAccessibilitySettings'));
199 }
200
201 if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
202 $ilTabs->addTab(
203 'acc_ctrl_cpt',
204 $this->lng->txt('acc_ctrl_cpt_txt'),
205 $this->ctrl->getLinkTargetByClass('ilaccessibilitydocumentgui')
206 );
207 }
208
209 if ($rbacsystem->checkAccess("edit_permission", $this->object->getRefId())) {
210 $ilTabs->addTarget(
211 "perm_settings",
212 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
213 array(),
214 'ilpermissiongui'
215 );
216 }
217 }
218}
Class ilAccessibilityDocumentGUI.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static addFieldsToForm(int $a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
This class represents a checkbox property in a property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAdminTabs()
administration tabs show only permissions and trash folder
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
saveAccessibilitySettings()
Save accessibility settings form.
editAccessibilitySettings(?ilPropertyFormGUI $form=null)
Class ilObjectGUI Basic methods of all Output classes.
ilGlobalTemplateInterface $tpl
ilSetting $settings
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
This class represents a property form user interface.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
Add a Tab.
This class represents a text property in a property form.
setContent(string $a_html)
Sets content for standard template.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form( $class_path, string $cmd, string $submit_caption="")
global $DIC
Definition: shib_login.php:26