コード例 #1
0
 function index(Application $app)
 {
     $mrb = new MediaRepositoryBuilder();
     $mrb->setIncludeDeleted(false);
     $mrb->setSite($app['currentSite']);
     $medias = $mrb->fetchAll();
     return $app['twig']->render('site/medialist/index.html.twig', array('medias' => $medias));
 }
コード例 #2
0
 public function build()
 {
     foreach ($this->eventRepositoryBuilder->fetchAll() as $event) {
         $eventMedias = null;
         if ($this->includeEventMedias) {
             $mrb = new MediaRepositoryBuilder();
             $mrb->setEvent($event);
             $mrb->setIncludeDeleted(false);
             $eventMedias = $mrb->fetchAll();
         }
         $this->addEvent($event, null, $event->getVenue(), $event->getArea(), $event->getCountry(), $eventMedias);
     }
 }
コード例 #3
0
 function index($siteid, Request $request, Application $app)
 {
     $sr = new SiteRepository();
     $site = $sr->loadById($siteid);
     if (!$site) {
         die("404");
     }
     $mrb = new MediaRepositoryBuilder();
     $mrb->setIncludeDeleted(true);
     $mrb->setSite($site);
     $medias = $mrb->fetchAll();
     return $app['twig']->render('sysadmin/medialist/index.html.twig', array('site' => $site, 'medias' => $medias));
 }
コード例 #4
0
 function editMediaAddExisting($slug, Request $request, Application $app)
 {
     if (!$this->build($slug, $request, $app)) {
         $app->abort(404, "Venue does not exist.");
     }
     if ($request->request->get('addMedia') && $request->request->get('CSFRToken') == $app['websession']->getCSFRToken()) {
         $mediaRepository = new MediaRepository();
         $media = $mediaRepository->loadBySlug($app['currentSite'], $request->request->get('addMedia'));
         if ($media) {
             $mediaInVenueRepo = new MediaInVenueRepository();
             $mediaInVenueRepo->add($media, $this->parameters['venue'], $app['currentUser']);
             $app['flashmessages']->addMessage('Added!');
             return $app->redirect("/venue/" . $this->parameters['venue']->getSlugForURL() . '/');
         }
     }
     $mrb = new MediaRepositoryBuilder();
     $mrb->setIncludeDeleted(false);
     $mrb->setSite($app['currentSite']);
     $mrb->setNotInVenue($this->parameters['venue']);
     $this->parameters['medias'] = $mrb->fetchAll();
     return $app['twig']->render('site/venue/edit.media.add.existing.html.twig', $this->parameters);
 }
コード例 #5
0
 function jsonp($slug, Request $request, Application $app)
 {
     if (!$this->build($slug, $request, $app)) {
         $app->abort(404, "Event does not exist.");
     }
     $eventMedias = array();
     $ourRequest = new \Request($request);
     if ($ourRequest->getGetOrPostBoolean("includeMedias", false)) {
         $mrb = new MediaRepositoryBuilder();
         $mrb->setEvent($this->parameters['event']);
         $mrb->setIncludeDeleted(false);
         $eventMedias = $mrb->fetchAll();
     }
     $jsonp = new EventListJSONPBuilder($app['currentSite'], $app['currentTimeZone']);
     $jsonp->addEvent($this->parameters['event'], $this->parameters['groups'], $this->parameters['venue'], $this->parameters['area'], $this->parameters['country'], $eventMedias);
     if (isset($_GET['callback'])) {
         $jsonp->setCallBackFunction($_GET['callback']);
     }
     return $jsonp->getResponse();
 }
コード例 #6
0
 function media(Request $request, Application $app)
 {
     $mrb = new MediaRepositoryBuilder();
     $mrb->setIncludeDeleted(false);
     $mrb->setSite($app['currentSite']);
     $size = 0;
     $count = 0;
     foreach ($mrb->fetchAll() as $media) {
         $count += 1;
         $size += $media->getStorageSize();
     }
     return $app['twig']->render('site/admin/media.html.twig', array('count' => $count, 'size' => $size));
 }