app->l11nManager, $request, $response); $view->setTemplate('/Modules/Notification/Theme/Backend/notification-dashboard'); $view->data['notifications'] = NotificationMapper::getAll() ->where('createdFor', $request->header->account) ->where('seenAt', null) ->where('createdAt', new \DateTime('now'), '<') // Don't show future notifications ->sort('createdAt', OrderType::ASC) ->executeGetArray(); return $view; } /** * {@inheritdoc} * @codeCoverageIgnore */ public function viewDashboard(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Notification/Theme/Backend/dashboard-notification'); $view->data['notifications'] = NotificationMapper::getAll() ->where('createdFor', $request->header->account) ->where('seenAt', null) ->where('createdAt', new \DateTime('now'), '<') // Don't show future notifications ->sort('createdAt', OrderType::ASC) ->limit(5) ->executeGetArray(); return $view; } /** * Count unread messages * * @param int $account Account id * * @return int Returns the amount of unread tasks * * @since 1.0.0 */ public function openNav(int $account) : int { return NotificationMapper::count() ->where('createdFor', $account) ->where('seenAt', null) ->where('createdAt', new \DateTime('now'), '<') // Don't show future notifications ->executeCount(); } }