ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMDSettings.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  public static $instance = null;
36 
37  private $settings;
38  private $copyright_selection_active = false;
39 
46  private function __construct()
47  {
48  $this->read();
49  }
50 
59  public static function _getInstance()
60  {
61  if(self::$instance)
62  {
63  return self::$instance;
64  }
65  return self::$instance = new ilMDSettings();
66  }
67 
74  public function isCopyrightSelectionActive()
75  {
76  return $this->copyright_selection_active ? true : false;
77  }
78 
86  public function activateCopyrightSelection($a_status)
87  {
88  $this->copyright_selection_active = $a_status;
89  }
90 
96  function setDelimiter($a_val)
97  {
98  $this->delimiter = $a_val;
99  }
100 
106  function getDelimiter()
107  {
108  if (trim($this->delimiter) == "")
109  {
110  return ",";
111  }
112  return $this->delimiter;
113  }
114 
121  public function save()
122  {
123  $this->settings->set('copyright_selection_active',(int) $this->isCopyrightSelectionActive());
124  $this->settings->set('delimiter', $this->getDelimiter());
125  }
126 
133  private function read()
134  {
135  $this->settings = new ilSetting('md_settings');
136 
137  $this->copyright_selection_active = $this->settings->get('copyright_selection_active',0);
138  $this->delimiter = $this->settings->get('delimiter',",");
139  }
140 }
141 
142 
143 ?>