ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4include_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::ilObjectGUI($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 {
37 $ilErr->raiseError($this->lng->txt("no_permission"), $ilErr->WARNING);
38 }
39
40 switch($next_class)
41 {
42 case 'ilpermissiongui':
43 $this->tabs_gui->setTabActive("perm_settings");
44 include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
45 $perm_gui = new ilPermissionGUI($this);
46 $this->ctrl->forwardCommand($perm_gui);
47 break;
48
49 default:
50 if(!$cmd || $cmd == "view")
51 {
52 $cmd = "editSettings";
53 }
54 $this->$cmd();
55 break;
56 }
57 return true;
58 }
59
60 public function getAdminTabs()
61 {
62 global $rbacsystem;
63
64 if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId()))
65 {
66 $this->tabs_gui->addTarget("settings",
67 $this->ctrl->getLinkTarget($this, "editSettings"),
68 array("editSettings", "view"));
69 }
70
71 if ($rbacsystem->checkAccess("edit_permission", $this->object->getRefId()))
72 {
73 $this->tabs_gui->addTarget("perm_settings",
74 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"),
75 array(), "ilpermissiongui");
76 }
77 }
78
79 public function editSettings(ilObjPropertyFormGUI $a_form = null)
80 {
81 $this->tabs_gui->setTabActive('settings');
82
83 if(!$a_form)
84 {
85 $a_form = $this->initFormSettings();
86 }
87 $this->tpl->setContent($a_form->getHTML());
88 return true;
89 }
90
91 public function saveSettings()
92 {
93 global $ilSetting;
94
95 $this->checkPermission("write");
96
97 $form = $this->initFormSettings();
98 if($form->checkInput())
99 {
100 $ilSetting->set("links_dynamic", $form->getInput("links_dynamic"));
101
102 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
103 $this->ctrl->redirect($this, "editSettings");
104 }
105
106 $form->setValuesByPost();
107 $this->editSettings($form);
108 }
109
110 protected function initFormSettings()
111 {
112 global $ilSetting, $ilAccess;
113
114 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
115 $form = new ilPropertyFormGUI();
116 $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings"));
117 $form->setTitle($this->lng->txt("settings"));
118
119 // dynamic web links
120 $cb = new ilCheckboxInputGUI($this->lng->txt("links_dynamic"), "links_dynamic");
121 $cb->setInfo($this->lng->txt("links_dynamic_info"));
122 $cb->setChecked($ilSetting->get("links_dynamic"));
123 $form->addItem($cb);
124
125 if ($ilAccess->checkAccess("write",'',$this->object->getRefId()))
126 {
127 $form->addCommandButton("saveSettings", $this->lng->txt("save"));
128 $form->addCommandButton("view", $this->lng->txt("cancel"));
129 }
130
131 return $form;
132 }
133}
134
135?>
This class represents a checkbox property in a property form.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput()
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35