|
|
@@ -98,32 +98,33 @@ class Route_Cron extends RouteBase {
|
|
|
$notify = Router::getRoute('Notify');
|
|
|
$todoReminders = array();
|
|
|
|
|
|
- {// limit send time to 8 - 20
|
|
|
- $timeNow = time();
|
|
|
- $timeSendLimitFrom = mktime(8, 0, 0, date('n'), date('j'), date('Y'));
|
|
|
- $timeSendLimitTo = mktime(20, 0, 0, date('n'), date('j'), date('Y'));
|
|
|
- if ($timeNow > $timeSendLimitFrom && $timeNow < $timeSendLimitTo) {
|
|
|
- $todoReminders = $notify->getTodoList(2);
|
|
|
+ echo '<div class="container">' . "\n";
|
|
|
+ echo '<h1>Cron</h1>' . "\n";
|
|
|
+ try {
|
|
|
+ {// limit send time to 8 - 20
|
|
|
+ $timeNow = time();
|
|
|
+ $timeSendLimitFrom = mktime(8, 0, 0, date('n'), date('j'), date('Y'));
|
|
|
+ $timeSendLimitTo = mktime(20, 0, 0, date('n'), date('j'), date('Y'));
|
|
|
+ if ($timeNow > $timeSendLimitFrom && $timeNow < $timeSendLimitTo) {
|
|
|
+ $todoReminders = $notify->getTodoList(2);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- ?>
|
|
|
-<div class="container">
|
|
|
- <h1>Cron</h1>
|
|
|
- <?php DBG::_('DBG_CRON', '>0', 'todoReminders', $todoReminders, __CLASS__, __FUNCTION__, __LINE__); ?>
|
|
|
- <?php
|
|
|
-
|
|
|
- foreach ($todoReminders as $who => $listWhen) {
|
|
|
- foreach ($listWhen as $when => $listWhat) {
|
|
|
- if (!empty($listWhat)) {
|
|
|
- $reminders = array_keys($listWhat);
|
|
|
- echo "<p>Sending to {$who} reminders [" . implode(",", $reminders) . "]</p>" . "\n";
|
|
|
- $notify->send($who, $reminders, $forceMail = 'plabudda@biall-net.pl');
|
|
|
- $notify->markAsSent($who, $reminders);
|
|
|
+ DBG::_('DBG_CRON', '>0', 'todoReminders', $todoReminders, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
+
|
|
|
+ foreach ($todoReminders as $who => $listWhen) {
|
|
|
+ foreach ($listWhen as $when => $listWhat) {
|
|
|
+ if (!empty($listWhat)) {
|
|
|
+ $reminders = array_keys($listWhat);
|
|
|
+ echo "<p>Sending to {$who} reminders [" . implode(",", $reminders) . "]</p>" . "\n";
|
|
|
+ $notify->send($who, $reminders, $forceMail = 'plabudda@biall-net.pl');
|
|
|
+ $notify->markAsSent($who, $reminders);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ } catch (Exception $e) {
|
|
|
+ SE_Layout::alert('danger', "#" . $e->getLine() . ":" . $e->getMessage());
|
|
|
}
|
|
|
-echo "\n" . '</div>';// .container
|
|
|
+ echo "\n" . '</div>';// .container
|
|
|
echo "\n.EOF\n";
|
|
|
}
|
|
|
|