?php // Comic Con-Kalender - Filtert nach Type "comicon" // Nutzt die "events_conventions" Tabelle mit Type-Filter require_once '../config.php'; require_once '../includes/functions.php'; require_once '../includes/trusted.php'; require_once '../includes/visitor_tracking.php'; require_once '../includes/ui_layout.php'; require_once '../includes/calendar_location_ui.php'; require_once '../includes/convention-types.php'; // Type-Key für diesen Kalender $typeKey = 'fantasy'; $typeInfo = $allowedConventionTypes[$typeKey] ?? null; if (!$typeInfo) { die("Ungültiger Convention-Typ"); } // Synchronisiere Session-Daten mit Datenbank if (isLoggedIn()) { syncSessionWithDatabase(); } // Theme serverseitig anwenden $themeClass = applyThemeToHTML(); // Status-Filter $status = isset($_GET['status']) ? $_GET['status'] : 'all'; // Hole Events aus der "events_conventions" Tabelle - NUR mit Type "comicon" try { $pdo = getDBConnection(); $stmt = $pdo->query("SHOW TABLES LIKE 'events_conventions'"); $tableExists = $stmt->rowCount() > 0; if ($tableExists) { // Filtere nach Type - prüfe sowohl direkten Match als auch Keywords $typeKeywords = $typeInfo['keywords']; $typeConditions = []; $params = []; // Direkter Type-Match $typeConditions[] = "LOWER(e.convention_type) = ?"; $params[] = $typeKey; // Keyword-Matches foreach ($typeKeywords as $keyword) { $typeConditions[] = "LOWER(e.convention_type) LIKE ?"; $params[] = '%' . strtolower($keyword) . '%'; } $typeWhere = "(" . implode(" OR ", $typeConditions) . ")"; $sql = " SELECT e.*, u.username as creator_name FROM events_conventions e LEFT JOIN users u ON e.created_by = u.id WHERE $typeWhere ORDER BY e.date_from ASC "; $stmt = $pdo->prepare($sql); $stmt->execute($params); $events = $stmt->fetchAll(PDO::FETCH_ASSOC); } else { $events = []; } } catch (Exception $e) { error_log("Calendar conventions-fantasy.php Fehler: " . $e->getMessage()); $events = []; } if (!empty($events) && function_exists('enrichCalendarEventsWithCoordinates')) { $events = enrichCalendarEventsWithCoordinates($events); } $pdoStats = getDBConnection(); $calendarStats = ['total' => 0, 'approved' => 0, 'pending' => 0]; if ($pdoStats && function_exists('getCalendarTableStats')) { $q = $pdoStats->quote($typeKey); $calendarStats = getCalendarTableStats('events_conventions', " AND (convention_type = $q OR LOWER(convention_type) = " . $pdoStats->quote(strtolower($typeKey)) . ")"); } // Kalender-Titel und Meta-Informationen $calendarTitle = $typeInfo['name'] . '-Kalender'; $calendarDescription = $typeInfo['description'] . '. Finde Events nach Datum, Ort oder Veranstaltung.'; $calendarKeywords = implode(', ', $typeInfo['keywords']); $calendarImage = APP_URL . '/assets/bilder/og-calendar.jpg'; $detailPageUrl = '/events-convention/detail.php'; $createPageUrl = '/events-convention/create.php?type=' . $typeKey; ?>