Minor - Adding new function in display.lib.phg in order to centralize the "badge" style

skala
Julio Montoya 13 years ago
parent 51fa7efe6b
commit f737e45dd5
  1. 2
      main/inc/lib/banner.lib.php
  2. 5
      main/inc/lib/display.lib.php
  3. 4
      main/inc/lib/social.lib.php
  4. 9
      main/inc/lib/userportal.lib.php

@ -79,7 +79,7 @@ function get_tabs() {
$group_pending_invitations = count($group_pending_invitations);
}
$total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval($count_unread_message);
$total_invitations = (!empty($total_invitations)?' <span class="badge badge-warning">'.$total_invitations.'</span>':'');
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) :'');
$navigation['social']['title'] = get_lang('SocialNetwork'). $total_invitations;
}

@ -1371,4 +1371,9 @@ class Display {
return $div;
}
function badge($count) {
$count = intval($count);
return ' <span class="badge badge-warning">'.$count.'</span>';
}
} //end class Display

@ -556,13 +556,13 @@ class SocialManager extends UserManager {
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
$count_unread_message = (!empty($count_unread_message)?' ('.$count_unread_message.')':'');
$count_unread_message = (!empty($count_unread_message)? Display::badge($count_unread_message) :'');
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION,false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = (!empty($total_invitations)?' ('.$total_invitations.')':'');
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) :'');
$html = '<div class="social-menu">';

@ -826,7 +826,7 @@ class IndexManager {
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$cant_msg = '';
if ($number_of_new_messages > 0) {
$cant_msg = ' <span class="badge badge-warning">'.$number_of_new_messages.'</span>';
$cant_msg = Display::badge($number_of_new_messages);
}
$link = '';
@ -840,9 +840,9 @@ class IndexManager {
if ($total_invitations == 0) {
$total_invitations = '';
} else {
$total_invitations = ' <span class="badge badge-warning">'.$total_invitations.'</span>';
$total_invitations = Display::badge($total_invitations);
}
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('PendingInvitations').' '.$total_invitations.' </a></li>';
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('PendingInvitations').Display::badge($total_invitations).'</a></li>';
}
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/auth/profile.php">'.get_lang('EditProfile').'</a></li>';
}
@ -862,8 +862,7 @@ class IndexManager {
// Main navigation section.
// Tabs that are deactivated are added here.
if (!empty($this->tpl->menu_navigation)) {
$main_navigation_content .= '<ul class="menulist">';
$main_navigation_content .= '<ul class="menulist">';
foreach ($this->tpl->menu_navigation as $section => $navigation_info) {
$current = $section == $GLOBALS['this_section'] ? ' id="current"' : '';

Loading…
Cancel
Save