prepare('DELETE FROM sessions WHERE novena_group_id = ?')->execute([$gid]); $pdo->prepare('DELETE FROM novena_groups WHERE id = ?')->execute([$gid]); } else { $pdo->prepare('DELETE FROM sessions WHERE novena_group_id = ? AND (SELECT user_id FROM novena_groups WHERE id = ?) = ?') ->execute([$gid, $gid, $uid]); $pdo->prepare('DELETE FROM novena_groups WHERE id = ? AND user_id = ?')->execute([$gid, $uid]); } header('Location: ' . BASE_URL . '/admin/'); exit; } if (isset($_POST['delete_id'])) { $id = (int)$_POST['delete_id']; if ($is_admin) { $pdo->prepare('DELETE FROM sessions WHERE id = ?')->execute([$id]); } else { $pdo->prepare('DELETE FROM sessions WHERE id = ? AND user_id = ?')->execute([$id, $uid]); } header('Location: ' . BASE_URL . '/admin/'); exit; } } // Load sessions if ($is_admin) { $regular = $pdo->query(" SELECT s.*, 'session' AS row_type, u.username, u.display_name FROM sessions s LEFT JOIN users u ON u.id = s.user_id WHERE s.novena_group_id IS NULL ORDER BY s.created_at DESC ")->fetchAll(); $novena_groups = $pdo->query(" SELECT ng.*, 'novena_group' AS row_type, COUNT(s.id) AS day_count, u.username, u.display_name FROM novena_groups ng LEFT JOIN sessions s ON s.novena_group_id = ng.id LEFT JOIN users u ON u.id = ng.user_id GROUP BY ng.id ORDER BY ng.created_at DESC ")->fetchAll(); } else { $regular = $pdo->prepare(" SELECT s.*, 'session' AS row_type, u.username, u.display_name FROM sessions s LEFT JOIN users u ON u.id = s.user_id WHERE s.novena_group_id IS NULL AND s.user_id = ? ORDER BY s.created_at DESC "); $regular->execute([$uid]); $regular = $regular->fetchAll(); $ng_stmt = $pdo->prepare(" SELECT ng.*, 'novena_group' AS row_type, COUNT(s.id) AS day_count, u.username, u.display_name FROM novena_groups ng LEFT JOIN sessions s ON s.novena_group_id = ng.id LEFT JOIN users u ON u.id = ng.user_id WHERE ng.user_id = ? GROUP BY ng.id ORDER BY ng.created_at DESC "); $ng_stmt->execute([$uid]); $novena_groups = $ng_stmt->fetchAll(); } $all_rows = array_merge($regular, $novena_groups); usort($all_rows, fn($a, $b) => strcmp($b['created_at'], $a['created_at'])); $occasion_labels = [ 'novena_deceased' => 'Novena for Deceased', 'divine_mercy_novena' => 'Divine Mercy Novena', 'general_rosary' => 'General Rosary', 'memorial' => 'Memorial', 'custom' => 'Custom Sequence', ]; $mystery_labels = [ 'sorrowful' => 'Sorrowful', 'joyful' => 'Joyful', 'glorious' => 'Glorious', 'luminous' => 'Luminous', 'by_day_of_week' => 'By Day', ]; $novena_created = isset($_GET['novena_created']) ? (int)$_GET['novena_created'] : 0; ?> Dashboard — <?= htmlspecialchars($site_name) ?>

0): ?>
novena day sessions created.

✒ Build Custom + New Session

No sessions yet.

Create Your First Session
Name Occasion Mysteries Owner Public Created Actions
9-Day Novena ✓ Yes' : 'No' ?> View Days →
✓ Yes' : 'No' ?> Present Edit