Added messages notification ball

Former-commit-id: c44a99cf63bc7451890389e4d234fd8aa7b62cbc
This commit is contained in:
fermin831 2019-01-31 15:16:56 +01:00
parent 3f81e60df2
commit 397f2964da
3 changed files with 36 additions and 1 deletions

View File

@ -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] .= '</a>';
}
$table->data[0]['notifications'] = notifications_print_ball();
html_print_table($table);

View File

@ -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
"<div class='notification-ball $class_status' id='notification-ball-header'>
$num_notifications
</div>";
}

View File

@ -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;