ILIAS  release_8 Revision v8.23
class.ilObjAccessibilitySettingsGUI.php
Go to the documentation of this file.
1 <?php
2 
26 {
28  protected \ILIAS\DI\Container $dic;
29  protected ilTabsGUI $tabs;
30 
31  public function __construct(
32  $a_data,
33  int $a_id,
34  bool $a_call_by_reference = true,
35  bool $a_prepare_output = true
36  ) {
37  global $DIC;
38 
39  $this->dic = $DIC;
40  $this->rbacsystem = $DIC->rbac()->system();
41  $this->access = $DIC->access();
42  $this->tabs = $DIC->tabs();
43  $this->tpl = $DIC["tpl"];
44  $this->ctrl = $DIC->ctrl();
45  $this->lng = $DIC->language();
46  $this->type = 'accs';
47  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
48 
49  $this->lng->loadLanguageModule('acc');
50  $this->lng->loadLanguageModule('adm');
51  $this->lng->loadLanguageModule('meta');
52  }
53 
54  public function executeCommand(): void
55  {
56  $rbacsystem = $this->rbacsystem;
57 
58  $next_class = $this->ctrl->getNextClass($this);
59  $cmd = $this->ctrl->getCmd();
60 
61  $this->prepareOutput();
62 
63  if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) {
64  throw new ilPermissionException($this->lng->txt('no_permission'));
65  }
66 
67  switch ($next_class) {
68  case 'ilpermissiongui':
69  $this->tabs_gui->setTabActive('perm_settings');
70  $perm_gui = new ilPermissionGUI($this);
71  $ret = $this->ctrl->forwardCommand($perm_gui);
72  break;
73 
74  case 'ilaccessibilitydocumentgui':
75  $this->tabs_gui->activateTab('acc_ctrl_cpt');
76 
77  $tableDataProviderFactory = new ilAccessibilityTableDataProviderFactory();
78  $tableDataProviderFactory->setDatabaseAdapter($this->dic->database());
79 
82  $documentGui = new ilAccessibilityDocumentGUI(
83  $settings,
84  $this->dic['acc.criteria.type.factory'],
85  $this->dic->ui()->mainTemplate(),
86  $this->dic->user(),
87  $this->dic->ctrl(),
88  $this->dic->language(),
89  $this->dic->rbac()->system(),
90  $this->dic['ilErr'],
91  $this->dic->logger()->acc(),
92  $this->dic->toolbar(),
93  $this->dic->http(),
94  $this->dic->ui()->factory(),
95  $this->dic->ui()->renderer(),
96  $this->dic->filesystem(),
97  $this->dic->upload(),
98  $tableDataProviderFactory,
100  );
101 
102  $this->ctrl->forwardCommand($documentGui);
103  break;
104 
105  default:
106  if (!$cmd || $cmd == 'view') {
107  $cmd = "editAccessibilitySettings";
108  }
109 
110  $this->$cmd();
111  break;
112  }
113  }
114 
115  protected function getSettingsForm(): ilPropertyFormGUI
116  {
117  $this->form = new ilPropertyFormGUI();
118  $this->form->setTitle($this->lng->txt('settings'));
119 
120  $cb = new ilCheckboxInputGUI($this->lng->txt('adm_acc_ctrl_cpt_enable'), 'acc_ctrl_cpt_status');
121  $cb->setValue(1);
123  $cb->setInfo($this->lng->txt('adm_acc_ctrl_cpt_desc'));
124  $this->form->addItem($cb);
125 
126  $ti = new ilTextInputGUI($this->lng->txt("adm_accessibility_contacts"), "accessibility_support_contacts");
127  $ti->setMaxLength(500);
129  $ti->setInfo($this->lng->txt("adm_accessibility_contacts_info"));
130  $this->form->addItem($ti);
131 
134  $this->form,
135  $this
136  );
137 
138  $this->form->addCommandButton("saveAccessibilitySettings", $this->lng->txt("save"));
139  $this->form->setFormAction($this->ctrl->getFormAction($this));
140 
141  return $this->form;
142  }
143 
147  public function saveAccessibilitySettings(): void
148  {
149  $tpl = $this->tpl;
150  $lng = $this->lng;
151  $ilCtrl = $this->ctrl;
152  $rbacsystem = $this->rbacsystem;
153 
154  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
155  throw new ilPermissionException($this->lng->txt('permission_denied'));
156  }
157 
158  $this->getSettingsForm();
159  if ($this->form->checkInput()) {
160  // Accessibility Control Concept status
161  ilObjAccessibilitySettings::saveControlConceptStatus((bool) $this->form->getInput('acc_ctrl_cpt_status'));
162  // Accessibility support contacts
164  $this->form->getInput("accessibility_support_contacts")
165  );
166 
167  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
168  $ilCtrl->redirect($this, "editAccessibilitySettings");
169  } else {
170  $this->form->setValuesByPost();
171  $tpl->setContent($this->form->getHTML());
172  }
173  }
174 
175  protected function editAccessibilitySettings(ilPropertyFormGUI $form = null): void
176  {
177  $this->tabs_gui->setTabActive('acc_settings');
178  if (!$form) {
179  $this->form = $this->getSettingsForm();
180  }
181 
182  $this->tpl->setContent($this->form->getHTML());
183  }
184 
185  public function getAdminTabs(): void
186  {
187  $rbacsystem = $this->rbacsystem;
188  $ilTabs = $this->tabs;
189 
190  if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
191  $ilTabs->addTab('acc_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'editAccessibilitySettings'));
192  }
193 
194  if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
195  $ilTabs->addTab(
196  'acc_ctrl_cpt',
197  $this->lng->txt('acc_ctrl_cpt_txt'),
198  $this->ctrl->getLinkTargetByClass('ilaccessibilitydocumentgui')
199  );
200  }
201 
202  if ($rbacsystem->checkAccess("edit_permission", $this->object->getRefId())) {
203  $ilTabs->addTarget(
204  "perm_settings",
205  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
206  array(),
207  'ilpermissiongui'
208  );
209  }
210  }
211 }
__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 class represents a checkbox property in a property form.
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...
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
Class ilObjectGUI Basic methods of all Output classes.
form( $class_path, string $cmd)
editAccessibilitySettings(ilPropertyFormGUI $form=null)
saveAccessibilitySettings()
Save accessibility settings form.
__construct(Container $dic, ilPlugin $plugin)
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.