ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPrivacySettings.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 
35 {
36  private static $instance = null;
37  private $db;
38  private $settings;
39 
40  private $export_course;
41  private $export_confirm;
43  private $anonymous_fora;
46  private $ref_id;
47 
55  private function __construct()
56  {
57  global $ilSetting,$ilDB;
58 
59  $this->db = $ilDB;
60  $this->settings = $ilSetting;
61 
62  $this->read();
63  }
64 
71  public function _getInstance()
72  {
73  if(is_object(self::$instance))
74  {
75  return self::$instance;
76  }
77  return self::$instance = new ilPrivacySettings();
78  }
79 
80  public function getPrivacySettingsRefId()
81  {
82  return $this->ref_id;
83  }
84 
85  public function enabledExport()
86  {
87  return $this->export_course;
88  }
89  public function enableExport($a_status)
90  {
91  $this->export_course = (bool) $a_status;
92  }
93 
94 
99  public function enableForaStatistics ($a_status)
100  {
101  $this->fora_statistics = (bool) $a_status;
102  }
103 
108  public function enabledForaStatistics ()
109  {
110  return $this->fora_statistics;
111  }
112 
117  public function disableAnonymousFora ($a_status)
118  {
119  $this->anonymous_fora = (bool) $a_status;
120  }
121 
126  public function disabledAnonymousFora ()
127  {
128  return $this->anonymous_fora;
129  }
130 
131  public function confirmationRequired()
132  {
133  return $this->export_confirm;
134  }
135 
136  public function setConfirmationRequired($a_status)
137  {
138  $this->export_confirm = (bool) $a_status;
139  }
140 
148  public function showGroupAccessTimes($a_status)
149  {
150  $this->show_grp_access_times = $a_status;
151  }
152 
159  public function enabledGroupAccessTimes()
160  {
161  return (bool) $this->show_grp_access_times;
162  }
163 
171  public function showCourseAccessTimes($a_status)
172  {
173  $this->show_crs_access_times = $a_status;
174  }
175 
182  public function enabledCourseAccessTimes()
183  {
184  return (bool) $this->show_crs_access_times;
185  }
186 
192  public function save()
193  {
194  $this->settings->set('ps_export_confirm',(bool) $this->confirmationRequired());
195  $this->settings->set('ps_export_course',(bool) $this->enabledExport());
196  $this->settings->set('enable_fora_statistics',(bool) $this->enabledForaStatistics());
197  $this->settings->set('disable_anonymous_fora',(bool) $this->disabledAnonymousFora());
198  $this->settings->set('ps_access_times',(bool) $this->enabledGroupAccessTimes());
199  $this->settings->set('ps_crs_access_times',(bool) $this->enabledCourseAccessTimes());
200  }
208  private function read()
209  {
210  global $ilDB;
211 
212  $query = "SELECT object_reference.ref_id FROM object_reference,tree,object_data ".
213  "WHERE tree.parent = ".$ilDB->quote(SYSTEM_FOLDER_ID,'integer')." ".
214  "AND object_data.type = 'ps' ".
215  "AND object_reference.ref_id = tree.child ".
216  "AND object_reference.obj_id = object_data.obj_id";
217  $res = $this->db->query($query);
218  $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
219  $this->ref_id = $row["ref_id"];
220 
221  $this->export_course = (bool) $this->settings->get('ps_export_course',false);
222  $this->export_confirm = (bool) $this->settings->get('ps_export_confirm',false);
223  $this->fora_statistics = (bool) $this->settings->get('enable_fora_statistics',false);
224  $this->anonymous_fora = (bool) $this->settings->get('disable_anonymous_fora',false);
225  $this->show_grp_access_times = (bool) $this->settings->get('ps_access_times',false);
226  $this->show_crs_access_times = (bool) $this->settings->get('ps_crs_access_times',false);
227 
228  }
229 
235  public function validate()
236  {
237  return 0;
238  }
239 
240 
241 }
242 ?>