+ //Fetch calendar
+ $calendar = $doctrine->getRepository(Session::class)->fetchCalendarByDatePeriod($this->translator, $period, null, $request->get('session'), !$this->isGranted('IS_AUTHENTICATED_REMEMBERED'));
+
+ //Fetch locations
+ //XXX: we want to display all active locations anyway
+ $locations = $doctrine->getRepository(Location::class)->findTranslatedSortedByPeriod($this->translator, $period);
+
+ //Render the view
+ return $this->render('@RapsysAir/default/index.html.twig', ['calendar' => $calendar, 'locations' => $locations]+$this->context);
+
+ //Set Cache-Control must-revalidate directive
+ //TODO: add a javascript forced refresh after 1h ? or header refresh ?
+ #$response->setPublic(true);
+ #$response->setMaxAge(300);
+ #$response->mustRevalidate();
+ ##$response->setCache(['public' => true, 'max_age' => 300]);
+
+ //Return the response
+ #return $response;
+ }
+
+ /**
+ * The organizer regulation page
+ *
+ * @desc Display the organizer regulation policy
+ *
+ * @return Response The rendered view
+ */
+ public function organizerRegulation(): Response {
+ //Set section
+ $section = $this->translator->trans('Organizer regulation');
+
+ //Set description
+ $this->context['description'] = $this->translator->trans('Libre Air organizer regulation');
+
+ //Set keywords
+ $this->context['keywords'] = [
+ $this->translator->trans('organizer regulation'),
+ $this->translator->trans('Libre Air')
+ ];
+
+ //Set title
+ $title = $this->translator->trans($this->config['site']['title']).' - '.$section;
+
+ //Render template
+ return $this->render('@RapsysAir/default/organizer_regulation.html.twig', ['title' => $title, 'section' => $section]+$this->context);
+ }
+
+ /**
+ * The terms of service page
+ *
+ * @desc Display the terms of service policy
+ *
+ * @return Response The rendered view
+ */
+ public function termsOfService(): Response {
+ //Set section
+ $section = $this->translator->trans('Terms of service');
+
+ //Set description
+ $this->context['description'] = $this->translator->trans('Libre Air terms of service');
+
+ //Set keywords
+ $this->context['keywords'] = [
+ $this->translator->trans('terms of service'),
+ $this->translator->trans('Libre Air')
+ ];
+
+ //Set title
+ $title = $this->translator->trans($this->config['site']['title']).' - '.$section;
+
+ //Render template
+ return $this->render('@RapsysAir/default/terms_of_service.html.twig', ['title' => $title, 'section' => $section]+$this->context);
+ }
+
+ /**
+ * The frequently asked questions page
+ *
+ * @desc Display the frequently asked questions
+ *
+ * @return Response The rendered view
+ */
+ public function frequentlyAskedQuestions(): Response {
+ //Set section
+ $section = $this->translator->trans('Frequently asked questions');
+
+ //Set description
+ $this->context['description'] = $this->translator->trans('Libre Air frequently asked questions');
+
+ //Set keywords
+ $this->context['keywords'] = [
+ $this->translator->trans('frequently asked questions'),
+ $this->translator->trans('faq'),
+ $this->translator->trans('Libre Air')
+ ];
+
+ //Set title
+ $title = $this->translator->trans($this->config['site']['title']).' - '.$section;
+
+ //Render template
+ return $this->render('@RapsysAir/default/frequently_asked_questions.html.twig', ['title' => $title, 'section' => $section]+$this->context);
+ }
+
+ /**
+ * Return the bundle alias
+ *
+ * {@inheritdoc}
+ */
+ public function getAlias(): string {
+ return 'rapsys_air';
+ }
+
+ /**
+ * Return the facebook image
+ *
+ * @desc Generate image in jpeg format or load it from cache
+ *
+ * @return array The image array
+ */
+ protected function getFacebookImage(): array {
+ //Set texts
+ $texts = $this->facebookImage['texts'] ?? [];
+
+ //Set default source
+ $source = $this->facebookImage['source'] ?? 'png/facebook.png';
+
+ //Set default source
+ $updated = $this->facebookImage['updated'] ?? strtotime('last week');
+
+ //Set source path
+ $src = $this->config['path']['public'].'/'.$source;
+
+ //Set cache path
+ //XXX: remove extension and store as png anyway
+ $cache = $this->config['path']['cache'].'/facebook/'.substr($source, 0, strrpos($source, '.')).'.'.$this->config['facebook']['width'].'x'.$this->config['facebook']['height'].'.png';
+
+ //Set destination path
+ $dest = $this->config['path']['public'].'/'.$this->facebookImage['destination'];
+
+ //Set asset
+ $asset = '@RapsysAir/'.$this->facebookImage['destination'];
+
+ //With up to date generated image
+ if (
+ is_file($dest) &&
+ ($stat = stat($dest)) &&
+ $stat['mtime'] >= $updated
+ ) {
+ //Get image size
+ //TODO: see if it works every time
+ list ($width, $height) = getimagesize($dest);
+
+ //Return image data
+ return [
+ //TODO: see if it works every time
+ 'image' => $this->stack->getCurrentRequest()->getUriForPath($this->asset->getUrl($asset), true),#.'?fbrefresh='.$stat['mtime'],
+ 'image:alt' => str_replace("\n", ' ', implode(' - ', array_keys($texts))),
+ 'image:height' => $height,
+ 'image:width' => $width