コード例 #1
0
            $lastEventTime = $events[0]['created'];
            $time = $lastEventTime;
        }
        $notifications = $notifier->getFormattedForInline($events);
        echo json_encode(array("events" => $notifications, "time" => $time));
    }
});
dispatch_get('Ajax/data/new', function () {
    if (Request::valid($_GET['_token'])) {
        $notifier = new \CODOF\Forum\Notification\Notifier();
        if (isset($_GET['time']) && $_GET['time'] > 0) {
            $time = $_GET['time'];
        } else {
            $time = time();
        }
        $events = $notifier->getLatest($time);
        if (!empty($events)) {
            $lastEventTime = $events[0]['created'];
            $time = $lastEventTime;
        }
        $notifications = $notifier->getFormattedForInline($events);
        echo json_encode(array("events" => $notifications, "time" => $time));
    }
});
dispatch_get('Ajax/notifications/all', function () {
    if (Request::valid($_GET['_token'])) {
        $notifier = new \CODOF\Forum\Notification\Notifier();
        $notifications = $notifier->get();
        echo json_encode($notifier->getFormattedForInline($notifications));
    }
});