ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDiskQuotaReminderMail Class Reference

Class ilDiskQuotaReminderMail. More...

+ Collaboration diagram for ilDiskQuotaReminderMail:

Public Member Functions

 __construct ()
 constructor public
 useLangVariablesAsFallback ($a_status)
 areLangVariablesUsedAsFallback ()
 setData ($a_data)
 Sets used to fill in the placeholders in the mail.
 reset ()
 reset all values
 readMailTemplate ($a_lang)
 get new mail template array (including subject and message body)
 send ()
 Sends the mail with its object properties as MimeMail It first tries to read the mail body, subject and sender address from posted named formular fields.
 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.
 $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:
class.ilDiskQuotaReminderMail.php 34069 2012-04-06 07:21:57Z mjansen

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

Constructor & Destructor Documentation

ilDiskQuotaReminderMail::__construct ( )

constructor public

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

{
}

Member Function Documentation

ilDiskQuotaReminderMail::areLangVariablesUsedAsFallback ( )

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

References $lang_variables_as_fallback.

Referenced by send().

+ Here is the caller graph for this function:

ilDiskQuotaReminderMail::getLng (   $a_lang)
private

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

References $lang, and $tmp_lng.

Referenced by replacePlaceholders(), and send().

{
if ($this->tmp_lng == null || $this->tmp_lng->lang_key != $a_lang)
{
$this->tmp_lng = new ilLanguage($lang);
}
}

+ Here is the caller graph for this function:

ilDiskQuotaReminderMail::readMailTemplate (   $a_lang)

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

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

References ilObjDiskQuotaSettings\_lookupReminderMailTemplate().

Referenced by send().

{
if (!is_array($this->amail[$a_lang]))
{
require_once('./Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php');
$this->amail[$a_lang] = ilObjDiskQuotaSettings::_lookupReminderMailTemplate($a_lang);
$this->amail["body"] = trim($this->amail["body"]);
$this->amail["subject"] = trim($this->amail["subject"]);
}
return $this->amail[$a_lang];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References $ilSetting, ilFormat\formatFloat(), ilFormat\formatSize(), and getLng().

Referenced by send().

{
global $ilSetting, $tree;
$tmp_lang = $this->getLng($a_lang);
// determine salutation
switch ($this->data['gender'])
{
case "f" : $gender_salut = $a_amail["sal_f"];
break;
case "m" : $gender_salut = $a_amail["sal_m"];
break;
default : $gender_salut = $a_amail["sal_g"];
}
$gender_salut = trim($gender_salut);
$a_string = str_replace("[MAIL_SALUTATION]", $gender_salut, $a_string);
$a_string = str_replace("[LOGIN]", $this->data['login'], $a_string);
$a_string = str_replace("[FIRST_NAME]", $this->data['firstname'], $a_string);
$a_string = str_replace("[LAST_NAME]", $this->data['lastname'], $a_string);
// BEGIN Mail Include E-Mail Address in account mail
$a_string = str_replace("[EMAIL]", $this->data['email'], $a_string);
$a_string = str_replace("[ILIAS_URL]",
ILIAS_HTTP_PATH."/login.php?client_id=".CLIENT_ID, $a_string);
$a_string = str_replace("[CLIENT_NAME]", CLIENT_NAME, $a_string);
$a_string = str_replace("[ADMIN_MAIL]", $ilSetting->get("admin_email"),
$a_string);
require_once './Services/Utilities/classes/class.ilFormat.php';
$a_string = str_replace("[DISK_QUOTA]", ilFormat::formatSize($this->data['disk_quota'],'short',$tmp_lang), $a_string);
$a_string = str_replace("[DISK_USAGE]", ilFormat::formatSize($this->data['disk_usage'],'short',$tmp_lang), $a_string);
$disk_usage_details = '';
foreach ($this->data['disk_usage_details'] as $details)
{
$disk_usage_details .= ilFormat::formatFloat($details['count'],0,true,$tmp_lang).' '.$tmp_lang->txt($details['type']).' '.ilFormat::formatSize($details['size'],'short',$tmp_lang)."\n";
}
$a_string = str_replace("[DISK_USAGE_DETAILS]", $disk_usage_details, $a_string);
return $a_string;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDiskQuotaReminderMail::reset ( )

reset all values

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

{
unset($this->data);
}
ilDiskQuotaReminderMail::send ( )

Sends the mail with its object properties as MimeMail It first tries to read the mail body, subject and sender address from posted named formular fields.

If no field values found the defaults are used. Placehoders will be replaced by the appropriate data. public

Parameters
objectilUser

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

References $_SESSION, $data, $ilSetting, $lang, areLangVariablesUsedAsFallback(), getLng(), readMailTemplate(), and replacePlaceholders().

{
global $ilSetting;
// determine language and get account mail data
// fall back to default language if acccount mail data is not given for user language.
$amail = $this->readMailTemplate($this->data['language']);
if ($amail['body'] == '' || $amail['subject'] == '')
{
$amail = $this->readMailTemplate($ilSetting->get('language'));
$lang = $ilSetting->get('language');
}
else
{
$lang = $this->data['language'];
}
// fallback if mail data is still not given
($amail['body'] == '' || $amail['subject'] == ''))
{
$lang = $this->data['language'];
$tmp_lang = $this->getLng($lang);
// mail subject
$mail_subject = $tmp_lang->txt('disk_quota_mail_subject');
// mail body
$mail_body = $tmp_lang->txt('disk_quota_mail_body_salutation').' '.$data['firstname'].' '.$data['lastname'].",\n\n".
$tmp_lang->txt('disk_quota_body_text1')."\n\n".
$tmp_lang->txt('disk_quota_body_text2')."\n".
ILIAS_HTTP_PATH.'/login.php?client_id='.CLIENT_ID."\n";
$mail_body .= $tmp_lang->txt('login').': '.$data['firstname']."\n";
$mail_body.= "\n";
$mail_body .= $tmp_lang->txt('disk_quota_mail_body_text3')."\n\r";
//$mail_body .= $user->getProfileAsString($tmp_lang);
}
else
{
// replace placeholders
$mail_subject = $this->replacePlaceholders($amail['subject'], $amail, $lang);
$mail_body = $this->replacePlaceholders($amail['body'], $amail, $lang);
}
// send the mail
include_once 'Services/Mail/classes/class.ilMimeMail.php';
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->From($ilSetting->get('admin_email'));
$mmail->Subject($mail_subject);
$mmail->To($this->data['email']);
$mmail->Body($mail_body);
$mmail->Send();
include_once 'Services/Mail/classes/class.ilMail.php';
$mail = new ilMail($_SESSION["AccountId"]);
$mail->sendMail($this->data['login'],"","",$mail_subject,$mail_body,array(),array("normal"));
return true;
}

+ Here is the call graph for this function:

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.

{
$this->data = $a_data;
}
ilDiskQuotaReminderMail::useLangVariablesAsFallback (   $a_status)

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

{
$this->lang_variables_as_fallback = $a_status;
}

Field Documentation

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 send().

ilDiskQuotaReminderMail::$lang_variables_as_fallback = true
private

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

Referenced by areLangVariablesUsedAsFallback().

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: