mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
Create templates/public/head.php accepting $pageTitle and $extraCss (array of stylesheet hrefs), mirroring the existing templates/admin/head.php pattern. The partial emits: DOCTYPE, <html lang=fr>, charset/viewport meta, favicon, modern-normalize, common.css, any extra CSS links, and the dev-only live-reload script. The live-reload snippet was previously copy-pasted verbatim into all five public pages. Updated pages: - public/index.php ($pageTitle='Posterg', $extraCss=['assets/main.css']) - public/search.php ($pageTitle='Répertoire – Posterg', search.css) - public/tfe.php ($pageTitle=thesis title + suffix, tfe.css) - public/apropos.php ($pageTitle='À Propos – Posterg', apropos.css) - public/licence.php ($pageTitle=DB title + suffix, apropos.css) tfe.php: removed redundant htmlspecialchars() call on $pageTitle (the partial applies it); licence.php: renamed conflicting $page variable to $dbPage to avoid collision with the shared $pageTitle expected by the partial. All syntax checks and test suite pass (4/4).
203 lines
9.1 KiB
PHP
203 lines
9.1 KiB
PHP
<?php
|
||
require_once __DIR__ . '/../config/bootstrap.php';
|
||
require_once APP_ROOT . '/src/Database.php';
|
||
|
||
if (isset($_GET['id'])) {
|
||
$thesisId = intval($_GET['id']);
|
||
try {
|
||
$db = Database::getInstance();
|
||
$data = $db->getThesisById($thesisId);
|
||
if (!$data) { header('Location: index.php'); exit; }
|
||
} catch (Exception $e) {
|
||
error_log("Error loading thesis: " . $e->getMessage());
|
||
header('Location: index.php'); exit;
|
||
}
|
||
} else {
|
||
header('Location: index.php'); exit;
|
||
}
|
||
|
||
$currentNav = '';
|
||
$pageTitle = $data['title'] . ' – Posterg';
|
||
$extraCss = ['assets/tfe.css'];
|
||
?>
|
||
<?php include APP_ROOT . '/templates/public/head.php'; ?>
|
||
<body class="tfe-body">
|
||
<a href="#main-content" class="skip-link">Aller au contenu principal</a>
|
||
|
||
<?php include APP_ROOT . '/templates/nav.php'; ?>
|
||
<?php include APP_ROOT . '/templates/search-bar.php'; ?>
|
||
|
||
<main class="tfe-main" id="main-content">
|
||
<div class="tfe-layout">
|
||
|
||
<!-- LEFT: info -->
|
||
<div class="tfe-left">
|
||
<h1 class="tfe-author"><?= htmlspecialchars($data['authors'] ?? 'Auteur inconnu') ?></h1>
|
||
|
||
<h2 class="tfe-title">
|
||
<?= htmlspecialchars($data['title']) ?>
|
||
<?php if (!empty($data['subtitle'])): ?>
|
||
– <?= htmlspecialchars($data['subtitle']) ?>
|
||
<?php endif; ?>
|
||
</h2>
|
||
|
||
<div class="tfe-meta-list">
|
||
<?php if (!empty($data['orientation'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Orientation :</span>
|
||
<span class="value"><?= htmlspecialchars($data['orientation']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['ap_program'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Atelier pluridisciplinaire :</span>
|
||
<span class="value"><?= htmlspecialchars($data['ap_program']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['year'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Date :</span>
|
||
<span class="value"><?= htmlspecialchars($data['year']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['languages'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Langue :</span>
|
||
<span class="value"><?= htmlspecialchars($data['languages']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['formats'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Format :</span>
|
||
<span class="value"><?= htmlspecialchars($data['formats']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['file_size_info'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Durée :</span>
|
||
<span class="value"><?= htmlspecialchars($data['file_size_info']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['keywords'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Mots-clés :</span>
|
||
<span class="value"><?= htmlspecialchars($data['keywords']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['jury_president'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Président·e du jury :</span>
|
||
<span class="value"><?= htmlspecialchars($data['jury_president']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['jury_promoteurs'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Promoteur·ice :</span>
|
||
<span class="value"><?= htmlspecialchars($data['jury_promoteurs']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['jury_lecteurs'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Lecteur·ices :</span>
|
||
<span class="value"><?= htmlspecialchars($data['jury_lecteurs']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['access_type'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Accès :</span>
|
||
<span class="value"><?= htmlspecialchars($data['access_type']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['license_type'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Licence :</span>
|
||
<span class="value"><?= htmlspecialchars($data['license_type']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['context_note'])): ?>
|
||
<div class="tfe-meta-item" style="align-items:start;">
|
||
<span class="label">Note :</span>
|
||
<span class="value" style="font-style:italic;"><?= nl2br(htmlspecialchars($data['context_note'])) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($data['baiu_link'])): ?>
|
||
<div class="tfe-meta-item">
|
||
<span class="label">Contact :</span>
|
||
<span class="value">
|
||
<a href="<?= htmlspecialchars($data['baiu_link']) ?>" target="_blank" rel="noopener">
|
||
<?= htmlspecialchars($data['baiu_link']) ?>
|
||
</a>
|
||
</span>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<?php if (!empty($data['synopsis'])): ?>
|
||
<div class="tfe-synopsis-text">
|
||
<?= nl2br(htmlspecialchars($data['synopsis'])) ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div style="margin-top:1.5rem;">
|
||
<a href="index.php" style="font-size:.88rem;color:#666;text-decoration:underline;text-underline-offset:2px;">
|
||
← Retour
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- RIGHT: media -->
|
||
<div class="tfe-right">
|
||
<?php
|
||
// Determine effective access: need raw access_type_id
|
||
// The view exposes 'access_type' (name string). Fetch raw id for gate.
|
||
$accessTypeId = $db->getThesisAccessTypeId($thesisId) ?? 1;
|
||
$isInterdit = ($accessTypeId === 3);
|
||
?>
|
||
<?php if ($isInterdit): ?>
|
||
<p class="tfe-no-files" style="color:#999;font-style:italic;">
|
||
Ce TFE n'est pas disponible en ligne.
|
||
</p>
|
||
<?php elseif (!empty($data['files'])): ?>
|
||
<?php foreach ($data['files'] as $file): ?>
|
||
<?php $ext = strtolower(pathinfo($file['file_path'], PATHINFO_EXTENSION)); ?>
|
||
<div class="tfe-media-block">
|
||
<?php if ($ext === 'pdf'): ?>
|
||
<embed src="/media.php?path=<?= urlencode($file['file_path']) ?>"
|
||
type="application/pdf" width="100%" height="700px">
|
||
<?php elseif (in_array($ext, ['jpg','jpeg','png','gif','bmp','webp'])): ?>
|
||
<img src="/media.php?path=<?= urlencode($file['file_path']) ?>"
|
||
alt="<?= htmlspecialchars($file['file_name']) ?>">
|
||
<?php elseif ($ext === 'mp4'): ?>
|
||
<video width="100%" controls>
|
||
<source src="/media.php?path=<?= urlencode($file['file_path']) ?>" type="video/mp4">
|
||
</video>
|
||
<?php endif; ?>
|
||
<?php if (!empty($file['description'])): ?>
|
||
<p class="tfe-file-caption"><?= htmlspecialchars($file['description']) ?></p>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
<?php else: ?>
|
||
<p class="tfe-no-files">Aucun fichier disponible pour ce TFE.</p>
|
||
<?php endif; // end !$isInterdit ?>
|
||
</div>
|
||
|
||
</div>
|
||
</main>
|
||
|
||
</body>
|
||
</html>
|