]> Raphaël G. Git Repositories - airbundle/commitdiff
Add translated location fetch
authorRaphaël Gertz <git@rapsys.eu>
Sun, 29 Nov 2020 06:11:25 +0000 (07:11 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Sun, 29 Nov 2020 06:11:25 +0000 (07:11 +0100)
Display only attributed session when not authenticated

Controller/LocationController.php

index bf5f62d860409f9c2ce74d0c0d437a1df96b8c76..0f47a99c281f0493a46124170dd51247915f371c 100644 (file)
@@ -78,9 +78,13 @@ class LocationController extends DefaultController {
                );
 
                //Fetch calendar
-               $calendar = $doctrine->getRepository(Session::class)->fetchCalendarByDatePeriod($this->translator, $period, $id, $request->get('session'));
+               $calendar = $doctrine->getRepository(Session::class)->fetchCalendarByDatePeriod($this->translator, $period, $id, $request->get('session'), !$this->isGranted('IS_AUTHENTICATED_REMEMBERED'));
+
+               //Fetch locations
+               //XXX: we want to display all active locations anyway
+               $locations = $doctrine->getRepository(Location::class)->fetchTranslatedLocationByDatePeriod($this->translator, $period/*, !$this->isGranted('IS_AUTHENTICATED_REMEMBERED')*/);
 
                //Render the view
-               return $this->render('@RapsysAir/location/view.html.twig', ['id' => $id, 'title' => $title, 'section' => $section, 'calendar' => $calendar]+$context+$this->context);
+               return $this->render('@RapsysAir/location/view.html.twig', ['id' => $id, 'title' => $title, 'section' => $section, 'calendar' => $calendar, 'locations' => $locations]+$context+$this->context);
        }
 }