mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
Redesign UI to match target design images
- Flat purple-gradient nav bar with POSTERG/RÉPERTOIRE/À PROPOS links - Full-width search bar with icon, bottom-border only, below nav - Home: white bg, media card grid (thumbnail + author/title label below) - Répertoire: 4-column index (Années/Catégories/Étudiantes/Mots-clés) - TFE: 2-column layout (large text left, media right) - À Propos: 2-column, large monospace text, new apropos.php page - Admin: dark theme (#1a1a1a), purple gradient nav, bottom-border inputs - New shared partials: templates/nav.php, templates/search-bar.php - Rewrote all CSS: common, main, search, tfe, apropos, admin
This commit is contained in:
276
public/tfe.php
276
public/tfe.php
@@ -1,202 +1,172 @@
|
||||
<?php
|
||||
// Bootstrap application
|
||||
require_once __DIR__ . '/../config/bootstrap.php';
|
||||
|
||||
// Load required libraries and classes
|
||||
require_once APP_ROOT . '/src/Database.php';
|
||||
|
||||
// Check if an id parameter is provided in the URL
|
||||
if (isset($_GET['id'])) {
|
||||
$thesisId = intval($_GET['id']);
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
$data = $db->getThesisById($thesisId);
|
||||
|
||||
if (!$data) {
|
||||
// Thesis not found or not published
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
if (!$data) { header('Location: index.php'); exit; }
|
||||
} catch (Exception $e) {
|
||||
error_log("Error loading thesis: " . $e->getMessage());
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
header('Location: index.php'); exit;
|
||||
}
|
||||
} else {
|
||||
// Redirect to the index page if no id parameter is provided
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
header('Location: index.php'); exit;
|
||||
}
|
||||
|
||||
// Set page title and additional CSS
|
||||
$pageTitle = $data['title'];
|
||||
$additionalCSS = ['assets/tfe.css'];
|
||||
|
||||
// Include shared head template
|
||||
include APP_ROOT . '/templates/head.php';
|
||||
$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="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">
|
||||
<header class="tfe-header">
|
||||
<div class="header-content">
|
||||
<h1 class="tfe-title"><?= htmlspecialchars($data['title']); ?></h1>
|
||||
<?php if (!empty($data['subtitle'])): ?>
|
||||
<p class="tfe-subtitle"><?= htmlspecialchars($data['subtitle']); ?></p>
|
||||
<?php endif; ?>
|
||||
<div class="header-metadata">
|
||||
<div class="meta-group">
|
||||
<span class="author"><?= htmlspecialchars($data['authors'] ?? 'Auteur inconnu'); ?></span>
|
||||
<span class="separator">•</span>
|
||||
<span class="year"><?= htmlspecialchars($data['year']); ?></span>
|
||||
</div>
|
||||
<?php if (!empty($data['orientation']) || !empty($data['ap_program'])): ?>
|
||||
<div class="meta-group">
|
||||
<?php if (!empty($data['orientation'])): ?>
|
||||
<span><?= htmlspecialchars($data['orientation']); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($data['orientation']) && !empty($data['ap_program'])): ?>
|
||||
<span class="separator">•</span>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($data['ap_program'])): ?>
|
||||
<span><?= htmlspecialchars($data['ap_program']); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($data['finality_type'])): ?>
|
||||
<div class="meta-group">
|
||||
<span><?= htmlspecialchars($data['finality_type']); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($data['keywords'])): ?>
|
||||
<div class="meta-group keywords">
|
||||
<span class="label">Mots-clés:</span>
|
||||
<span><?= htmlspecialchars($data['keywords']); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<?php include APP_ROOT . '/templates/nav.php'; ?>
|
||||
<?php include APP_ROOT . '/templates/search-bar.php'; ?>
|
||||
|
||||
<main class="tfe-main">
|
||||
<div class="tfe-container">
|
||||
|
||||
<!-- Metadata Section -->
|
||||
<section class="tfe-metadata">
|
||||
<?php if (!empty($data['subtitle'])): ?>
|
||||
<h2 class="subtitle"><?= htmlspecialchars($data['subtitle']); ?></h2>
|
||||
<?php endif; ?>
|
||||
<div class="tfe-layout">
|
||||
|
||||
<div class="metadata-grid">
|
||||
<div class="metadata-column">
|
||||
<?php if (!empty($data['orientation']) || !empty($data['ap_program'])): ?>
|
||||
<div class="meta-item">
|
||||
<strong>Programme:</strong>
|
||||
<span>
|
||||
<?php if (!empty($data['orientation'])): ?>
|
||||
<?= htmlspecialchars($data['orientation']); ?>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($data['orientation']) && !empty($data['ap_program'])): ?>
|
||||
et
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($data['ap_program'])): ?>
|
||||
<?= htmlspecialchars($data['ap_program']); ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!-- LEFT: info -->
|
||||
<div class="tfe-left">
|
||||
<h1 class="tfe-author"><?= htmlspecialchars($data['authors'] ?? 'Auteur inconnu') ?></h1>
|
||||
|
||||
<?php if (!empty($data['finality_type'])): ?>
|
||||
<div class="meta-item">
|
||||
<strong>Finalité:</strong>
|
||||
<span><?= htmlspecialchars($data['finality_type']); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<h2 class="tfe-title">
|
||||
<?= htmlspecialchars($data['title']) ?>
|
||||
<?php if (!empty($data['subtitle'])): ?>
|
||||
– <?= htmlspecialchars($data['subtitle']) ?>
|
||||
<?php endif; ?>
|
||||
</h2>
|
||||
|
||||
<?php if (!empty($data['supervisors'])): ?>
|
||||
<div class="meta-item">
|
||||
<strong>Promoteur·ice·s:</strong>
|
||||
<span><?= htmlspecialchars($data['supervisors']); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<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; ?>
|
||||
|
||||
<div class="metadata-column">
|
||||
<?php if (!empty($data['languages'])): ?>
|
||||
<div class="meta-item">
|
||||
<strong>Langue(s):</strong>
|
||||
<span><?= htmlspecialchars($data['languages']); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($data['formats'])): ?>
|
||||
<div class="meta-item">
|
||||
<strong>Format(s):</strong>
|
||||
<span><?= htmlspecialchars($data['formats']); ?></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['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['context_note'])): ?>
|
||||
<div class="context-note">
|
||||
<em><?= htmlspecialchars($data['context_note']); ?></em>
|
||||
</div>
|
||||
<?php if (!empty($data['synopsis'])): ?>
|
||||
<div class="tfe-synopsis-text">
|
||||
<?= nl2br(htmlspecialchars($data['synopsis'])) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<!-- Synopsis Section -->
|
||||
<?php if (!empty($data['synopsis'])): ?>
|
||||
<section class="tfe-synopsis">
|
||||
<h3>Synopsis</h3>
|
||||
<div class="synopsis-content">
|
||||
<?= nl2br(htmlspecialchars($data['synopsis'])); ?>
|
||||
</div>
|
||||
</section>
|
||||
<?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>
|
||||
|
||||
<!-- Files Section -->
|
||||
<section class="tfe-files">
|
||||
<?php if (isset($data['files']) && count($data['files']) > 0): ?>
|
||||
<!-- 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="file-block">
|
||||
<div class="tfe-media-block">
|
||||
<?php if ($ext === 'pdf'): ?>
|
||||
<embed src="/media.php?path=<?= urlencode($file['file_path']); ?>" type="application/pdf" width="100%" height="800px" />
|
||||
<?php elseif (in_array($ext, ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'])): ?>
|
||||
<figure class="image-figure">
|
||||
<img src="/media.php?path=<?= urlencode($file['file_path']); ?>" alt="<?= htmlspecialchars($file['file_name']); ?>">
|
||||
</figure>
|
||||
<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">
|
||||
Votre navigateur ne supporte pas la lecture de vidéos.
|
||||
<source src="/media.php?path=<?= urlencode($file['file_path']) ?>" type="video/mp4">
|
||||
</video>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($file['description'])): ?>
|
||||
<p class="file-description"><?= htmlspecialchars($file['description']); ?></p>
|
||||
<p class="tfe-file-caption"><?= htmlspecialchars($file['description']) ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<p class="no-files">Aucun fichier disponible pour ce TFE.</p>
|
||||
<p class="tfe-no-files">Aucun fichier disponible pour ce TFE.</p>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="tfe-footer">
|
||||
<div class="footer-content">
|
||||
<a href="index.php" class="back-button" aria-label="Retour à l'accueil" title="Retour à l'accueil">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M19 12H5M12 19l-7-7 7-7"/>
|
||||
</svg>
|
||||
</a>
|
||||
<div class="footer-meta">
|
||||
<span><?= htmlspecialchars($data['authors'] ?? 'Auteur inconnu'); ?></span>
|
||||
<span class="separator">•</span>
|
||||
<span><?= htmlspecialchars($data['year']); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user