ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMediaCastSettings.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 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 */
23 
34 {
35  private static $instance = null;
36  private $defaultAccess = "users";
37  private $purposeSuffixes = array();
38 
45  private function __construct()
46  {
47  $this->initStorage();
48  $this->read();
49  }
50 
58  public static function _getInstance()
59  {
60  if(self::$instance)
61  {
62  return self::$instance;
63  }
64  return self::$instance = new ilMediaCastSettings();
65  }
66 
73  public function setPurposeSuffixes($purpose_filetypes)
74  {
75  $this->purposeSuffixes = $purpose_filetypes;
76  }
77 
84  public function getPurposeSuffixes()
85  {
87  }
88 
89  public function getDefaultAccess() {
90  return $this->defaultAccess;
91  }
92 
93  public function setDefaultAccess($value) {
94  $this->defaultAccess = $value == "users" ? "users" : "public";
95  }
96 
102  public function save()
103  {
104  foreach ($this->purposeSuffixes as $purpose => $filetypes) {
105  $this->storage->set($purpose . "_types", implode(",",$filetypes));
106  }
107  $this->storage->set("defaultaccess",$this->defaultAccess);
108  }
109 
117  private function read()
118  {
119  foreach ($this->purposeSuffixes as $purpose => $filetypes) {
120  if ($this->storage->get($purpose."_types") != false) {
121  $this->purposeSuffixes[$purpose] = explode(",",$this->storage->get($purpose."_types"));
122  }
123  }
124  $this->setDefaultAccess($this->storage->get("defaultaccess"));
125  }
126 
132  private function initStorage()
133  {
134  include_once('./Services/Administration/classes/class.ilSetting.php');
135  $this->storage = new ilSetting('mcst');
136  include_once('./Modules/MediaCast/classes/class.ilObjMediaCast.php');
137  $this->purposeSuffixes = array_flip(ilObjMediaCast::$purposes);
138 
139  $this->purposeSuffixes["Standard"] = array("mp3","flv","mp4","m4v","mov","wmv","gif","png");
140  $this->purposeSuffixes["AudioPortable"] = array("mp3");
141  $this->purposeSuffixes["VideoPortable"] = array("mp4","m4v","mov");
142  $this->setDefaultAccess("users");
143  }
144 }
145 ?>