ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjAccessibilitySettingsGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 include_once("./Services/Object/classes/class.ilObjectGUI.php");
4 
5 
18 {
22  protected $dic;
23 
27  protected $rbacsystem;
28 
32  protected $error;
33 
37  protected $access;
38 
42  protected $tabs;
43 
49  public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
50  {
51  global $DIC;
52 
53  $this->dic = $DIC;
54  $this->rbacsystem = $DIC->rbac()->system();
55  $this->error = $DIC["ilErr"];
56  $this->access = $DIC->access();
57  $this->tabs = $DIC->tabs();
58  $this->tpl = $DIC["tpl"];
59  $this->ctrl = $DIC->ctrl();
60  $this->lng = $DIC->language();
61  $this->type = 'accs';
62  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
63 
64  $this->lng->loadLanguageModule('acc');
65  $this->lng->loadLanguageModule('adm');
66  $this->lng->loadLanguageModule('meta');
67  }
68 
75  public function executeCommand()
76  {
79  $ilAccess = $this->access;
80 
81  $next_class = $this->ctrl->getNextClass($this);
82  $cmd = $this->ctrl->getCmd();
83 
84  $this->prepareOutput();
85 
86  if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) {
87  $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
88  }
89 
90  switch ($next_class) {
91  case 'ilpermissiongui':
92  $this->tabs_gui->setTabActive('perm_settings');
93  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
94  $perm_gui = new ilPermissionGUI($this);
95  $ret = $this->ctrl->forwardCommand($perm_gui);
96  break;
97 
98  case 'ilaccessibilitydocumentgui':
99  $this->tabs_gui->activateTab('acc_ctrl_cpt');
100 
101  $tableDataProviderFactory = new ilAccessibilityTableDataProviderFactory();
102  $tableDataProviderFactory->setDatabaseAdapter($this->dic->database());
103 
104  $documentGui = new ilAccessibilityDocumentGUI(
105  $this->object,
106  $this->dic['acc.criteria.type.factory'],
107  $this->dic->ui()->mainTemplate(),
108  $this->dic->user(),
109  $this->dic->ctrl(),
110  $this->dic->language(),
111  $this->dic->rbac()->system(),
112  $this->dic['ilErr'],
113  $this->dic->logger()->acc(),
114  $this->dic->toolbar(),
115  $this->dic->http(),
116  $this->dic->ui()->factory(),
117  $this->dic->ui()->renderer(),
118  $this->dic->filesystem(),
119  $this->dic->upload(),
120  $tableDataProviderFactory,
122  );
123 
124  $this->ctrl->forwardCommand($documentGui);
125  break;
126 
127  default:
128  if (!$cmd || $cmd == 'view') {
129  $cmd = "editAccessibilitySettings";
130  }
131 
132  $this->$cmd();
133  break;
134  }
135  return true;
136  }
137 
141  protected function getSettingsForm()
142  {
143  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
144  $this->form = new ilPropertyFormGUI();
145  $this->form->setTitle($this->lng->txt('settings'));
146 
147  $cb = new ilCheckboxInputGUI($this->lng->txt('adm_acc_ctrl_cpt_enable'), 'acc_ctrl_cpt_status');
148  $cb->setValue(1);
150  $cb->setInfo($this->lng->txt('adm_acc_ctrl_cpt_desc'));
151  $this->form->addItem($cb);
152 
153  $ti = new ilTextInputGUI($this->lng->txt("adm_accessibility_contacts"), "accessibility_support_contacts");
154  $ti->setMaxLength(500);
156  $ti->setInfo($this->lng->txt("adm_accessibility_contacts_info"));
157  $this->form->addItem($ti);
158 
159  $se = new ilFormSectionHeaderGUI();
160  $se ->setTitle($this->lng->txt('obj_accs_captcha'));
161  $this->form->addItem($se);
162 
163  require_once 'Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php';
166  $this->form,
167  $this
168  );
169 
170  $this->form->addCommandButton("saveAccessibilitySettings", $this->lng->txt("save"));
171  $this->form->setFormAction($this->ctrl->getFormAction($this));
172 
173  return $this->form;
174  }
175 
179  public function saveAccessibilitySettings()
180  {
181  $tpl = $this->tpl;
182  $lng = $this->lng;
186 
187  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
188  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
189  }
190 
191  $this->getSettingsForm();
192  if ($this->form->checkInput()) {
193  // Accessibility Control Concept status
194  ilObjAccessibilitySettings::saveControlConceptStatus((bool) $this->form->getInput('acc_ctrl_cpt_status'));
195  // Accessibility support contacts
196  ilAccessibilitySupportContacts::setList($_POST["accessibility_support_contacts"]);
197 
198  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
199  $ilCtrl->redirect($this, "editAccessibilitySettings");
200  } else {
201  $this->form->setValuesByPost();
202  $tpl->setContent($this->form->getHtml());
203  }
204  }
205 
209  protected function editAccessibilitySettings(ilPropertyFormGUI $form = null)
210  {
211  $this->tabs_gui->setTabActive('acc_settings');
212  if (!$form) {
213  $this->form = $this->getSettingsForm();
214  }
215 
216  $this->tpl->setContent($this->form->getHTML());
217  }
218 
225  public function getAdminTabs()
226  {
228  $ilAccess = $this->access;
229  $ilTabs = $this->tabs;
230 
231  if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
232  $ilTabs->addTab('acc_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'editAccessibilitySettings'));
233  }
234 
235  if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
236  $ilTabs->addTarget(
237  "acc_access_keys",
238  $this->ctrl->getLinkTarget($this, "editAccessKeys"),
239  array("editAccessKeys", "view")
240  );
241  }
242 
243  if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
244  $ilTabs->addTab(
245  'acc_ctrl_cpt',
246  $this->lng->txt('acc_ctrl_cpt_txt'),
247  $this->ctrl->getLinkTargetByClass('ilaccessibilitydocumentgui')
248  );
249  }
250 
251  if ($rbacsystem->checkAccess("edit_permission", $this->object->getRefId())) {
252  $ilTabs->addTarget(
253  "perm_settings",
254  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
255  array(),
256  'ilpermissiongui'
257  );
258  }
259  }
260 
264  public function editAccessKeys()
265  {
266  $tpl = $this->tpl;
267 
268  $this->tabs_gui->setTabActive('acc_access_keys');
269 
270  include_once("./Services/Accessibility/classes/class.ilAccessKeyTableGUI.php");
271  $table = new ilAccessKeyTableGUI($this, "editAccessKeys");
272 
273  $tpl->setContent($table->getHTML());
274  }
275 
279  public function saveAccessKeys()
280  {
282  $lng = $this->lng;
283  $ilAccess = $this->access;
284 
285  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
286  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
288  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
289  }
290  $ilCtrl->redirect($this, "editAccessKeys");
291  }
292 }
This class represents a property form user interface.
$_GET["client_id"]
Class ilAccessibilityDocumentHtmlPurifier.
This class represents a section header in a property form.
static writeKeys($a_keys, $a_lang_key="0")
Write keys.
This class represents a checkbox property in a property form.
TableGUI class for access keys.
static addFieldsToForm($a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
global $ilCtrl
Definition: ilias.php:18
prepareOutput($a_show_subobjects=true)
prepare output
Class ilObjectGUI Basic methods of all Output classes.
setValue($a_value)
Set Value.
editAccessibilitySettings(ilPropertyFormGUI $form=null)
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
saveAccessibilitySettings()
Save accessibility settings form.
__construct(Container $dic, ilPlugin $plugin)
$ret
Definition: parser.php:6
$DIC
Definition: xapitoken.php:46
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Class ilAccessibilityDocumentGUI.
$_POST["username"]