ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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  {
57  $rbacsystem = $this->rbacsystem;
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(
84  $settings,
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  $this->form = new ilPropertyFormGUI();
119  $this->form->setTitle($this->lng->txt('settings'));
120 
121  $cb = new ilCheckboxInputGUI($this->lng->txt('adm_acc_ctrl_cpt_enable'), 'acc_ctrl_cpt_status');
122  $cb->setValue(1);
124  $cb->setInfo($this->lng->txt('adm_acc_ctrl_cpt_desc'));
125  $this->form->addItem($cb);
126 
127  $ti = new ilTextInputGUI($this->lng->txt("adm_accessibility_contacts"), "accessibility_support_contacts");
128  $ti->setMaxLength(500);
130  $ti->setInfo($this->lng->txt("adm_accessibility_contacts_info"));
131  $this->form->addItem($ti);
132 
135  $this->form,
136  $this
137  );
138 
139  $this->form->addCommandButton("saveAccessibilitySettings", $this->lng->txt("save"));
140  $this->form->setFormAction($this->ctrl->getFormAction($this));
141 
142  return $this->form;
143  }
144 
148  public function saveAccessibilitySettings(): void
149  {
150  $tpl = $this->tpl;
151  $lng = $this->lng;
152  $ilCtrl = $this->ctrl;
153  $rbacsystem = $this->rbacsystem;
154 
155  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
156  throw new ilPermissionException($this->lng->txt('permission_denied'));
157  }
158 
159  $this->getSettingsForm();
160  if ($this->form->checkInput()) {
161  // Accessibility Control Concept status
162  ilObjAccessibilitySettings::saveControlConceptStatus((bool) $this->form->getInput('acc_ctrl_cpt_status'));
163  // Accessibility support contacts
165  $this->form->getInput("accessibility_support_contacts")
166  );
167 
168  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
169  $ilCtrl->redirect($this, "editAccessibilitySettings");
170  } else {
171  $this->form->setValuesByPost();
172  $tpl->setContent($this->form->getHTML());
173  }
174  }
175 
176  protected function editAccessibilitySettings(ilPropertyFormGUI $form = null): void
177  {
178  $this->tabs_gui->setTabActive('acc_settings');
179  if (!$form) {
180  $this->form = $this->getSettingsForm();
181  }
182 
183  $this->tpl->setContent($this->form->getHTML());
184  }
185 
186  public function getAdminTabs(): void
187  {
188  $rbacsystem = $this->rbacsystem;
189  $ilTabs = $this->tabs;
190 
191  if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
192  $ilTabs->addTab('acc_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'editAccessibilitySettings'));
193  }
194 
195  if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
196  $ilTabs->addTab(
197  'acc_ctrl_cpt',
198  $this->lng->txt('acc_ctrl_cpt_txt'),
199  $this->ctrl->getLinkTargetByClass('ilaccessibilitydocumentgui')
200  );
201  }
202 
203  if ($rbacsystem->checkAccess("edit_permission", $this->object->getRefId())) {
204  $ilTabs->addTarget(
205  "perm_settings",
206  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
207  array(),
208  'ilpermissiongui'
209  );
210  }
211  }
212 }
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
prepareOutput(bool $show_sub_objects=true)
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...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 ...
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(VocabulariesInterface $vocabularies)
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
Class ilObjectGUI Basic methods of all Output classes.
editAccessibilitySettings(ilPropertyFormGUI $form=null)
saveAccessibilitySettings()
Save accessibility settings form.
form( $class_path, string $cmd, string $submit_caption="")
static addFieldsToForm(int $a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Class ilAccessibilityDocumentGUI.
ilSetting $settings
addTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
Add a Tab.