function listNotifications($id, Request $request, Application $app)
 {
     $this->build($id, $request, $app);
     $rb = new UserNotificationRepositoryBuilder($app['extensions']);
     $rb->setLimit(40);
     $rb->setUser($this->parameters['user']);
     $this->parameters['notifications'] = $rb->fetchAll();
     return $app['twig']->render('/sysadmin/user/notifications.html.twig', $this->parameters);
 }
 function listNotificationsJson(Application $app)
 {
     $rb = new UserNotificationRepositoryBuilder($app['extensions']);
     $rb->setIsOpenBySysAdminsOnly(true);
     $rb->setLimit(20);
     $rb->setUser($app['currentUser']);
     $notifications = $rb->fetchAll();
     $timeSinceInWordsExtension = new TimeSinceInWordsExtension($app);
     $out = array();
     foreach ($notifications as $notification) {
         $out[] = array('id' => $notification->getId(), 'text' => $notification->getNotificationText(), 'read' => $notification->getIsRead(), 'timesince' => $timeSinceInWordsExtension->timeSinceInWords($notification->getCreatedAt()), 'site' => array('slug' => $notification->getSite()->getSlug(), 'title' => $notification->getSite()->getTitle()));
     }
     return json_encode(array('notifications' => $out));
 }