?> "}, <?php } ?> ]}, ] } ]; if(window.user_loggedin){ var mi = { <?php $cnt = get_unread_messages_count($current_user["id"]); $mi_name = "Messages"; if ($cnt > 0) { $mi_name = "Messages ({$cnt})"; } ?> name: "<?php echo $mi_name; ?> ", options: [ {name: "All messages", url: "all_messages.php"}, {name: "Unread messages", url: "unread_messages.php"} ] }; menuItems.push(mi);
/** * Build the evobar menu */ function build_evobar_menu() { global $DB; global $topleft_Menu, $topright_Menu; global $admin_url; global $current_User; global $unread_messages_count; $left_entries = array(); $right_entries = array(); if ($current_User->check_perm('perm_messaging', 'reply')) { if (!empty($topleft_Menu->_menus['entries']['tools']['entries'])) { // TODO: this is hackish and would require a proper function call $topleft_Menu->_menus['entries']['tools']['disabled'] = false; $left_entries['messaging'] = array('text' => T_('Messages') . '…', 'href' => $admin_url . '?ctrl=threads'); } $right_entries['messaging'] = array('text' => T_('Messages'), 'href' => get_dispctrl_url('threads'), 'style' => 'padding: 3px 1ex;'); // Count unread messages for current user $unread_messages_count = get_unread_messages_count(); if ($unread_messages_count > 0) { $right_entries['messaging']['text'] = '<b>' . T_('Messages') . ' <span class="badge">' . $unread_messages_count . '</span></b>'; } } $topleft_Menu->add_menu_entries('tools', $left_entries); $topright_Menu->insert_menu_entries_after('userprefs', $right_entries); }
/** * Builds the 3rd half of the menu. This is the one with the configuration features * * At some point this might be displayed differently than the 1st half. */ function build_menu_3() { global $admin_url; /** * @var User */ global $current_User; /** * @var AdminUI_general */ global $AdminUI; if (!$current_User->check_perm('admin', 'restricted')) { return; } if ($current_User->check_perm('perm_messaging', 'reply')) { // Permission to view messaging: // Count unread messages for current user $unread_messages_count = get_unread_messages_count(); if ($unread_messages_count > 0) { $messages_counter = ' <span class="badge badge-important">' . $unread_messages_count . '</span>'; } else { $messages_counter = ''; } $AdminUI->add_menu_entries(NULL, array('messaging' => array('text' => T_('Messages') . $messages_counter, 'title' => T_('Messages'), 'href' => $admin_url . '?ctrl=threads', 'entries' => get_messaging_sub_entries(true))), 'users'); } }