ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 155 of file class.ilDiskQuotaReminderMail.php.

References $lang, and $tmp_lng.

Referenced by readMailTemplate(), and replacePlaceholders().

156  {
157  if ($this->tmp_lng == null || $this->tmp_lng->lang_key != $a_lang) {
158  $this->tmp_lng = new ilLanguage($lang);
159  }
160  return $this->tmp_lng;
161  }
$lang
Definition: xapiexit.php:8
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(), getLng(), ILIAS_HTTP_PATH, replacePlaceholders(), and send().

78  {
79  if (!is_array($this->amail[$a_lang])) {
80  $this->amail[$a_lang] = ilObjDiskQuotaSettings::_lookupReminderMailTemplate($a_lang);
81  $this->amail["body"] = trim($this->amail["body"]);
82  $this->amail["subject"] = trim($this->amail["subject"]);
83  }
84 
85  return $this->amail[$a_lang];
86  }
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 163 of file class.ilDiskQuotaReminderMail.php.

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

Referenced by readMailTemplate().

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

70  {
71  unset($this->data);
72  }

◆ 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.

62  {
63  $this->data = $a_data;
64  }

◆ 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: