mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
- Rename memoire.php to tfe.php throughout codebase - Create dedicated tfe.css with rounded header/main/footer layout - Move metadata (orientation, AP program, finality, keywords) to header - Move back button from header to footer - Create shared templates/head.php for common HTML head section - Maintain rounded borders (40px) matching main site design - Keep purple header (#9557b5), green main (#3c856b), dark footer (#222) - Improve content readability with centered max-width layout - Add responsive design for mobile devices
203 lines
9.1 KiB
PHP
203 lines
9.1 KiB
PHP
<?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;
|
|
}
|
|
} catch (Exception $e) {
|
|
error_log("Error loading thesis: " . $e->getMessage());
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
} else {
|
|
// Redirect to the index page if no id parameter is provided
|
|
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';
|
|
?>
|
|
<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>
|
|
|
|
<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="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; ?>
|
|
|
|
<?php if (!empty($data['finality_type'])): ?>
|
|
<div class="meta-item">
|
|
<strong>Finalité:</strong>
|
|
<span><?= htmlspecialchars($data['finality_type']); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($data['supervisors'])): ?>
|
|
<div class="meta-item">
|
|
<strong>Promoteur·ice·s:</strong>
|
|
<span><?= htmlspecialchars($data['supervisors']); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<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; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (!empty($data['context_note'])): ?>
|
|
<div class="context-note">
|
|
<em><?= htmlspecialchars($data['context_note']); ?></em>
|
|
</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; ?>
|
|
|
|
<!-- Files Section -->
|
|
<section class="tfe-files">
|
|
<?php if (isset($data['files']) && count($data['files']) > 0): ?>
|
|
<?php foreach ($data['files'] as $file): ?>
|
|
<?php $ext = strtolower(pathinfo($file['file_path'], PATHINFO_EXTENSION)); ?>
|
|
<div class="file-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>
|
|
<?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.
|
|
</video>
|
|
<?php endif; ?>
|
|
<?php if (!empty($file['description'])): ?>
|
|
<p class="file-description"><?= htmlspecialchars($file['description']); ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<p class="no-files">Aucun fichier disponible pour ce TFE.</p>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
</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>
|