mirror of
https://github.com/tips-of-mine/gestion-certificats2.git
synced 2025-07-01 20:28:42 +02:00
Add files via upload
This commit is contained in:
47
app/src/Controllers/DashboardController.php
Normal file
47
app/src/Controllers/DashboardController.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Core\Database;
|
||||
use App\Services\AuthService;
|
||||
use App\Services\LanguageService;
|
||||
use App\Utils\DarkMode;
|
||||
|
||||
/**
|
||||
* Contrôleur pour la page du tableau de bord.
|
||||
*/
|
||||
class DashboardController
|
||||
{
|
||||
private $authService;
|
||||
private $langService;
|
||||
|
||||
/**
|
||||
* Constructeur du DashboardController.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->authService = new AuthService(Database::getInstance());
|
||||
$this->langService = new LanguageService(APP_ROOT_DIR . '/src/Lang/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche le tableau de bord.
|
||||
* Redirige vers la page de connexion si l'utilisateur n'est pas connecté.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (!$this->authService->isLoggedIn()) {
|
||||
header('Location: /login');
|
||||
exit();
|
||||
}
|
||||
|
||||
// Récupère les traductions et les informations pour la vue
|
||||
global $translations;
|
||||
$currentLang = $this->langService->getLanguage();
|
||||
$username = $this->authService->getUsername();
|
||||
$darkModeClass = DarkMode::getBodyClass();
|
||||
$userRole = $this->authService->getUserRole(); // Pour afficher/masquer certains éléments
|
||||
|
||||
require_once APP_ROOT_DIR . '/src/Views/dashboard/index.php';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user