ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjMediaObjectsSettingsGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3include_once("./Services/Object/classes/class.ilObjectGUI.php");
4
5
18{
19
23 protected $error;
24
28 protected $access;
29
33 protected $tabs;
34
40 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
41 {
42 global $DIC;
43 $this->error = $DIC["ilErr"];
44 $this->access = $DIC->access();
45 $this->tabs = $DIC->tabs();
46 $this->tpl = $DIC["tpl"];
47 $this->lng = $DIC->language();
48 $this->ctrl = $DIC->ctrl();
49 $this->type = 'mobs';
50 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
51
52 $this->lng->loadLanguageModule('mob');
53 $this->lng->loadLanguageModule('mep');
54 $this->lng->loadLanguageModule('content');
55 }
56
63 public function executeCommand()
64 {
65 $next_class = $this->ctrl->getNextClass($this);
66 $cmd = $this->ctrl->getCmd();
67
68 $this->prepareOutput();
69
70 if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
71 $this->error->raiseError($this->lng->txt('no_permission'), $this->error->WARNING);
72 }
73
74 switch ($next_class) {
75 case 'ilpermissiongui':
76 $this->tabs_gui->setTabActive('perm_settings');
77 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
78 $perm_gui = new ilPermissionGUI($this);
79 $ret = $this->ctrl->forwardCommand($perm_gui);
80 break;
81
82 default:
83 if (!$cmd || $cmd == 'view') {
84 $cmd = "editSettings";
85 }
86
87 $this->$cmd();
88 break;
89 }
90 return true;
91 }
92
99 public function getAdminTabs()
100 {
101 $ilAccess = $this->access;
102 $ilTabs = $this->tabs;
103
104 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
105 $ilTabs->addTarget(
106 "settings",
107 $this->ctrl->getLinkTarget($this, "editSettings"),
108 array("editSettings", "view")
109 );
110 }
111
112 if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
113 $ilTabs->addTarget(
114 "perm_settings",
115 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
116 array(),
117 'ilpermissiongui'
118 );
119 }
120 }
121
125 public function editSettings($a_omit_init = false)
126 {
128
129 if (!$a_omit_init) {
131 $this->getSettingsValues();
132 }
133 $tpl->setContent($this->form->getHTML());
134 }
135
139 public function saveSettings()
140 {
143 $ilCtrl = $this->ctrl;
144
145 $this->checkPermission("write");
146
148 if ($this->form->checkInput()) {
149 // perform save
150 $mset = new ilSetting("mobs");
151 $mset->set("mep_activate_pages", $_POST["activate_pages"]);
152 $mset->set("file_manager_always", $_POST["file_manager_always"]);
153 $mset->set("restricted_file_types", $_POST["restricted_file_types"]);
154 $mset->set("black_list_file_types", $_POST["black_list_file_types"]);
155
156 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
157 $ilCtrl->redirect($this, "editSettings");
158 }
159
160 $this->form->setValuesByPost();
161 $this->editSettings(true);
162 }
163
168 {
170 $ilCtrl = $this->ctrl;
171 $ilAccess = $this->access;
172
173
174 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
175 $this->form = new ilPropertyFormGUI();
176
177 // activate page in media pool
178 $cb = new ilCheckboxInputGUI($lng->txt("mobs_activate_pages"), "activate_pages");
179 $cb->setInfo($lng->txt("mobs_activate_pages_info"));
180 $this->form->addItem($cb);
181
182 // activate page in media pool
183 $cb = new ilCheckboxInputGUI($lng->txt("mobs_always_show_file_manager"), "file_manager_always");
184 $cb->setInfo($lng->txt("mobs_always_show_file_manager_info"));
185 $this->form->addItem($cb);
186
187 // allowed file types
188 $ta = new ilTextAreaInputGUI($this->lng->txt("mobs_restrict_file_types"), "restricted_file_types");
189 //$ta->setCols();
190 //$ta->setRows();
191 $ta->setInfo($this->lng->txt("mobs_restrict_file_types_info"));
192 $this->form->addItem($ta);
193
194 // black lis file types
195 $ta = new ilTextAreaInputGUI($this->lng->txt("mobs_black_list_file_types"), "black_list_file_types");
196 $ta->setInfo($this->lng->txt("mobs_black_list_file_types_info"));
197 $this->form->addItem($ta);
198
199 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
200 $this->form->addCommandButton("saveSettings", $lng->txt("save"));
201 }
202
203 $this->form->setTitle($lng->txt("settings"));
204 $this->form->setFormAction($ilCtrl->getFormAction($this));
205 }
206
210 public function getSettingsValues()
211 {
212 $values = array();
213
214 $mset = new ilSetting("mobs");
215 $values["activate_pages"] = $mset->get("mep_activate_pages");
216 $values["file_manager_always"] = $mset->get("file_manager_always");
217 $values["restricted_file_types"] = $mset->get("restricted_file_types");
218 $values["black_list_file_types"] = $mset->get("black_list_file_types");
219
220 $this->form->setValuesByArray($values);
221 }
222}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
This class represents a checkbox property in a property form.
editSettings($a_omit_init=false)
Edit settings.
initMediaObjectsSettingsForm()
Init media objects settings form.
getSettingsValues()
Get current values for form from.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
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.
ILIAS Setting Class.
This class represents a text area property in a property form.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6