Translate site title
Add translated location fetch
Display only attributed session when not authenticated
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Rapsys\UserBundle\Utils\Slugger;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Rapsys\UserBundle\Utils\Slugger;
+use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
+use Symfony\Component\DependencyInjection\ContainerAwareTrait;
-class DefaultController extends AbstractController {
- //Config array
+class DefaultController {
+ use ControllerTrait;
+
+ ///Config array
+ /**
+ * @var ContainerInterface
+ */
+ protected $container;
+
/**
* Inject container and translator interface
*
/**
* Inject container and translator interface
*
//Retrieve config
$this->config = $container->getParameter($this->getAlias());
//Retrieve config
$this->config = $container->getParameter($this->getAlias());
+ //Set the container
+ $this->container = $container;
+
//Set the router
$this->router = $router;
//Set the router
$this->router = $router;
$section = $this->translator->trans('Index');
//Set title
$section = $this->translator->trans('Index');
//Set title
- $title = $section.' - '.$this->context['site_title'];
+ $title = $section.' - '.$this->translator->trans($this->config['site']['title']);
//Init context
$context = [];
//Init context
$context = [];
- $calendar = $doctrine->getRepository(Session::class)->fetchCalendarByDatePeriod($this->translator, $period, null, $request->get('session'), true);
+ $calendar = $doctrine->getRepository(Session::class)->fetchCalendarByDatePeriod($this->translator, $period, null, $request->get('session'), !$this->isGranted('IS_AUTHENTICATED_REMEMBERED'));
- $locations = $doctrine->getRepository(Location::class)->fetchTranslatedLocationByDatePeriod($this->translator, $period, true);
+ //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/default/index.html.twig', ['title' => $title, 'section' => $section, 'calendar' => $calendar, 'locations' => $locations]+$context+$this->context);
//Render the view
return $this->render('@RapsysAir/default/index.html.twig', ['title' => $title, 'section' => $section, 'calendar' => $calendar, 'locations' => $locations]+$context+$this->context);
$section = $this->translator->trans('Regulation');
//Set title
$section = $this->translator->trans('Regulation');
//Set title
- $title = $section.' - '.$this->context['site_title'];
+ $title = $section.' - '.$this->translator->trans($this->config['site']['title']);
//Render template
return $this->render('@RapsysAir/default/regulation.html.twig', ['title' => $title, 'section' => $section]+$this->context);
//Render template
return $this->render('@RapsysAir/default/regulation.html.twig', ['title' => $title, 'section' => $section]+$this->context);