ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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{
22 protected $rbacsystem;
23
27 protected $error;
28
32 protected $access;
33
37 protected $tabs;
38
44 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
45 {
46 global $DIC;
47
48 $this->rbacsystem = $DIC->rbac()->system();
49 $this->error = $DIC["ilErr"];
50 $this->access = $DIC->access();
51 $this->tabs = $DIC->tabs();
52 $this->tpl = $DIC["tpl"];
53 $this->lng = $DIC->language();
54 $this->ctrl = $DIC->ctrl();
55 $this->type = 'mobs';
56 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
57
58 $this->lng->loadLanguageModule('mob');
59 $this->lng->loadLanguageModule('mep');
60 $this->lng->loadLanguageModule('content');
61 }
62
69 public function executeCommand()
70 {
73 $ilAccess = $this->access;
74
75 $next_class = $this->ctrl->getNextClass($this);
76 $cmd = $this->ctrl->getCmd();
77
78 $this->prepareOutput();
79
80 if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
81 $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
82 }
83
84 switch ($next_class) {
85 case 'ilpermissiongui':
86 $this->tabs_gui->setTabActive('perm_settings');
87 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
88 $perm_gui = new ilPermissionGUI($this);
89 $ret = $this->ctrl->forwardCommand($perm_gui);
90 break;
91
92 default:
93 if (!$cmd || $cmd == 'view') {
94 $cmd = "editSettings";
95 }
96
97 $this->$cmd();
98 break;
99 }
100 return true;
101 }
102
109 public function getAdminTabs()
110 {
112 $ilAccess = $this->access;
113 $ilTabs = $this->tabs;
114
115 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
116 $ilTabs->addTarget(
117 "settings",
118 $this->ctrl->getLinkTarget($this, "editSettings"),
119 array("editSettings", "view")
120 );
121 }
122
123 if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
124 $ilTabs->addTarget(
125 "perm_settings",
126 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
127 array(),
128 'ilpermissiongui'
129 );
130 }
131 }
132
136 public function editSettings($a_omit_init = false)
137 {
139
140 if (!$a_omit_init) {
142 $this->getSettingsValues();
143 }
144 $tpl->setContent($this->form->getHTML());
145 }
146
150 public function saveSettings()
151 {
155
156 $this->checkPermission("write");
157
159 if ($this->form->checkInput()) {
160 // perform save
161 $mset = new ilSetting("mobs");
162 $mset->set("mep_activate_pages", $_POST["activate_pages"]);
163 $mset->set("file_manager_always", $_POST["file_manager_always"]);
164 $mset->set("restricted_file_types", $_POST["restricted_file_types"]);
165 $mset->set("black_list_file_types", $_POST["black_list_file_types"]);
166 $mset->set("upload_dir", $_POST["mob_upload_dir"]);
167
168 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
169 $ilCtrl->redirect($this, "editSettings");
170 }
171
172 $this->form->setValuesByPost();
173 $this->editSettings(true);
174 }
175
180 {
183 $ilAccess = $this->access;
184
185
186 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
187 $this->form = new ilPropertyFormGUI();
188
189 // activate page in media pool
190 $cb = new ilCheckboxInputGUI($lng->txt("mobs_activate_pages"), "activate_pages");
191 $cb->setInfo($lng->txt("mobs_activate_pages_info"));
192 $this->form->addItem($cb);
193
194 // activate page in media pool
195 $cb = new ilCheckboxInputGUI($lng->txt("mobs_always_show_file_manager"), "file_manager_always");
196 $cb->setInfo($lng->txt("mobs_always_show_file_manager_info"));
197 $this->form->addItem($cb);
198
199 // allowed file types
200 $ta = new ilTextAreaInputGUI($this->lng->txt("mobs_restrict_file_types"), "restricted_file_types");
201 //$ta->setCols();
202 //$ta->setRows();
203 $ta->setInfo($this->lng->txt("mobs_restrict_file_types_info"));
204 $this->form->addItem($ta);
205
206 // black lis file types
207 $ta = new ilTextAreaInputGUI($this->lng->txt("mobs_black_list_file_types"), "black_list_file_types");
208 $ta->setInfo($this->lng->txt("mobs_black_list_file_types_info"));
209 $this->form->addItem($ta);
210
211 // Upload dir for learning resources
212 $tx_prop = new ilTextInputGUI(
213 $lng->txt("mob_upload_dir"),
214 "mob_upload_dir"
215 );
216 $tx_prop->setInfo($lng->txt("mob_upload_dir_info"));
217 $this->form->addItem($tx_prop);
218
219 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
220 $this->form->addCommandButton("saveSettings", $lng->txt("save"));
221 }
222
223 $this->form->setTitle($lng->txt("settings"));
224 $this->form->setFormAction($ilCtrl->getFormAction($this));
225 }
226
230 public function getSettingsValues()
231 {
232 $values = array();
233
234 $mset = new ilSetting("mobs");
235 $values["activate_pages"] = $mset->get("mep_activate_pages");
236 $values["file_manager_always"] = $mset->get("file_manager_always");
237 $values["restricted_file_types"] = $mset->get("restricted_file_types");
238 $values["black_list_file_types"] = $mset->get("black_list_file_types");
239 $values["mob_upload_dir"] = $mset->get("upload_dir");
240
241 $this->form->setValuesByArray($values);
242 }
243}
$_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.
This class represents a text property in a property form.
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
global $DIC
Definition: saml.php:7
$values