ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCronMailNotification Class Reference
+ Collaboration diagram for ilCronMailNotification:

Public Member Functions

 ilCronMailNotification ()
 sendMails ($res)
 sendNotifications ()

Detailed Description

Definition at line 33 of file class.ilCronMailNotification.php.

Member Function Documentation

ilCronMailNotification::ilCronMailNotification ( )

Definition at line 35 of file class.ilCronMailNotification.php.

References $ilLog.

{
global $ilLog,$ilDB;
$this->log =& $ilLog;
$this->db =& $ilDB;
}
ilCronMailNotification::sendMails (   $res)

Definition at line 43 of file class.ilCronMailNotification.php.

{
global $ilias, $rbacsystem;
}
ilCronMailNotification::sendNotifications ( )

Definition at line 49 of file class.ilCronMailNotification.php.

References $res, ilObjUser\_lookupEmail(), and DB_FETCHMODE_ASSOC.

{
global $ilias;
include_once "Services/Mail/classes/class.ilMail.php";
include_once './Services/User/classes/class.ilObjUser.php';
include_once "./Services/Language/classes/class.ilLanguage.php";
$query = "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 1 "
."AND cronjob_notification = '1' "
."AND send_time >= '" . date("Y-m-d H:i:s", time() - 60 * 60 * 24). "' "
."AND mail_obj_data.type = 'inbox' "
."AND m_status = 'unread' "
." ";
$res = $this->db->query($query);
$users = array();
$user_id = 0;
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($user_id == 0 || $row['user_id'] != $user_id) $user_id = $row['user_id'];
$users[$user_id][] = $row;
}
$numRows = 0;
foreach ($users as $user_id => $mail_data)
{
$tmp_mail_obj = new ilMail($user_id);
include_once "Services/Mail/classes/class.ilMimeMail.php";
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->From('noreply');
$mmail->To(ilObjUser::_lookupEmail($user_id));
$mmail->Subject($tmp_mail_obj->formatNotificationSubject());
$mmail->Body($tmp_mail_obj->formatNotificationMessage($user_id, $mail_data));
$mmail->Send();
unset($tmp_mail_obj);
++$numRows;
}
$this->log->write(__METHOD__.': Send '.$numRows.' messages.');
return true;
}

+ Here is the call graph for this function:


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