ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMailSummaryNotification Class Reference
+ Inheritance diagram for ilMailSummaryNotification:
+ Collaboration diagram for ilMailSummaryNotification:

Public Member Functions

 __construct ()
 Constructor.
 send ()
 Send notifications.
- Public Member Functions inherited from ilMailNotification
 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
 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.

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

Detailed Description

Author
Nadia Ahmad nahma.nosp@m.d@da.nosp@m.tabay.nosp@m..de
Version
$Id:$

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

Constructor & Destructor Documentation

ilMailSummaryNotification::__construct ( )

Constructor.

Returns

Reimplemented from ilMailNotification.

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

Member Function Documentation

ilMailSummaryNotification::send ( )

Send notifications.

Returns

Reimplemented from ilMailNotification.

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

References $ilDB, $ilSetting, $lng, ilMailNotification\$mail, $res, $row, 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().

{
global $ilDB, $lng, $ilSetting;
$is_message_enabled = $ilSetting->get("mail_notification_message");
$res = $ilDB->queryF('SELECT mail.* FROM mail_options
INNER JOIN mail ON mail.user_id = mail_options.user_id
INNER JOIN mail_obj_data ON mail_obj_data.obj_id = mail.folder_id
WHERE cronjob_notification = %s
AND send_time >= %s
AND m_status = %s',
array('integer', 'timestamp', 'text'),
array(1, date('Y-m-d H:i:s', time() - 60 * 60 * 24), 'unread')
);
$users = array();
$user_id = 0;
while($row = $ilDB->fetchAssoc($res))
{
if($user_id == 0 || $row['user_id'] != $user_id)
{
$user_id = $row['user_id'];
}
$users[$user_id][] = $row;
}
foreach($users as $user_id => $mail_data)
{
$this->initLanguage($user_id);
$user_lang = $this->getLanguage() ? $this->getLanguage() : $lng;
$this->initMail();
$this->setRecipients($user_id);
$this->setSubject($this->getLanguageText('mail_notification_subject'));
$this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
$this->appendBody("\n\n");
if(count($mail_data) == 1)
{
$this->appendBody(sprintf($user_lang->txt('mail_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
}
else
{
$this->appendBody(sprintf($user_lang->txt('mails_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
}
$this->appendBody("\n\n");
$counter = 1;
foreach($mail_data as $mail)
{
$this->appendBody("----------------------------------------------------------------------------------------------");
$this->appendBody("\n\n");
$this->appendBody('#'.$counter."\n\n");
$this->appendBody($user_lang->txt('date') .": ".$mail['send_time']);
$this->appendBody("\n");
$this->appendBody($user_lang->txt('sender') .": ".ilObjUser::_lookupLogin($mail['sender_id'])."");
$this->appendBody("\n");
$this->appendBody($user_lang->txt('subject').": ". $mail['m_subject']);
$this->appendBody("\n\n");
if($is_message_enabled == true)
{
$this->appendBody($user_lang->txt('message').": ". $mail['m_message']);
$this->appendBody("\n\n");
}
++$counter;
}
$this->appendBody("----------------------------------------------------------------------------------------------");
$this->appendBody("\n\n");
$this->appendBody($user_lang->txt('follow_link_to_read_mails')." ");
$this->appendBody("\n");
$mailbox_link = ilUtil::_getHttpPath();
$mailbox_link .= "/goto.php?target=mail&client_id=".CLIENT_ID;
$this->appendBody($mailbox_link);
$this->appendBody("\n\n");
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->To(ilObjUser::_lookupEmail($user_id));
$mmail->Subject($this->getSubject());
$mmail->Body($this->getBody());
$mmail->Send();
}
}

+ Here is the call graph for this function:


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