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); $applications = PhabricatorApplication::getAllInstalledApplications(); $icon_views = array(); foreach ($applications as $application) { $icon_views[] = $application->buildMainMenuItems($this->getRequest()->getUser(), $this->getController()); } $icon_views = array_mergev($icon_views); $icon_views = msort($icon_views, 'getSortOrder'); $menu->appendChild($icon_views); return $menu->render(); }
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(); }