diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index a5223d184..6720b9be7 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -4,5 +4,6 @@ twig: globals: photo_storage: '@AppBundle\CFP\PhotoStorage' global_menu_event_label: '%env(AFUP_GLOBAL_MENU_EVENT_LABEL)%' + planning_timezone: !php/const AppBundle\Event\Model\Planning::TIMEZONE form_themes: ['form_theme.html.twig'] default_path: "%kernel.project_dir%/templates" diff --git a/sources/AppBundle/Controller/Admin/Event/Session/IndexAction.php b/sources/AppBundle/Controller/Admin/Event/Session/IndexAction.php index fa4835d9d..4960342b6 100644 --- a/sources/AppBundle/Controller/Admin/Event/Session/IndexAction.php +++ b/sources/AppBundle/Controller/Admin/Event/Session/IndexAction.php @@ -38,7 +38,6 @@ public function __invoke(Request $request, AdminEventSelection $eventSelection): 'events' => $this->calendarEvents($sessions), 'resources' => $this->calendarResources($event), ], - 'timezone' => Planning::TIMEZONE, ]); } diff --git a/sources/AppBundle/Event/Talk/ExportGenerator.php b/sources/AppBundle/Event/Talk/ExportGenerator.php index 472d3ebf2..067d1a524 100644 --- a/sources/AppBundle/Event/Talk/ExportGenerator.php +++ b/sources/AppBundle/Event/Talk/ExportGenerator.php @@ -5,6 +5,7 @@ namespace AppBundle\Event\Talk; use AppBundle\Event\Model\Event; +use AppBundle\Event\Model\Planning; use AppBundle\Event\Model\Repository\TalkRepository; use AppBundle\Event\Model\Speaker; use AppBundle\Event\Model\Talk; @@ -56,6 +57,8 @@ public function exportJoindIn(Event $event, \SplFileObject $toFile): void $toFile->fputcsv(['Title','Description','Speaker','Date','Time','Type'], escape: '\\'); + $timezone = new \DateTimeZone(Planning::TIMEZONE); + foreach ($talkAggregates as $talkAggregate) { // Gestion de la description @@ -72,6 +75,11 @@ public function exportJoindIn(Event $event, \SplFileObject $toFile): void } $speakers = implode(',', $speakers); + // Gestion des horaires : stockés en timestamp, ils sont exportés dans la + // timezone de l'événement et non dans celle du serveur. + $start = $talkAggregate->planning?->getStart(); + $start = $start === null ? null : \DateTimeImmutable::createFromInterface($start)->setTimezone($timezone); + // Gestion du type de conférence if ($talkAggregate->planning?->getIsKeynote()) { $type = 'Keynote'; @@ -85,8 +93,8 @@ public function exportJoindIn(Event $event, \SplFileObject $toFile): void $talkAggregate->talk->getTitle(), $abstract, $speakers, - $talkAggregate->planning?->getStart()?->format('Y-m-d'), - $talkAggregate->planning?->getStart()?->format('H:i'), + $start?->format('Y-m-d'), + $start?->format('H:i'), $type, ], escape: '\\'); } diff --git a/templates/blog/program.html.twig b/templates/blog/program.html.twig index a79c918d3..5d60461a1 100644 --- a/templates/blog/program.html.twig +++ b/templates/blog/program.html.twig @@ -31,9 +31,9 @@