ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMailSummaryNotification Class Reference
+ Inheritance diagram for ilMailSummaryNotification:
+ Collaboration diagram for ilMailSummaryNotification:

Public Member Functions

 __construct ($a_is_personal_workspace=false)
 {} More...
 
 send ()
 
- Public Member Functions inherited from ilMailNotification
 __construct ($a_is_personal_workspace=false)
 
 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 (array $a_rcp)
 
 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)
 
 getRefId ()
 
 getObjId ()
 
 setObjId ($a_obj_id)
 
 getObjType ()
 Get object type. More...
 
 setAdditionalInformation (array $a_info)
 Additional information for creating notification mails. More...
 
 getAdditionalInformation ()
 
 sendMail (array $a_rcp, $a_type, $a_parse_recipients=true)
 
 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)
 
 getSubject ()
 
 setBody ($a_body)
 
 appendBody ($a_body)
 Append body text. More...
 
 getBody ()
 
 initLanguage ($a_usr_id)
 Init language. More...
 
 initLanguageByIso2Code ($a_code='')
 Init language by ISO2 code. More...
 
 setLanguage ($a_language)
 
 getLanguage ()
 
 getLanguageText ($a_keyword)
 
 getObjectTitle ($a_shorten=false)
 
 initMail ()
 
 getMail ()
 
 createPermanentLink ($a_params=array(), $a_append='')
 
 userToString ($a_usr_id)
 
 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 (   $a_is_personal_workspace = false)

{}

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

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

Member Function Documentation

◆ send()

ilMailSummaryNotification::send ( )

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

References $counter, $ilDB, $ilSetting, $lng, ilMailNotification\$mail, $res, $row, ilMailNotification\$sender, ilUtil\_getHttpPath(), ilObjUser\_lookupEmail(), ilObjUser\_lookupLogin(), ilMailNotification\appendBody(), array, date, ilMailNotification\getBody(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getSubject(), ilMailNotification\initLanguage(), ilMailNotification\initMail(), ilMailNotification\setBody(), ilMailNotification\setRecipients(), ilMailNotification\setSubject(), and time.

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  INNER JOIN usr_data ud ON ud.usr_id = mail.user_id
35  WHERE mail_options.cronjob_notification = %s
36  AND mail.send_time >= %s
37  AND mail.m_status = %s
38  AND ud.active = %s',
39  array('integer', 'timestamp', 'text', 'integer'),
40  array(1, date('Y-m-d H:i:s', time() - 60 * 60 * 24), 'unread', 1)
41  );
42 
43  $users = array();
44  $user_id = 0;
45 
46  while($row = $ilDB->fetchAssoc($res))
47  {
48  if($user_id == 0 || $row['user_id'] != $user_id)
49  {
50  $user_id = $row['user_id'];
51  }
52  $users[$user_id][] = $row;
53  }
54 
55  foreach($users as $user_id => $mail_data)
56  {
57  $this->initLanguage($user_id);
58  $user_lang = $this->getLanguage() ? $this->getLanguage() : $lng;
59 
60  $this->initMail();
61 
62  $this->setRecipients(array($user_id));
63  $this->setSubject($this->getLanguageText('mail_notification_subject'));
64 
65  $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
66  $this->appendBody("\n\n");
67  if(count($mail_data) == 1)
68  {
69  $this->appendBody(sprintf($user_lang->txt('mail_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
70  }
71  else
72  {
73  $this->appendBody(sprintf($user_lang->txt('mails_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
74  }
75  $this->appendBody("\n\n");
76 
77  $counter = 1;
78  foreach($mail_data as $mail)
79  {
80  $this->appendBody("----------------------------------------------------------------------------------------------");
81  $this->appendBody("\n\n");
82  $this->appendBody('#'.$counter."\n\n");
83  $this->appendBody($user_lang->txt('date') .": ".$mail['send_time']);
84  $this->appendBody("\n");
85  if($mail['sender_id'] == ANONYMOUS_USER_ID)
86  {
87  $sender = ilMail::_getIliasMailerName();
88  }
89  else
90  {
91  $sender = ilObjUser::_lookupLogin($mail['sender_id']);
92  }
93  $this->appendBody($user_lang->txt('sender') . ": " . $sender);
94  $this->appendBody("\n");
95  $this->appendBody($user_lang->txt('subject').": ". $mail['m_subject']);
96  $this->appendBody("\n\n");
97 
98  if($is_message_enabled == true)
99  {
100  $this->appendBody($user_lang->txt('message').": ". $mail['m_message']);
101  $this->appendBody("\n\n");
102  }
103  ++$counter;
104  }
105  $this->appendBody("----------------------------------------------------------------------------------------------");
106  $this->appendBody("\n\n");
107  $this->appendBody($user_lang->txt('follow_link_to_read_mails')." ");
108  $this->appendBody("\n");
109  $mailbox_link = ilUtil::_getHttpPath();
110  $mailbox_link .= "/goto.php?target=mail&client_id=".CLIENT_ID;
111 
112  $this->appendBody($mailbox_link);
113  $this->appendBody("\n\n");
114  $this->appendBody(ilMail::_getAutoGeneratedMessageString($this->getLanguage()));
115  $this->appendBody(ilMail::_getInstallationSignature());
116 
117  $mmail = new ilMimeMail();
118  $mmail->autoCheck(false);
119  $mmail->From(ilMail::getIliasMailerAddress());
120  $mmail->To(ilObjUser::_lookupEmail($user_id));
121 
122  $mmail->Subject($this->getSubject());
123  $mmail->Body($this->getBody());
124  $mmail->Send();
125  }
126  }
static _lookupLogin($a_user_id)
lookup login
initLanguage($a_usr_id)
Init language.
$counter
this class encapsulates the PHP mail() function.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
static _getHttpPath()
global $ilSetting
Definition: privfeed.php:17
static _lookupEmail($a_user_id)
Lookup email.
global $lng
Definition: privfeed.php:17
global $ilDB
appendBody($a_body)
Append body text.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

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