ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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::__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 $next_class = $this->ctrl->getNextClass($this);
29 $cmd = $this->ctrl->getCmd();
30
31 $this->prepareOutput();
32
33 if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
34 $this->ilErr->raiseError($this->lng->txt("no_permission"), $this->ilErr->WARNING);
35 }
36
37 switch ($next_class) {
38 case 'ilpermissiongui':
39 $this->tabs_gui->setTabActive("perm_settings");
40 include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
41 $perm_gui = new ilPermissionGUI($this);
42 $this->ctrl->forwardCommand($perm_gui);
43 break;
44
45 default:
46 if (!$cmd || $cmd == "view") {
47 $cmd = "editSettings";
48 }
49 $this->$cmd();
50 break;
51 }
52 return true;
53 }
54
55 public function getAdminTabs()
56 {
57 global $DIC;
58
59 $rbacsystem = $DIC['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 $DIC;
93
94 $ilSetting = $DIC['ilSetting'];
95
96 $this->checkPermission("write");
97
98 $form = $this->initFormSettings();
99 if ($form->checkInput()) {
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 $DIC;
113
114 $ilSetting = $DIC['ilSetting'];
115 $ilAccess = $DIC['ilAccess'];
116
117 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
118 $form = new ilPropertyFormGUI();
119 $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings"));
120 $form->setTitle($this->lng->txt("settings"));
121
122 // dynamic web links
123 $cb = new ilCheckboxInputGUI($this->lng->txt("links_dynamic"), "links_dynamic");
124 $cb->setInfo($this->lng->txt("links_dynamic_info"));
125 $cb->setChecked($ilSetting->get("links_dynamic"));
126 $form->addItem($cb);
127
128 if ($ilAccess->checkAccess("write", '', $this->object->getRefId())) {
129 $form->addCommandButton("saveSettings", $this->lng->txt("save"));
130 $form->addCommandButton("view", $this->lng->txt("cancel"));
131 }
132
133 return $form;
134 }
135}
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
getAdminTabs()
administration tabs show only permissions and trash folder
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($a_show_subobjects=true)
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46