ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDiskQuotaSummaryNotification Class Reference
+ Inheritance diagram for ilDiskQuotaSummaryNotification:
+ Collaboration diagram for ilDiskQuotaSummaryNotification:

Public Member Functions

 __construct ()
 Constructor.
 send ()
 Send notifications.
- Public Member Functions inherited from ilMailNotification
 __construct ($a_is_personal_workspace=false)
 Constructor.
 setType ($a_type)
 Set notification type.
 getType ()
 Get notification type.
 setSender ($a_usr_id)
 Set sender of mail.
 getSender ()
 get sender of mail
 setRecipients ($a_rcp)
 set mail recipients
 getRecipients ()
 get array of recipients
 setAttachments ($a_att)
 Set attachments.
 getAttachments ()
 Get attachments.
 setLangModules (array $a_modules)
 Set lang modules.
 getUserLanguage ($a_usr_id)
 Get user language.
 setRefId ($a_id)
 Set ref id.
 getRefId ()
 get reference id
 getObjId ()
 get object id
 setObjId ($a_obj_id)
 set obj id
 getObjType ()
 Get object type.
 setAdditionalInformation ($a_info)
 Additional information for creating notification mails.
 getAdditionalInformation ()
 Get additional information for generating notification mails.
 sendMail ($a_rcp, $a_type, $a_parse_recipients=true)
 Send Mail.
 getBlockBorder ()
 Get (ascii) block border.

Additional Inherited Members

- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60
- Protected Member Functions inherited from ilMailNotification
 setSubject ($a_subject)
 Set mail subject.
 getSubject ()
 Get mail subject.
 setBody ($a_body)
 Set mail body.
 appendBody ($a_body)
 Append body text.
 getBody ()
 Get body.
 initLanguage ($a_usr_id)
 Init language.
 initLanguageByIso2Code ($a_code= '')
 Init language by ISO2 code.
 setLanguage ($a_language)
 A language.
 getLanguage ()
 get language object
 getLanguageText ($a_keyword)
 Replace new lines.
 getObjectTitle ($a_shorten=false)
 Get object title.
 initMail ()
 Init mail.
 getMail ()
 Get mail object.
 createPermanentLink ($a_params=array(), $a_append= '')
 Create a permanent link for an object.
 userToString ($a_usr_id)
 Utility function.
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user.
- Protected Attributes inherited from ilMailNotification
 $type = null
 $sender = null
 $mail = null
 $subject = ''
 $body = ''
 $attachments = array()
 $language = null
 $lang_modules = array()
 $recipients = array()
 $ref_id = null
 $obj_id = null
 $obj_type = null
 $additional_info = array()
 $is_in_wsp
 $wsp_tree
 $wsp_access_handler

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

ilDiskQuotaSummaryNotification::__construct ( )

Constructor.

public

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

References ilObjUser\_lookupId(), and ilMailNotification\setRecipients().

{
$dqs = new ilSetting('disk_quota');
$rcpt = $dqs->get('summary_rcpt');
$rcpt = explode(',', $rcpt);
$loginnames = array();
foreach($rcpt as $loginname)
{
$loginname = trim($loginname);
if(ilObjUser::_lookupId($loginname))
{
$loginnames[] = $loginname;
}
}
$this->setRecipients($loginnames);
}

+ Here is the call graph for this function:

Member Function Documentation

ilDiskQuotaSummaryNotification::send ( )

Send notifications.

public

Definition at line 48 of file class.ilDiskQuotaSummaryNotification.php.

References $res, $row, ilUtil\_getHttpPath(), ilDiskQuotaChecker\_lookupDiskUsage(), ilObjUser\_lookupId(), ilMailNotification\appendBody(), ilFormat\formatSize(), ilMailNotification\getLanguage(), ilMailNotification\getMail(), ilMailNotification\getRecipients(), ilMail\getSalutation(), ilMailNotification\initLanguage(), ilMailNotification\initMail(), ilMailNotification\sendMail(), ilMailNotification\setBody(), and ilMailNotification\setSubject().

