v0.2
This commit is contained in:
parent
a26f2122a4
commit
385244dfee
15
admin.php
15
admin.php
@ -361,6 +361,10 @@ $current_session_user = isset($_SESSION['user']) ? (string) $_SESSION['user'] :
|
||||
box-shadow: 0 0 15px rgba(255, 77, 77, 0.3);
|
||||
}
|
||||
|
||||
.nav-tabs { display: flex; gap: 1rem; margin-bottom: 2rem; border-bottom: 1px solid var(--border-glow); padding-bottom: 1rem; }
|
||||
.nav-tabs a { text-decoration: none; color: #888; text-transform: uppercase; font-size: 0.9rem; transition: color 0.3s; }
|
||||
.nav-tabs a:hover, .nav-tabs a.active { color: var(--primary); }
|
||||
|
||||
.admin-content {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr;
|
||||
@ -505,7 +509,7 @@ $current_session_user = isset($_SESSION['user']) ? (string) $_SESSION['user'] :
|
||||
<header class="admin-topbar">
|
||||
<div class="topbar-info">
|
||||
<h1>R.E.A.C.T. Core Admin</h1>
|
||||
<p>Niveau d\'accès : <strong>Administrateur</strong> | Session : <strong><?php echo htmlspecialchars($current_session_user, ENT_QUOTES, 'UTF-8'); ?></strong></p>
|
||||
<p>Niveau d'accès : <strong>Administrateur</strong> | Session : <strong><?php echo htmlspecialchars($current_session_user, ENT_QUOTES, 'UTF-8'); ?></strong></p>
|
||||
</div>
|
||||
<div class="topbar-actions">
|
||||
<a href="index.php" class="btn-modern">Retour au site</a>
|
||||
@ -513,6 +517,11 @@ $current_session_user = isset($_SESSION['user']) ? (string) $_SESSION['user'] :
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<nav class="nav-tabs">
|
||||
<a href="admin.php" class="active">Utilisateurs</a>
|
||||
<a href="scitems.php">Base d'Objets</a>
|
||||
</nav>
|
||||
|
||||
<?php if ($flash_message !== ''): ?>
|
||||
<div class="flash <?php echo htmlspecialchars($flash_type, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<?php echo htmlspecialchars($flash_message, ENT_QUOTES, 'UTF-8'); ?>
|
||||
@ -540,7 +549,7 @@ $current_session_user = isset($_SESSION['user']) ? (string) $_SESSION['user'] :
|
||||
|
||||
<div class="form-group">
|
||||
<label for="cl_auth_user">Identifiant Système</label>
|
||||
<input class="form-control" id="cl_auth_user" name="cl_auth_user" type="text" required value="<?php echo htmlspecialchars($edit_cl_auth_user, ENT_QUOTES, 'UTF-8'); ?>" placeholder="Nom d\'utilisateur">
|
||||
<input class="form-control" id="cl_auth_user" name="cl_auth_user" type="text" required value="<?php echo htmlspecialchars($edit_cl_auth_user, ENT_QUOTES, 'UTF-8'); ?>" placeholder="Nom d'utilisateur">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@ -549,7 +558,7 @@ $current_session_user = isset($_SESSION['user']) ? (string) $_SESSION['user'] :
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="cl_auth_right">Niveau d\'accréditation</label>
|
||||
<label for="cl_auth_right">Niveau d'accréditation</label>
|
||||
<select class="form-control" id="cl_auth_right" name="cl_auth_right">
|
||||
<option value="admin" <?php echo $edit_cl_auth_right === 'admin' ? 'selected' : ''; ?>>Admin</option>
|
||||
<option value="member" <?php echo $edit_cl_auth_right === 'member' ? 'selected' : ''; ?>>Membre</option>
|
||||
|
||||
472
scitems.php
Normal file
472
scitems.php
Normal file
@ -0,0 +1,472 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/db/auth.php';
|
||||
|
||||
auth_start_session();
|
||||
auth_bootstrap();
|
||||
|
||||
if (!auth_is_admin()) {
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$flash = auth_flash_get();
|
||||
$flash_type = $flash['type'] ?? '';
|
||||
$flash_message = $flash['message'] ?? '';
|
||||
|
||||
$db = db();
|
||||
$csrf_token = auth_csrf_token();
|
||||
|
||||
// Pagination
|
||||
$limit = 20;
|
||||
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
|
||||
if ($page < 1) $page = 1;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
// Search
|
||||
$search = isset($_GET['search']) ? trim($_GET['search']) : '';
|
||||
$where = "1=1";
|
||||
$params = [];
|
||||
if ($search !== '') {
|
||||
$where = "(cl_scobjs_name LIKE :search OR cl_scobjs_type LIKE :search OR cl_scobjs_subtype LIKE :search OR cl_scobjs_uuid LIKE :search)";
|
||||
$params['search'] = "%$search%";
|
||||
}
|
||||
|
||||
// Handle POST actions
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$submitted_csrf = $_POST['csrf_token'] ?? '';
|
||||
if (!auth_validate_csrf($submitted_csrf)) {
|
||||
auth_flash_set('error', 'Jeton CSRF invalide.');
|
||||
header('Location: scitems.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$action = $_POST['action'] ?? '';
|
||||
|
||||
if ($action === 'import_json') {
|
||||
if (!isset($_FILES['json_file']) || $_FILES['json_file']['error'] !== UPLOAD_ERR_OK) {
|
||||
auth_flash_set('error', 'Erreur lors du téléchargement du fichier JSON.');
|
||||
} else {
|
||||
$jsonData = file_get_contents($_FILES['json_file']['tmp_name']);
|
||||
$items = json_decode($jsonData, true);
|
||||
|
||||
if (!is_array($items)) {
|
||||
auth_flash_set('error', 'Format JSON invalide (doit être un tableau).');
|
||||
} else {
|
||||
$count_new = 0;
|
||||
$count_updated = 0;
|
||||
|
||||
$stmt_check = $db->prepare("SELECT cl_scobjs_id FROM tbl_scobjs WHERE cl_scobjs_uuid = :uuid");
|
||||
$stmt_insert = $db->prepare("INSERT INTO tbl_scobjs (cl_scobjs_name, cl_scobjs_type, cl_scobjs_subtype, cl_scobjs_uuid, cl_scobjs_about) VALUES (:name, :type, :subtype, :uuid, :about)");
|
||||
$stmt_update = $db->prepare("UPDATE tbl_scobjs SET cl_scobjs_name = :name, cl_scobjs_type = :type, cl_scobjs_subtype = :subtype, cl_scobjs_about = :about WHERE cl_scobjs_uuid = :uuid");
|
||||
|
||||
foreach ($items as $item) {
|
||||
$uuid = $item['reference'] ?? ($item['stdItem']['UUID'] ?? '');
|
||||
if (!$uuid) continue;
|
||||
|
||||
$name = $item['stdItem']['Name'] ?? '';
|
||||
$type = $item['type'] ?? '';
|
||||
$subtype = $item['subType'] ?? '';
|
||||
$about = $item['stdItem']['Description'] ?? '';
|
||||
|
||||
$stmt_check->execute(['uuid' => $uuid]);
|
||||
if ($stmt_check->fetch()) {
|
||||
$stmt_update->execute([
|
||||
'name' => $name,
|
||||
'type' => $type,
|
||||
'subtype' => $subtype,
|
||||
'about' => $about,
|
||||
'uuid' => $uuid
|
||||
]);
|
||||
$count_updated++;
|
||||
} else {
|
||||
$stmt_insert->execute([
|
||||
'name' => $name,
|
||||
'type' => $type,
|
||||
'subtype' => $subtype,
|
||||
'uuid' => $uuid,
|
||||
'about' => $about
|
||||
]);
|
||||
$count_new++;
|
||||
}
|
||||
}
|
||||
auth_flash_set('success', "Importation terminée : $count_new nouveaux, $count_updated mis à jour.");
|
||||
}
|
||||
}
|
||||
header('Location: scitems.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === 'update_item') {
|
||||
$id = (int)$_POST['id'];
|
||||
$rarity = trim($_POST['rarity'] ?? '');
|
||||
$about = trim($_POST['about'] ?? '');
|
||||
|
||||
$stmt = $db->prepare("UPDATE tbl_scobjs SET cl_scobjs_rarity = :rarity, cl_scobjs_about = :about WHERE cl_scobjs_id = :id");
|
||||
$stmt->execute(['rarity' => $rarity, 'about' => $about, 'id' => $id]);
|
||||
|
||||
auth_flash_set('success', "Objet mis à jour avec succès.");
|
||||
header('Location: scitems.php?page=' . $page . '&search=' . urlencode($search));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch items
|
||||
$sql_count = "SELECT COUNT(*) FROM tbl_scobjs WHERE $where";
|
||||
$stmt_count = $db->prepare($sql_count);
|
||||
$stmt_count->execute($params);
|
||||
$total_items = (int)$stmt_count->fetchColumn();
|
||||
$total_pages = ceil($total_items / $limit);
|
||||
|
||||
$sql_items = "SELECT * FROM tbl_scobjs WHERE $where ORDER BY cl_scobjs_name ASC LIMIT $limit OFFSET $offset";
|
||||
$stmt_items = $db->prepare($sql_items);
|
||||
$stmt_items->execute($params);
|
||||
$items_list = $stmt_items->fetchAll();
|
||||
|
||||
$current_session_user = $_SESSION['user'] ?? '';
|
||||
$edit_id = isset($_GET['edit']) ? (int)$_GET['edit'] : 0;
|
||||
$edit_item = null;
|
||||
if ($edit_id > 0) {
|
||||
$stmt_edit = $db->prepare("SELECT * FROM tbl_scobjs WHERE cl_scobjs_id = :id");
|
||||
$stmt_edit->execute(['id' => $edit_id]);
|
||||
$edit_item = $stmt_edit->fetch();
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Gestion des Objets | R.E.A.C.T. Admin</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/styles.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/default.css">
|
||||
<style>
|
||||
:root {
|
||||
--primary: #a29b78;
|
||||
--primary-glow: rgba(162, 155, 120, 0.4);
|
||||
--bg-dark: #080a0f;
|
||||
--card-bg: rgba(20, 24, 33, 0.85);
|
||||
--border-glow: rgba(162, 155, 120, 0.25);
|
||||
--danger: #ff4d4d;
|
||||
--success: #00ff88;
|
||||
}
|
||||
|
||||
body {
|
||||
background: radial-gradient(circle at top right, #1a1f2e, var(--bg-dark));
|
||||
background-attachment: fixed;
|
||||
color: #e0e0e0;
|
||||
font-family: 'Electrolize', sans-serif;
|
||||
margin: 0;
|
||||
overflow-x: hidden;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.admin-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
animation: fadeIn 0.6s ease-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(10px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.admin-topbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1.5rem 2rem;
|
||||
background: var(--card-bg);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid var(--border-glow);
|
||||
border-radius: 12px;
|
||||
margin-bottom: 2rem;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.topbar-info h1 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
letter-spacing: 2px;
|
||||
text-transform: uppercase;
|
||||
background: linear-gradient(90deg, #fff, var(--primary));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
|
||||
.topbar-info p {
|
||||
margin: 0.25rem 0 0;
|
||||
font-size: 0.85rem;
|
||||
color: var(--primary);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.topbar-actions {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.btn-modern {
|
||||
padding: 0.6rem 1.2rem;
|
||||
border: 1px solid var(--primary);
|
||||
background: transparent;
|
||||
color: #fff;
|
||||
font-family: 'Electrolize', sans-serif;
|
||||
font-size: 0.9rem;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.btn-modern:hover {
|
||||
background: var(--primary);
|
||||
color: var(--bg-dark);
|
||||
box-shadow: 0 0 15px var(--primary-glow);
|
||||
}
|
||||
|
||||
.btn-modern.danger { border-color: var(--danger); color: var(--danger); }
|
||||
.btn-modern.danger:hover { background: var(--danger); color: #fff; }
|
||||
|
||||
.admin-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 3fr;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.admin-grid { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
.glass-card {
|
||||
background: var(--card-bg);
|
||||
backdrop-filter: blur(12px);
|
||||
border: 1px solid var(--border-glow);
|
||||
border-radius: 12px;
|
||||
padding: 2rem;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
||||
height: fit-content;
|
||||
}
|
||||
|
||||
.glass-card h2 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.5rem;
|
||||
font-size: 1.25rem;
|
||||
color: var(--primary);
|
||||
border-bottom: 1px solid var(--border-glow);
|
||||
padding-bottom: 0.75rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.form-group { margin-bottom: 1.5rem; }
|
||||
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.85rem; color: #aaa; text-transform: uppercase; }
|
||||
.form-control {
|
||||
width: 100%;
|
||||
padding: 0.8rem 1rem;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border: 1px solid #444;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-family: 'Electrolize', sans-serif;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
.form-control:focus { outline: none; border-color: var(--primary); background: rgba(0, 0, 0, 0.5); }
|
||||
|
||||
.modern-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
|
||||
.modern-table th { text-align: left; padding: 1rem; font-size: 0.8rem; text-transform: uppercase; color: var(--primary); opacity: 0.7; }
|
||||
.modern-table td { padding: 1rem; background: rgba(255, 255, 255, 0.03); border-top: 1px solid rgba(255, 255, 255, 0.05); border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
|
||||
.modern-table td:first-child { border-left: 1px solid rgba(255, 255, 255, 0.05); border-radius: 8px 0 0 8px; }
|
||||
.modern-table td:last-child { border-right: 1px solid rgba(255, 255, 255, 0.05); border-radius: 0 8px 8px 0; }
|
||||
.modern-table tr:hover td { background: rgba(162, 155, 120, 0.05); }
|
||||
|
||||
.flash { padding: 1rem 1.5rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.9rem; border-left: 4px solid var(--primary); background: rgba(162, 155, 120, 0.1); }
|
||||
.flash.error { border-color: var(--danger); background: rgba(255, 77, 77, 0.1); color: #ffbaba; }
|
||||
.flash.success { border-color: var(--success); background: rgba(0, 255, 136, 0.1); color: #baffda; }
|
||||
|
||||
.pagination { display: flex; gap: 0.5rem; margin-top: 2rem; justify-content: center; }
|
||||
.page-link {
|
||||
padding: 0.5rem 1rem;
|
||||
border: 1px solid var(--border-glow);
|
||||
background: var(--card-bg);
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.page-link:hover, .page-link.active { background: var(--primary); color: var(--bg-dark); }
|
||||
|
||||
.search-container { margin-bottom: 1.5rem; display: flex; gap: 10px; }
|
||||
.search-container input { flex: 1; }
|
||||
|
||||
.badge { padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.7rem; text-transform: uppercase; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); }
|
||||
|
||||
.item-name { color: var(--primary); font-weight: bold; display: block; }
|
||||
.item-meta { font-size: 0.75rem; color: #888; }
|
||||
.item-about { font-size: 0.8rem; color: #ccc; margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
||||
|
||||
.nav-tabs { display: flex; gap: 1rem; margin-bottom: 2rem; border-bottom: 1px solid var(--border-glow); padding-bottom: 1rem; }
|
||||
.nav-tabs a { text-decoration: none; color: #888; text-transform: uppercase; font-size: 0.9rem; transition: color 0.3s; }
|
||||
.nav-tabs a:hover, .nav-tabs a.active { color: var(--primary); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="admin-layout">
|
||||
<header class="admin-topbar">
|
||||
<div class="topbar-info">
|
||||
<h1>R.E.A.C.T. Objects Control</h1>
|
||||
<p>Niveau d'accès : <strong>Administrateur</strong> | Session : <strong><?php echo htmlspecialchars($current_session_user); ?></strong></p>
|
||||
</div>
|
||||
<div class="topbar-actions">
|
||||
<a href="index.php" class="btn-modern">Site</a>
|
||||
<a href="logout.php" class="btn-modern danger">Exit</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<nav class="nav-tabs">
|
||||
<a href="admin.php">Utilisateurs</a>
|
||||
<a href="scitems.php" class="active">Base d'Objets</a>
|
||||
</nav>
|
||||
|
||||
<?php if ($flash_message !== ''): ?>
|
||||
<div class="flash <?php echo htmlspecialchars($flash_type); ?>">
|
||||
<?php echo htmlspecialchars($flash_message); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="admin-grid">
|
||||
<div class="side-panel">
|
||||
<section class="glass-card" style="margin-bottom: 2rem;">
|
||||
<h2>Importation JSON</h2>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrf_token); ?>">
|
||||
<input type="hidden" name="action" value="import_json">
|
||||
<div class="form-group">
|
||||
<label for="json_file">Fichier JSON</label>
|
||||
<input type="file" name="json_file" id="json_file" class="form-control" accept=".json" required>
|
||||
</div>
|
||||
<button type="submit" class="btn-modern" style="width: 100%;">Importer / Mettre à jour</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<?php if ($edit_item): ?>
|
||||
<section class="glass-card">
|
||||
<h2>Editer Objet</h2>
|
||||
<form method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrf_token); ?>">
|
||||
<input type="hidden" name="action" value="update_item">
|
||||
<input type="hidden" name="id" value="<?php echo $edit_item['cl_scobjs_id']; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Nom</label>
|
||||
<div class="form-control" style="background: rgba(255,255,255,0.05); border-color: transparent;">
|
||||
<?php echo htmlspecialchars($edit_item['cl_scobjs_name']); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="rarity">Rareté</label>
|
||||
<input type="text" name="rarity" id="rarity" class="form-control" value="<?php echo htmlspecialchars($edit_item['cl_scobjs_rarity']); ?>" placeholder="Ex: Légendaire, Commun...">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="about">Description / Notes</label>
|
||||
<textarea name="about" id="about" class="form-control" rows="5"><?php echo htmlspecialchars($edit_item['cl_scobjs_about']); ?></textarea>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<button type="submit" class="btn-modern" style="flex: 2;">Sauvegarder</button>
|
||||
<a href="scitems.php?page=<?php echo $page; ?>&search=<?php echo urlencode($search); ?>" class="btn-modern danger" style="flex: 1;">X</a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<main class="main-panel">
|
||||
<section class="glass-card">
|
||||
<h2>
|
||||
Base de Données d'Objets
|
||||
<span style="font-size: 0.8rem; opacity: 0.6;"><?php echo $total_items; ?> entrées</span>
|
||||
</h2>
|
||||
|
||||
<div class="search-container">
|
||||
<form method="get" style="display: flex; width: 100%; gap: 10px;">
|
||||
<input type="text" name="search" class="form-control" placeholder="Rechercher par nom, type, uuid..." value="<?php echo htmlspecialchars($search); ?>">
|
||||
<button type="submit" class="btn-modern">Filtrer</button>
|
||||
<?php if ($search !== ''): ?>
|
||||
<a href="scitems.php" class="btn-modern danger">Reset</a>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style="overflow-x: auto;">
|
||||
<table class="modern-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Détails</th>
|
||||
<th>Rareté</th>
|
||||
<th style="text-align: right;">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($items_list)): ?>
|
||||
<tr><td colspan="3" style="text-align: center; padding: 3rem; color: #666;">Aucun objet trouvé.</td></tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($items_list as $item): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<span class="item-name"><?php echo htmlspecialchars($item['cl_scobjs_name']); ?></span>
|
||||
<span class="item-meta">
|
||||
<?php echo htmlspecialchars($item['cl_scobjs_type']); ?>
|
||||
<?php if($item['cl_scobjs_subtype']) echo " / " . htmlspecialchars($item['cl_scobjs_subtype']); ?>
|
||||
</span>
|
||||
<div class="item-about"><?php echo htmlspecialchars($item['cl_scobjs_about']); ?></div>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($item['cl_scobjs_rarity']): ?>
|
||||
<span class="badge" style="border-color: var(--primary); color: var(--primary);"><?php echo htmlspecialchars($item['cl_scobjs_rarity']); ?></span>
|
||||
<?php else: ?>
|
||||
<span class="badge" style="opacity: 0.3;">N/A</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td style="text-align: right;">
|
||||
<a href="scitems.php?edit=<?php echo $item['cl_scobjs_id']; ?>&page=<?php echo $page; ?>&search=<?php echo urlencode($search); ?>" class="btn-modern btn-mini">Editer</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if ($total_pages > 1): ?>
|
||||
<div class="pagination">
|
||||
<?php for ($i = 1; $i <= $total_pages; $i++): ?>
|
||||
<?php if ($i == 1 || $i == $total_pages || ($i >= $page - 2 && $i <= $page + 2)): ?>
|
||||
<a href="scitems.php?page=<?php echo $i; ?>&search=<?php echo urlencode($search); ?>" class="page-link <?php echo $i == $page ? 'active' : ''; ?>">
|
||||
<?php echo $i; ?>
|
||||
</a>
|
||||
<?php elseif ($i == $page - 3 || $i == $page + 3): ?>
|
||||
<span style="padding: 0.5rem;">...</span>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user