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
102 lines
3.1 KiB
PHP
102 lines
3.1 KiB
PHP
<?php
|
||
// Load configuration
|
||
require_once __DIR__ . '/../config/bootstrap.php';
|
||
require_once APP_ROOT . '/src/Database.php';
|
||
|
||
$pageTitle = "Liste des TFE";
|
||
$page = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
|
||
$year = isset($_GET["year"]) ? intval($_GET["year"]) : null;
|
||
$itemsPerPage = 10;
|
||
|
||
try {
|
||
$db = Database::getInstance();
|
||
$offset = ($page - 1) * $itemsPerPage;
|
||
|
||
// Get available years for footer
|
||
$availableYears = $db->getAvailableYears();
|
||
|
||
// Filter by year if specified
|
||
if ($year) {
|
||
$itemsToLoad = $db->searchTheses(['year' => $year], $itemsPerPage, $offset);
|
||
$totalItems = $db->countSearchResults(['year' => $year]);
|
||
} else {
|
||
$itemsToLoad = $db->getPublishedTheses($itemsPerPage, $offset);
|
||
$totalItems = $db->countPublishedTheses();
|
||
}
|
||
|
||
$totalPages = ceil($totalItems / $itemsPerPage);
|
||
} catch (Exception $e) {
|
||
error_log("Error loading theses: " . $e->getMessage());
|
||
$itemsToLoad = [];
|
||
$totalPages = 0;
|
||
$availableYears = [];
|
||
}
|
||
|
||
include APP_ROOT . '/templates/header.php';
|
||
?>
|
||
|
||
<?php if ($year): ?>
|
||
<div class="filter-info">
|
||
Année : <?= htmlspecialchars($year) ?>
|
||
<a href="index.php" class="clear-filter">✕ Réinitialiser</a>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<main>
|
||
<?php foreach ($itemsToLoad as $item): ?>
|
||
<a href="tfe.php?id=<?= (int)$item["id"] ?>" class="card-link">
|
||
<div class="card">
|
||
<div class="card-content">
|
||
<h2 class="title"><?= htmlspecialchars($item["title"]) ?></h2>
|
||
<p class="authors"><?= htmlspecialchars($item["authors"]) ?></p>
|
||
<p class="year"><?= htmlspecialchars($item["year"]) ?></p>
|
||
</div>
|
||
</div>
|
||
</a>
|
||
<?php endforeach; ?>
|
||
|
||
<?php if (empty($itemsToLoad)): ?>
|
||
<p>Aucun mémoire trouvé.</p>
|
||
<?php endif; ?>
|
||
</main>
|
||
|
||
<?php if ($totalPages > 1): ?>
|
||
<nav class="pagination">
|
||
<?php
|
||
$yearParam = $year ? '&year=' . (int)$year : '';
|
||
?>
|
||
|
||
<a href="?page=1<?= $yearParam ?>"
|
||
class="pagination-btn <?= $page <= 1 ? 'disabled' : '' ?>"
|
||
<?= $page <= 1 ? 'aria-disabled="true"' : '' ?>>
|
||
‹‹
|
||
</a>
|
||
|
||
<a href="?page=<?= max(1, (int)($page - 1)) . $yearParam ?>"
|
||
class="pagination-btn <?= $page <= 1 ? 'disabled' : '' ?>"
|
||
<?= $page <= 1 ? 'aria-disabled="true"' : '' ?>>
|
||
‹
|
||
</a>
|
||
|
||
<span class="pagination-info">
|
||
<span class="page-current"><?= (int)$page ?></span>
|
||
<span class="page-separator">/</span>
|
||
<span class="page-total"><?= (int)$totalPages ?></span>
|
||
</span>
|
||
|
||
<a href="?page=<?= min($totalPages, (int)($page + 1)) . $yearParam ?>"
|
||
class="pagination-btn <?= $page >= $totalPages ? 'disabled' : '' ?>"
|
||
<?= $page >= $totalPages ? 'aria-disabled="true"' : '' ?>>
|
||
›
|
||
</a>
|
||
|
||
<a href="?page=<?= $totalPages . $yearParam ?>"
|
||
class="pagination-btn <?= $page >= $totalPages ? 'disabled' : '' ?>"
|
||
<?= $page >= $totalPages ? 'aria-disabled="true"' : '' ?>>
|
||
››
|
||
</a>
|
||
</nav>
|
||
<?php endif; ?>
|
||
|
||
<?php include APP_ROOT . '/templates/footer.php'; ?>
|