|
|
@@ -49,7 +49,6 @@ if ($show_login):
|
|
|
$msg = "";
|
|
|
$msg_type = "success";
|
|
|
|
|
|
-// Spiel hinzufügen
|
|
|
if (isset($_POST['add_new_game'])) {
|
|
|
$ean = trim($_POST['new_ean']);
|
|
|
$titel = trim($_POST['new_titel']);
|
|
|
@@ -69,20 +68,17 @@ if (isset($_POST['add_new_game'])) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// Spiel aktualisieren
|
|
|
if (isset($_POST['update_game'])) {
|
|
|
$stmt = $pdo->prepare("UPDATE spiele SET titel = ?, typ_id = ?, ean = ?, level = ?, bild_url = ? WHERE id = ?");
|
|
|
$stmt->execute([$_POST['titel'], ($_POST['typ_id'] == '0' ? null : (int)$_POST['typ_id']), $_POST['ean'], $_POST['level'], $_POST['bild_url'], (int)$_POST['spiel_id']]);
|
|
|
$msg = "💾 Änderungen gespeichert!";
|
|
|
}
|
|
|
|
|
|
-// Löschen
|
|
|
if (isset($_POST['delete_game'])) {
|
|
|
$pdo->prepare("DELETE FROM spiele WHERE id = ?")->execute([(int)$_POST['spiel_id']]);
|
|
|
$msg = "🗑 Spiel gelöscht!";
|
|
|
}
|
|
|
|
|
|
-// Daten abrufen
|
|
|
$spiele = $pdo->query("SELECT s.*, t.bezeichnung as typ_name FROM spiele s LEFT JOIN game_typen t ON s.typ_id = t.id ORDER BY s.id DESC")->fetchAll();
|
|
|
$typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetchAll();
|
|
|
?>
|
|
|
@@ -94,17 +90,26 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<title>EXIT Admin - Stammdaten</title>
|
|
|
<style>
|
|
|
body { font-family: 'Segoe UI', sans-serif; background: #121212; color: #e0e0e0; padding: 20px; }
|
|
|
- .container { max-width: 1300px; margin: 0 auto; }
|
|
|
+ .container { max-width: 1400px; margin: 0 auto; }
|
|
|
.alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: bold; text-align: center; }
|
|
|
.alert-success { background: #27ae60; color: white; }
|
|
|
.alert-error { background: #e74c3c; color: white; }
|
|
|
|
|
|
.admin-card { background: #1e1e1e; padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); margin-bottom: 30px; border: 1px solid #333; }
|
|
|
- table { width: 100%; border-collapse: collapse; margin-top: 20px; }
|
|
|
- th, td { padding: 10px; border-bottom: 1px solid #333; text-align: left; }
|
|
|
- th { color: #e67e22; }
|
|
|
- input, select { padding: 8px; border: 1px solid #444; border-radius: 6px; width: 100%; box-sizing: border-box; background: #2a2a2a; color: white; }
|
|
|
+ table { width: 100%; border-collapse: collapse; margin-top: 20px; table-layout: fixed; }
|
|
|
+ th, td { padding: 10px; border-bottom: 1px solid #333; text-align: left; overflow: hidden; }
|
|
|
+ th { color: #e67e22; font-size: 0.9em; text-transform: uppercase; }
|
|
|
+ input, select { padding: 8px; border: 1px solid #444; border-radius: 6px; width: 100%; box-sizing: border-box; background: #2a2a2a; color: white; font-size: 0.95em; }
|
|
|
|
|
|
+ /* Spaltenbreiten Tabelle */
|
|
|
+ .col-img { width: 60px; }
|
|
|
+ .col-titel { width: auto; } /* Nimmt den Rest */
|
|
|
+ .col-ean { width: 140px; }
|
|
|
+ .col-typ { width: 160px; }
|
|
|
+ .col-lvl { width: 150px; }
|
|
|
+ .col-url { width: 200px; }
|
|
|
+ .col-akt { width: 100px; text-align: center; }
|
|
|
+
|
|
|
.lvl-unknown { background: #d35400 !important; color: white; }
|
|
|
.btn { padding: 10px 15px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; text-decoration: none; display: inline-block; }
|
|
|
.btn-add { background: #27ae60; width: 100%; margin-top: 10px; }
|
|
|
@@ -112,7 +117,7 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
.btn-del { background: #c0392b; }
|
|
|
.btn-nav { background: #e67e22; }
|
|
|
|
|
|
- .img-preview { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; background: #333; }
|
|
|
+ .img-preview { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; background: #333; display: block; margin: 0 auto; }
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
@@ -133,9 +138,9 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<div class="admin-card">
|
|
|
<h3>🆕 Neues Spiel hinzufügen</h3>
|
|
|
<form method="POST">
|
|
|
- <div style="display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 2fr; gap: 10px;">
|
|
|
+ <div style="display: grid; grid-template-columns: 3fr 1fr 1.2fr 1.2fr 2fr; gap: 10px;">
|
|
|
<input type="text" name="new_titel" placeholder="Spieltitel" required>
|
|
|
- <input type="text" name="new_ean" placeholder="EAN Scannen" required>
|
|
|
+ <input type="text" name="new_ean" placeholder="EAN" required>
|
|
|
<select name="new_typ_id">
|
|
|
<option value="0">-- Typ: Unbekannt --</option>
|
|
|
<?php foreach($typen as $t): ?>
|
|
|
@@ -148,7 +153,7 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<option value="Fortgeschrittene">Fortgeschrittene</option>
|
|
|
<option value="Profi">Profi</option>
|
|
|
</select>
|
|
|
- <input type="text" name="new_bild_url" placeholder="Bild-URL (z.B. https://...)">
|
|
|
+ <input type="text" name="new_bild_url" placeholder="Bild-URL">
|
|
|
</div>
|
|
|
<button type="submit" name="add_new_game" class="btn btn-add">Spiel in Datenbank speichern</button>
|
|
|
</form>
|
|
|
@@ -159,13 +164,13 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<table>
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th style="width: 50px;">Bild</th>
|
|
|
- <th>Titel</th>
|
|
|
- <th>EAN</th>
|
|
|
- <th>Typ</th>
|
|
|
- <th>Level</th>
|
|
|
- <th>Bild-URL</th>
|
|
|
- <th>Aktion</th>
|
|
|
+ <th class="col-img">Bild</th>
|
|
|
+ <th class="col-titel">Titel</th>
|
|
|
+ <th class="col-ean">EAN</th>
|
|
|
+ <th class="col-typ">Typ</th>
|
|
|
+ <th class="col-lvl">Level</th>
|
|
|
+ <th class="col-url">Bild-URL</th>
|
|
|
+ <th class="col-akt">Aktion</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
@@ -175,10 +180,10 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<tr>
|
|
|
<form method="POST">
|
|
|
<input type="hidden" name="spiel_id" value="<?= $sp['id'] ?>">
|
|
|
- <td><img src="<?= htmlspecialchars($sp['bild_url']) ?>" class="img-preview" alt="Cover"></td>
|
|
|
- <td><input type="text" name="titel" value="<?= htmlspecialchars($sp['titel']) ?>"></td>
|
|
|
- <td><input type="text" name="ean" value="<?= htmlspecialchars($sp['ean']) ?>"></td>
|
|
|
- <td>
|
|
|
+ <td class="col-img"><img src="<?= htmlspecialchars($sp['bild_url']) ?>" class="img-preview" alt="Cover"></td>
|
|
|
+ <td class="col-titel"><input type="text" name="titel" value="<?= htmlspecialchars($sp['titel']) ?>"></td>
|
|
|
+ <td class="col-ean"><input type="text" name="ean" value="<?= htmlspecialchars($sp['ean']) ?>"></td>
|
|
|
+ <td class="col-typ">
|
|
|
<select name="typ_id">
|
|
|
<option value="0">-- Unbekannt --</option>
|
|
|
<?php foreach($typen as $t): ?>
|
|
|
@@ -186,7 +191,7 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<?php endforeach; ?>
|
|
|
</select>
|
|
|
</td>
|
|
|
- <td>
|
|
|
+ <td class="col-lvl">
|
|
|
<select name="level" class="<?= $is_unknown ? 'lvl-unknown' : '' ?>" onchange="this.className=this.value=='Unknown'?'lvl-unknown':''">
|
|
|
<option value="Unknown" <?= $is_unknown ? 'selected' : '' ?>>Unbekannt</option>
|
|
|
<option value="Einsteiger" <?= $sp['level']=='Einsteiger'?'selected':'' ?>>Einsteiger</option>
|
|
|
@@ -194,8 +199,8 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<option value="Profi" <?= $sp['level']=='Profi'?'selected':'' ?>>Profi</option>
|
|
|
</select>
|
|
|
</td>
|
|
|
- <td><input type="text" name="bild_url" value="<?= htmlspecialchars($sp['bild_url']) ?>"></td>
|
|
|
- <td style="white-space:nowrap;">
|
|
|
+ <td class="col-url"><input type="text" name="bild_url" value="<?= htmlspecialchars($sp['bild_url']) ?>"></td>
|
|
|
+ <td class="col-akt">
|
|
|
<button type="submit" name="update_game" class="btn btn-save" title="Speichern">💾</button>
|
|
|
<button type="submit" name="delete_game" class="btn btn-del" onclick="return confirm('Wirklich löschen?')" title="Löschen">🗑</button>
|
|
|
</td>
|