mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
- Moved /lib → /src (PHP source code)
- Moved /includes → /public/includes (main site templates)
- Admin section remains self-contained in /public/admin with its own /inc
- Updated all require/include paths across codebase
- Updated config/bootstrap.php, justfile, tests, docs
- All tests passing ✅
Structure now follows PHP best practices:
/config - Configuration files
/database - SQLite database + schema
/docs - Documentation (intact)
/nginx - Server config (intact)
/public - Web-accessible files (entry point)
/admin - Self-contained admin interface
/assets - CSS, fonts, icons
/includes - Main site templates (header/footer)
/scripts - Deployment scripts (intact)
/src - PHP source classes (Database, AdminAuth, RateLimit)
/tests - Test suites
58 lines
1.8 KiB
PHP
58 lines
1.8 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;
|
|
$itemsPerPage = 10;
|
|
|
|
try {
|
|
$db = Database::getInstance();
|
|
$offset = ($page - 1) * $itemsPerPage;
|
|
$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;
|
|
}
|
|
|
|
include APP_ROOT . '/public/includes/header.php';
|
|
?>
|
|
|
|
<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 if ($page > 1): ?>
|
|
<a href="?page=<?= (int)($page - 1) ?>" class="pagination-previous">Précédent</a>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($page < $totalPages): ?>
|
|
<a href="?page=<?= (int)($page + 1) ?>" class="pagination-next">Suivant</a>
|
|
<?php endif; ?>
|
|
|
|
<span class="pagination-info">Page <?= (int)$page ?> sur <?= (int)$totalPages ?></span>
|
|
</nav>
|
|
<?php endif; ?>
|
|
|
|
<?php include APP_ROOT . '/public/includes/footer.php'; ?>
|