mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
- Add comprehensive migration guides (DEPLOYMENT_MIGRATION.md, DIRECTORY_STRUCTURE.md, MIGRATION_CHECKLIST.md) - Refactor admin panel: split add.php, create reusable header/footer - Update styles: admin.css, common.css, main.css - Improve public pages: index.php, memoire.php - Reorganize database documentation into database/docs/ - Update .gitignore and justfile This prepares for migration to public/ directory structure
86 lines
3.1 KiB
PHP
86 lines
3.1 KiB
PHP
<?php
|
|
ini_set("display_errors", 0);
|
|
ini_set("log_errors", 1);
|
|
ini_set("error_log", "error.log");
|
|
|
|
$pageTitle = "Liste des TFE";
|
|
|
|
require_once __DIR__ . "/lib/Database.php";
|
|
|
|
$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 "inc/header.php"; ?>
|
|
|
|
<main>
|
|
<?php foreach ($itemsToLoad as $item): ?>
|
|
<a href="memoire.php?id=<?= $item["id"] ?>" class="card-link">
|
|
<div class="card">
|
|
<?php
|
|
// Get cover image from thesis_files if available
|
|
$coverImage = null;
|
|
if (!empty($item["id"])) {
|
|
$files = $db->getThesisFiles($item["id"]);
|
|
foreach ($files as $file) {
|
|
$ext = strtolower(
|
|
pathinfo($file["file_path"], PATHINFO_EXTENSION),
|
|
);
|
|
if (
|
|
in_array($ext, ["jpg", "jpeg", "png", "gif"]) &&
|
|
$file["file_type"] === "main"
|
|
) {
|
|
$coverImage = $file["file_path"];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
<?php if ($coverImage): ?>
|
|
<div class="card-image">
|
|
<figure class="image ">
|
|
<img src="<?= htmlspecialchars(
|
|
$coverImage,
|
|
) ?>" alt="Image preview">
|
|
</figure>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="card-content">
|
|
<h4 class="title is-4">
|
|
<?= htmlspecialchars($item["title"]) ?>
|
|
</h4>
|
|
<h2 class="subtitle">
|
|
<?= htmlspecialchars($item["authors"] ?? "Auteur inconnu") ?>
|
|
</h2>
|
|
<h3 class="tag title is-6 is-link is-light">
|
|
<?= htmlspecialchars($item["year"]) ?>
|
|
</h3>
|
|
<p class="block content">
|
|
<?php
|
|
$excerpt_length = 150;
|
|
$synopsis = $item["synopsis"] ?? "";
|
|
$description_excerpt =
|
|
strlen($synopsis) > $excerpt_length
|
|
? substr($synopsis, 0, $excerpt_length) . "..."
|
|
: $synopsis;
|
|
?>
|
|
<?= htmlspecialchars($description_excerpt) ?>
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</main>
|
|
<?php include "inc/footer.php"; ?>
|