Terminart auswählen
query("SELECT * FROM kalli_categories ORDER BY sort_order, name");
$kalliCategories = [];
while ($cat = $catQuery->fetch(PDO::FETCH_ASSOC)) {
$kalliCategories[] = $cat;
}
$typeQuery = $pdo->query("SELECT * FROM kalli_appointment_types ORDER BY sort_order, name");
$kalliTypesByCategory = [];
while ($type = $typeQuery->fetch(PDO::FETCH_ASSOC)) {
$kalliTypesByCategory[$type['category_id']][] = $type;
}
// Alle verwendeten Rollen sammeln für die "Terminart nicht aufgelistet"-Sektion
$kalliAllRoles = [];
$isAdminUser = (isset($groups["Admin"]) && $groups["Admin"] == 1);
foreach ($kalliCategories as $cat):
$role = $cat['permission_role'];
$kalliAllRoles[$role] = 1;
if (!$isAdminUser && !(isset($groups[$role]) && $groups[$role] == 1)) continue;
$types = $kalliTypesByCategory[$cat['id']] ?? [];
if (empty($types)) continue;
?>
0;
if ($hasAnyKalliRole): ?>