ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDAVCronDiskQuota.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Services/Cron/classes/class.ilCronJob.php";
6 
13 {
14  public function getId()
15  {
16  return "rep_disk_quota";
17  }
18 
19  public function getTitle()
20  {
21  global $DIC;
22  $lng = $DIC['lng'];
23 
24  $lng->loadLanguageModule("file");
25  return $lng->txt("repository_disk_quota");
26  }
27 
28  public function getDescription()
29  {
30  global $DIC;
31  $lng = $DIC['lng'];
32 
33  $lng->loadLanguageModule("file");
34  return $lng->txt("repository_disk_quota_info");
35  }
36 
37  public function getDefaultScheduleType()
38  {
39  return self::SCHEDULE_TYPE_DAILY;
40  }
41 
42  public function getDefaultScheduleValue()
43  {
44  return;
45  }
46 
47  public function hasAutoActivation()
48  {
49  return false;
50  }
51 
52  public function hasFlexibleSchedule()
53  {
54  return false;
55  }
56 
57  public function hasCustomSettings()
58  {
59  return true;
60  }
61 
62  public function run()
63  {
64  require_once'./Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
66  {
67  require_once'./Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
69 
71  {
73  }
74 
76  {
78  }
79  }
80 
81  $result = new ilCronJobResult();
83  return $result;
84  }
85 
86  public function addCustomSettingsToForm(ilPropertyFormGUI $a_form)
87  {
88  global $DIC;
89  $lng = $DIC['lng'];
90 
91  $lng->loadLanguageModule("file");
92 
93  require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
94  $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
95 
96  // Enable disk quota reminder mail
97  $cb_prop_reminder = new ilCheckboxInputGUI($lng->txt("enable_disk_quota_reminder_mail"), "enable_disk_quota_reminder_mail");
98  $cb_prop_reminder->setValue('1');
99  $cb_prop_reminder->setChecked($disk_quota_obj->isDiskQuotaReminderMailEnabled());
100  $cb_prop_reminder->setInfo($lng->txt('disk_quota_reminder_mail_desc'));
101  $a_form->addItem($cb_prop_reminder);
102 
103  // Enable summary mail for certain users
104  $cb_prop_summary= new ilCheckboxInputGUI($lng->txt("enable_disk_quota_summary_mail"), "enable_disk_quota_summary_mail");
105  $cb_prop_summary->setValue(1);
106  $cb_prop_summary->setChecked($disk_quota_obj->isDiskQuotaSummaryMailEnabled());
107  $cb_prop_summary->setInfo($lng->txt('enable_disk_quota_summary_mail_desc'));
108  $a_form->addItem($cb_prop_summary);
109 
110  // Edit disk quota recipients
111  $summary_rcpt = new ilTextInputGUI($lng->txt("disk_quota_summary_rctp"), "disk_quota_summary_rctp");
112  $summary_rcpt->setValue($disk_quota_obj->getSummaryRecipients());
113  $summary_rcpt->setInfo($lng->txt('disk_quota_summary_rctp_desc'));
114  $cb_prop_summary->addSubItem($summary_rcpt);
115  }
116 
117  public function saveCustomSettings(ilPropertyFormGUI $a_form)
118  {
119  require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
120  $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
121  $disk_quota_obj->setDiskQuotaReminderMailEnabled($_POST['enable_disk_quota_reminder_mail'] == '1');
122  $disk_quota_obj->isDiskQuotaSummaryMailEnabled($_POST['enable_disk_quota_summary_mail'] == '1');
123  $disk_quota_obj->setSummaryRecipients(ilUtil::stripSlashes($_POST['disk_quota_summary_rctp']));
124  $disk_quota_obj->update();
125 
126  return true;
127  }
128 
129  public function addToExternalSettingsForm($a_form_id, array &$a_fields, $a_is_active)
130  {
131  global $DIC;
132  $lng = $DIC['lng'];
133 
134  $lng->loadLanguageModule("file");
135 
136  switch($a_form_id)
137  {
140 
141  require_once('Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php');
142 
143  $subitems = array(
144  "enable_disk_quota_reminder_mail" => array(
147  ),
148  "enable_disk_quota_summary_mail" => array(
151  )
152  );
153  $a_fields["repository_disk_quota"] = array($a_is_active ?
154  $lng->txt("enabled") :
155  $lng->txt("disabled"),
156  null, $subitems);
157  break;
158  }
159  }
160 
161  public function activationWasToggled($a_currently_active)
162  {
163  // #12221
164  $settings = new ilSetting('disk_quota');
165  $settings->set('enabled', $a_currently_active);
166 
167  /* objDefinition is not available in setup, we cannot use ilObject
168  require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
169  $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
170  $disk_quota_obj->setDiskQuotaEnabled((bool)$a_currently_active);
171  $disk_quota_obj->update();
172  */
173  }
174 }
175 
176 ?>
activationWasToggled($a_currently_active)
ILIAS Setting Class.
static _sendReminderMails()
Sends reminder e-mails to all users who have access and who have exceeded their disk quota and who ha...
$result
This class represents a property form user interface.
addToExternalSettingsForm($a_form_id, array &$a_fields, $a_is_active)
Cron job application base class.
Soft disk quota notifications.
This class represents a checkbox property in a property form.
static _updateDiskUsageReport()
Updates the disk usage info of all user accounts.
addItem($a_item)
Add Item (Property, SectionHeader).
setValue($a_value)
Set Value.
This class represents a text property in a property form.
saveCustomSettings(ilPropertyFormGUI $a_form)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
global $DIC
Cron job result data container.
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
setValue($a_value)
Set Value.
$_POST["username"]
static getInstance()
Get settings instance.