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] 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] Masquer le bloc "Durée" sur la page TFE quand aucune durée n'est encodée (ni pages ni minutes)
+4 -2
View File
@@ -46,6 +46,7 @@
<?php
$_hasPages = isset($data["duration_pages"]) && $data["duration_pages"] !== null && $data["duration_pages"] !== '';
$_hasMins = isset($data["duration_minutes"]) && $data["duration_minutes"] !== null && $data["duration_minutes"] !== '';
if ($_hasPages || $_hasMins):
$_parts = [];
if ($_hasPages) $_parts[] = $data['duration_pages'] . ' pages';
if ($_hasMins) {
@@ -53,13 +54,14 @@
$_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">
<span class="tfe-meta-label">Durée :</span>
<?= $_duree ?>
</p>
<?php endif; unset($_hasPages, $_hasMins, $_parts, $_duree); ?>
<?php if (!empty($data["languages"])): ?>
<p class="tfe-meta-item">