fix: masquer le bloc "Durée" sur la page TFE quand aucune durée n'est encodée

This commit is contained in:
Pontoporeia
2026-07-10 11:56:27 +02:00
parent b0925d9cfa
commit 28c0efe755
2 changed files with 12 additions and 9 deletions
+1
View File
@@ -44,3 +44,4 @@
- [x] Extend admin auth cookie lifetime from session-only to 1 week (604800s) - [x] Extend admin auth cookie lifetime from session-only to 1 week (604800s)
- [x] Close TOC (licence/charte/apropos) and Filtres (search.php) <details> by default on mobile - [x] Close TOC (licence/charte/apropos) and Filtres (search.php) <details> by default on mobile
- [x] Wider heading scale (h1/h2/h3) for apropos/licence/charte pages: step-5 / step-3 / step-1 - [x] Wider heading scale (h1/h2/h3) for apropos/licence/charte pages: step-5 / step-3 / step-1
- [x] Masquer le bloc "Durée" sur la page TFE quand aucune durée n'est encodée (ni pages ni minutes)
+11 -9
View File
@@ -46,20 +46,22 @@
<?php <?php
$_hasPages = isset($data["duration_pages"]) && $data["duration_pages"] !== null && $data["duration_pages"] !== ''; $_hasPages = isset($data["duration_pages"]) && $data["duration_pages"] !== null && $data["duration_pages"] !== '';
$_hasMins = isset($data["duration_minutes"]) && $data["duration_minutes"] !== null && $data["duration_minutes"] !== ''; $_hasMins = isset($data["duration_minutes"]) && $data["duration_minutes"] !== null && $data["duration_minutes"] !== '';
$_parts = []; if ($_hasPages || $_hasMins):
if ($_hasPages) $_parts[] = $data['duration_pages'] . ' pages'; $_parts = [];
if ($_hasMins) { if ($_hasPages) $_parts[] = $data['duration_pages'] . ' pages';
$_h = (int)floor((int)$data['duration_minutes'] / 60); if ($_hasMins) {
$_m = (int)$data['duration_minutes'] % 60; $_h = (int)floor((int)$data['duration_minutes'] / 60);
$_parts[] = $_h . 'h' . str_pad((string)$_m, 2, '0', STR_PAD_LEFT); $_m = (int)$data['duration_minutes'] % 60;
} $_parts[] = $_h . 'h' . str_pad((string)$_m, 2, '0', STR_PAD_LEFT);
$_duree = $_parts ? htmlspecialchars(implode(', ', $_parts)) : ''; }
unset($_hasPages, $_hasMins, $_parts, $_h, $_m); $_duree = htmlspecialchars(implode(', ', $_parts));
unset($_h, $_m);
?> ?>
<p class="tfe-meta-item"> <p class="tfe-meta-item">
<span class="tfe-meta-label">Durée :</span> <span class="tfe-meta-label">Durée :</span>
<?= $_duree ?> <?= $_duree ?>
</p> </p>
<?php endif; unset($_hasPages, $_hasMins, $_parts, $_duree); ?>
<?php if (!empty($data["languages"])): ?> <?php if (!empty($data["languages"])): ?>
<p class="tfe-meta-item"> <p class="tfe-meta-item">