Tambah Agenda Baru
Agenda Minggu Ini
Tidak ada agenda untuk hari ini.
prepare("INSERT INTO agenda (tanggal, waktu, judul, deskripsi) VALUES (?, ?, ?, ?)"); $stmt->execute([$tanggal, $waktu, $judul, $deskripsi]); $toast_message = ['type' => 'success', 'message' => 'Agenda berhasil ditambahkan!']; } catch (PDOException $e) { error_log($e->getMessage()); $toast_message = ['type' => 'danger', 'message' => 'Gagal menambahkan agenda.']; } } else { $toast_message = ['type' => 'warning', 'message' => 'Semua kolom wajib diisi.']; } } // Fetch agenda for the current week $today = new DateTime(); $start_of_week = (clone $today)->modify('monday this week'); $end_of_week = (clone $today)->modify('friday this week'); $agendas = []; if ($pdo) { $stmt = $pdo->prepare("SELECT * FROM agenda WHERE tanggal BETWEEN ? AND ? ORDER BY tanggal, waktu"); $stmt->execute([$start_of_week->format('Y-m-d'), $end_of_week->format('Y-m-d')]); $results = $stmt->fetchAll(); foreach ($results as $row) { $day_name = date('l', strtotime($row['tanggal'])); $agendas[$day_name][] = $row; } } $days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']; ?>
Tidak ada agenda untuk hari ini.