public function buildMainMenuItems(PhabricatorUser $user, PhabricatorController $controller = null)
 {
     $items = array();
     $application = null;
     if ($controller) {
         $application = $controller->getCurrentApplication();
     }
     if ($application && $application->getHelpURI()) {
         $class = 'main-menu-item-icon-help';
         $item = new PhabricatorMainMenuIconView();
         $item->setName(pht('%s Help', $application->getName()));
         $item->addClass('autosprite main-menu-item-icon ' . $class);
         $item->setHref($application->getHelpURI());
         $item->setSortOrder(0.1);
         $items[] = $item;
     }
     return $items;
 }
 public function buildMainMenuItems(PhabricatorUser $user, PhabricatorController $controller = null)
 {
     $items = array();
     if ($controller instanceof PhabricatorSettingsMainController) {
         $class = 'main-menu-item-icon-settings-selected';
     } else {
         $class = 'main-menu-item-icon-settings';
     }
     if ($user->isLoggedIn()) {
         $item = new PhabricatorMainMenuIconView();
         $item->setName(pht('Settings'));
         $item->addClass('autosprite main-menu-item-icon ' . $class);
         $item->setHref('/settings/');
         $item->setSortOrder(0.9);
         $items[] = $item;
     }
     return $items;
 }
 public function buildMainMenuItems(PhabricatorUser $user, PhabricatorController $controller = null)
 {
     $items = array();
     if ($controller instanceof PhabricatorLogoutController) {
         $class = 'main-menu-item-icon-logout-selected';
     } else {
         $class = 'main-menu-item-icon-logout';
     }
     if ($user->isLoggedIn()) {
         $item = new PhabricatorMainMenuIconView();
         $item->setName(pht('Log Out'));
         $item->addClass('autosprite main-menu-item-icon ' . $class);
         $item->setWorkflow(true);
         $item->setHref('/logout/');
         $item->setSortOrder(1.0);
         $items[] = $item;
     }
     return $items;
 }
 public function buildMainMenuItems(PhabricatorUser $user, PhabricatorController $controller = null)
 {
     $items = array();
     if ($controller instanceof PhabricatorPeopleProfileController && $controller->getProfileUser() && $controller->getProfileUser()->getPHID() == $user->getPHID()) {
         $class = 'main-menu-item-icon-profile-selected';
     } else {
         $class = 'main-menu-item-icon-profile-not-selected';
     }
     if ($user->isLoggedIn()) {
         $image = $user->loadProfileImageURI();
         $item = new PhabricatorMainMenuIconView();
         $item->setName($user->getUsername());
         $item->addClass('main-menu-item-icon-profile ' . $class);
         $item->addStyle('background-image: url(' . $image . ')');
         $item->setHref('/p/' . $user->getUsername() . '/');
         $item->setSortOrder(0.0);
         $items[] = $item;
     }
     return $items;
 }
 private function renderMainMenu()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $menu = new PhabricatorMainMenuView();
     $menu->setUser($user);
     $keyboard_config = array('helpURI' => '/help/keyboardshortcut/');
     if ($user->isLoggedIn()) {
         $search = new PhabricatorMainMenuSearchView();
         $search->setUser($user);
         $search->setScope($this->getSearchDefaultScope());
         $menu->appendChild($search);
         $pref_shortcut = PhabricatorUserPreferences::PREFERENCE_SEARCH_SHORTCUT;
         if ($user->loadPreferences()->getPreference($pref_shortcut, true)) {
             $keyboard_config['searchID'] = $search->getID();
         }
     }
     Javelin::initBehavior('phabricator-keyboard-shortcuts', $keyboard_config);
     if ($user->isLoggedIn()) {
         require_celerity_resource('phabricator-glyph-css');
         $item = new PhabricatorMainMenuIconView();
         $item->setName($user->getUsername());
         $item->addClass('glyph glyph-profile');
         $item->setHref('/p/' . $user->getUsername() . '/');
         $menu->appendChild($item);
         $item = new PhabricatorMainMenuIconView();
         $item->setName(pht('Settings'));
         $item->addClass('glyph glyph-settings');
         $item->setHref('/settings/');
         $menu->appendChild($item);
         $item = new PhabricatorMainMenuIconView();
         $item->setName(pht('Log Out'));
         $item->addClass('glyph glyph-logout');
         $item->setHref('/logout/');
         $menu->appendChild($item);
     }
     return $menu->render();
 }