{
global $ilDB;
// parent::send();
if( count($this->getRecipients()) )
{
$res = $ilDB->queryf(
"SELECT u.usr_id,u.gender,u.firstname,u.lastname,u.login,u.email,u.last_login,u.active,".
"u.time_limit_unlimited, ".$ilDB->fromUnixtime("u.time_limit_from").", ".$ilDB->fromUnixtime("u.time_limit_until").",".
// Inactive users get the date 0001-01-01 so that they appear
// first when the list is sorted by this field. Users with
// unlimited access get the date 9999-12-31 so that they appear
// last.
"CASE WHEN u.active = 0 THEN '0001-01-01' ELSE CASE WHEN u.time_limit_unlimited=1 THEN '9999-12-31' ELSE ".$ilDB->fromUnixtime("u.time_limit_until")." END END access_until,".
" CASE WHEN ".$ilDB->unixTimestamp()." BETWEEN u.time_limit_from AND u.time_limit_until THEN 0 ELSE 1 END expired,".
"rq.role_disk_quota, system_role.rol_id role_id, ".
"p1.value+0 user_disk_quota,".
"p2.value+0 disk_usage, ".
"p3.value last_update, ".
"p5.value language, ".
// We add 0 to some of the values to convert them into a number.
// This is needed for correct sorting.
"CASE WHEN rq.role_disk_quota>p1.value+0 OR p1.value IS NULL THEN rq.role_disk_quota ELSE p1.value+0 END disk_quota ".
"FROM usr_data u ".
// Fetch the role with the highest disk quota value.
"JOIN (SELECT u.usr_id usr_id,MAX(rd.disk_quota) role_disk_quota ".
"FROM usr_data u ".
"JOIN rbac_ua ua ON ua.usr_id=u.usr_id ".
"JOIN rbac_fa fa ON fa.rol_id=ua.rol_id AND fa.parent=%s ".
"JOIN role_data rd ON rd.role_id=ua.rol_id WHERE u.usr_id=ua.usr_id GROUP BY u.usr_id) rq ON rq.usr_id=u.usr_id ".
// Fetch the system role in order to determine whether the user has unlimited disk quota
"LEFT JOIN rbac_ua system_role ON system_role.usr_id=u.usr_id AND system_role.rol_id = %s ".
// Fetch the user disk quota from table usr_pref
"LEFT JOIN usr_pref p1 ON p1.usr_id=u.usr_id AND p1.keyword = 'disk_quota' ".
// Fetch the disk usage from table usr_pref
"LEFT JOIN usr_pref p2 ON p2.usr_id=u.usr_id AND p2.keyword = 'disk_usage' ".
// Fetch the last update from table usr_pref
"LEFT JOIN usr_pref p3 ON p3.usr_id=u.usr_id AND p3.keyword = 'disk_usage.last_update' ".
// Fetch the language of the user
"LEFT JOIN usr_pref p5 ON p5.usr_id=u.usr_id AND p5.keyword = 'language' ".
// Fetch only users who have exceeded their quota, and who have
// access, and who have not received a reminder in the past seven days
// #8554 / #10301
'WHERE (((p1.value+0 > rq.role_disk_quota OR rq.role_disk_quota IS NULL) AND p2.value+0 > p1.value+0) OR
((rq.role_disk_quota > p1.value+0 OR p1.value IS NULL) AND p2.value+0 > rq.role_disk_quota)) '.
'AND (u.active=1 AND (u.time_limit_unlimited = 1 OR '.$ilDB->unixTimestamp().' BETWEEN u.time_limit_from AND u.time_limit_until)) '
,
array('integer','integer'),
array(ROLE_FOLDER_ID, SYSTEM_ROLE_ID)
);
$users = array();
$counter = 0;
while( $row = $ilDB->fetchAssoc($res) )
{
$users[$counter]['disk_quota'] = $row['disk_quota'];
$users[$counter]['disk_usage'] = $details['disk_usage'];
$users[$counter]['email'] = $row['email'];
$users[$counter]['firstname'] = $row['firstname'];
$users[$counter]['lastname'] = $row['lastname'];
++$counter;
}
if( count($users) ) foreach($this->getRecipients() as $rcp)
{
$usrId = ilObjUser::_lookupId($rcp);
$this->initLanguage($usrId);
$this->initMail();
$this->setSubject($this->getLanguage()->txt('disk_quota_summary_subject'));
$this->setBody(ilMail::getSalutation($usrId, $this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody($this->getLanguage()->txt('disk_quota_exceeded_headline'));
$this->appendBody("\n\n");
$first = true;
$counter = 0;
$numUsers = count($users);
foreach($users as $user)
{
if(!$first)
{
$this->appendBody("\n---------------------------------------------------\n\n");
}
$this->appendBody(
$this->getLanguage()->txt('fullname').': '.
$user['lastname'].', '.$user['firstname']
."\n");
$this->appendBody(
$this->getLanguage()->txt('email').': '.
$user['email']
."\n");
$this->appendBody(
$this->getLanguage()->txt('disk_quota').': '.
ilFormat::formatSize($user['disk_quota'],'short', $this->getLanguage())
."\n");
$this->appendBody(
$this->getLanguage()->txt('currently_used_disk_space').': '.
ilFormat::formatSize($user['disk_usage'],'short', $this->getLanguage())
."\n");
$this->appendBody(
$this->getLanguage()->txt('usrf_profile_link').': '.
ilUtil::_getHttpPath().'/goto.php?target=usrf&client_id='.CLIENT_ID
);
if($counter < $numUsers - 1)
{
$this->appendBody("\n");
}
++$counter;
$first = false;
}
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp), array('system'), false);
}
}
}

+ Here is the call graph for this function:


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