ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDiskQuotaReminderMail Class Reference

Class ilDiskQuotaReminderMail. More...

+ Collaboration diagram for ilDiskQuotaReminderMail:

Public Member Functions

 __construct ()
 constructor public More...
 
 useLangVariablesAsFallback ($a_status)
 
 areLangVariablesUsedAsFallback ()
 
 setData ($a_data)
 Sets used to fill in the placeholders in the mail. More...
 
 reset ()
 reset all values More...
 
 readMailTemplate ($a_lang)
 get new mail template array (including subject and message body) More...
 
 replacePlaceholders ($a_string, $a_amail, $a_lang)
 

Private Member Functions

 getLng ($a_lang)
 

Private Attributes

 $lang_variables_as_fallback = true
 
 $data
 Data used to fill in the placeholders in the mail. More...
 
 $tmp_lng
 

Detailed Description

Class ilDiskQuotaReminderMail.

Sends e-mail to users who have exceeded their disk quota.

Author
Werner Randelshofer werne.nosp@m.r.ra.nosp@m.ndels.nosp@m.hofe.nosp@m.r@hsl.nosp@m.u.ch
Version
$Id$

Definition at line 13 of file class.ilDiskQuotaReminderMail.php.

Constructor & Destructor Documentation

◆ __construct()

ilDiskQuotaReminderMail::__construct ( )

constructor public

Definition at line 28 of file class.ilDiskQuotaReminderMail.php.

29  {
30  }

Member Function Documentation

◆ areLangVariablesUsedAsFallback()

ilDiskQuotaReminderMail::areLangVariablesUsedAsFallback ( )

Definition at line 37 of file class.ilDiskQuotaReminderMail.php.

References $lang_variables_as_fallback.

Referenced by readMailTemplate().

+ Here is the caller graph for this function:

◆ getLng()

ilDiskQuotaReminderMail::getLng (   $a_lang)
private

Definition at line 156 of file class.ilDiskQuotaReminderMail.php.

References $lang, and $tmp_lng.

Referenced by readMailTemplate(), and replacePlaceholders().

157  {
158  if ($this->tmp_lng == null || $this->tmp_lng->lang_key != $a_lang) {
159  $this->tmp_lng = new ilLanguage($lang);
160  }
161  return $this->tmp_lng;
162  }
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
language handling
+ Here is the caller graph for this function:

◆ readMailTemplate()

ilDiskQuotaReminderMail::readMailTemplate (   $a_lang)

get new mail template array (including subject and message body)

Definition at line 77 of file class.ilDiskQuotaReminderMail.php.

References $data, $DIC, $GLOBALS, $lang, ilObjDiskQuotaSettings\_lookupReminderMailTemplate(), areLangVariablesUsedAsFallback(), data, getLng(), and replacePlaceholders().

78  {
79  if (!is_array($this->amail[$a_lang])) {
80  require_once('./Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php');
81  $this->amail[$a_lang] = ilObjDiskQuotaSettings::_lookupReminderMailTemplate($a_lang);
82  $this->amail["body"] = trim($this->amail["body"]);
83  $this->amail["subject"] = trim($this->amail["subject"]);
84  }
85 
86  return $this->amail[$a_lang];
87  }
static _lookupReminderMailTemplate($a_lang)
Looks up the mail template for the specified language.
+ Here is the call graph for this function:

◆ replacePlaceholders()

ilDiskQuotaReminderMail::replacePlaceholders (   $a_string,
  $a_amail,
  $a_lang 
)

Definition at line 164 of file class.ilDiskQuotaReminderMail.php.

References $DIC, data, ilUtil\formatSize(), and getLng().

Referenced by readMailTemplate().

