event : méthode schedule(), main-infos, structure article

Méthode schedule() sur le modèle : plage globale du/le sur toutes les dates.
Affichage des crédits principaux et du schedule dans main-infos. Layout article
en grille 2/1 pour présentation + infos.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-05-28 11:28:32 +02:00
parent 8dd9dbefee
commit a0b98e8a18
3 changed files with 79 additions and 1 deletions

View file

@ -4,8 +4,9 @@
.slideshow {
position: relative;
width: 100%;
height: 80vh;
height: calc(100vh - 16rem);
background-color: #000;
z-index: 1;
.swiper {
height: 100%;
@ -26,5 +27,33 @@
}
}
}
.main-infos {
position: relative;
box-sizing: border-box;
width: 100%;
margin-top: -0.2rem;
background-color: #000;
color: #fff;
border-radius: 0 0 var(--radius) var(--radius);
padding: 1rem;
ul {
display: flex;
justify-content: space-between;
li {
font-size: 1rem;
}
}
}
article {
box-sizing: border-box;
width: 100%;
padding: 2rem;
display: grid;
grid-template-columns: 2fr 1fr;
column-gap: 4rem;
}
}
}

View file

@ -2,6 +2,38 @@
class EventPage extends Page
{
public function schedule(): string
{
$dateRanges = $this->dates()->toStructure();
if ($dateRanges->isEmpty()) return '';
$allFromDates = [];
$allToDates = [];
foreach ($dateRanges as $range) {
$from = $range->from()->value();
if (empty($from)) continue;
$allFromDates[] = $from;
// to est optionnel : date ponctuelle si absent
$allToDates[] = $range->to()->value() ?: $from;
}
if (empty($allFromDates)) return '';
$earliestFrom = min($allFromDates);
$latestTo = max($allToDates);
$formattedFrom = date('d/m/y', strtotime($earliestFrom));
$formattedTo = date('d/m/y', strtotime($latestTo));
if ($earliestFrom === $latestTo) {
return 'le ' . $formattedFrom;
}
return 'du ' . $formattedFrom . ' au ' . $formattedTo;
}
public function isLive(): bool
{
$today = date('Y-m-d');

View file

@ -23,4 +23,21 @@
</div>
<?php endif ?>
<div class="main-infos bottom-tab">
<ul>
<li><?= $page->schedule() ?></li>
<?php foreach($page->mainCredits()->toStructure() as $mainCredit): ?>
<li><?= $mainCredit->label() ?> : <?= $mainCredit->value() ?></li>
<?php endforeach ?>
</ul>
</div>
<article>
<div class="presentation">
<?= $page->presentation() ?>
</div>
<div class="infos"></div>
</article>
<?php snippet('footer') ?>