index-main/site/templates/package.php

224 lines
8.3 KiB
PHP
Raw Normal View History

2026-01-27 16:55:02 +01:00
2026-01-25 22:42:02 +01:00
<?php snippet('header') ?>
2026-02-25 19:05:22 +01:00
<main class="main__single">
2026-01-25 22:42:02 +01:00
2026-02-25 18:22:13 +01:00
<?php
$lang = kirby()->language();
$locale = $lang ? $lang->locale(LC_ALL) : 'fr_FR.UTF-8';
$dateLocale = substr(is_array($locale) ? reset($locale) : $locale, 0, 5);
$investigations = $page->linkedContent()->toPages();
2026-02-26 17:54:47 +01:00
$impacts = $page->linkedImpacts()->toPages();
$resources = $page->linkedResources()->toPages();
$news = $page->linkedNews()->toPages();
$projects = $page->linkedProjects()->toPages();
2026-02-25 18:22:13 +01:00
?>
2026-01-25 22:42:02 +01:00
<header class="page__header">
2026-02-25 18:22:13 +01:00
<p class="page__type"><?= t('package.type') ?></p>
2026-01-25 22:42:02 +01:00
<h2 class="page__title"><?= $page->title() ?></h2>
2026-02-26 17:54:47 +01:00
<?php if ($investigations->isNotEmpty() || $impacts->isNotEmpty() || $resources->isNotEmpty() || $news->isNotEmpty() || $projects->isNotEmpty()): ?>
<ul class="list-nav">
2026-02-25 18:22:13 +01:00
<?php if ($investigations->isNotEmpty()): ?>
<li><a href="#investigations"><?= $investigations->count() ?> <?= $investigations->count() > 1 ? t('investigation.type.plural') : t('investigation.type') ?></a></li>
<?php endif ?>
<?php if ($impacts->isNotEmpty()): ?>
<li><a href="#impacts"><?= $impacts->count() ?> <?= $impacts->count() > 1 ? t('impact.type.plural') : t('impact.type') ?></a></li>
<?php endif ?>
2026-02-26 17:54:47 +01:00
<?php if ($resources->isNotEmpty()): ?>
<li><a href="#resources"><?= $resources->count() ?> <?= $resources->count() > 1 ? t('resource.type.plural') : t('resource.type') ?></a></li>
<?php endif ?>
<?php if ($news->isNotEmpty()): ?>
<li><a href="#news"><?= $news->count() ?> <?= $news->count() > 1 ? t('news.type.plural') : t('news.type') ?></a></li>
<?php endif ?>
<?php if ($projects->isNotEmpty()): ?>
<li><a href="#projects"><?= $projects->count() ?> <?= $projects->count() > 1 ? t('project.type.plural') : t('project.type') ?></a></li>
<?php endif ?>
2026-02-25 18:22:13 +01:00
</ul>
2026-01-25 22:42:02 +01:00
<?php endif ?>
2026-02-25 19:05:22 +01:00
<?php if ($cover = $page->cover()->toFile()): ?>
<figure class="page__cover">
<?php snippet('picture', ['file' => $cover]) ?>
</figure>
<?php if ($cover->caption()->isNotEmpty()): ?>
<p class="caption"><?= $cover->caption()->html() ?></p>
<?php endif ?>
<?php endif ?>
2026-01-25 22:42:02 +01:00
</header>
2026-02-25 19:05:22 +01:00
2026-02-25 18:22:13 +01:00
<?php if ($page->description()->isNotEmpty()): ?>
<div class="page__content">
<p><?= $page->description() ?></p>
2026-01-27 18:33:27 +01:00
</div>
2026-02-25 18:22:13 +01:00
<?php endif ?>
2026-01-27 18:33:27 +01:00
2026-01-25 22:42:02 +01:00
<?php if ($investigations->isNotEmpty()): ?>
2026-02-25 18:22:13 +01:00
<div class="package__section" id="investigations">
<h3 class="section__title"><?= t('investigations.title') ?> (<?= $investigations->count() ?>)</h3>
2026-01-25 22:42:02 +01:00
2026-01-27 18:33:27 +01:00
<?php foreach ($investigations as $investigation): ?>
2026-02-25 18:22:13 +01:00
<article class="card--article-small">
2026-01-27 18:33:27 +01:00
<?php if ($cover = $investigation->cover()->toFile()): ?>
<figure>
<img src="<?= $cover->url() ?>" alt="<?= $investigation->title()->esc() ?>">
</figure>
<?php endif ?>
<div class="content">
2026-02-25 18:22:13 +01:00
<p class="type"><?= t('investigation.type') ?></p>
<h4 class="title"><a href="<?= $investigation->url() ?>"><?= $investigation->title()->esc() ?></a></h4>
2026-01-27 18:33:27 +01:00
<?php if ($investigation->incidentDate()->isNotEmpty()): ?>
2026-02-25 18:22:13 +01:00
<time class="date" datetime="<?= $investigation->incidentDate()->toDate('yyyy-MM-dd') ?>"><?= $investigation->incidentDate()->toDate('d MMMM yyyy', $dateLocale) ?></time>
2026-01-27 18:33:27 +01:00
<?php endif ?>
2026-02-25 18:22:13 +01:00
<?php if ($investigation->chapo()->isNotEmpty()): ?>
<p class="description"><?= $investigation->chapo()->excerpt(200) ?></p>
2026-01-27 18:33:27 +01:00
<?php endif ?>
</div>
2026-02-25 18:22:13 +01:00
<button class="btn--go-to"><a href="<?= $investigation->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a></button>
<a class="link-block" href="<?= $investigation->url() ?>" aria-hidden="true"></a>
2026-01-27 18:33:27 +01:00
</article>
<?php endforeach ?>
2026-02-25 18:22:13 +01:00
</div>
2026-01-27 18:33:27 +01:00
<?php endif ?>
2026-01-25 22:42:02 +01:00
2026-01-27 18:33:27 +01:00
2026-02-25 18:22:13 +01:00
<?php if ($impacts->isNotEmpty()): ?>
<div class="package__section" id="impacts">
<h3 class="section__title"><?= t('impacts.title') ?> (<?= $impacts->count() ?>)</h3>
2026-01-27 18:33:27 +01:00
2026-02-25 18:22:13 +01:00
<?php foreach ($impacts as $impact): ?>
<div class="card--block-small has-link">
<div class="group-top">
<p class="type"><?= t('impact.type') ?></p>
<?php if ($impact->category()->isNotEmpty()): ?>
<p class="category"><?= $impact->category()->esc() ?></p>
<?php endif ?>
2026-01-29 20:57:17 +01:00
</div>
2026-01-25 22:42:02 +01:00
2026-02-25 18:22:13 +01:00
<h4 class="title"><?= $impact->title()->esc() ?></h4>
2026-01-27 18:33:27 +01:00
2026-02-25 18:22:13 +01:00
<?php if ($impact->created()->isNotEmpty()): ?>
<p class="date">
<time datetime="<?= $impact->created()->toDate('yyyy-MM-dd') ?>"><?= $impact->created()->toDate('d MMMM yyyy', $dateLocale) ?></time>
</p>
<?php endif ?>
2026-02-06 15:10:27 +01:00
2026-02-25 18:22:13 +01:00
<button class="btn--go-to">
<a href="<?= $impact->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a>
</button>
<a class="link-block" href="<?= $impact->url() ?>" aria-hidden="true"></a>
2026-02-06 15:10:27 +01:00
</div>
2026-02-25 18:22:13 +01:00
<?php endforeach ?>
2026-02-06 15:10:27 +01:00
2026-01-27 18:33:27 +01:00
</div>
2026-02-25 18:22:13 +01:00
<?php endif ?>
2026-01-27 18:33:27 +01:00
2026-01-25 22:42:02 +01:00
2026-02-26 17:54:47 +01:00
<?php if ($resources->isNotEmpty()): ?>
<div class="package__section" id="resources">
<h3 class="section__title"><?= t('resources.title') ?> (<?= $resources->count() ?>)</h3>
<?php foreach ($resources as $resource): ?>
<div class="card--block-small has-link">
<div class="group-top">
<p class="type"><?= t('resource.type') ?></p>
<?php if ($resource->category()->isNotEmpty()): ?>
<p class="category"><?= $resource->category()->esc() ?></p>
<?php endif ?>
</div>
<h4 class="title"><?= $resource->title()->esc() ?></h4>
<?php if ($resource->created()->isNotEmpty()): ?>
<p class="date">
<time datetime="<?= $resource->created()->toDate('yyyy-MM-dd') ?>"><?= $resource->created()->toDate('d MMMM yyyy', $dateLocale) ?></time>
</p>
<?php endif ?>
<button class="btn--go-to">
<a href="<?= $resource->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a>
</button>
<a class="link-block" href="<?= $resource->url() ?>" aria-hidden="true"></a>
</div>
<?php endforeach ?>
</div>
<?php endif ?>
<?php if ($news->isNotEmpty()): ?>
<div class="package__section" id="news">
<h3 class="section__title"><?= t('news.title') ?> (<?= $news->count() ?>)</h3>
<?php foreach ($news as $newsItem): ?>
<div class="card--block-small has-link">
<div class="group-top">
<p class="type"><?= t('news.type') ?></p>
<?php if ($newsItem->category()->isNotEmpty()): ?>
<p class="category"><?= $newsItem->category()->esc() ?></p>
<?php endif ?>
</div>
<h4 class="title"><?= $newsItem->title()->esc() ?></h4>
<?php if ($newsItem->created()->isNotEmpty()): ?>
<p class="date">
<time datetime="<?= $newsItem->created()->toDate('yyyy-MM-dd') ?>"><?= $newsItem->created()->toDate('d MMMM yyyy', $dateLocale) ?></time>
</p>
<?php endif ?>
<button class="btn--go-to">
<a href="<?= $newsItem->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a>
</button>
<a class="link-block" href="<?= $newsItem->url() ?>" aria-hidden="true"></a>
</div>
<?php endforeach ?>
</div>
<?php endif ?>
<?php if ($projects->isNotEmpty()): ?>
<div class="package__section" id="projects">
<h3 class="section__title"><?= t('lab.title') ?> (<?= $projects->count() ?>)</h3>
<?php foreach ($projects as $project): ?>
<div class="card--block-small has-link">
<div class="group-top">
<p class="type"><?= t('project.type') ?></p>
<?php if ($project->category()->isNotEmpty()): ?>
<p class="category"><?= $project->category()->esc() ?></p>
<?php endif ?>
</div>
<h4 class="title"><?= $project->title()->esc() ?></h4>
<?php if ($project->created()->isNotEmpty()): ?>
<p class="date">
<time datetime="<?= $project->created()->toDate('yyyy-MM-dd') ?>"><?= $project->created()->toDate('d MMMM yyyy', $dateLocale) ?></time>
</p>
<?php endif ?>
<button class="btn--go-to">
<a href="<?= $project->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a>
</button>
<a class="link-block" href="<?= $project->url() ?>" aria-hidden="true"></a>
</div>
<?php endforeach ?>
</div>
<?php endif ?>
2026-01-25 22:42:02 +01:00
</main>
<?php snippet('footer') ?>