diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index c26bed8762..1edcf76b77 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -16,6 +16,7 @@ require_once ("include/functions_messages.php"); require_once ('include/functions_servers.php'); +require_once ('include/functions_notifications.php'); // Check permissions @@ -65,6 +66,7 @@ config_check(); $table->style[8] = $table->style[9] = $table->style['qr'] = + $table->style['notifications'] = 'width: 22px; text-align:center; height: 22px; padding-right: 9px;padding-left: 9px;'; $table->style[7] = 'width: 20px; padding-right: 9px;'; $table->style['searchbar'] = 'width: 180px; min-width: 180px;'; @@ -360,7 +362,7 @@ config_check(); $table->data[0][9] .= ''; } - + $table->data[0]['notifications'] = notifications_print_ball(); html_print_table($table); diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index 3005e9a47c..5c9bb71885 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -147,3 +147,19 @@ function check_notification_readable(int $id_message) return (bool) db_get_value_sql($sql); } + +/** + * Print the notification ball to see unread messages + * + * @return string with HTML code of notification ball + */ +function notifications_print_ball() { + $num_notifications = messages_get_count(); + $class_status = $num_notifications == 0 + ? 'notification-ball-no-messages' + : 'notification-ball-new-messages'; + return + "
+ $num_notifications +
"; +} diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index f42c64f70a..15d81dbbb5 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4912,6 +4912,23 @@ div#dialog_messages table th:last-child { text-align: right; } +.notification-ball { + border: white solid 2px; + border-radius: 50px; + width: 18px; + height: 18px; + display: flex; + justify-content: center; + align-items: center; +} + +.notification-ball-no-messages { + background-color: #82b92e; +} +.notification-ball-new-messages { + background-color: #fc4444; +} + /* --- JQUERY-UI --- */ .ui-button-text-only .ui-button-text { font-family: "nunito", sans-serif;