ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjDiskQuotaSettings.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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 
38 include_once "classes/class.ilObject.php";
39 
41 {
50 
52  private static $dqSettings;
53 
60  public function ilObjDiskQuotaSettings($a_id = 0,$a_call_by_reference = true)
61  {
62  // NOTE: We share the facs object with ilObjFileAccessSettings!
63  $this->type = "facs";
64  $this->ilObject($a_id,$a_call_by_reference);
65  }
66 
73  public function setDiskQuotaEnabled($newValue)
74  {
75  $this->diskQuotaEnabled = $newValue;
76  }
82  public function isDiskQuotaEnabled()
83  {
85  }
92  public function setDiskQuotaReminderMailEnabled($newValue)
93  {
94  $this->diskQuotaReminderMailEnabled = $newValue;
95  }
102  {
104  }
112  public function create()
113  {
114  parent::create();
115  $this->write();
116  }
122  public function update()
123  {
124  parent::update();
125  $this->write();
126  }
131  private function write()
132  {
133  $settings = new ilSetting('disk_quota');
134  $settings->set('enabled', $this->diskQuotaEnabled);
135  $settings->set('reminder_mail_enabled', $this->diskQuotaReminderMailEnabled);
136  }
141  public function read($a_force_db = false)
142  {
143  parent::read($a_force_db);
144 
145  $settings = new ilSetting('disk_quota');
146  $this->diskQuotaEnabled = $settings->get('enabled') == true;
147  $this->diskQuotaReminderMailEnabled = $settings->get('reminder_mail_enabled') == true;
148  }
149 
150 
160  function _lookupReminderMailTemplate($a_lang)
161  {
162  global $ilDB;
163 
164  $set = $ilDB->query("SELECT * FROM mail_template ".
165  " WHERE type='dqta' AND lang = ".$ilDB->quote($a_lang,'text'));
166 
167  if ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
168  {
169  return $rec;
170  }
171  return array();
172  }
173 
174  function _writeReminderMailTemplate($a_lang, $a_subject, $a_sal_g, $a_sal_f, $a_sal_m, $a_body)
175  {
176  global $ilDB;
177 
178  if(self::_lookupReminderMailTemplate($a_lang))
179  {
180  $values = array(
181  'subject' => array('text',$a_subject),
182  'body' => array('clob',$a_body),
183  'sal_g' => array('text',$a_sal_g),
184  'sal_f' => array('text',$a_sal_f),
185  'sal_m' => array('text',$a_sal_m)
186  );
187  $ilDB->update('mail_template',
188  $values,
189  array('lang' => array('text',$a_lang), 'type' => array('text','dqta'))
190  );
191  }
192  else
193  {
194  $values = array(
195  'subject' => array('text',$a_subject),
196  'body' => array('clob',$a_body),
197  'sal_g' => array('text',$a_sal_g),
198  'sal_f' => array('text',$a_sal_f),
199  'sal_m' => array('text',$a_sal_m),
200  'lang' => array('text',$a_lang),
201  'type' => array('text','dqta')
202  );
203  $ilDB->insert('mail_template',$values);
204  }
205  }
206 } // END class.ilObjDiskQuotaSettings
207 ?>