|
@@ -12,14 +12,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_player'])) {
|
|
|
|
|
|
|
|
// --- LOGIK: SCORE HINZUFÜGEN ---
|
|
// --- LOGIK: SCORE HINZUFÜGEN ---
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_score'])) {
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_score'])) {
|
|
|
|
|
+ $unbekannt = isset($_POST['ergebnis_unbekannt']);
|
|
|
|
|
+
|
|
|
|
|
+ // Wenn unbekannt, werden 0-Werte gespeichert
|
|
|
|
|
+ $zeit = $unbekannt ? 0 : (int)$_POST['zeit'];
|
|
|
|
|
+ $hilfe = $unbekannt ? 0 : (int)$_POST['hilfe'];
|
|
|
|
|
+ $sterne = $unbekannt ? 0 : (int)$_POST['sterne'];
|
|
|
|
|
+
|
|
|
$sql = "INSERT INTO scores (spieler_id, spiel_id, zeit, hilfe, sterne) VALUES (?, ?, ?, ?, ?)";
|
|
$sql = "INSERT INTO scores (spieler_id, spiel_id, zeit, hilfe, sterne) VALUES (?, ?, ?, ?, ?)";
|
|
|
$stmt = $pdo->prepare($sql);
|
|
$stmt = $pdo->prepare($sql);
|
|
|
$stmt->execute([
|
|
$stmt->execute([
|
|
|
$_POST['spieler_id'],
|
|
$_POST['spieler_id'],
|
|
|
$_POST['spiel_id'],
|
|
$_POST['spiel_id'],
|
|
|
- (int)$_POST['zeit'],
|
|
|
|
|
- (int)$_POST['hilfe'],
|
|
|
|
|
- (int)$_POST['sterne']
|
|
|
|
|
|
|
+ $zeit,
|
|
|
|
|
+ $hilfe,
|
|
|
|
|
+ $sterne
|
|
|
]);
|
|
]);
|
|
|
header("Location: index.php?success=score");
|
|
header("Location: index.php?success=score");
|
|
|
exit;
|
|
exit;
|
|
@@ -75,11 +82,10 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
|
|
|
|
|
|
|
|
.theme-toggle { background: var(--card); border: 1px solid var(--border); color: var(--text); width: 42px; height: 34px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.3s; }
|
|
.theme-toggle { background: var(--card); border: 1px solid var(--border); color: var(--text); width: 42px; height: 34px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.3s; }
|
|
|
|
|
|
|
|
- /* --- SWIPER LAYOUT MIT TRANSPARENTEN PFEILEN OHNE KREIS --- */
|
|
|
|
|
.swiper-outer-wrapper {
|
|
.swiper-outer-wrapper {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
- padding: 0 50px; /* Platz für die Pfeile neben dem Banner */
|
|
|
|
|
|
|
+ padding: 0 50px;
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
|
margin-bottom: 40px;
|
|
margin-bottom: 40px;
|
|
|
}
|
|
}
|
|
@@ -89,41 +95,35 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
|
|
|
.swiper-pagination-progressbar { background: var(--border) !important; height: 4px !important; top: 0 !important; }
|
|
.swiper-pagination-progressbar { background: var(--border) !important; height: 4px !important; top: 0 !important; }
|
|
|
.swiper-pagination-progressbar-fill { background: var(--accent) !important; }
|
|
.swiper-pagination-progressbar-fill { background: var(--accent) !important; }
|
|
|
|
|
|
|
|
- /* Die Pfeil-Buttons angepasst */
|
|
|
|
|
.swiper-button-next, .swiper-button-prev {
|
|
.swiper-button-next, .swiper-button-prev {
|
|
|
- color: var(--text); /* Nutzt Standard-Textfarbe oder Akzentfarbe */
|
|
|
|
|
- background: none; /* Kreis entfernen */
|
|
|
|
|
- width: auto; /* Breite automatisch */
|
|
|
|
|
- height: auto; /* Höhe automatisch */
|
|
|
|
|
- box-shadow: none; /* Schatten entfernen */
|
|
|
|
|
- border: none; /* Rahmen entfernen */
|
|
|
|
|
|
|
+ color: var(--text);
|
|
|
|
|
+ background: none;
|
|
|
|
|
+ width: auto;
|
|
|
|
|
+ height: auto;
|
|
|
|
|
+ box-shadow: none;
|
|
|
|
|
+ border: none;
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
top: 50%;
|
|
top: 50%;
|
|
|
transform: translateY(-50%);
|
|
transform: translateY(-50%);
|
|
|
z-index: 10;
|
|
z-index: 10;
|
|
|
- margin-top: 0;
|
|
|
|
|
- opacity: 0.5; /* Transparent setzen */
|
|
|
|
|
|
|
+ opacity: 0.5;
|
|
|
transition: all 0.3s ease;
|
|
transition: all 0.3s ease;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /* Hover-Effekt: Farbe ändern und Deckkraft erhöhen */
|
|
|
|
|
.swiper-button-next:hover, .swiper-button-prev:hover {
|
|
.swiper-button-next:hover, .swiper-button-prev:hover {
|
|
|
color: var(--accent);
|
|
color: var(--accent);
|
|
|
opacity: 1;
|
|
opacity: 1;
|
|
|
- background: none;
|
|
|
|
|
transform: translateY(-50%) scale(1.1);
|
|
transform: translateY(-50%) scale(1.1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.swiper-button-prev { left: 10px; }
|
|
.swiper-button-prev { left: 10px; }
|
|
|
.swiper-button-next { right: 10px; }
|
|
.swiper-button-next { right: 10px; }
|
|
|
|
|
|
|
|
- /* Pfeilspitzen-Größe (angepasst für Icon-Look) */
|
|
|
|
|
.swiper-button-next:after, .swiper-button-prev:after {
|
|
.swiper-button-next:after, .swiper-button-prev:after {
|
|
|
- font-size: 40px; /* Etwas größer, da der Kreis weg ist */
|
|
|
|
|
|
|
+ font-size: 40px;
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /* Auf kleinen Geräten Pfeile ausblenden für mehr Platz */
|
|
|
|
|
@media (max-width: 768px) {
|
|
@media (max-width: 768px) {
|
|
|
.swiper-outer-wrapper { padding: 0 10px; }
|
|
.swiper-outer-wrapper { padding: 0 10px; }
|
|
|
.swiper-button-next, .swiper-button-prev { display: none; }
|
|
.swiper-button-next, .swiper-button-prev { display: none; }
|
|
@@ -161,6 +161,9 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
|
|
|
|
|
|
|
|
#playerModal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--card); padding: 30px; border-radius: 12px; border: 1px solid var(--accent); z-index: 2000; color: var(--text); box-shadow: 0 0 50px rgba(0,0,0,0.5); }
|
|
#playerModal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--card); padding: 30px; border-radius: 12px; border: 1px solid var(--accent); z-index: 2000; color: var(--text); box-shadow: 0 0 50px rgba(0,0,0,0.5); }
|
|
|
.overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 1500; }
|
|
.overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 1500; }
|
|
|
|
|
+
|
|
|
|
|
+ .unknown-box { margin-bottom: 15px; display: flex; align-items: center; gap: 8px; font-size: 0.9em; }
|
|
|
|
|
+ .unknown-box input { width: auto; margin: 0; cursor: pointer; }
|
|
|
</style>
|
|
</style>
|
|
|
<script>
|
|
<script>
|
|
|
if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
|
|
if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
|
|
@@ -200,8 +203,8 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
|
|
|
if ($entry['spiel_id'] == $game['id']): $found = true; ?>
|
|
if ($entry['spiel_id'] == $game['id']): $found = true; ?>
|
|
|
<tr>
|
|
<tr>
|
|
|
<td><strong><?= htmlspecialchars($entry['spieler_name']) ?></strong></td>
|
|
<td><strong><?= htmlspecialchars($entry['spieler_name']) ?></strong></td>
|
|
|
- <td><?= $entry['zeit'] ?>'</td>
|
|
|
|
|
- <td style="color:#f1c40f"><?= $entry['sterne'] ?>★</td>
|
|
|
|
|
|
|
+ <td><?= $entry['zeit'] > 0 ? $entry['zeit']."'" : '?' ?></td>
|
|
|
|
|
+ <td style="color:#f1c40f"><?= $entry['sterne'] > 0 ? $entry['sterne']."★" : "gespielt" ?></td>
|
|
|
</tr>
|
|
</tr>
|
|
|
<?php endif; endforeach;
|
|
<?php endif; endforeach;
|
|
|
if (!$found) echo "<tr><td colspan='3' style='opacity:0.5'>Noch keine Scores.</td></tr>";
|
|
if (!$found) echo "<tr><td colspan='3' style='opacity:0.5'>Noch keine Scores.</td></tr>";
|
|
@@ -243,10 +246,16 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
|
|
|
<option value="<?= $p['id'] ?>"><?= htmlspecialchars($p['name']) ?></option>
|
|
<option value="<?= $p['id'] ?>"><?= htmlspecialchars($p['name']) ?></option>
|
|
|
<?php endforeach; ?>
|
|
<?php endforeach; ?>
|
|
|
</select>
|
|
</select>
|
|
|
- <div style="display: flex; gap: 10px;">
|
|
|
|
|
- <input type="number" name="zeit" placeholder="Min" required>
|
|
|
|
|
- <input type="number" name="sterne" min="1" max="10" placeholder="Sterne">
|
|
|
|
|
- <input type="number" name="hilfe" placeholder="Hilfe">
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <div class="unknown-box">
|
|
|
|
|
+ <input type="checkbox" name="ergebnis_unbekannt" id="ergebnis_unbekannt" onchange="toggleInputs()">
|
|
|
|
|
+ <label for="ergebnis_unbekannt">Ergebnisse unbekannt</label>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div id="input-fields" style="display: flex; gap: 10px;">
|
|
|
|
|
+ <input type="number" name="zeit" id="zeit" placeholder="Min" required>
|
|
|
|
|
+ <input type="number" name="sterne" id="sterne" min="1" max="10" placeholder="Sterne">
|
|
|
|
|
+ <input type="number" name="hilfe" id="hilfe" placeholder="Hilfe">
|
|
|
</div>
|
|
</div>
|
|
|
<button type="submit" name="add_score">Score speichern</button>
|
|
<button type="submit" name="add_score">Score speichern</button>
|
|
|
</form>
|
|
</form>
|
|
@@ -281,6 +290,18 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
|
|
|
}
|
|
}
|
|
|
if (localStorage.getItem('theme') === 'dark') themeIcon.innerText = '☀️';
|
|
if (localStorage.getItem('theme') === 'dark') themeIcon.innerText = '☀️';
|
|
|
|
|
|
|
|
|
|
+ function toggleInputs() {
|
|
|
|
|
+ const check = document.getElementById('ergebnis_unbekannt');
|
|
|
|
|
+ const fields = ['zeit', 'sterne', 'hilfe'];
|
|
|
|
|
+ fields.forEach(id => {
|
|
|
|
|
+ const el = document.getElementById(id);
|
|
|
|
|
+ el.disabled = check.checked;
|
|
|
|
|
+ if (check.checked) el.value = '';
|
|
|
|
|
+ if (id === 'zeit') el.required = !check.checked;
|
|
|
|
|
+ });
|
|
|
|
|
+ document.getElementById('input-fields').style.opacity = check.checked ? '0.5' : '1';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
new Swiper(".mySwiper", {
|
|
new Swiper(".mySwiper", {
|
|
|
slidesPerView: "auto",
|
|
slidesPerView: "auto",
|
|
|
spaceBetween: 20,
|
|
spaceBetween: 20,
|