diff --git a/vilesci/cronjobs/ampel_erinnerungsmail.php b/vilesci/cronjobs/ampel_erinnerungsmail.php deleted file mode 100644 index eaef4ad17..000000000 --- a/vilesci/cronjobs/ampel_erinnerungsmail.php +++ /dev/null @@ -1,315 +0,0 @@ - */ -require_once('../../config/vilesci.config.inc.php'); -require_once('../../include/basis_db.class.php'); -require_once('../../include/datum.class.php'); -require_once('../../include/mail.class.php'); -require_once('../../include/ampel.class.php'); -require_once('../../include/person.class.php'); -require_once('../../include/phrasen.class.php'); - -$db = new basis_db(); -$datum = new datum(); -$now = $datum->mktime_fromdate(date('Y-m-d')); - -$sprache = getSprache(); -$p = new phrasen($sprache); - -//get all notifications -$ampel_obj = new ampel(); -$ampel_obj->getAll(); -$ampel_arr = $ampel_obj->result; - -//filter only notifications that are not expired, not before vorlaufzeit AND email is true -$ampel_arr = filterAmpeln($ampel_arr); - -//get user of notifications, ampel_id, description and deadline -$new_ampel_user_arr = array(); //user with new notifications that are not confirmed -$overdue_ampel_user_arr = array(); //user with overdue notifications that are not confirmed -foreach($ampel_arr as $ampel) -{ - $deadline = $datum->mktime_fromdate($ampel->deadline); - $insert_date = $datum->formatDatum($ampel->insertamum, 'Y-m-d'); - $qry_all_ampel_user = $ampel->benutzer_select; - $kurzbz = $ampel->kurzbz; - - $new = false; - $overdue = false; - $new_user_arr = array(); - $overdue_user_arr = array(); - - if($result = $db->db_query($qry_all_ampel_user)) - { - while($row = $db->db_fetch_object($result)) - { - $user = $row->uid; - - //break if almost confirmed - if ($ampel_obj->isBestaetigt($user, $ampel->ampel_id)) - break; - - //check if notification is new (within last week, as cronjob will run every week) - if($datum->DateDiff(date('Y-m-d'), $insert_date) >= -7) - { - $new = true; - $new_user_arr[] = $user; - } - - //check if notification is overdue - if ($now > $deadline) - { - $overdue = true; - $overdue_user_arr[] = $user; - } - }; - }; - - if ($new) - { - $new_ampel_user_arr[] = - array( - 'ampel_id' => $ampel->ampel_id, - 'ampel_bezeichnung' => $kurzbz, - 'user' => $new_user_arr, - 'deadline' => date('d.m.Y', $deadline) - ); - } - - if ($overdue) - { - $overdue_ampel_user_arr[] = - array( - 'ampel_id' => $ampel->ampel_id, - 'ampel_bezeichnung' => $kurzbz, - 'user' => $overdue_user_arr, - 'deadline' => date('d.m.Y', $deadline) - ); - } -}; - -//rearrange arrays as needed to send in eMails -$new_ampel_user_arr = organizeAmpelnForMail($new_ampel_user_arr); -$overdue_ampel_user_arr = organizeAmpelnForMail($overdue_ampel_user_arr); - -//send eMail for new notifications -foreach ($new_ampel_user_arr as $receiver) -{ - //get data about sender - $person = new person(); - $person->getPersonFromBenutzer($receiver['user']); - $firstName = $person->vorname; - - //link to notifications system site - $link = APP_ROOT. "cis/index.php?sprache=German&content_id=&menu=". - APP_ROOT. "cis/menu.php?content_id=&content=". - APP_ROOT. "cis/private/tools/ampelverwaltung.php"; - - //eMail data - $to = $receiver['user']. '@'. DOMAIN; - $from = 'noreply@'. DOMAIN; - $subject = 'Sie haben eine neue Ampel!'; - $headerImg = "sancho_header_neue_nachrichten_in_ampelsystem.jpg"; - $content = "
Hallo ". $firstName. ",
es gibt neue Ampeln für Sie:
". strtoupper($receiver[$i]['ampel_bezeichnung']). "
"; - } - - $content .= "Sie können sie jetzt gleich in Ihrem Ampelsystem bestätigen:
"; - $content .= "Zu meinem Ampelsystem"; - $content .= "
Schönen Tag noch,";
- $content .= "Sancho
Hallo " . $firstName . ",
diese Ampeln müssen von Ihnen noch bestätigt werden:
" . strtoupper($receiver[$i]['ampel_bezeichnung']) . "
";
- $content .= "Die Deadline für die Bestätigung war am " . $receiver[$i]['deadline'] . "
Sie können sie jetzt gleich in Ihrem Ampelsystem bestätigen:
"; - $content .= "Zu meinem Ampelsystem
Schönen Tag noch!
";
- $content .= "Sancho
-
|
- |
-
|
- |
-
|
-