feat: notification dropdown panel and /notifications page
This commit is contained in:
@@ -7,6 +7,7 @@ namespace ServerManager\Controllers;
|
||||
use ServerManager\Core\App;
|
||||
use ServerManager\Core\Session;
|
||||
use ServerManager\Models\Server;
|
||||
use ServerManager\Models\Notification;
|
||||
use ServerManager\Services\MonitoringService;
|
||||
use ServerManager\Services\AuditService;
|
||||
|
||||
@@ -80,4 +81,22 @@ class DashboardController
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function notifications(): void
|
||||
{
|
||||
$userId = (int) Session::get('user_id');
|
||||
$page = (int) ($_GET['page'] ?? 1);
|
||||
$perPage = 20;
|
||||
|
||||
$notificationModel = new Notification();
|
||||
$result = $notificationModel->getForUser($userId, $page, $perPage);
|
||||
$unreadCount = $notificationModel->getUnreadCount($userId);
|
||||
|
||||
$this->view->display('notifications.index', [
|
||||
'title' => 'Notifications - ServerManager',
|
||||
'notifications' => $result['data'],
|
||||
'pagination' => $result,
|
||||
'unreadCount' => $unreadCount,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user