Files
xamxam/public/tfe.php
Pontoporeia d87348c388 feat: licence page, admin pages editor, license types, gradient card placeholders, latest-year home view
- Feature 1: public /licence.php fetches 'licenses' page from DB, renders Markdown
- Feature 1: nav.php adds 'Licence' link with active state
- Feature 2: Database::getPage(), savePage(), getAllPages() methods
- Feature 2: bundled src/Parsedown.php (MIT, zero-dependency)
- Feature 2: apropos.php now renders 'about' page content from DB via Parsedown
- Feature 2: admin/pages.php (list) + admin/pages-edit.php (EasyMDE editor)
- Feature 2: admin/actions/page.php (auth+CSRF+validation+save)
- Feature 2: admin/head.php adds 'Pages statiques' nav link
- Feature 3: storage/schema.sql seeds 8 CC license types
- Feature 3: storage/migrations/003_seed_license_types.sql (applied to live DB)
- Feature 3: Database::getLicenseTypes() / getAllLicenseTypes()
- Feature 3: admin/add.php + formulaire.php: license_id field on add form
- Feature 3: admin/edit.php: license_id field on edit form with raw FK lookup
- Feature 3: tfe.php: shows 'Licence :' meta row when non-null
- Feature 6: main.css: .card__media--gradient styles
- Feature 6: index.php: deterministic HSL gradient placeholder cards
- Feature 6: Database::getLatestYearTheses() + getLatestPublishedYear()
- Feature 6: index.php default home = random latest-year theses with info label
2026-03-24 13:12:48 +01:00

181 lines
7.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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 = '';
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= htmlspecialchars($data['title']) ?> Posterg</title>
<link rel="icon" type="image/svg+xml" href="/assets/admin_favicon.svg">
<link rel="stylesheet" href="assets/modern-normalize.min.css">
<link rel="stylesheet" href="assets/common.css">
<link rel="stylesheet" href="assets/tfe.css">
<?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="tfe-body">
<?php include APP_ROOT . '/templates/nav.php'; ?>
<?php include APP_ROOT . '/templates/search-bar.php'; ?>
<main class="tfe-main">
<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['supervisors'])): ?>
<div class="tfe-meta-item">
<span class="label">Promoteur·ice interne :</span>
<span class="value"><?= htmlspecialchars($data['supervisors']) ?></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['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 if (!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; ?>
</div>
</div>
</main>
</body>
</html>