ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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 {
24  public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
25  {
26  $this->type = 'accs';
27  parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
28 
29  $this->lng->loadLanguageModule('acc');
30  }
31 
38  public function executeCommand()
39  {
40  global $rbacsystem,$ilErr,$ilAccess;
41 
42  $next_class = $this->ctrl->getNextClass($this);
43  $cmd = $this->ctrl->getCmd();
44 
45  $this->prepareOutput();
46 
47  if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
48  {
49  $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
50  }
51 
52  switch($next_class)
53  {
54  case 'ilpermissiongui':
55  $this->tabs_gui->setTabActive('perm_settings');
56  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
57  $perm_gui =& new ilPermissionGUI($this);
58  $ret =& $this->ctrl->forwardCommand($perm_gui);
59  break;
60 
61  default:
62  if(!$cmd || $cmd == 'view')
63  {
64  $cmd = "editAccessibilitySettings";
65  }
66 
67  $this->$cmd();
68  break;
69  }
70  return true;
71  }
72 
76  protected function getSettingsForm()
77  {
78  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
79  $form = new ilPropertyFormGUI();
80  $form->setTitle($this->lng->txt('settings'));
81 
82  require_once 'Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php';
85  $form,
86  $this
87  );
88 
89  return $form;
90  }
91 
95  protected function editAccessibilitySettings(ilPropertyFormGUI $form = null)
96  {
97  $this->tabs_gui->setTabActive('acc_settings');
98  if(!$form)
99  {
100  $form = $this->getSettingsForm();
101  }
102 
103  $this->tpl->setContent($form->getHTML());
104  }
105 
112  public function getAdminTabs()
113  {
114  global $rbacsystem, $ilAccess, $ilTabs;
115 
116  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
117  {
118  $ilTabs->addTab('acc_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'editAccessibilitySettings'));
119  }
120 
121  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
122  {
123  $ilTabs->addTarget("acc_access_keys",
124  $this->ctrl->getLinkTarget($this, "editAccessKeys"),
125  array("editAccessKeys", "view"));
126  }
127 
128  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
129  {
130  $ilTabs->addTarget("perm_settings",
131  $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
132  array(),'ilpermissiongui');
133  }
134  }
135 
139  function editAccessKeys()
140  {
141  global $tpl;
142 
143  $this->tabs_gui->setTabActive('acc_access_keys');
144 
145  include_once("./Services/Accessibility/classes/class.ilAccessKeyTableGUI.php");
146  $table = new ilAccessKeyTableGUI($this, "editAccessKeys");
147 
148  $tpl->setContent($table->getHTML());
149  }
150 
154  function saveAccessKeys()
155  {
156  global $ilCtrl, $lng, $ilAccess;
157 
158  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
159  {
160  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
162  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
163  }
164  $ilCtrl->redirect($this, "editAccessKeys");
165  }
166 }