prepare("INSERT INTO events (title, description, event_type, start_datetime, end_datetime, location, created_by, school_id) VALUES (:title, :description, :event_type, :start_datetime, :end_datetime, :location, :created_by, :school_id)"); $stmt->execute([ 'title' => $title, 'description' => $description, 'event_type' => $event_type, 'start_datetime' => $start_datetime, 'end_datetime' => $end_datetime, 'location' => $location, 'created_by' => $user_id, 'school_id' => $school_id ]); $message = "Event created successfully!"; } catch (Exception $e) { $message = "Error: " . $e->getMessage(); } } else { $message = "Please fill in all required fields."; } } } // Fetch Upcoming Events $stmt = $db->prepare("SELECT e.*, u.email as creator_email FROM events e JOIN users u ON e.created_by = u.id WHERE e.school_id = :school_id AND e.end_datetime >= NOW() ORDER BY e.start_datetime ASC"); $stmt->execute(['school_id' => $school_id]); $upcoming_events = $stmt->fetchAll(); // Fetch Past Events $stmt = $db->prepare("SELECT e.*, u.email as creator_email FROM events e JOIN users u ON e.created_by = u.id WHERE e.school_id = :school_id AND e.end_datetime < NOW() ORDER BY e.start_datetime DESC LIMIT 10"); $stmt->execute(['school_id' => $school_id]); $past_events = $stmt->fetchAll(); include 'includes/header.php'; ?>
Stay updated with meetings, conferences, and school holidays.
No upcoming events scheduled.
= nl2br(htmlspecialchars($event['description'])) ?>
Parents can request specific slots for parent-teacher conferences via the direct message system in the Hub.