ILIAS  eassessment Revision 61809
 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 
56 
58  private $summary_recipients = '';
59 
66  public function ilObjDiskQuotaSettings($a_id = 0,$a_call_by_reference = true)
67  {
68  // NOTE: We share the facs object with ilObjFileAccessSettings!
69  $this->type = "facs";
70  $this->ilObject($a_id,$a_call_by_reference);
71  }
72 
79  public function setDiskQuotaEnabled($newValue)
80  {
81  $this->diskQuotaEnabled = $newValue;
82  }
88  public function isDiskQuotaEnabled()
89  {
91  }
98  public function setDiskQuotaReminderMailEnabled($newValue)
99  {
100  $this->diskQuotaReminderMailEnabled = $newValue;
101  }
108  {
110  }
118  public function create()
119  {
120  parent::create();
121  $this->write();
122  }
128  public function update()
129  {
130  parent::update();
131  $this->write();
132  }
137  private function write()
138  {
139  $settings = new ilSetting('disk_quota');
140  $settings->set('enabled', $this->diskQuotaEnabled);
141  $settings->set('reminder_mail_enabled', $this->diskQuotaReminderMailEnabled);
142  $settings->set('summary_mail_enabled', $this->isDiskQuotaSummaryMailEnabled() ? 1 : 0);
143  $settings->set('summary_rcpt', $this->getSummaryRecipients());
144  }
149  public function read($a_force_db = false)
150  {
151  parent::read($a_force_db);
152 
153  $settings = new ilSetting('disk_quota');
154  $this->diskQuotaEnabled = $settings->get('enabled') == true;
155  $this->diskQuotaReminderMailEnabled = $settings->get('reminder_mail_enabled') == true;
156  $this->isDiskQuotaSummaryMailEnabled($settings->get('summary_mail_enabled') == 1 ? true : false);
157  $this->setSummaryRecipients($settings->get('summary_rcpt'));
158  }
159 
160 
170  function _lookupReminderMailTemplate($a_lang)
171  {
172  global $ilDB;
173 
174  $set = $ilDB->query("SELECT * FROM mail_template ".
175  " WHERE type='dqta' AND lang = ".$ilDB->quote($a_lang,'text'));
176 
177  if ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
178  {
179  return $rec;
180  }
181  return array();
182  }
183 
184  function _writeReminderMailTemplate($a_lang, $a_subject, $a_sal_g, $a_sal_f, $a_sal_m, $a_body)
185  {
186  global $ilDB;
187 
188  if(self::_lookupReminderMailTemplate($a_lang))
189  {
190  $values = array(
191  'subject' => array('text',$a_subject),
192  'body' => array('clob',$a_body),
193  'sal_g' => array('text',$a_sal_g),
194  'sal_f' => array('text',$a_sal_f),
195  'sal_m' => array('text',$a_sal_m)
196  );
197  $ilDB->update('mail_template',
198  $values,
199  array('lang' => array('text',$a_lang), 'type' => array('text','dqta'))
200  );
201  }
202  else
203  {
204  $values = array(
205  'subject' => array('text',$a_subject),
206  'body' => array('clob',$a_body),
207  'sal_g' => array('text',$a_sal_g),
208  'sal_f' => array('text',$a_sal_f),
209  'sal_m' => array('text',$a_sal_m),
210  'lang' => array('text',$a_lang),
211  'type' => array('text','dqta')
212  );
213  $ilDB->insert('mail_template',$values);
214  }
215  }
216 
225  public function setSummaryRecipients($s_recipients)
226  {
227  $this->summary_recipients = $s_recipients;
228 
229  return $this;
230  }
231 
240  public function getSummaryRecipients()
241  {
243  }
244 
254  public function isDiskQuotaSummaryMailEnabled($status = null)
255  {
256  if( null === $status )
257  {
259  }
260 
261  $this->diskQuotaSummaryMailEnabled = $status;
262 
263  return $this;
264  }
265 } // END class.ilObjDiskQuotaSettings
266 ?>