mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
Layout improvements:
- Fixed header/main/footer ratios to 2:5, 3:5, 1:5 using flex
- Default to sans-serif font system stack
- Made sections properly flex-based instead of viewport height
Pagination improvements:
- First/previous/next/last navigation buttons (‹‹ ‹ › ››)
- Current page highlighted in colored badge
- Disabled state for unavailable actions
- Clean rounded button design with hover effects
- Proper spacing and visual hierarchy
Card styling:
- Better typography hierarchy
- Hover effects (lift + shadow)
- Improved spacing and readability
- Year displayed in brand color
Tests passing ✅
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="memoire.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'; ?>
|