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 @@

{{ talk.talk.title|raw }}

{% if talk.planning is not null and event.isPlanningDisplayable %} {{ talk.room.name }} - {{ talk.planning.start|date('d/m/Y') }} + {{ talk.planning.start|date('d/m/Y', planning_timezone) }} - {{ talk.planning.start|date('H:i') }}-{{ talk.planning.end|date('H:i') }} + {{ talk.planning.start|date('H:i', planning_timezone) }}-{{ talk.planning.end|date('H:i', planning_timezone) }} - Niveau : {{ talk.talk.skillTranslationKey|trans }} {% if talk.talk.languageCode %}- {{ talk.talk.languageLabel }}{% endif %} diff --git a/templates/blog/talk.html.twig b/templates/blog/talk.html.twig index 9f467e4fd..31ec3115a 100644 --- a/templates/blog/talk.html.twig +++ b/templates/blog/talk.html.twig @@ -20,8 +20,8 @@ {% if talks_info.event.isPlanningDisplayable %} {{ talks_info.room.name }}
- {{ talks_info.planning.start|date('d/m/Y') }}
- {{ talks_info.planning.start|date('H:i') }}-{{ talks_info.planning.end|date('H:i') }} + {{ talks_info.planning.start|date('d/m/Y', planning_timezone) }}
+ {{ talks_info.planning.start|date('H:i', planning_timezone) }}-{{ talks_info.planning.end|date('H:i', planning_timezone) }} {% endif %} diff --git a/templates/event/session/index.html.twig b/templates/event/session/index.html.twig index 52f1b2871..ae89f3db1 100644 --- a/templates/event/session/index.html.twig +++ b/templates/event/session/index.html.twig @@ -116,8 +116,8 @@
{% if session.planning %} - {{ session.planning.start|date("d/m/Y", timezone) }} / - {{ session.planning.start|date("H:i", timezone) }} - {{ session.planning.end|date("H:i", timezone) }} / {{ session.room ? session.room.name }} + {{ session.planning.start|date("d/m/Y", planning_timezone) }} / + {{ session.planning.start|date("H:i", planning_timezone) }} - {{ session.planning.end|date("H:i", planning_timezone) }} / {{ session.room ? session.room.name }} {% else %} non planifié {% endif %} diff --git a/templates/event/speaker/page.html.twig b/templates/event/speaker/page.html.twig index 71e4546a2..261bad13d 100644 --- a/templates/event/speaker/page.html.twig +++ b/templates/event/speaker/page.html.twig @@ -87,7 +87,7 @@ {% if talk_info.planning %} {% if talk_info.room %}({{ talk_info.room.name }}){% endif %} - ({{ talk_info.planning.start|format_datetime('full', 'short') }}) + ({{ talk_info.planning.start|format_datetime('full', 'short', timezone=planning_timezone) }}) {% else %} (salle et dates de passage à venir) {% endif %}