3 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsNotificationCollectionObj.php';
4 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsFolderObject.php';
5 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsFolderMailObject.php';
35 $this->db = $DIC->database();
36 $this->setting = $DIC->settings();
46 $mail_notify_orphaned = (int) $this->setting->get(
'mail_notify_orphaned');
47 $mail_threshold = (int) $this->setting->get(
'mail_threshold');
49 if ($mail_threshold > $mail_notify_orphaned) {
50 $notify_days_before = $mail_threshold - $mail_notify_orphaned;
52 $notify_days_before = 1;
55 $ts_notify = strtotime(
"- " . $notify_days_before .
" days");
56 $ts_for_notification =
date(
'Y-m-d', $ts_notify) .
' 23:59:59';
58 $res = $this->db->query(
'SELECT mail_id FROM mail_cron_orphaned');
59 $already_notified =
array();
60 while (
$row = $this->db->fetchAssoc(
$res)) {
61 $already_notified[
$row[
'mail_id']] = $row[
'mail_id'];
64 $types =
array(
'timestamp');
67 $notification_query =
" 68 SELECT mail_id, m.user_id, folder_id, send_time, m_subject, mdata.title 70 INNER JOIN mail_obj_data mdata ON obj_id = folder_id 71 WHERE send_time <= %s";
73 if ((
int) $this->setting->get(
'mail_only_inbox_trash') > 0) {
74 $notification_query .=
" AND (mdata.m_type = %s OR mdata.m_type = %s)";
75 $types =
array(
'timestamp',
'text',
'text');
76 $data =
array($ts_for_notification,
'inbox',
'trash');
79 $notification_query .=
" AND " . $this->db->in(
'mail_id', array_values($already_notified),
true,
'integer')
80 .
" ORDER BY m.user_id, folder_id, mail_id";
82 $collection_obj = null;
85 $res = $this->db->queryF($notification_query, $types,
$data);
86 while (
$row = $this->db->fetchAssoc(
$res)) {
88 if (is_object($collection_obj)) {
93 if (!is_object($collection_obj)) {
97 if (is_object($collection_obj)) {
98 if (!$folder_obj = $collection_obj->getFolderObjectById(
$row[
'folder_id'])) {
100 $folder_obj->setFolderTitle(
$row[
'title']);
101 $collection_obj->addFolderObject($folder_obj);
104 if (is_object($folder_obj)) {
106 $folder_obj->addMailObject($orphaned_mail_obj);
111 if (is_object($collection_obj)) {
113 unset($collection_obj);
122 $this->collection[$collection_obj->
getUserId()] = $collection_obj;
131 if (isset($this->collection[$user_id])) {
ilMailCronOrphanedMailsFolderObject
ilMailCronOrphanedMailsNotificationCollectionObj
ilMailCronOrphanedMailsFolderMailObject
addCollectionObject(ilMailCronOrphanedMailsNotificationCollectionObj $collection_obj)
foreach($_POST as $key=> $value) $res
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
existsCollectionObjForUserId($user_id)
ilMailCronOrphanedMailsNotificationCollector
Create styles array
The data for the language used.