ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 */
3 include_once("./Services/Object/classes/class.ilObjectGUI.php");
4 
5 
18 {
24  public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
25  {
26  $this->type = 'mobs';
27  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
28 
29  $this->lng->loadLanguageModule('mob');
30  $this->lng->loadLanguageModule('mep');
31  $this->lng->loadLanguageModule('content');
32  }
33 
40  public function executeCommand()
41  {
42  global $rbacsystem,$ilErr,$ilAccess;
43 
44  $next_class = $this->ctrl->getNextClass($this);
45  $cmd = $this->ctrl->getCmd();
46 
47  $this->prepareOutput();
48 
49  if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
50  {
51  $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
52  }
53 
54  switch($next_class)
55  {
56  case 'ilpermissiongui':
57  $this->tabs_gui->setTabActive('perm_settings');
58  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
59  $perm_gui = new ilPermissionGUI($this);
60  $ret = $this->ctrl->forwardCommand($perm_gui);
61  break;
62 
63  default:
64  if(!$cmd || $cmd == 'view')
65  {
66  $cmd = "editSettings";
67  }
68 
69  $this->$cmd();
70  break;
71  }
72  return true;
73  }
74 
81  public function getAdminTabs()
82  {
83  global $rbacsystem, $ilAccess, $ilTabs;
84 
85  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
86  {
87  $ilTabs->addTarget("settings",
88  $this->ctrl->getLinkTarget($this, "editSettings"),
89  array("editSettings", "view"));
90  }
91 
92  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
93  {
94  $ilTabs->addTarget("perm_settings",
95  $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
96  array(),'ilpermissiongui');
97  }
98  }
99 
103  function editSettings($a_omit_init = false)
104  {
105  global $tpl;
106 
107  if (!$a_omit_init)
108  {
110  $this->getSettingsValues();
111  }
112  $tpl->setContent($this->form->getHTML());
113  }
114 
118  public function saveSettings()
119  {
120  global $tpl, $lng, $ilCtrl;
121 
122  $this->checkPermission("write");
123 
125  if ($this->form->checkInput())
126  {
127  // perform save
128  $mset = new ilSetting("mobs");
129  $mset->set("mep_activate_pages", $_POST["activate_pages"]);
130  $mset->set("file_manager_always", $_POST["file_manager_always"]);
131  $mset->set("restricted_file_types", $_POST["restricted_file_types"]);
132  $mset->set("black_list_file_types", $_POST["black_list_file_types"]);
133  $mset->set("upload_dir", $_POST["mob_upload_dir"]);
134 
135  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
136  $ilCtrl->redirect($this, "editSettings");
137  }
138 
139  $this->form->setValuesByPost();
140  $this->editSettings(true);
141  }
142 
147  {
148  global $lng, $ilCtrl, $ilAccess;
149 
150 
151  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
152  $this->form = new ilPropertyFormGUI();
153 
154  // activate page in media pool
155  $cb = new ilCheckboxInputGUI($lng->txt("mobs_activate_pages"), "activate_pages");
156  $cb->setInfo($lng->txt("mobs_activate_pages_info"));
157  $this->form->addItem($cb);
158 
159  // activate page in media pool
160  $cb = new ilCheckboxInputGUI($lng->txt("mobs_always_show_file_manager"), "file_manager_always");
161  $cb->setInfo($lng->txt("mobs_always_show_file_manager_info"));
162  $this->form->addItem($cb);
163 
164  // allowed file types
165  $ta = new ilTextAreaInputGUI($this->lng->txt("mobs_restrict_file_types"), "restricted_file_types");
166  //$ta->setCols();
167  //$ta->setRows();
168  $ta->setInfo($this->lng->txt("mobs_restrict_file_types_info"));
169  $this->form->addItem($ta);
170 
171  // black lis file types
172  $ta = new ilTextAreaInputGUI($this->lng->txt("mobs_black_list_file_types"), "black_list_file_types");
173  $ta->setInfo($this->lng->txt("mobs_black_list_file_types_info"));
174  $this->form->addItem($ta);
175 
176  // Upload dir for learning resources
177  $tx_prop = new ilTextInputGUI($lng->txt("mob_upload_dir"),
178  "mob_upload_dir");
179  $tx_prop->setInfo($lng->txt("mob_upload_dir_info"));
180  $this->form->addItem($tx_prop);
181 
182  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
183  {
184  $this->form->addCommandButton("saveSettings", $lng->txt("save"));
185  }
186 
187  $this->form->setTitle($lng->txt("settings"));
188  $this->form->setFormAction($ilCtrl->getFormAction($this));
189  }
190 
194  public function getSettingsValues()
195  {
196  $values = array();
197 
198  $mset = new ilSetting("mobs");
199  $values["activate_pages"] = $mset->get("mep_activate_pages");
200  $values["file_manager_always"] = $mset->get("file_manager_always");
201  $values["restricted_file_types"] = $mset->get("restricted_file_types");
202  $values["black_list_file_types"] = $mset->get("black_list_file_types");
203  $values["mob_upload_dir"] = $mset->get("upload_dir");
204 
205  $this->form->setValuesByArray($values);
206  }
207 
208 }
209 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
ILIAS Setting Class.
getSettingsValues()
Get current values for form from.
This class represents a property form user interface.
initMediaObjectsSettingsForm()
Init media objects settings form.
$cmd
Definition: sahs_server.php:35
This class represents a checkbox property in a property form.
global $ilCtrl
Definition: ilias.php:18
editSettings($a_omit_init=false)
Edit settings.
setInfo($a_info)
Set Information Text.
prepareOutput($a_show_subobjects=true)
prepare output
Class ilObjectGUI Basic methods of all Output classes.
This class represents a text property in a property form.
Create styles array
The data for the language used.
This class represents a text area property in a property form.
$ret
Definition: parser.php:6
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
$_POST["username"]
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.