• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/PrivacySecurity/classes/class.ilPrivacySettings.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00034 class ilPrivacySettings
00035 {
00036     private static $instance = null;
00037                 private $db;
00038                 private $settings;
00039         
00040                 private $export_course;
00041                 private $export_confirm;
00042                 private $fora_statistics;
00043                 private $access_times;
00044                 private $ref_id;
00045 
00053         private function __construct()
00054         {
00055                 global $ilSetting,$ilDB;
00056 
00057                 $this->db = $ilDB;
00058                 $this->settings = $ilSetting;
00059 
00060                 $this->read();
00061         }
00062 
00069         public function _getInstance()
00070         {
00071                 if(is_object(self::$instance))
00072                 {
00073                         return self::$instance;
00074                 }
00075                 return self::$instance = new ilPrivacySettings();
00076         }
00077 
00078         public function getPrivacySettingsRefId()
00079         {
00080                 return $this->ref_id;
00081         }
00082 
00083         public function enabledExport()
00084         {
00085                 return $this->export_course;
00086         }
00087         public function enableExport($a_status)
00088         {
00089                 $this->export_course = (bool) $a_status;
00090         }
00091 
00092 
00097         public function enableForaStatistics ($a_status) {
00098                 $this->fora_statistics = (bool) $a_status;
00099         }
00100         
00105          public function enabledForaStatistics () {
00106                         return $this->fora_statistics;
00107                 }
00108 
00109 
00110 
00111         public function confirmationRequired()
00112         {
00113                 return $this->export_confirm;
00114         }
00115 
00116         public function setConfirmationRequired($a_status)
00117         {
00118                 $this->export_confirm = (bool) $a_status;
00119         }
00120         
00128         public function showAccessTimes($a_status)
00129         {
00130                 $this->show_access_times = $a_status;
00131         }
00132         
00139         public function enabledAccessTimes()
00140         {
00141                 return (bool) $this->show_access_times;
00142         }
00143 
00149         public function save()
00150         {
00151                 $this->settings->set('ps_export_confirm',(bool) $this->confirmationRequired());
00152                 $this->settings->set('ps_export_course',(bool) $this->enabledExport());
00153                 $this->settings->set('enable_fora_statistics',(bool) $this->enabledForaStatistics());
00154                 $this->settings->set('ps_access_times',(bool) $this->enabledAccessTimes());
00155         }
00163         private function read()
00164         {
00165                 global $ilDB;
00166                 
00167             $query = "SELECT object_reference.ref_id FROM object_reference,tree,object_data ".
00168                                 "WHERE tree.parent = ".$ilDB->quote(SYSTEM_FOLDER_ID)." ".
00169                                 "AND object_data.type = 'ps' ".
00170                                 "AND object_reference.ref_id = tree.child ".
00171                                 "AND object_reference.obj_id = object_data.obj_id";
00172                 $res = $this->db->query($query);
00173                 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
00174                 $this->ref_id = $row["ref_id"];
00175 
00176                 $this->export_course = (bool) $this->settings->get('ps_export_course',false);
00177                 $this->export_confirm = (bool) $this->settings->get('ps_export_confirm',false);
00178                 $this->fora_statistics = (bool) $this->settings->get('enable_fora_statistics',false);
00179                 $this->show_access_times = (bool) $this->settings->get('ps_access_times',false);
00180 
00181         }
00182 
00188         public function validate() {
00189             return 0;
00190         }
00191 
00192 
00193 }
00194 ?>

Generated on Fri Dec 13 2013 17:57:00 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1