56 lines
1.8 KiB
PHP
56 lines
1.8 KiB
PHP
<?php
|
|
require_once '../includes/config.php';
|
|
require_once '../includes/auth.php';
|
|
require_once '../includes/stories.php';
|
|
|
|
// Vérification de l'authentification
|
|
if (!Auth::check()) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
|
|
$stories = Stories::getAll();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Administration</title>
|
|
<link rel="stylesheet" href="../assets/css/admin.css">
|
|
</head>
|
|
<body>
|
|
<nav class="admin-nav">
|
|
<div class="nav-brand">Administration</div>
|
|
<div class="nav-menu">
|
|
<a href="story-edit.php" class="button">Nouveau roman</a>
|
|
<form method="POST" action="logout.php" class="logout-form">
|
|
<button type="submit">Déconnexion</button>
|
|
</form>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="admin-main">
|
|
<h1>Gestion des romans</h1>
|
|
|
|
<div class="stories-list">
|
|
<?php foreach ($stories as $story): ?>
|
|
<div class="story-item">
|
|
<img src="<?= htmlspecialchars('../' . $story['cover']) ?>" alt="" class="story-cover">
|
|
<div class="story-info">
|
|
<h2><?= htmlspecialchars($story['title']) ?></h2>
|
|
<p>Dernière modification : <?= htmlspecialchars($story['updated']) ?></p>
|
|
</div>
|
|
<div class="story-actions">
|
|
<a href="story-edit.php?id=<?= htmlspecialchars($story['id']) ?>" class="button">Modifier</a>
|
|
<button type="button" class="button delete-story" data-id="<?= htmlspecialchars($story['id']) ?>">Supprimer</button>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</main>
|
|
|
|
<script src="../assets/js/admin.js"></script>
|
|
</body>
|
|
</html>
|