ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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::ilObjectGUI($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 $ret =& $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;
136 foreach ($this->settings->getPurposeSuffixes() as $purpose => $filetypes) {
137 $purposeSuffixes[$purpose] = explode(",", preg_replace("/[^\w,]/", "", strtolower($_POST[$purpose])));
138 }
139
140 $this->settings->setPurposeSuffixes($purposeSuffixes);
141 $this->settings->setDefaultAccess ($_POST["defaultaccess"]);
142 $this->settings->setMimeTypes (explode(",", $_POST["mimetypes"]));
143
144 $this->settings->save();
145
146 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
147
148 $ilCtrl->redirect($this, "view");
149 }
150
154 public function cancel()
155 {
156 global $ilCtrl;
157
158 $ilCtrl->redirect($this, "view");
159 }
160
165 protected function initMediaCastSettings()
166 {
167 include_once('Modules/MediaCast/classes/class.ilMediaCastSettings.php');
168 $this->settings = ilMediaCastSettings::_getInstance();
169 }
170
176 protected function initFormSettings()
177 {
178 global $lng;
179 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
180
181 $form = new ilPropertyFormGUI();
182 $form->setFormAction($this->ctrl->getFormAction($this));
183 $form->setTitle($this->lng->txt('settings'));
184 $form->addCommandButton('saveSettings',$this->lng->txt('save'));
185 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
186
187 //Default Visibility
188 $radio_group = new ilRadioGroupInputGUI($lng->txt("mcst_default_visibility"), "defaultaccess");
189 $radio_option = new ilRadioOption($lng->txt("mcst_visibility_users"), "users");
190 $radio_group->addOption($radio_option);
191 $radio_option = new ilRadioOption($lng->txt("mcst_visibility_public"), "public");
192 $radio_group->addOption($radio_option);
193 $radio_group->setInfo($lng->txt("mcst_news_item_visibility_info"));
194 $radio_group->setRequired(false);
195 $radio_group->setValue($this->settings->getDefaultAccess());
196 #$ch->addSubItem($radio_group);
197 $form->addItem($radio_group);
198
199
200 foreach ($this->settings->getPurposeSuffixes() as $purpose => $filetypes)
201 {
202 if ($purpose != "VideoAlternative")
203 {
204 $text = new ilTextInputGUI($lng->txt("mcst_".strtolower($purpose)."_settings_title"),$purpose);
205 $text->setValue(implode(",",$filetypes));
206 $text->setInfo($lng->txt("mcst_".strtolower($purpose)."_settings_info"));
207 $form->addItem($text);
208 }
209 }
210
211 $text = new ilTextAreaInputGUI($lng->txt("mcst_mimetypes"), "mimetypes");
212 $text->setInfo($lng->txt("mcst_mimetypes_info"));
213 $text->setCols(120);
214 $text->setRows(10);
215 if (is_array($this->settings->getMimeTypes()))
216 $text->setValue(implode(",",$this->settings->getMimeTypes()));
217 $form->addItem($text);
218
219 $this->tpl->setContent($form->getHTML());
220 }
221}
222?>
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()
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.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35