[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorHomeApplication extends PhabricatorApplication { 4 5 const DASHBOARD_DEFAULT = 'dashboard:default'; 6 7 public function getBaseURI() { 8 return '/home/'; 9 } 10 11 public function getName() { 12 return pht('Home'); 13 } 14 15 public function getShortDescription() { 16 return pht('Command Center'); 17 } 18 19 public function getIconName() { 20 return 'home'; 21 } 22 23 public function getRoutes() { 24 return array( 25 '/' => 'PhabricatorHomeMainController', 26 '/(?P<only>home)/' => 'PhabricatorHomeMainController', 27 '/home/' => array( 28 'create/' => 'PhabricatorHomeQuickCreateController', 29 ), 30 ); 31 } 32 33 public function isLaunchable() { 34 return false; 35 } 36 37 public function canUninstall() { 38 return false; 39 } 40 41 public function getApplicationOrder() { 42 return 9; 43 } 44 45 public function buildMainMenuItems( 46 PhabricatorUser $user, 47 PhabricatorController $controller = null) { 48 49 $items = array(); 50 51 if ($user->isLoggedIn() && $user->isUserActivated()) { 52 $create_id = celerity_generate_unique_node_id(); 53 Javelin::initBehavior( 54 'aphlict-dropdown', 55 array( 56 'bubbleID' => $create_id, 57 'dropdownID' => 'phabricator-quick-create-menu', 58 'local' => true, 59 'desktop' => true, 60 'right' => true, 61 )); 62 63 $item = id(new PHUIListItemView()) 64 ->setName(pht('Create New...')) 65 ->setIcon('new-sm') 66 ->addClass('core-menu-item') 67 ->setHref('/home/create/') 68 ->addSigil('quick-create-menu') 69 ->setID($create_id) 70 ->setAural(pht('Quick Create')) 71 ->setOrder(300); 72 $items[] = $item; 73 } 74 75 return $items; 76 } 77 78 public function loadAllQuickCreateItems(PhabricatorUser $viewer) { 79 $applications = id(new PhabricatorApplicationQuery()) 80 ->setViewer($viewer) 81 ->withInstalled(true) 82 ->execute(); 83 84 $items = array(); 85 foreach ($applications as $application) { 86 $app_items = $application->getQuickCreateItems($viewer); 87 foreach ($app_items as $app_item) { 88 $items[] = $app_item; 89 } 90 } 91 92 return $items; 93 } 94 95 public function buildMainMenuExtraNodes( 96 PhabricatorUser $viewer, 97 PhabricatorController $controller = null) { 98 99 $items = $this->loadAllQuickCreateItems($viewer); 100 101 $view = new PHUIListView(); 102 $view->newLabel(pht('Create New...')); 103 foreach ($items as $item) { 104 $view->addMenuItem($item); 105 } 106 107 return phutil_tag( 108 'div', 109 array( 110 'id' => 'phabricator-quick-create-menu', 111 'class' => 'phabricator-main-menu-dropdown phui-list-sidenav', 112 'style' => 'display: none', 113 ), 114 $view); 115 } 116 117 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |