ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilMailSummaryNotification Class Reference
+ Inheritance diagram for ilMailSummaryNotification:
+ Collaboration diagram for ilMailSummaryNotification:

Public Member Functions

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

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. More...
 
 getSubject ()
 Get mail subject. More...
 
 setBody ($a_body)
 Set mail body. More...
 
 appendBody ($a_body)
 Append body text. More...
 
 getBody ()
 Get body. More...
 
 initLanguage ($a_usr_id)
 Init language. More...
 
 initLanguageByIso2Code ($a_code='')
 Init language by ISO2 code. More...
 
 setLanguage ($a_language)
 A language. More...
 
 getLanguage ()
 get language object More...
 
 getLanguageText ($a_keyword)
 Replace new lines. More...
 
 getObjectTitle ($a_shorten=false)
 Get object title. More...
 
 initMail ()
 Init mail. More...
 
 getMail ()
 Get mail object. More...
 
 createPermanentLink ($a_params=array(), $a_append='')
 Create a permanent link for an object. More...
 
 userToString ($a_usr_id)
 Utility function. More...
 
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user. More...
 
- 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
Nadia Ahmad nahma.nosp@m.d@da.nosp@m.tabay.nosp@m..de
Version
$Id:$

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

Constructor & Destructor Documentation

◆ __construct()

ilMailSummaryNotification::__construct ( )

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

21 {
22 parent::__construct();
23 }

Member Function Documentation

◆ send()

ilMailSummaryNotification::send ( )

Definition at line 25 of file class.ilMailSummaryNotification.php.

26 {
27 global $ilDB, $lng, $ilSetting;
28
29 $is_message_enabled = $ilSetting->get("mail_notification_message");
30
31 $res = $ilDB->queryF('SELECT mail.* FROM mail_options
32 INNER JOIN mail ON mail.user_id = mail_options.user_id
33 INNER JOIN mail_obj_data ON mail_obj_data.obj_id = mail.folder_id
34 WHERE cronjob_notification = %s
35 AND send_time >= %s
36 AND m_status = %s',
37 array('integer', 'timestamp', 'text'),
38 array(1, date('Y-m-d H:i:s', time() - 60 * 60 * 24), 'unread')
39 );
40
41 $users = array();
42 $user_id = 0;
43
44 while($row = $ilDB->fetchAssoc($res))
45 {
46 if($user_id == 0 || $row['user_id'] != $user_id)
47 {
48 $user_id = $row['user_id'];
49 }
50 $users[$user_id][] = $row;
51 }
52
53 foreach($users as $user_id => $mail_data)
54 {
55 $this->initLanguage($user_id);
56 $user_lang = $this->getLanguage() ? $this->getLanguage() : $lng;
57
58 $this->initMail();
59
60 $this->setRecipients($user_id);
61 $this->setSubject($this->getLanguageText('mail_notification_subject'));
62
63 $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
64 $this->appendBody("\n\n");
65 if(count($mail_data) == 1)
66 {
67 $this->appendBody(sprintf($user_lang->txt('mail_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
68 }
69 else
70 {
71 $this->appendBody(sprintf($user_lang->txt('mails_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
72 }
73 $this->appendBody("\n\n");
74
75 $counter = 1;
76 foreach($mail_data as $mail)
77 {
78 $this->appendBody("----------------------------------------------------------------------------------------------");
79 $this->appendBody("\n\n");
80 $this->appendBody('#'.$counter."\n\n");
81 $this->appendBody($user_lang->txt('date') .": ".$mail['send_time']);
82 $this->appendBody("\n");
83 if($mail['sender_id'] == ANONYMOUS_USER_ID)
84 {
85 $sender = ilMail::_getIliasMailerName();
86 }
87 else
88 {
90 }
91 $this->appendBody($user_lang->txt('sender') . ": " . $sender);
92 $this->appendBody("\n");
93 $this->appendBody($user_lang->txt('subject').": ". $mail['m_subject']);
94 $this->appendBody("\n\n");
95
96 if($is_message_enabled == true)
97 {
98 $this->appendBody($user_lang->txt('message').": ". $mail['m_message']);
99 $this->appendBody("\n\n");
100 }
101 ++$counter;
102 }
103 $this->appendBody("----------------------------------------------------------------------------------------------");
104 $this->appendBody("\n\n");
105 $this->appendBody($user_lang->txt('follow_link_to_read_mails')." ");
106 $this->appendBody("\n");
107 $mailbox_link = ilUtil::_getHttpPath();
108 $mailbox_link .= "/goto.php?target=mail&client_id=".CLIENT_ID;
109
110 $this->appendBody($mailbox_link);
111 $this->appendBody("\n\n");
114
115 $mmail = new ilMimeMail();
116 $mmail->autoCheck(false);
117 $mmail->From(ilMail::getIliasMailerAddress());
118 $mmail->To(ilObjUser::_lookupEmail($user_id));
119
120 $mmail->Subject($this->getSubject());
121 $mmail->Body($this->getBody());
122 $mmail->Send();
123 }
124 }
appendBody($a_body)
Append body text.
setRecipients($a_rcp)
set mail recipients
getLanguage()
get language object
setBody($a_body)
Set mail body.
getSubject()
Get mail subject.
initLanguage($a_usr_id)
Init language.
getLanguageText($a_keyword)
Replace new lines.
setSubject($a_subject)
Set mail subject.
static getSalutation($a_usr_id, $a_language=null)
Get salutation.
static getIliasMailerAddress()
Builds an email address used for system notifications.
static _getInstallationSignature()
Static getter for the installation signature.
static _getAutoGeneratedMessageString($lang=null)
get auto generated info string
this class encapsulates the PHP mail() function.
_lookupLogin($a_user_id)
lookup login
_lookupEmail($a_user_id)
Lookup email.
static _getHttpPath()
global $lng
Definition: privfeed.php:40
global $ilSetting
Definition: privfeed.php:40
global $ilDB

References $ilDB, $ilSetting, $lng, ilMailNotification\$mail, $res, $row, ilMailNotification\$sender, ilMail\_getAutoGeneratedMessageString(), ilUtil\_getHttpPath(), ilMail\_getInstallationSignature(), ilObjUser\_lookupEmail(), ilObjUser\_lookupLogin(), ilMailNotification\appendBody(), ilMailNotification\getBody(), ilMail\getIliasMailerAddress(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMail\getSalutation(), ilMailNotification\getSubject(), ilMailNotification\initLanguage(), ilMailNotification\initMail(), ilMailNotification\setBody(), ilMailNotification\setRecipients(), and ilMailNotification\setSubject().

+ Here is the call graph for this function:

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