[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhortuneChargeListController 4 extends PhortuneController { 5 6 private $accountID; 7 private $queryKey; 8 9 private $account; 10 11 public function willProcessRequest(array $data) { 12 $this->accountID = idx($data, 'accountID'); 13 $this->queryKey = idx($data, 'queryKey'); 14 } 15 16 public function processRequest() { 17 $request = $this->getRequest(); 18 $viewer = $request->getUser(); 19 20 $engine = new PhortuneChargeSearchEngine(); 21 22 if ($this->accountID) { 23 $account = id(new PhortuneAccountQuery()) 24 ->setViewer($viewer) 25 ->withIDs(array($this->accountID)) 26 ->requireCapabilities( 27 array( 28 PhabricatorPolicyCapability::CAN_VIEW, 29 PhabricatorPolicyCapability::CAN_EDIT, 30 )) 31 ->executeOne(); 32 if (!$account) { 33 return new Aphront404Response(); 34 } 35 $this->account = $account; 36 $engine->setAccount($account); 37 } else { 38 return new Aphront404Response(); 39 } 40 41 $controller = id(new PhabricatorApplicationSearchController()) 42 ->setQueryKey($this->queryKey) 43 ->setSearchEngine($engine) 44 ->setNavigation($this->buildSideNavView()); 45 46 return $this->delegateToController($controller); 47 } 48 49 public function buildSideNavView() { 50 $viewer = $this->getRequest()->getUser(); 51 52 $nav = new AphrontSideNavFilterView(); 53 $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 54 55 id(new PhortuneChargeSearchEngine()) 56 ->setViewer($viewer) 57 ->addNavigationItems($nav->getMenu()); 58 59 $nav->selectFilter(null); 60 61 return $nav; 62 } 63 64 public function buildApplicationCrumbs() { 65 $crumbs = parent::buildApplicationCrumbs(); 66 67 $account = $this->account; 68 if ($account) { 69 $id = $account->getID(); 70 $crumbs->addTextCrumb( 71 $account->getName(), 72 $this->getApplicationURI("{$id}/")); 73 $crumbs->addTextCrumb( 74 pht('Charges'), 75 $this->getApplicationURI("{$id}/charge/")); 76 } 77 78 return $crumbs; 79 } 80 81 }
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 |