55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php snippet('header') ?>
|
|
<main>
|
|
|
|
<header class="page__header">
|
|
<h2 class="page__title"><?= $page->title() ?></h2>
|
|
|
|
<?php if ($page->chapo()->isNotEmpty()): ?>
|
|
<div class="page__description">
|
|
<p><?= $page->chapo() ?></p>
|
|
</div>
|
|
<?php endif ?>
|
|
</header>
|
|
|
|
<section id="container-cards">
|
|
|
|
<?php foreach ($page->children()->listed() as $folder): ?>
|
|
<article class="card--article">
|
|
|
|
<?php if ($cover = $folder->cover()->toFile()): ?>
|
|
<figure>
|
|
<img src="<?= $cover->url() ?>" alt="<?= $folder->title()->esc() ?>">
|
|
</figure>
|
|
<?php endif ?>
|
|
|
|
<div class="content">
|
|
<h4 class="title"><a href="<?= $folder->url() ?>"><?= $folder->title()->esc() ?></a></h4>
|
|
|
|
<?php if ($folder->description()->isNotEmpty()): ?>
|
|
<p class="description"><?= $folder->description()->excerpt(200) ?></p>
|
|
<?php endif ?>
|
|
|
|
<?php
|
|
// Compter les enquêtes associées à ce dossier
|
|
$investigationsCount = site()->find('enquetes')->children()->listed()->filter(function($investigation) use ($folder) {
|
|
return $investigation->folder()->value() === $folder->slug();
|
|
})->count();
|
|
?>
|
|
|
|
<?php if ($investigationsCount > 0): ?>
|
|
<dl class="dl">
|
|
<div class="dl__group">
|
|
<dt>Enquêtes</dt>
|
|
<dd><?= $investigationsCount ?> enquête<?= $investigationsCount > 1 ? 's' : '' ?></dd>
|
|
</div>
|
|
</dl>
|
|
<?php endif ?>
|
|
</div>
|
|
|
|
<a class="link-block" href="<?= $folder->url() ?>"></a>
|
|
</article>
|
|
<?php endforeach ?>
|
|
|
|
</section>
|
|
</main>
|
|
<?php snippet('footer') ?>
|