コード例 #1
0
 function index($slug, Request $request, Application $app)
 {
     if (!$this->build($slug, $request, $app)) {
         $app->abort(404, "Event does not exist.");
     }
     if ($request->request->get('eventCommentSlug') && $request->request->get('CSFRToken') == $app['websession']->getCSFRToken()) {
         $repo = new EventCommentRepository();
         $eventComment = $repo->getByEventAndSlug($this->parameters['event'], $request->request->get('eventCommentSlug'));
         if ($eventComment) {
             if ($request->request->get('action') == 'delete') {
                 $repo->delete($eventComment, $app['currentUser']);
             } else {
                 if ($request->request->get('action') == 'undelete') {
                     $repo->undelete($eventComment, $app['currentUser']);
                 } else {
                     if ($request->request->get('action') == 'close') {
                         $repo->closeByAdmin($eventComment, $app['currentUser']);
                     } else {
                         if ($request->request->get('action') == 'unclose') {
                             $repo->uncloseByAdmin($eventComment, $app['currentUser']);
                         }
                     }
                 }
             }
         }
     }
     $ecrb = new EventCommentRepositoryBuilder();
     $ecrb->setIncludeDeleted(true);
     $ecrb->setIncludeClosedByAdmin(true);
     $ecrb->setEvent($this->parameters['event']);
     $this->parameters['eventComments'] = $ecrb->fetchAll();
     return $app['twig']->render('site/commentsadminevent/index.html.twig', $this->parameters);
 }
 public function getParameters()
 {
     $ecrb = new EventCommentRepositoryBuilder();
     $ecrb->setIncludeDeleted(false);
     $ecrb->setIncludeClosedByAdmin(false);
     $ecrb->setEvent($this->parameters['event']);
     $ecrb->setLimit(1000);
     return array('eventComments' => $ecrb->fetchAll());
 }