feat: rôles admin/user, page Utilisateurs, lien Vision dans navbar, filtre courriers par compte
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
define('VISION_URL', 'http://192.168.111.212');
|
||||
|
||||
function html_head(string $title): void {
|
||||
$domain = cfg('domain', 'copymail');
|
||||
echo <<<HTML
|
||||
@@ -18,13 +20,23 @@ HTML;
|
||||
}
|
||||
|
||||
function html_navbar(string $active = ''): void {
|
||||
$user = current_user();
|
||||
$user = current_user();
|
||||
$isAdmin = is_admin();
|
||||
|
||||
$pages = [
|
||||
'mail' => ['/', 'bi-envelope-fill', 'Courriers'],
|
||||
'accounts' => ['/admin/accounts.php', 'bi-people-fill', 'Comptes'],
|
||||
'domain' => ['/admin/domain.php', 'bi-gear-fill', 'Configuration'],
|
||||
'status' => ['/admin/index.php', 'bi-activity', 'Tableau de bord'],
|
||||
'mail' => ['/', 'bi-envelope-fill', 'Courriers'],
|
||||
];
|
||||
if ($isAdmin) {
|
||||
$pages['accounts'] = ['/admin/accounts.php', 'bi-people-fill', 'Comptes'];
|
||||
$pages['domain'] = ['/admin/domain.php', 'bi-gear-fill', 'Configuration'];
|
||||
$pages['status'] = ['/admin/index.php', 'bi-activity', 'Tableau de bord'];
|
||||
$pages['users'] = ['/admin/users.php', 'bi-person-lock', 'Utilisateurs'];
|
||||
}
|
||||
|
||||
$roleBadge = $isAdmin
|
||||
? '<span class="badge bg-warning text-dark me-2">admin</span>'
|
||||
: '<span class="badge bg-secondary me-2">user</span>';
|
||||
|
||||
echo '<nav class="navbar navbar-expand-lg navbar-dark bg-primary mb-4">';
|
||||
echo '<div class="container-fluid">';
|
||||
echo '<a class="navbar-brand fw-bold" href="/"><i class="bi bi-envelope-arrow-down-fill me-2"></i>CopyMail</a>';
|
||||
@@ -35,9 +47,12 @@ function html_navbar(string $active = ''): void {
|
||||
echo "<li class=\"nav-item\"><a class=\"{$cls}\" href=\"{$href}\"><i class=\"bi {$icon} me-1\"></i>{$label}</a></li>";
|
||||
}
|
||||
echo '</ul>';
|
||||
echo "<span class=\"navbar-text me-3\"><i class=\"bi bi-person-circle me-1\"></i>{$user}</span>";
|
||||
echo '<div class="d-flex align-items-center gap-2">';
|
||||
// Lien Vision
|
||||
echo '<a class="btn btn-outline-light btn-sm" href="' . VISION_URL . '" target="_blank" title="Ouvrir Vision"><i class="bi bi-grid-fill me-1"></i>Vision</a>';
|
||||
echo "{$roleBadge}<span class=\"navbar-text me-2\"><i class=\"bi bi-person-circle me-1\"></i>{$user}</span>";
|
||||
echo '<a class="btn btn-outline-light btn-sm" href="/logout.php"><i class="bi bi-box-arrow-right me-1"></i>Déconnexion</a>';
|
||||
echo '</div></div></nav>';
|
||||
echo '</div></div></div></nav>';
|
||||
}
|
||||
|
||||
function html_foot(): void {
|
||||
|
||||
Reference in New Issue
Block a user