mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
feat: extract MediaController, wire into Dispatcher, delete media.php
This commit is contained in:
39
app/templates/admin/footer.php
Normal file
39
app/templates/admin/footer.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php include APP_ROOT . '/templates/partials/flash-messages.php'; ?>
|
||||
|
||||
<!-- Fixed toast container (bottom-center, always visible) -->
|
||||
<div id="toast-container" aria-live="polite"></div>
|
||||
|
||||
<?php foreach ($extraJs ?? [] as $js): ?>
|
||||
<script src="<?= App::assetV($js) ?>"></script>
|
||||
<?php endforeach; ?>
|
||||
<?php if (!empty($extraJsInline)): ?>
|
||||
<script><?= $extraJsInline ?></script>
|
||||
<?php endif; ?>
|
||||
<script src="/assets/js/htmx.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
var box = document.getElementById('toast-container');
|
||||
if (!box) return;
|
||||
|
||||
// 1) Flash messages from hidden #admin-toasts
|
||||
var src = document.getElementById('admin-toasts');
|
||||
if (src) {
|
||||
src.querySelectorAll('.toast').forEach(function (t) { box.appendChild(t); });
|
||||
src.remove();
|
||||
}
|
||||
|
||||
// 2) Orphaned .toast elements rendered inline by pages (login, thanks, etc.)
|
||||
document.querySelectorAll('.toast:not(#toast-container .toast)')
|
||||
.forEach(function (t) { box.appendChild(t); });
|
||||
|
||||
// Auto-dismiss every toast after 4 seconds
|
||||
box.querySelectorAll('.toast').forEach(function (toast, i) {
|
||||
setTimeout(function () {
|
||||
toast.classList.add('toast-exit');
|
||||
toast.addEventListener('animationend', function () { toast.remove(); });
|
||||
}, 4000 + (i * 200));
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
6
app/templates/footer.php
Normal file
6
app/templates/footer.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<!-- footer.php -->
|
||||
<footer>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
82
app/templates/head.php
Normal file
82
app/templates/head.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?php
|
||||
// Admin: append suffix to title and prepend admin.css
|
||||
if (!empty($isAdmin)) {
|
||||
$pageTitle = isset($pageTitle) ? $pageTitle . ' – Admin' : 'Admin';
|
||||
$extraCss = array_merge(['/assets/css/admin.css'], $extraCss ?? []);
|
||||
}
|
||||
?>
|
||||
<title><?= htmlspecialchars($pageTitle ?? 'XAMXAM') ?></title>
|
||||
<?php if (empty($isAdmin)): ?>
|
||||
<?php if (!empty($metaDescription)): ?>
|
||||
<meta name="description" content="<?= htmlspecialchars($metaDescription) ?>">
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
// Open Graph / Twitter Card tags — populated per-page via $ogTags array.
|
||||
// Keys: type, title, description, url, image, image_alt, site_name, article_author, article_published_time
|
||||
if (!empty($ogTags)):
|
||||
$ogType = $ogTags['type'] ?? 'website';
|
||||
$ogTitle = $ogTags['title'] ?? ($pageTitle ?? 'Posterg');
|
||||
$ogDescription = $ogTags['description'] ?? ($metaDescription ?? '');
|
||||
$ogUrl = $ogTags['url'] ?? '';
|
||||
$ogImage = $ogTags['image'] ?? '';
|
||||
$ogImageAlt = $ogTags['image_alt'] ?? $ogTitle;
|
||||
$ogSiteName = $ogTags['site_name'] ?? 'XAMXAM – ERG';
|
||||
?>
|
||||
<meta property="og:type" content="<?= htmlspecialchars($ogType) ?>">
|
||||
<meta property="og:site_name" content="<?= htmlspecialchars($ogSiteName) ?>">
|
||||
<meta property="og:title" content="<?= htmlspecialchars($ogTitle) ?>">
|
||||
<?php if (!empty($ogDescription)): ?>
|
||||
<meta property="og:description" content="<?= htmlspecialchars($ogDescription) ?>">
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($ogUrl)): ?>
|
||||
<meta property="og:url" content="<?= htmlspecialchars($ogUrl) ?>">
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($ogImage)): ?>
|
||||
<meta property="og:image" content="<?= htmlspecialchars($ogImage) ?>">
|
||||
<meta property="og:image:alt" content="<?= htmlspecialchars($ogImageAlt) ?>">
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($ogTags['article_author'])): ?>
|
||||
<meta property="article:author" content="<?= htmlspecialchars($ogTags['article_author']) ?>">
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($ogTags['article_published_time'])): ?>
|
||||
<meta property="article:published_time" content="<?= htmlspecialchars($ogTags['article_published_time']) ?>">
|
||||
<?php endif; ?>
|
||||
<meta name="twitter:card" content="<?= !empty($ogImage) ? 'summary_large_image' : 'summary' ?>">
|
||||
<meta name="twitter:title" content="<?= htmlspecialchars($ogTitle) ?>">
|
||||
<?php if (!empty($ogDescription)): ?>
|
||||
<meta name="twitter:description" content="<?= htmlspecialchars($ogDescription) ?>">
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($ogImage)): ?>
|
||||
<meta name="twitter:image" content="<?= htmlspecialchars($ogImage) ?>">
|
||||
<meta name="twitter:image:alt" content="<?= htmlspecialchars($ogImageAlt) ?>">
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="/assets/favicon/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="167x167" href="/assets/favicon/apple-touch-icon-167x167.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/assets/favicon/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon/favicon-16x16.png">
|
||||
<link rel="shortcut icon" href="/assets/favicon/favicon.ico">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<link rel="stylesheet" href="<?= App::assetV('/assets/css/modern-normalize.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?= App::assetV('/assets/css/common.css') ?>">
|
||||
<?php foreach ($extraCss ?? [] as $css): ?>
|
||||
<link rel="stylesheet" href="<?= App::assetV($css) ?>">
|
||||
<?php endforeach; ?>
|
||||
<?php if (php_sapi_name() === 'cli-server'): ?>
|
||||
<script>
|
||||
(function poll(){
|
||||
fetch('/live-reload.php').then(r=>r.json()).then(d=>{
|
||||
if(d.changed) location.reload(); else setTimeout(poll,1000);
|
||||
}).catch(()=>setTimeout(poll,2000));
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
<body class="<?= htmlspecialchars($bodyClass ?? '') ?>">
|
||||
86
app/templates/header.php
Normal file
86
app/templates/header.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
// header.php — unified site header for public and admin sections.
|
||||
// Reads: $isAdmin (bool), $currentNav (string, public only)
|
||||
$_isAdmin = !empty($isAdmin);
|
||||
$_navCurrent = $currentNav ?? '';
|
||||
$_currentPage = basename($_SERVER['PHP_SELF']);
|
||||
$_thesisId = $_GET['id'] ?? null;
|
||||
?>
|
||||
<header>
|
||||
<a href="#main-content" class="skip-link">Aller au contenu principal</a>
|
||||
|
||||
<?php if ($_isAdmin): ?>
|
||||
|
||||
<nav aria-label="Navigation admin">
|
||||
<a href="/" target="_blank" rel="noopener noreferrer">
|
||||
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 256 256"><path d="M208,72H128V32a8,8,0,0,0-13.66-5.66l-96,96a8,8,0,0,0,0,11.32l96,96A8,8,0,0,0,128,224V184h80a16,16,0,0,0,16-16V88A16,16,0,0,0,208,72Zm0,96H120a8,8,0,0,0-8,8v28.69L35.31,128,112,51.31V80a8,8,0,0,0,8,8h88Z"></path></svg>XAMXAM<span class="sr-only"> (site public, nouvel onglet)</span>
|
||||
</a>
|
||||
<ul>
|
||||
<li><a href="/admin/" <?= $_currentPage === 'index.php' ? 'aria-current="page"' : '' ?>>Liste des TFE</a></li>
|
||||
<li><a href="/admin/contenus.php" <?= in_array($_currentPage, ['contenus.php', 'contenus-edit.php']) ? 'aria-current="page"' : '' ?>>Contenus</a></li>
|
||||
<li><a href="/admin/tags.php" <?= $_currentPage === 'tags.php' ? 'aria-current="page"' : '' ?>>Mots-clés</a></li>
|
||||
<li><a href="/admin/system.php" <?= in_array($_currentPage, ['system.php', 'status.php', 'logs.php']) ? 'aria-current="page"' : '' ?>>Système</a></li>
|
||||
<li><a href="/admin/acces-etudiante.php" <?= $_currentPage === 'acces-etudiante.php' ? 'aria-current="page"' : '' ?>>Accès étudiant·e</a></li>
|
||||
<li><a href="/admin/parametres.php" <?= $_currentPage === 'parametres.php' ? 'aria-current="page"' : '' ?>>Paramètres</a></li>
|
||||
<?php if ($_thesisId && in_array($_currentPage, ['edit.php', 'thanks.php'])): ?>
|
||||
<li><a href="/admin/edit.php?id=<?= intval($_thesisId) ?>" <?= $_currentPage === 'edit.php' ? 'aria-current="page"' : '' ?>>Modifier</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($_isAdmin && AdminAuth::hasPassword()): ?>
|
||||
<li data-nav-logout><a href="/admin/logout.php">Déconnexion</a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<nav aria-label="Navigation principale">
|
||||
<div class="nav-left">
|
||||
<a href="/index.php" class="nav-logo">Xamxam</a>
|
||||
<ul class="nav-left-links">
|
||||
<li>
|
||||
<a href="/repertoire.php"
|
||||
<?= ($_navCurrent === 'repertoire') ? 'aria-current="page"' : '' ?>>Répertoire</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul class="nav-right-links">
|
||||
<li>
|
||||
<a href="/licence.php"
|
||||
<?= ($_navCurrent === 'licence') ? 'aria-current="page"' : '' ?>>Licences</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/apropos.php"
|
||||
<?= ($_navCurrent === 'apropos') ? 'aria-current="page"' : '' ?>>À Propos</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</header>
|
||||
|
||||
<?php if (!$_isAdmin): ?>
|
||||
<?php
|
||||
// Search bar — public section only (rendered below header for equal height)
|
||||
$searchBarValue = $searchBarValue ?? $_GET['query'] ?? '';
|
||||
?>
|
||||
<div class="header-search-wrap">
|
||||
<form method="GET" action="/search.php"
|
||||
role="search" aria-label="Recherche">
|
||||
<label for="site-search-input" class="sr-only">Recherche</label>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
||||
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
||||
aria-hidden="true" focusable="false">
|
||||
<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
|
||||
</svg>
|
||||
<input
|
||||
id="site-search-input"
|
||||
type="text"
|
||||
name="query"
|
||||
placeholder="Recherche..."
|
||||
value="<?= htmlspecialchars($searchBarValue) ?>"
|
||||
autocomplete="off"
|
||||
>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
21
app/templates/partials/flash-messages.php
Normal file
21
app/templates/partials/flash-messages.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Shared flash-message partial for the admin section.
|
||||
*
|
||||
* Consumes all flash variants via App::consumeFlash(), then renders toast markup.
|
||||
* Toast JS in the admin footer auto-removes them after 4 seconds.
|
||||
*
|
||||
* Usage: include once per request in the admin footer.
|
||||
*/
|
||||
$_flash = App::consumeFlash();
|
||||
?>
|
||||
<?php if ($_flash['error'] || $_flash['success']): ?>
|
||||
<div id="admin-toasts" style="display:none">
|
||||
<?php if ($_flash['error']): ?>
|
||||
<div class="toast" role="alert" data-type="error">⚠ <?= htmlspecialchars($_flash['error']) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($_flash['success']): ?>
|
||||
<div class="toast" role="status" data-type="success">✓ <?= htmlspecialchars($_flash['success']) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
39
app/templates/partials/form/checkbox-list.php
Normal file
39
app/templates/partials/form/checkbox-list.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Checkbox list partial — renders a group of checkboxes (e.g. languages, formats).
|
||||
*
|
||||
* The group label uses a visible <span> as the first column (matching other form
|
||||
* rows), while a <fieldset>/<legend> in the second column provides the accessible
|
||||
* grouping required by WCAG 1.3.1. The <legend> is visually hidden (sr-only) to
|
||||
* avoid duplicating the visible label text.
|
||||
*
|
||||
* Variables consumed:
|
||||
* string $name — input name attribute (will be posted as array: name[])
|
||||
* string $label — group label text
|
||||
* array $options — each element must have 'id' and 'name' keys
|
||||
* array $checked — array of 'id' values that are currently checked
|
||||
*/
|
||||
|
||||
$checked = $checked ?? [];
|
||||
?>
|
||||
<div>
|
||||
<span class="admin-row-label"><?= htmlspecialchars($label) ?></span>
|
||||
<fieldset class="admin-checkbox-group">
|
||||
<legend class="sr-only"><?= htmlspecialchars($label) ?></legend>
|
||||
<ul>
|
||||
<?php foreach ($options as $opt): ?>
|
||||
<li>
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="checkbox"
|
||||
name="<?= htmlspecialchars($name) ?>[]"
|
||||
value="<?= htmlspecialchars((string)$opt['id']) ?>"
|
||||
<?= in_array((string)$opt['id'], array_map('strval', $checked)) ? 'checked' : '' ?>>
|
||||
<?= htmlspecialchars($opt['name']) ?>
|
||||
</label>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php
|
||||
unset($checked);
|
||||
33
app/templates/partials/form/file-field.php
Normal file
33
app/templates/partials/form/file-field.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* File input partial.
|
||||
*
|
||||
* Variables consumed:
|
||||
* string $name — input name attribute (used for id too unless $id set)
|
||||
* string $label — visible label text
|
||||
* string $accept — MIME types / extensions for the accept attribute (e.g. 'image/jpeg,image/png')
|
||||
* string|null $hint — optional hint shown in <small> below the input
|
||||
* bool $multiple — whether to allow multiple file selection; default false
|
||||
* string|null $id — override the id attribute (defaults to $name)
|
||||
*/
|
||||
|
||||
$accept = $accept ?? '';
|
||||
$hint = $hint ?? null;
|
||||
$multiple = $multiple ?? false;
|
||||
$id = $id ?? $name;
|
||||
?>
|
||||
<div>
|
||||
<label for="<?= htmlspecialchars($id) ?>"><?= htmlspecialchars($label) ?></label>
|
||||
<div class="admin-file-input">
|
||||
<input type="file"
|
||||
id="<?= htmlspecialchars($id) ?>"
|
||||
name="<?= htmlspecialchars($name) ?><?= $multiple ? '[]' : '' ?>"
|
||||
<?= $accept ? 'accept="' . htmlspecialchars($accept) . '"' : '' ?>
|
||||
<?= $multiple ? 'multiple' : '' ?>>
|
||||
<?php if ($hint): ?>
|
||||
<small><?= htmlspecialchars($hint) ?></small>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
unset($accept, $hint, $multiple, $id);
|
||||
115
app/templates/partials/form/jury-fieldset.php
Normal file
115
app/templates/partials/form/jury-fieldset.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* Jury composition fieldset partial.
|
||||
*
|
||||
* Variables consumed (all optional — defaults to empty/add-mode):
|
||||
* $juryPresident string|null President name
|
||||
* $juryPromoteur string|null Promoteur name
|
||||
* $juryPromoteurExt int 1 if promoteur is external, 0 otherwise
|
||||
* $juryLecteurs array Each element: ['name' => string, 'is_external' => int]
|
||||
*
|
||||
* In "add" mode (no existing jury data), callers should pass nulls/empty arrays and
|
||||
* may rely on the $formData repopulation helpers (old/wasSelected) defined in add.php.
|
||||
* When those helpers exist and no explicit values are set, the partial uses them.
|
||||
*/
|
||||
|
||||
$juryPresident = $juryPresident ?? null;
|
||||
$juryPromoteur = $juryPromoteur ?? null;
|
||||
$juryPromoteurExt = $juryPromoteurExt ?? 0;
|
||||
$juryLecteurs = $juryLecteurs ?? [];
|
||||
|
||||
// In add-mode, repopulate from flash form data when helpers are available.
|
||||
$addMode = ($juryPresident === null && $juryPromoteur === null && empty($juryLecteurs));
|
||||
if ($addMode && function_exists('old')) {
|
||||
$juryPresident = old('jury_president') ?: null;
|
||||
$juryPromoteur = old('jury_promoteur') ?: null;
|
||||
$juryPromoteurExt = function_exists('wasSelected') && wasSelected('jury_promoteur_ext', '1') ? 1 : 0;
|
||||
}
|
||||
|
||||
$juryIdx = max(count($juryLecteurs), 1);
|
||||
?>
|
||||
<!-- Composition du jury -->
|
||||
<fieldset>
|
||||
<legend>Composition du jury</legend>
|
||||
|
||||
<!-- Président·e -->
|
||||
<div>
|
||||
<label for="jury_president">Président·e :</label>
|
||||
<input type="text" id="jury_president" name="jury_president"
|
||||
value="<?= htmlspecialchars($juryPresident ?? '') ?>"
|
||||
placeholder="Nom du/de la président·e (interne)">
|
||||
</div>
|
||||
|
||||
<!-- Promoteur·ice -->
|
||||
<div>
|
||||
<label for="jury_promoteur">Promoteur·ice :</label>
|
||||
<div class="admin-jury-row">
|
||||
<input type="text" id="jury_promoteur" name="jury_promoteur"
|
||||
value="<?= htmlspecialchars($juryPromoteur ?? '') ?>" placeholder="Nom">
|
||||
<label class="admin-checkbox-label admin-jury-ext">
|
||||
<input type="checkbox" name="jury_promoteur_ext" value="1"
|
||||
<?= $juryPromoteurExt ? 'checked' : '' ?>
|
||||
aria-label="Promoteur·ice — externe"> Externe
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Lecteur·ices (dynamic list) -->
|
||||
<fieldset class="admin-jury-lecteurs">
|
||||
<legend>Lecteur·ices</legend>
|
||||
<div id="jury-lecteurs-list" class="admin-jury-list">
|
||||
<?php if (empty($juryLecteurs)): ?>
|
||||
<div class="admin-jury-entry">
|
||||
<input type="text" name="jury_lecteurs[]" placeholder="Nom"
|
||||
id="jury_lecteur_0" aria-label="Lecteur·ice 1 — nom">
|
||||
<label class="admin-checkbox-label admin-jury-ext">
|
||||
<input type="checkbox" name="jury_lecteurs_ext[0]" value="1"
|
||||
aria-label="Lecteur·ice 1 — externe"> Externe
|
||||
</label>
|
||||
<button type="button" class="admin-btn-remove" onclick="removeJuryRow(this)"
|
||||
aria-label="Supprimer le lecteur·ice 1"><span aria-hidden="true">✕</span></button>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($juryLecteurs as $li => $lm): ?>
|
||||
<?php $lNum = $li + 1; ?>
|
||||
<div class="admin-jury-entry">
|
||||
<input type="text" name="jury_lecteurs[]"
|
||||
value="<?= htmlspecialchars($lm['name']) ?>" placeholder="Nom"
|
||||
id="jury_lecteur_<?= $li ?>" aria-label="Lecteur·ice <?= $lNum ?> — nom">
|
||||
<label class="admin-checkbox-label admin-jury-ext">
|
||||
<input type="checkbox" name="jury_lecteurs_ext[<?= $li ?>]" value="1"
|
||||
<?= $lm['is_external'] ? 'checked' : '' ?>
|
||||
aria-label="Lecteur·ice <?= $lNum ?> — externe"> Externe
|
||||
</label>
|
||||
<button type="button" class="admin-btn-remove" onclick="removeJuryRow(this)"
|
||||
aria-label="Supprimer le lecteur·ice <?= $lNum ?>"><span aria-hidden="true">✕</span></button>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<button type="button" class="admin-btn-secondary admin-add-jury-btn"
|
||||
onclick="addJuryRow()">+ Ajouter un·e lecteur·ice</button>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
<script>
|
||||
var juryIdx = <?= $juryIdx ?>;
|
||||
function addJuryRow() {
|
||||
var list = document.getElementById('jury-lecteurs-list');
|
||||
var n = list.querySelectorAll('.admin-jury-entry').length + 1;
|
||||
var div = document.createElement('div');
|
||||
div.className = 'admin-jury-entry';
|
||||
div.innerHTML = '<input type="text" name="jury_lecteurs[]" placeholder="Nom"'
|
||||
+ ' aria-label="Lecteur\u00b7ice ' + n + ' \u2014 nom">'
|
||||
+ '<label class="admin-checkbox-label admin-jury-ext">'
|
||||
+ '<input type="checkbox" name="jury_lecteurs_ext[' + juryIdx + ']" value="1"'
|
||||
+ ' aria-label="Lecteur\u00b7ice ' + n + ' \u2014 externe"> Externe'
|
||||
+ '</label>'
|
||||
+ '<button type="button" class="admin-btn-remove" onclick="removeJuryRow(this)"'
|
||||
+ ' aria-label="Supprimer le lecteur\u00b7ice ' + n + '"><span aria-hidden="true">\u2715</span></button>';
|
||||
list.appendChild(div);
|
||||
juryIdx++;
|
||||
}
|
||||
function removeJuryRow(btn) {
|
||||
btn.closest('.admin-jury-entry').remove();
|
||||
}
|
||||
</script>
|
||||
61
app/templates/partials/form/select-field.php
Normal file
61
app/templates/partials/form/select-field.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Select field partial.
|
||||
*
|
||||
* Variables consumed:
|
||||
* string $name — select name attribute (also used for id)
|
||||
* string $label — visible label text
|
||||
* array $options — each element must have 'id' and 'name' keys;
|
||||
* may optionally have 'code' for display suffix
|
||||
* mixed $selected — currently selected value (compared to option 'id');
|
||||
* pass null or '' for no selection
|
||||
* bool $required — whether the field is required; default false
|
||||
* string $placeholder — text for the leading empty <option>; default ''
|
||||
* set to null to suppress the empty option entirely
|
||||
* string|null $id — override the id attribute (defaults to $name)
|
||||
* string|null $hint — optional hint shown in <small> below the select
|
||||
*/
|
||||
|
||||
$required = $required ?? false;
|
||||
$placeholder = array_key_exists('placeholder', get_defined_vars()) ? $placeholder : '';
|
||||
$id = $id ?? $name;
|
||||
$hint = $hint ?? null;
|
||||
$attrs = $attrs ?? [];
|
||||
?>
|
||||
<div>
|
||||
<label for="<?= htmlspecialchars($id) ?>"><?= htmlspecialchars($label) ?></label>
|
||||
<?php
|
||||
$selectAttrStr = '';
|
||||
foreach ($attrs as $k => $v) {
|
||||
if ($v === true) {
|
||||
$selectAttrStr .= ' ' . htmlspecialchars($k);
|
||||
} else {
|
||||
$selectAttrStr .= ' ' . htmlspecialchars($k) . '="' . htmlspecialchars((string)$v) . '"';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<select id="<?= htmlspecialchars($id) ?>"
|
||||
name="<?= htmlspecialchars($name) ?>"
|
||||
<?= $required ? 'required' : '' ?>
|
||||
<?= $selectAttrStr ?>>
|
||||
<?php if ($placeholder !== null): ?>
|
||||
<option value=""><?= htmlspecialchars($placeholder) ?></option>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($options as $opt): ?>
|
||||
<?php
|
||||
// Match by id (numeric FK) or by name string (when the view returns the name).
|
||||
$isSelected = ((string)$selected === (string)$opt['id'])
|
||||
|| ($selected !== null && $selected !== '' && isset($opt['name']) && (string)$selected === (string)$opt['name']);
|
||||
?>
|
||||
<option value="<?= htmlspecialchars((string)$opt['id']) ?>"
|
||||
<?= $isSelected ? 'selected' : '' ?>>
|
||||
<?= htmlspecialchars($opt['name']) ?><?php if (!empty($opt['code'])): ?> (<?= htmlspecialchars($opt['code']) ?>)<?php endif; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php if ($hint): ?>
|
||||
<small><?= htmlspecialchars($hint) ?></small>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
unset($required, $placeholder, $id, $hint, $attrs, $selectAttrStr, $k, $v);
|
||||
60
app/templates/partials/form/text-field.php
Normal file
60
app/templates/partials/form/text-field.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Text field partial — single-line text / number / url / email input.
|
||||
*
|
||||
* Variables consumed:
|
||||
* string $name — input name attribute (also used for id)
|
||||
* string $label — visible label text
|
||||
* string $value — current value (already htmlspecialchars'd by caller, or raw)
|
||||
* string $type — input type; default 'text'
|
||||
* bool $required — whether the field is required; default false
|
||||
* string $placeholder — placeholder text; default ''
|
||||
* string|null $hint — optional hint shown in <small> below the input
|
||||
* string|null $id — override the id attribute (defaults to $name)
|
||||
* array $attrs — extra HTML attributes as key=>value pairs (e.g. min/max for number)
|
||||
*
|
||||
* The partial does NOT call htmlspecialchars on $value — the caller is responsible.
|
||||
*/
|
||||
|
||||
$type = $type ?? 'text';
|
||||
$required = $required ?? false;
|
||||
$placeholder = $placeholder ?? '';
|
||||
$hint = $hint ?? null;
|
||||
$id = $id ?? $name;
|
||||
$attrs = $attrs ?? [];
|
||||
|
||||
$attrStr = '';
|
||||
foreach ($attrs as $k => $v) {
|
||||
if ($v === true) {
|
||||
$attrStr .= ' ' . htmlspecialchars($k);
|
||||
} else {
|
||||
$attrStr .= ' ' . htmlspecialchars($k) . '="' . htmlspecialchars((string)$v) . '"';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<label for="<?= htmlspecialchars($id) ?>"><?= htmlspecialchars($label) ?></label>
|
||||
<?php if ($hint): ?>
|
||||
<div>
|
||||
<input type="<?= htmlspecialchars($type) ?>"
|
||||
id="<?= htmlspecialchars($id) ?>"
|
||||
name="<?= htmlspecialchars($name) ?>"
|
||||
value="<?= $value ?>"
|
||||
<?= $required ? 'required' : '' ?>
|
||||
<?= $placeholder ? 'placeholder="' . htmlspecialchars($placeholder) . '"' : '' ?>
|
||||
<?= $attrStr ?>>
|
||||
<small><?= htmlspecialchars($hint) ?></small>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<input type="<?= htmlspecialchars($type) ?>"
|
||||
id="<?= htmlspecialchars($id) ?>"
|
||||
name="<?= htmlspecialchars($name) ?>"
|
||||
value="<?= $value ?>"
|
||||
<?= $required ? 'required' : '' ?>
|
||||
<?= $placeholder ? 'placeholder="' . htmlspecialchars($placeholder) . '"' : '' ?>
|
||||
<?= $attrStr ?>>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
// Reset consumed variables so includes in a loop don't bleed state.
|
||||
unset($type, $required, $placeholder, $hint, $id, $attrs, $attrStr, $k, $v);
|
||||
61
app/templates/partials/pagination.php
Normal file
61
app/templates/partials/pagination.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Pagination partial
|
||||
*
|
||||
* Required variables (set before include):
|
||||
* int $page — current page (1-based)
|
||||
* int $totalPages — total number of pages
|
||||
* array $baseParams — query-string params preserved across page links
|
||||
* (e.g. ['year' => 2024, 'query' => 'design'])
|
||||
* The 'page' key is injected automatically; do not include it.
|
||||
*
|
||||
* Usage:
|
||||
* <?php $baseParams = array_filter(['year' => $year]); ?>
|
||||
* <?php include APP_ROOT . '/templates/partials/pagination.php'; ?>
|
||||
*/
|
||||
|
||||
if (!isset($page, $totalPages) || $totalPages <= 1) {
|
||||
return; // nothing to render
|
||||
}
|
||||
|
||||
$baseParams = isset($baseParams) && is_array($baseParams) ? $baseParams : [];
|
||||
|
||||
/** Build a URL for a given target page, preserving all base params. */
|
||||
$paginationUrl = static function(int $targetPage) use ($baseParams): string {
|
||||
return '?' . http_build_query(array_merge($baseParams, ['page' => $targetPage]));
|
||||
};
|
||||
|
||||
$atFirst = $page <= 1;
|
||||
$atLast = $page >= $totalPages;
|
||||
?>
|
||||
<nav class="pagination-wrap" aria-label="Pagination">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="<?= $paginationUrl(1) ?>"
|
||||
class="pagination-btn<?= $atFirst ? ' disabled' : '' ?>"
|
||||
<?= $atFirst ? 'aria-disabled="true" tabindex="-1"' : '' ?>
|
||||
aria-label="Première page">«</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= $paginationUrl(max(1, $page - 1)) ?>"
|
||||
class="pagination-btn<?= $atFirst ? ' disabled' : '' ?>"
|
||||
<?= $atFirst ? 'aria-disabled="true" tabindex="-1"' : '' ?>
|
||||
aria-label="Page précédente">‹</a>
|
||||
</li>
|
||||
<li class="pagination-info" aria-current="page">
|
||||
<span class="page-current"><?= $page ?></span> / <?= $totalPages ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= $paginationUrl(min($totalPages, $page + 1)) ?>"
|
||||
class="pagination-btn<?= $atLast ? ' disabled' : '' ?>"
|
||||
<?= $atLast ? 'aria-disabled="true" tabindex="-1"' : '' ?>
|
||||
aria-label="Page suivante">›</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= $paginationUrl($totalPages) ?>"
|
||||
class="pagination-btn<?= $atLast ? ' disabled' : '' ?>"
|
||||
<?= $atLast ? 'aria-disabled="true" tabindex="-1"' : '' ?>
|
||||
aria-label="Dernière page">»</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
199
app/templates/partials/repertoire-index.php
Normal file
199
app/templates/partials/repertoire-index.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
/**
|
||||
* Partial: répertoire index columns.
|
||||
* Rendered both on full page load and as HTMX partial swap.
|
||||
*
|
||||
* Expected variables:
|
||||
* $repData array output of Database::getRepertoireFilterData()
|
||||
* $activeFilters array{years:int[], ap:string[], or:string[], fi:string[], kw:string[]}
|
||||
*/
|
||||
|
||||
$activeSets = [
|
||||
'years' => array_map('strval', $activeFilters['years'] ?? []),
|
||||
'ap' => $activeFilters['ap'] ?? [],
|
||||
'or' => $activeFilters['or'] ?? [],
|
||||
'fi' => $activeFilters['fi'] ?? [],
|
||||
'kw' => $activeFilters['kw'] ?? [],
|
||||
];
|
||||
|
||||
// Build the student map from matched students only
|
||||
$studentMap = []; // name => id
|
||||
foreach ($repData['students'] as $s) {
|
||||
if (empty($s['authors'])) continue;
|
||||
foreach (explode(',', $s['authors']) as $name) {
|
||||
$name = trim($name);
|
||||
if ($name !== '' && !isset($studentMap[$name])) {
|
||||
$studentMap[$name] = (int)$s['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
ksort($studentMap);
|
||||
|
||||
/**
|
||||
* Build the toggle URL for a filter button.
|
||||
* Toggles $value in $dim; keeps all other active filters intact.
|
||||
*/
|
||||
function repToggleUrl(array $sets, string $dim, string $value): string {
|
||||
if (in_array($value, $sets[$dim], true)) {
|
||||
$sets[$dim] = array_values(array_filter($sets[$dim], fn($v) => $v !== $value));
|
||||
} else {
|
||||
$sets[$dim][] = $value;
|
||||
}
|
||||
$params = [];
|
||||
foreach ($sets['years'] as $v) $params[] = 'fy[]=' . urlencode((string)$v);
|
||||
foreach ($sets['ap'] as $v) $params[] = 'ap[]=' . urlencode($v);
|
||||
foreach ($sets['or'] as $v) $params[] = 'or[]=' . urlencode($v);
|
||||
foreach ($sets['fi'] as $v) $params[] = 'fi[]=' . urlencode($v);
|
||||
foreach ($sets['kw'] as $v) $params[] = 'kw[]=' . urlencode($v);
|
||||
$qs = implode('&', $params);
|
||||
return '/repertoire.php' . ($qs ? '?' . $qs : '');
|
||||
}
|
||||
|
||||
$anyActive = !empty($activeSets['years']) || !empty($activeSets['ap'])
|
||||
|| !empty($activeSets['or']) || !empty($activeSets['fi'])
|
||||
|| !empty($activeSets['kw']);
|
||||
|
||||
// Common HTMX attributes for all active filter buttons
|
||||
$hx = 'hx-target="#repertoire-index" hx-swap="outerHTML" hx-push-url="true" hx-indicator="#rep-indicator"';
|
||||
?>
|
||||
<div id="repertoire-index" class="repertoire-index">
|
||||
|
||||
<!-- ANNÉES -->
|
||||
<section class="repertoire-col" data-col="years">
|
||||
<h2>Années</h2>
|
||||
<ul>
|
||||
<?php foreach ($repData['years'] as $item):
|
||||
$val = (string)$item['value'];
|
||||
$isActive = in_array($val, $activeSets['years'], true);
|
||||
$isFaded = $anyActive && !$item['matched'] && !$isActive;
|
||||
$cls = 'rep-entry'
|
||||
. ($isActive ? ' rep-entry--selected' : '')
|
||||
. ($isFaded ? ' rep-entry--faded' : '');
|
||||
$url = repToggleUrl($activeSets, 'years', $val);
|
||||
?>
|
||||
<li>
|
||||
<button type="button" class="<?= $cls ?>"
|
||||
aria-pressed="<?= $isActive ? 'true' : 'false' ?>"
|
||||
<?= $isFaded ? 'disabled' : "hx-get=\"" . htmlspecialchars($url) . "\" $hx" ?>>
|
||||
<?= htmlspecialchars($val) ?>
|
||||
</button>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- ATELIERS PLURIDISCIPLINAIRES -->
|
||||
<section class="repertoire-col" data-col="ap">
|
||||
<h2>Ateliers Pluridisciplinaires</h2>
|
||||
<ul>
|
||||
<?php foreach ($repData['ap_programs'] as $item):
|
||||
$val = $item['value'];
|
||||
$isActive = in_array($val, $activeSets['ap'], true);
|
||||
$isFaded = $anyActive && !$item['matched'] && !$isActive;
|
||||
$cls = 'rep-entry'
|
||||
. ($isActive ? ' rep-entry--selected' : '')
|
||||
. ($isFaded ? ' rep-entry--faded' : '');
|
||||
$url = repToggleUrl($activeSets, 'ap', $val);
|
||||
?>
|
||||
<li>
|
||||
<button type="button" class="<?= $cls ?>"
|
||||
aria-pressed="<?= $isActive ? 'true' : 'false' ?>"
|
||||
<?= $isFaded ? 'disabled' : "hx-get=\"" . htmlspecialchars($url) . "\" $hx" ?>>
|
||||
<?= htmlspecialchars($val) ?>
|
||||
</button>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- ORIENTATIONS -->
|
||||
<section class="repertoire-col" data-col="or">
|
||||
<h2>Orientations</h2>
|
||||
<ul>
|
||||
<?php foreach ($repData['orientations'] as $item):
|
||||
$val = $item['value'];
|
||||
$isActive = in_array($val, $activeSets['or'], true);
|
||||
$isFaded = $anyActive && !$item['matched'] && !$isActive;
|
||||
$cls = 'rep-entry'
|
||||
. ($isActive ? ' rep-entry--selected' : '')
|
||||
. ($isFaded ? ' rep-entry--faded' : '');
|
||||
$url = repToggleUrl($activeSets, 'or', $val);
|
||||
?>
|
||||
<li>
|
||||
<button type="button" class="<?= $cls ?>"
|
||||
aria-pressed="<?= $isActive ? 'true' : 'false' ?>"
|
||||
<?= $isFaded ? 'disabled' : "hx-get=\"" . htmlspecialchars($url) . "\" $hx" ?>>
|
||||
<?= htmlspecialchars($val) ?>
|
||||
</button>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- FINALITÉ DU MASTER -->
|
||||
<section class="repertoire-col" data-col="fi">
|
||||
<h2>Finalité du Master</h2>
|
||||
<ul>
|
||||
<?php foreach ($repData['finality_types'] as $item):
|
||||
$val = $item['value'];
|
||||
$isActive = in_array($val, $activeSets['fi'], true);
|
||||
$isFaded = $anyActive && !$item['matched'] && !$isActive;
|
||||
$cls = 'rep-entry'
|
||||
. ($isActive ? ' rep-entry--selected' : '')
|
||||
. ($isFaded ? ' rep-entry--faded' : '');
|
||||
$url = repToggleUrl($activeSets, 'fi', $val);
|
||||
?>
|
||||
<li>
|
||||
<button type="button" class="<?= $cls ?>"
|
||||
aria-pressed="<?= $isActive ? 'true' : 'false' ?>"
|
||||
<?= $isFaded ? 'disabled' : "hx-get=\"" . htmlspecialchars($url) . "\" $hx" ?>>
|
||||
<?= htmlspecialchars($val) ?>
|
||||
</button>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- ÉTUDIANTES -->
|
||||
<section class="repertoire-col" data-col="students">
|
||||
<h2>Étudiantes</h2>
|
||||
<ul>
|
||||
<?php if (empty($studentMap)): ?>
|
||||
<li class="rep-empty">—</li>
|
||||
<?php else: ?>
|
||||
<?php foreach ($studentMap as $name => $id): ?>
|
||||
<li>
|
||||
<a href="tfe.php?id=<?= (int)$id ?>" class="rep-entry rep-entry--link">
|
||||
<?= htmlspecialchars($name) ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- MOTS-CLÉS -->
|
||||
<section class="repertoire-col" data-col="kw">
|
||||
<h2>Mots-clés</h2>
|
||||
<ul>
|
||||
<?php foreach ($repData['keywords'] as $item):
|
||||
$val = $item['value'];
|
||||
$isActive = in_array($val, $activeSets['kw'], true);
|
||||
$isFaded = $anyActive && !$item['matched'] && !$isActive;
|
||||
$cls = 'rep-entry'
|
||||
. ($isActive ? ' rep-entry--selected' : '')
|
||||
. ($isFaded ? ' rep-entry--faded' : '');
|
||||
$url = repToggleUrl($activeSets, 'kw', $val);
|
||||
?>
|
||||
<li>
|
||||
<button type="button" class="<?= $cls ?>"
|
||||
aria-pressed="<?= $isActive ? 'true' : 'false' ?>"
|
||||
<?= $isFaded ? 'disabled' : "hx-get=\"" . htmlspecialchars($url) . "\" $hx" ?>>
|
||||
<?= htmlspecialchars($val) ?>
|
||||
</button>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
67
app/templates/partials/status-badge.php
Normal file
67
app/templates/partials/status-badge.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Status badge partial.
|
||||
*
|
||||
* Renders a single <span class="status-badge …"> with a decorative symbol,
|
||||
* an aria-label, and the visible label text.
|
||||
*
|
||||
* Variables (set before include):
|
||||
*
|
||||
* $badgeType (string) One of:
|
||||
* 'publish' — publish/pending state (uses $badgeValue as bool)
|
||||
* 'access' — access-type label (uses $badgeValue as string name)
|
||||
* 'ok' — generic green/yellow ok-or-warn (uses $badgeValue as bool)
|
||||
*
|
||||
* $badgeValue (mixed) Meaning depends on $badgeType (see above).
|
||||
*
|
||||
* $badgeOkLabel (string, optional) Label when ok/published/true. Default: 'Oui'
|
||||
* $badgeWarnLabel (string, optional) Label when warn/pending/false. Default: 'Non'
|
||||
* $badgeContext (string, optional) Prefix for aria-label, e.g. 'Statut'.
|
||||
* When empty the visible label is used directly.
|
||||
*
|
||||
* Example — publish badge:
|
||||
* <?php $badgeType = 'publish'; $badgeValue = $thesis['is_published']; include PARTIALS . '/status-badge.php'; ?>
|
||||
*
|
||||
* Example — access badge:
|
||||
* <?php $badgeType = 'access'; $badgeValue = $thesis['access_type']; include PARTIALS . '/status-badge.php'; ?>
|
||||
*
|
||||
* Example — generic ok badge:
|
||||
* <?php $badgeType = 'ok'; $badgeValue = $hasPassword; $badgeOkLabel = 'Active'; $badgeWarnLabel = 'Non configurée'; $badgeContext = ''; include PARTIALS . '/status-badge.php'; ?>
|
||||
*/
|
||||
|
||||
$badgeType = $badgeType ?? 'ok';
|
||||
$badgeValue = $badgeValue ?? false;
|
||||
$badgeOkLabel = $badgeOkLabel ?? 'Oui';
|
||||
$badgeWarnLabel = $badgeWarnLabel ?? 'Non';
|
||||
$badgeContext = $badgeContext ?? null; // null = use visible label as aria-label
|
||||
|
||||
if ($badgeType === 'publish') {
|
||||
$isOk = (bool) $badgeValue;
|
||||
$symbol = $isOk ? '●' : '◌';
|
||||
$cssClass = $isOk ? 'status-published' : 'status-pending';
|
||||
$visibleLabel = $isOk ? 'Publié' : 'En attente';
|
||||
$ariaLabel = 'Statut : ' . $visibleLabel;
|
||||
} elseif ($badgeType === 'access') {
|
||||
$accessName = (string) $badgeValue;
|
||||
$accessSlug = strtolower(preg_replace('/[^a-z]/i', '', $accessName));
|
||||
$symbols = ['libre' => '○', 'interne' => '◑', 'interdit' => '●'];
|
||||
$symbol = $symbols[$accessSlug] ?? '●';
|
||||
$cssClass = 'status-access status-access--' . $accessSlug;
|
||||
$visibleLabel = $accessName;
|
||||
$ariaLabel = 'Accès : ' . $visibleLabel;
|
||||
} else {
|
||||
// 'ok' — generic boolean badge
|
||||
$isOk = (bool) $badgeValue;
|
||||
$symbol = $isOk ? '●' : '◌';
|
||||
$cssClass = $isOk ? 'status-published' : 'status-pending';
|
||||
$visibleLabel = $isOk ? $badgeOkLabel : $badgeWarnLabel;
|
||||
$ariaLabel = $badgeContext !== null
|
||||
? ($badgeContext !== '' ? $badgeContext . ' : ' . $visibleLabel : $visibleLabel)
|
||||
: $visibleLabel;
|
||||
}
|
||||
?>
|
||||
<span class="status-badge <?= $cssClass ?>" aria-label="<?= htmlspecialchars($ariaLabel) ?>"><span aria-hidden="true"><?= $symbol ?> </span><?= htmlspecialchars($visibleLabel) ?></span>
|
||||
<?php
|
||||
// Clean up variables so they don't bleed into the including scope.
|
||||
unset($badgeType, $badgeValue, $badgeOkLabel, $badgeWarnLabel, $badgeContext,
|
||||
$isOk, $accessName, $accessSlug, $symbols, $symbol, $cssClass, $visibleLabel, $ariaLabel);
|
||||
49
app/templates/public/home.php
Normal file
49
app/templates/public/home.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php if ($year): ?>
|
||||
<p class="filter-info" role="status">
|
||||
Année : <?= htmlspecialchars($year) ?>
|
||||
<a href="?<?= http_build_query(array_diff_key($vars ?? [], ['page' => 1, 'year' => 1])) ?>" class="clear-filter"><span aria-hidden="true">✕</span> Réinitialiser</a>
|
||||
</p>
|
||||
<?php elseif ($isDefaultView): ?>
|
||||
<p class="home-section-label" role="status">Publication récente</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<main class="home-main" id="main-content">
|
||||
<h1 class="sr-only">Mémoires de l'ERG</h1>
|
||||
<ul class="cards-container">
|
||||
<?php foreach ($itemsToLoad as $item): ?>
|
||||
<li class="card">
|
||||
<a href="/tfe?id=<?= (int)$item["id"] ?>">
|
||||
<?php
|
||||
$thumb = null;
|
||||
if (!empty($item['banner_path'])) {
|
||||
$thumb = $item['banner_path'];
|
||||
}
|
||||
if (!$thumb && isset($coverMap[$item['id']])) {
|
||||
$thumb = $coverMap[$item['id']];
|
||||
}
|
||||
?>
|
||||
<?php if ($thumb): ?>
|
||||
<figure>
|
||||
<img src="/media.php?path=<?= urlencode($thumb) ?>"
|
||||
alt="Couverture — <?= htmlspecialchars($item['title']) ?> par <?= htmlspecialchars($item['authors'] ?? '') ?>"
|
||||
loading="lazy">
|
||||
</figure>
|
||||
<?php else: ?>
|
||||
<div class="card__media--gradient"
|
||||
aria-hidden="true">
|
||||
<span class="card__gradient-author"><?= htmlspecialchars($item['authors'] ?? '') ?></span>
|
||||
<span class="card__gradient-title"><?= htmlspecialchars($item['title']) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<p><?= htmlspecialchars($item["authors"] ?? '') ?><?php if (!empty($item['authors']) && !empty($item['title'])): ?> – <?php endif; ?><?= htmlspecialchars($item["title"]) ?><?php if (!empty($item['year'])): ?><span class="sr-only">, <?= (int)$item['year'] ?></span><?php endif; ?></p>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if (empty($itemsToLoad)): ?>
|
||||
<li class="cards-empty">Aucun mémoire trouvé.</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
<?php include APP_ROOT . '/templates/partials/pagination.php'; ?>
|
||||
</main>
|
||||
9
app/templates/public/licence.php
Normal file
9
app/templates/public/licence.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<main class="apropos-main" id="main-content">
|
||||
<div class="prose apropos-single">
|
||||
<?php if (!empty(trim($content))): ?>
|
||||
<?= $html ?>
|
||||
<?php else: ?>
|
||||
<p>Contenu à venir.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</main>
|
||||
22
app/templates/search-bar.php
Normal file
22
app/templates/search-bar.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// search-bar.php — shared search bar partial
|
||||
// $searchValue: current search query (optional)
|
||||
$_sbValue = $searchBarValue ?? $_GET['query'] ?? '';
|
||||
?>
|
||||
<form method="GET" action="/search.php"
|
||||
role="search" aria-label="Recherche">
|
||||
<label for="site-search-input" class="sr-only">Recherche</label>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
||||
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
||||
aria-hidden="true" focusable="false">
|
||||
<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
|
||||
</svg>
|
||||
<input
|
||||
id="site-search-input"
|
||||
type="text"
|
||||
name="query"
|
||||
placeholder="Recherche..."
|
||||
value="<?= htmlspecialchars($_sbValue) ?>"
|
||||
autocomplete="off"
|
||||
>
|
||||
</form>
|
||||
Reference in New Issue
Block a user