ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjMediaCastSettingsGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2009 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23include_once("./Services/Object/classes/class.ilObjectGUI.php");
24
25
38{
39 private static $ERROR_MESSAGE;
45 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
46 {
47 $this->type = 'mcts';
48 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
49
50 $this->lng->loadLanguageModule('mcst');
51 $this->initMediaCastSettings();
52 }
53
60 public function executeCommand()
61 {
62 global $rbacsystem,$ilErr,$ilAccess;
63
64 $next_class = $this->ctrl->getNextClass($this);
65 $cmd = $this->ctrl->getCmd();
66
67 $this->prepareOutput();
68
69 if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
70 {
71 $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
72 }
73
74 switch($next_class)
75 {
76 case 'ilpermissiongui':
77 $this->tabs_gui->setTabActive('perm_settings');
78 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
79 $perm_gui = new ilPermissionGUI($this);
80 $this->ctrl->forwardCommand($perm_gui);
81 break;
82
83 default:
84 if(!$cmd || $cmd == 'view')
85 {
86 $cmd = "editSettings";
87 }
88
89 $this->$cmd();
90 break;
91 }
92 return true;
93 }
94
101 public function getAdminTabs()
102 {
103 global $rbacsystem, $ilAccess;
104
105 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
106 {
107 $this->tabs_gui->addTarget("mcst_edit_settings",
108 $this->ctrl->getLinkTarget($this, "editSettings"),
109 array("editSettings", "view"));
110 }
111
112 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
113 {
114 $this->tabs_gui->addTarget("perm_settings",
115 $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
116 array(),'ilpermissiongui');
117 }
118 }
119
123 public function editSettings()
124 {
125 $this->tabs_gui->setTabActive('mcst_edit_settings');
126 $this->initFormSettings();
127 return true;
128 }
129
133 public function saveSettings()
134 {
135 global $ilCtrl, $ilAccess;
136
137 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
138 {
139 foreach ($this->settings->getPurposeSuffixes() as $purpose => $filetypes) {
140 $purposeSuffixes[$purpose] = explode(",", preg_replace("/[^\w,]/", "", strtolower($_POST[$purpose])));
141 }
142
143 $this->settings->setPurposeSuffixes($purposeSuffixes);
144 $this->settings->setDefaultAccess ($_POST["defaultaccess"]);
145 $this->settings->setMimeTypes (explode(",", $_POST["mimetypes"]));
146
147 $this->settings->save();
148
149 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
150 }
151
152 $ilCtrl->redirect($this, "view");
153 }
154
158 public function cancel()
159 {
160 global $ilCtrl;
161
162 $ilCtrl->redirect($this, "view");
163 }
164
169 protected function initMediaCastSettings()
170 {
171 include_once('Modules/MediaCast/classes/class.ilMediaCastSettings.php');
173 }
174
180 protected function initFormSettings()
181 {
182 global $lng, $ilAccess;
183 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
184
185 $form = new ilPropertyFormGUI();
186 $form->setFormAction($this->ctrl->getFormAction($this));
187 $form->setTitle($this->lng->txt('settings'));
188
189 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
190 {
191 $form->addCommandButton('saveSettings',$this->lng->txt('save'));
192 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
193 }
194
195 //Default Visibility
196 $radio_group = new ilRadioGroupInputGUI($lng->txt("mcst_default_visibility"), "defaultaccess");
197 $radio_option = new ilRadioOption($lng->txt("mcst_visibility_users"), "users");
198 $radio_group->addOption($radio_option);
199 $radio_option = new ilRadioOption($lng->txt("mcst_visibility_public"), "public");
200 $radio_group->addOption($radio_option);
201 $radio_group->setInfo($lng->txt("mcst_news_item_visibility_info"));
202 $radio_group->setRequired(false);
203 $radio_group->setValue($this->settings->getDefaultAccess());
204 #$ch->addSubItem($radio_group);
205 $form->addItem($radio_group);
206
207
208 foreach ($this->settings->getPurposeSuffixes() as $purpose => $filetypes)
209 {
210 if ($purpose != "VideoAlternative")
211 {
212 $text = new ilTextInputGUI($lng->txt("mcst_".strtolower($purpose)."_settings_title"),$purpose);
213 $text->setValue(implode(",",$filetypes));
214 $text->setInfo($lng->txt("mcst_".strtolower($purpose)."_settings_info"));
215 $form->addItem($text);
216 }
217 }
218
219 $text = new ilTextAreaInputGUI($lng->txt("mcst_mimetypes"), "mimetypes");
220 $text->setInfo($lng->txt("mcst_mimetypes_info"));
221 $text->setCols(120);
222 $text->setRows(10);
223 if (is_array($this->settings->getMimeTypes()))
224 $text->setValue(implode(",",$this->settings->getMimeTypes()));
225 $form->addItem($text);
226
227 $this->tpl->setContent($form->getHTML());
228 }
229}
230?>
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
static _getInstance()
get singleton instance
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
initFormSettings()
Init settings property form.
initMediaCastSettings()
iniitialize settings storage for media cast
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$text
global $ilCtrl
Definition: ilias.php:18
global $ilErr
Definition: raiseError.php:16
$cmd
Definition: sahs_server.php:35
settings()
Definition: settings.php:2