Exemplo n.º 1
0
/**
 * Build menu
 *
 * @param Menu $menu
 * @param User $user
 * @return array
 */
function status_handle_on_build_menu(&$menu, &$user)
{
    if ($user->isAdministrator() || $user->getSystemPermission('can_use_status_updates')) {
        $last_visit = UserConfigOptions::getValue('status_update_last_visited', $user);
        $menu->addToGroup(array(new MenuItem('status', lang('Status'), assemble_url('status_updates'), get_image_url('icon_menu.gif', STATUS_MODULE), StatusUpdates::countNewMessagesForUser($user, $last_visit))), 'main');
    }
    // if
}
 /**
  * Provide ajax functionality for menu badge
  * 
  * @param void
  * @return void
  */
 function count_new_messages()
 {
     $last_visit = UserConfigOptions::getValue('status_update_last_visited', $this->logged_user);
     echo StatusUpdates::countNewMessagesForUser($this->logged_user, $last_visit);
     die;
 }