mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
feat: licence page, admin pages editor, license types, gradient card placeholders, latest-year home view
- Feature 1: public /licence.php fetches 'licenses' page from DB, renders Markdown - Feature 1: nav.php adds 'Licence' link with active state - Feature 2: Database::getPage(), savePage(), getAllPages() methods - Feature 2: bundled src/Parsedown.php (MIT, zero-dependency) - Feature 2: apropos.php now renders 'about' page content from DB via Parsedown - Feature 2: admin/pages.php (list) + admin/pages-edit.php (EasyMDE editor) - Feature 2: admin/actions/page.php (auth+CSRF+validation+save) - Feature 2: admin/head.php adds 'Pages statiques' nav link - Feature 3: storage/schema.sql seeds 8 CC license types - Feature 3: storage/migrations/003_seed_license_types.sql (applied to live DB) - Feature 3: Database::getLicenseTypes() / getAllLicenseTypes() - Feature 3: admin/add.php + formulaire.php: license_id field on add form - Feature 3: admin/edit.php: license_id field on edit form with raw FK lookup - Feature 3: tfe.php: shows 'Licence :' meta row when non-null - Feature 6: main.css: .card__media--gradient styles - Feature 6: index.php: deterministic HSL gradient placeholder cards - Feature 6: Database::getLatestYearTheses() + getLatestPublishedYear() - Feature 6: index.php default home = random latest-year theses with info label
This commit is contained in:
55
public/admin/pages.php
Normal file
55
public/admin/pages.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
require_once __DIR__ . "/../../config/bootstrap.php";
|
||||
require_once __DIR__ . '/../../src/AdminAuth.php';
|
||||
AdminAuth::requireLogin();
|
||||
|
||||
require_once __DIR__ . '/../../src/Database.php';
|
||||
|
||||
$pageTitle = "Pages statiques";
|
||||
|
||||
try {
|
||||
$db = new Database();
|
||||
$pages = $db->getAllPages();
|
||||
} catch (Exception $e) {
|
||||
error_log("Error loading pages: " . $e->getMessage());
|
||||
die("Erreur lors du chargement des pages.");
|
||||
}
|
||||
|
||||
$success = $_SESSION['success'] ?? null;
|
||||
unset($_SESSION['success']);
|
||||
?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
||||
|
||||
<main class="admin-main">
|
||||
<h1 class="admin-page-title">Pages statiques</h1>
|
||||
|
||||
<?php if ($success): ?>
|
||||
<div class="admin-alert admin-alert--success">✓ <?= htmlspecialchars($success) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Slug</th>
|
||||
<th>Titre</th>
|
||||
<th>Mis à jour</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($pages as $p): ?>
|
||||
<tr>
|
||||
<td><code><?= htmlspecialchars($p['slug']) ?></code></td>
|
||||
<td><?= htmlspecialchars($p['title']) ?></td>
|
||||
<td><?= htmlspecialchars($p['updated_at'] ?? '—') ?></td>
|
||||
<td>
|
||||
<a href="/admin/pages-edit.php?slug=<?= urlencode($p['slug']) ?>"
|
||||
class="admin-btn" style="font-size:.8rem;padding:.3rem .75rem;">Éditer</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
|
||||
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
||||
Reference in New Issue
Block a user