mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 15:21:22 +02:00
Fix lint: use IterableCallbackReturn — wrap forEach body in braces
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<main class="tfe-main" id="main-content">
|
||||
<article class="tfe-layout">
|
||||
|
||||
<!-- Two-column layout: left 35% (info), right 65% (files) -->
|
||||
<!-- Two-column layout: left 40% (info), right 60% (files) -->
|
||||
<div class="tfe-content-row">
|
||||
<div class="tfe-left-column">
|
||||
|
||||
@@ -46,22 +46,22 @@
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$_hasPages = isset($data["duration_pages"]) && $data["duration_pages"] !== null;
|
||||
$_hasMins = isset($data["duration_minutes"]) && $data["duration_minutes"] !== null;
|
||||
if ($_hasPages || $_hasMins):
|
||||
$_parts = [];
|
||||
if ($_hasPages) $_parts[] = $data['duration_pages'] . ' pages';
|
||||
if ($_hasMins) {
|
||||
$_h = (int)floor($data['duration_minutes'] / 60);
|
||||
$_m = $data['duration_minutes'] % 60;
|
||||
$_parts[] = $_h . 'h' . str_pad((string)$_m, 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
$_hasPages = isset($data["duration_pages"]) && $data["duration_pages"] !== null && $data["duration_pages"] !== '';
|
||||
$_hasMins = isset($data["duration_minutes"]) && $data["duration_minutes"] !== null && $data["duration_minutes"] !== '';
|
||||
$_parts = [];
|
||||
if ($_hasPages) $_parts[] = $data['duration_pages'] . ' pages';
|
||||
if ($_hasMins) {
|
||||
$_h = (int)floor((int)$data['duration_minutes'] / 60);
|
||||
$_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);
|
||||
?>
|
||||
<p class="tfe-meta-item">
|
||||
<span class="tfe-meta-label">Durée :</span>
|
||||
<?= htmlspecialchars(implode(', ', $_parts)) ?>
|
||||
<?= $_duree ?>
|
||||
</p>
|
||||
<?php unset($_hasPages, $_hasMins, $_parts, $_h, $_m); endif; ?>
|
||||
|
||||
<?php if (!empty($data["languages"])): ?>
|
||||
<p class="tfe-meta-item">
|
||||
@@ -376,10 +376,19 @@
|
||||
?>
|
||||
<div class="tfe-file-item">
|
||||
<?php if ($isPdf): ?>
|
||||
<iframe src="<?= $mediaUrl ?>#toolbar=0&navpanes=0&scrollbar=0"
|
||||
class="tfe-file-iframe"
|
||||
title="<?= $fileName ?>">
|
||||
</iframe>
|
||||
<?php
|
||||
$_pdfLabel = match ($fileType) {
|
||||
'main' => 'TFE',
|
||||
'annex' => 'Annexes',
|
||||
'note_intention' => "Note d'intention",
|
||||
default => '',
|
||||
};
|
||||
?>
|
||||
<div class="pdf-embed-wrapper"
|
||||
data-pdf-url="<?= $mediaUrl ?>"
|
||||
data-pdf-scale="1"
|
||||
data-pdf-label="<?= htmlspecialchars($_pdfLabel) ?>"
|
||||
tabindex="-1"></div>
|
||||
<?php elseif ($isWebsite): ?>
|
||||
<iframe src="<?= $mediaUrl ?>"
|
||||
class="tfe-file-iframe"
|
||||
@@ -458,3 +467,10 @@
|
||||
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<?php if (!$isInterdit && !$shouldHideFiles && !empty($data["files"])): ?>
|
||||
<?php $_hasPdf = false; foreach ($data["files"] as $_f) { $_ext = strtolower(pathinfo($_f["file_path"] ?? '', PATHINFO_EXTENSION)); $_type = $_f['file_type'] ?? ''; if ($_ext === 'pdf' || $_type === 'main') { $_hasPdf = true; break; } } ?>
|
||||
<?php if ($_hasPdf): ?>
|
||||
<script type="module" src="/assets/js/vendor/pdf.min.mjs" async></script>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user