ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjWebResourceAdministrationGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "./Services/Object/classes/class.ilObjectGUI.php" ;
5 
17 {
18  public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
19  {
20  $this->type = "wbrs";
21  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
22 
23  $this->lng->loadLanguageModule("webr");
24  }
25 
26  public function executeCommand()
27  {
28  global $ilAccess, $ilErr;
29 
30  $next_class = $this->ctrl->getNextClass($this);
31  $cmd = $this->ctrl->getCmd();
32 
33  $this->prepareOutput();
34 
35  if (!$ilAccess->checkAccess("read", "", $this->object->getRefId())) {
36  $ilErr->raiseError($this->lng->txt("no_permission"), $ilErr->WARNING);
37  }
38 
39  switch ($next_class) {
40  case 'ilpermissiongui':
41  $this->tabs_gui->setTabActive("perm_settings");
42  include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
43  $perm_gui = new ilPermissionGUI($this);
44  $this->ctrl->forwardCommand($perm_gui);
45  break;
46 
47  default:
48  if (!$cmd || $cmd == "view") {
49  $cmd = "editSettings";
50  }
51  $this->$cmd();
52  break;
53  }
54  return true;
55  }
56 
57  public function getAdminTabs()
58  {
59  global $rbacsystem;
60 
61  if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
62  $this->tabs_gui->addTarget(
63  "settings",
64  $this->ctrl->getLinkTarget($this, "editSettings"),
65  array("editSettings", "view")
66  );
67  }
68 
69  if ($rbacsystem->checkAccess("edit_permission", $this->object->getRefId())) {
70  $this->tabs_gui->addTarget(
71  "perm_settings",
72  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"),
73  array(),
74  "ilpermissiongui"
75  );
76  }
77  }
78 
79  public function editSettings(ilObjPropertyFormGUI $a_form = null)
80  {
81  $this->tabs_gui->setTabActive('settings');
82 
83  if (!$a_form) {
84  $a_form = $this->initFormSettings();
85  }
86  $this->tpl->setContent($a_form->getHTML());
87  return true;
88  }
89 
90  public function saveSettings()
91  {
92  global $ilSetting;
93 
94  $this->checkPermission("write");
95 
96  $form = $this->initFormSettings();
97  if ($form->checkInput()) {
98  $ilSetting->set("links_dynamic", $form->getInput("links_dynamic"));
99 
100  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
101  $this->ctrl->redirect($this, "editSettings");
102  }
103 
104  $form->setValuesByPost();
105  $this->editSettings($form);
106  }
107 
108  protected function initFormSettings()
109  {
110  global $ilSetting, $ilAccess;
111 
112  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
113  $form = new ilPropertyFormGUI();
114  $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings"));
115  $form->setTitle($this->lng->txt("settings"));
116 
117  // dynamic web links
118  $cb = new ilCheckboxInputGUI($this->lng->txt("links_dynamic"), "links_dynamic");
119  $cb->setInfo($this->lng->txt("links_dynamic_info"));
120  $cb->setChecked($ilSetting->get("links_dynamic"));
121  $form->addItem($cb);
122 
123  if ($ilAccess->checkAccess("write", '', $this->object->getRefId())) {
124  $form->addCommandButton("saveSettings", $this->lng->txt("save"));
125  $form->addCommandButton("view", $this->lng->txt("cancel"));
126  }
127 
128  return $form;
129  }
130 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents a property form user interface.
This class represents a checkbox property in a property form.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
setInfo($a_info)
Set Information Text.
prepareOutput($a_show_subobjects=true)
prepare output
if(isset($_POST['submit'])) $form
Class ilObjectGUI Basic methods of all Output classes.
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.