asdasd
This commit is contained in:
@@ -114,7 +114,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
'lat' => $lat,
|
||||
'lng' => $lng,
|
||||
'start' => $_POST['starts_at'] ?? null,
|
||||
'allow' => isset($_POST['allow_kids']) ? 1 : 0,
|
||||
'allow' => isset($_POST['allow_kids']) ? 0 : 1, // checkbox = Treffen ohne Kinder
|
||||
'vis' => $_POST['visibility'] ?? 'public',
|
||||
'status' => 'published',
|
||||
]);
|
||||
@@ -334,9 +334,6 @@ $eventsPast = $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-8" style="flex-wrap: wrap;">
|
||||
<a class="btn ghost" href="/dashboard?edit_event=<?= (int)$e['id'] ?>#events">Bearbeiten</a>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
@@ -1,6 +1,38 @@
|
||||
<?php
|
||||
$app = app();
|
||||
$flash = $app->flash()->get();
|
||||
|
||||
$eventsForJs = [];
|
||||
try {
|
||||
$pdo = $app->pdo();
|
||||
if ($pdo) {
|
||||
$stmt = $pdo->prepare('SELECT id, title, teaser_public, description, city, region, zip, starts_at, allow_kids, visibility, location_label, lat, lng FROM events WHERE starts_at >= NOW() AND status != "cancelled" ORDER BY starts_at ASC LIMIT 50');
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];
|
||||
foreach ($rows as $r) {
|
||||
$eventsForJs[] = [
|
||||
'id' => (int)$r['id'],
|
||||
'title' => $r['title'],
|
||||
'teaser' => $r['teaser_public'],
|
||||
'description' => $r['description'],
|
||||
'city' => $r['city'],
|
||||
'zip' => $r['zip'],
|
||||
'region' => $r['region'],
|
||||
'topic' => 'general',
|
||||
'startsAt' => $r['starts_at'],
|
||||
'allowKids' => ((int)$r['allow_kids'] === 1),
|
||||
'ageGroup' => '',
|
||||
'visibility' => $r['visibility'],
|
||||
'contact' => '',
|
||||
'locationLabel' => $r['location_label'],
|
||||
'lat' => $r['lat'] !== null ? (float)$r['lat'] : null,
|
||||
'lng' => $r['lng'] !== null ? (float)$r['lng'] : null,
|
||||
];
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
$eventsForJs = [];
|
||||
}
|
||||
?>
|
||||
<main>
|
||||
<?php if ($flash): ?>
|
||||
@@ -63,7 +95,7 @@ $flash = $app->flash()->get();
|
||||
<div class="section__head">
|
||||
<div>
|
||||
<p class="eyebrow">Termine entdecken</p>
|
||||
<h2>Upcoming Events in deiner Nähe</h2>
|
||||
<h2>Die nächsten anstehenden Events</h2>
|
||||
<p class="muted">Gäste sehen nur Basisinfos. Als Mitglied siehst du vollständige Details, kannst zusagen und neue Treffen anlegen.</p>
|
||||
</div>
|
||||
<div class="chips">
|
||||
@@ -187,3 +219,6 @@ $flash = $app->flash()->get();
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<script>
|
||||
window.__events = <?= json_encode($eventsForJs, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user