ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSParticipantSettings.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 
33 {
34  private static $instance = null;
35  protected $storage = null;
36 
37  protected $enabled = array();
38  protected $all_enabled = array();
39 
40 
41 
48  private function __construct()
49  {
50  $this->initStorage();
51  $this->read();
52  }
53 
61  public static function _getInstance()
62  {
63  if(self::$instance)
64  {
65  return self::$instance;
66  }
67  return self::$instance = new ilECSParticipantSettings();
68  }
69 
76  public function getEnabledParticipants()
77  {
78  return $this->enabled ? $this->enabled : array();
79  }
80 
88  public function isEnabled($a_mid)
89  {
90  return in_array($a_mid,$this->enabled);
91  }
92 
100  public function setEnabledParticipants($a_parts)
101  {
102  $this->enabled = (array) $a_parts;
103  }
104 
111  public function save()
112  {
113  $this->storage->set('enabled',addslashes(serialize($this->enabled)));
114  }
115 
121  private function initStorage()
122  {
123  include_once('./Services/Administration/classes/class.ilSetting.php');
124  $this->storage = new ilSetting('ecs_participants');
125  }
126 
134  private function read()
135  {
136  $enabled = $this->storage->get('enabled');
137  if($enabled)
138  {
139  $this->enabled = unserialize(stripslashes($enabled));
140  }
141  }
142 
143 }
144 
145 
146 ?>