ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 {
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 $mset->set("upload_dir", $_POST["mob_upload_dir"]);
156
157 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
158 $ilCtrl->redirect($this, "editSettings");
159 }
160
161 $this->form->setValuesByPost();
162 $this->editSettings(true);
163 }
164
169 {
172 $ilAccess = $this->access;
173
174
175 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
176 $this->form = new ilPropertyFormGUI();
177
178 // activate page in media pool
179 $cb = new ilCheckboxInputGUI($lng->txt("mobs_activate_pages"), "activate_pages");
180 $cb->setInfo($lng->txt("mobs_activate_pages_info"));
181 $this->form->addItem($cb);
182
183 // activate page in media pool
184 $cb = new ilCheckboxInputGUI($lng->txt("mobs_always_show_file_manager"), "file_manager_always");
185 $cb->setInfo($lng->txt("mobs_always_show_file_manager_info"));
186 $this->form->addItem($cb);
187
188 // allowed file types
189 $ta = new ilTextAreaInputGUI($this->lng->txt("mobs_restrict_file_types"), "restricted_file_types");
190 //$ta->setCols();
191 //$ta->setRows();
192 $ta->setInfo($this->lng->txt("mobs_restrict_file_types_info"));
193 $this->form->addItem($ta);
194
195 // black lis file types
196 $ta = new ilTextAreaInputGUI($this->lng->txt("mobs_black_list_file_types"), "black_list_file_types");
197 $ta->setInfo($this->lng->txt("mobs_black_list_file_types_info"));
198 $this->form->addItem($ta);
199
200 // Upload dir for learning resources
201 $tx_prop = new ilTextInputGUI(
202 $lng->txt("mob_upload_dir"),
203 "mob_upload_dir"
204 );
205 $tx_prop->setInfo($lng->txt("mob_upload_dir_info"));
206 $this->form->addItem($tx_prop);
207
208 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
209 $this->form->addCommandButton("saveSettings", $lng->txt("save"));
210 }
211
212 $this->form->setTitle($lng->txt("settings"));
213 $this->form->setFormAction($ilCtrl->getFormAction($this));
214 }
215
219 public function getSettingsValues()
220 {
221 $values = array();
222
223 $mset = new ilSetting("mobs");
224 $values["activate_pages"] = $mset->get("mep_activate_pages");
225 $values["file_manager_always"] = $mset->get("file_manager_always");
226 $values["restricted_file_types"] = $mset->get("restricted_file_types");
227 $values["black_list_file_types"] = $mset->get("black_list_file_types");
228 $values["mob_upload_dir"] = $mset->get("upload_dir");
229
230 $this->form->setValuesByArray($values);
231 }
232}
$_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
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
$DIC
Definition: xapitoken.php:46