165  {
166  global $DIC;
167 
168  $tmp_lang = $this->getLng($a_lang);
169 
170  // determine salutation
171  switch ($this->data['gender']) {
172  case "f": $gender_salut = $a_amail["sal_f"];
173  break;
174  case "m": $gender_salut = $a_amail["sal_m"];
175  break;
176  default: $gender_salut = $a_amail["sal_g"];
177  }
178  $gender_salut = trim($gender_salut);
179 
180  $a_string = str_replace("[MAIL_SALUTATION]", $gender_salut, $a_string);
181  $a_string = str_replace("[LOGIN]", $this->data['login'], $a_string);
182  $a_string = str_replace("[FIRST_NAME]", $this->data['firstname'], $a_string);
183  $a_string = str_replace("[LAST_NAME]", $this->data['lastname'], $a_string);
184  // BEGIN Mail Include E-Mail Address in account mail
185  $a_string = str_replace("[EMAIL]", $this->data['email'], $a_string);
186  $a_string = str_replace(
187  "[ILIAS_URL]",
188  ILIAS_HTTP_PATH . "/login.php?client_id=" . CLIENT_ID,
189  $a_string
190  );
191  $a_string = str_replace("[CLIENT_NAME]", CLIENT_NAME, $a_string);
192  $a_string = str_replace(
193  "[ADMIN_MAIL]",
194  $DIC->settings()->get("admin_email"),
195  $a_string
196  );
197 
198  $a_string = str_replace("[DISK_QUOTA]", ilUtil::formatSize($this->data['disk_quota'], 'short', $tmp_lang), $a_string);
199  $a_string = str_replace("[DISK_USAGE]", ilUtil::formatSize($this->data['disk_usage'], 'short', $tmp_lang), $a_string);
200 
201  $disk_usage_details = '';
202  foreach ($this->data['disk_usage_details'] as $details) {
203  $disk_usage_details .= number_format($details['count'], 0) . ' ' .
204  $tmp_lang->txt($details['type']) . ' ' .
205  ilUtil::formatSize($details['size'], 'short', $tmp_lang) . "\n";
206  }
207  $a_string = str_replace("[DISK_USAGE_DETAILS]", $disk_usage_details, $a_string);
208 
209  return $a_string;
210  }
global $DIC
Definition: saml.php:7
$this data['403_header']
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

ilDiskQuotaReminderMail::reset ( )

reset all values

Definition at line 69 of file class.ilDiskQuotaReminderMail.php.

References data.

70  {
71  unset($this->data);
72  }
$this data['403_header']

◆ setData()

ilDiskQuotaReminderMail::setData (   $a_data)

Sets used to fill in the placeholders in the mail.

The following key value pairs must be supplied:

'language' string language of user 'gender' string gender of user 'm' or 'f' 'firstname' string firstname of the user 'lastname' string lastname of the user 'email' string email address of the user 'login' string login of the user 'disk_quota' integer disk quota in bytes of the user 'disk_usage' integer disk usage in bytes of the user 'disk_usage_details' associative array with the values returned by ilDiskQuotaChecker::_lookupDiskUsage($a_usr_id)

Parameters
$a_dataarray Key value pairs with the name of the placeholder as keys.

Definition at line 61 of file class.ilDiskQuotaReminderMail.php.

References data.

62  {
63  $this->data = $a_data;
64  }
$this data['403_header']

◆ useLangVariablesAsFallback()

ilDiskQuotaReminderMail::useLangVariablesAsFallback (   $a_status)

Definition at line 32 of file class.ilDiskQuotaReminderMail.php.

33  {
34  $this->lang_variables_as_fallback = $a_status;
35  }

Field Documentation

◆ $data

ilDiskQuotaReminderMail::$data
private

Data used to fill in the placeholders in the mail.

Contains key value pairs with the name of the placeholder as keys.

Definition at line 20 of file class.ilDiskQuotaReminderMail.php.

Referenced by readMailTemplate().

◆ $lang_variables_as_fallback

ilDiskQuotaReminderMail::$lang_variables_as_fallback = true
private

Definition at line 15 of file class.ilDiskQuotaReminderMail.php.

Referenced by areLangVariablesUsedAsFallback().

◆ $tmp_lng

ilDiskQuotaReminderMail::$tmp_lng
private

Definition at line 22 of file class.ilDiskQuotaReminderMail.php.

Referenced by getLng().


The documentation for this class was generated from the following file: