diff --git a/controllers/auth_ctrl2.php b/controllers/auth_ctrl2.php index 9e94da3..8d7d65b 100644 --- a/controllers/auth_ctrl2.php +++ b/controllers/auth_ctrl2.php @@ -1,5 +1,7 @@ Accueil'; -$nav .= '
  • Opérations
  • '; -$nav .= '
  • Gestion des comptes
  • '; +// --- NAVIGATION selon le rôle --- +$nav = ''; -// À DÉCOMMENTER quand l'auth sera fonctionnelle : -// if (is_logged()) { -// $nav .= '
  • Planning
  • '; -// $nav .= '
  • Sauveteurs
  • '; -// } -// if (has_role('gestionnaire') || has_role('administration')) { -// $nav .= '
  • Gestion
  • '; -// } -// if (has_role('administration')) { -// $nav .= '
  • Admin
  • '; -// } -// if (is_logged()) { -// $nav .= '
  • Déconnexion
  • '; -// } else { -// $nav .= '
  • Connexion
  • '; -// } +if (is_logged()) { + $nav .= '
  • Accueil
  • '; -// $session = 'Connecté : ' . htmlentities($_SESSION['login']) . ' (' . ($_SESSION['role'] ?: 'lecture') . ')'; -$session = 'Non connecté'; + if (has_any_role(['gestionnaire', 'administration'])) { + $nav .= '
  • Opérations
  • '; + } + if (has_role('administration')) { + $nav .= '
  • Gestion des comptes
  • '; + } + + $nav .= '
  • Déconnexion
  • '; +} + +// --- BARRE DE SESSION --- +if (is_logged()) { + $session = 'Connecté : ' . htmlentities($_SESSION['login']) . ' (' . htmlentities($_SESSION['role']) . ')'; +} else { + $session = 'Non connecté'; +} + +// --- NOTIFICATION --- $notif = ''; -// if (!empty($_SESSION['notification'])) { -// $notif = '
    ' . htmlentities($_SESSION['notification']) . '
    '; -// unset($_SESSION['notification']); -// } +if (!empty($_SESSION['notification'])) { + $notif = '
    ' . htmlentities($_SESSION['notification']) . '
    '; + unset($_SESSION['notification']); +} ?>