[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/fund/controller/ -> FundBackerListController.php (source)

   1  <?php
   2  
   3  final class FundBackerListController
   4    extends FundController {
   5  
   6    private $id;
   7    private $queryKey;
   8    private $initiative;
   9  
  10    public function shouldAllowPublic() {
  11      return true;
  12    }
  13  
  14    public function willProcessRequest(array $data) {
  15      $this->id = idx($data, 'id');
  16      $this->queryKey = idx($data, 'queryKey');
  17    }
  18  
  19    public function processRequest() {
  20      $request = $this->getRequest();
  21  
  22      if ($this->id) {
  23        $this->initiative = id(new FundInitiativeQuery())
  24          ->setViewer($request->getUser())
  25          ->withIDs(array($this->id))
  26          ->executeOne();
  27        if (!$this->initiative) {
  28          return new Aphront404Response();
  29        }
  30      }
  31  
  32      $controller = id(new PhabricatorApplicationSearchController())
  33        ->setQueryKey($this->queryKey)
  34        ->setSearchEngine($this->getEngine())
  35        ->setNavigation($this->buildSideNavView());
  36  
  37      return $this->delegateToController($controller);
  38    }
  39  
  40    public function buildSideNavView() {
  41      $user = $this->getRequest()->getUser();
  42  
  43      $nav = new AphrontSideNavFilterView();
  44      $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
  45  
  46      $this->getEngine()->addNavigationItems($nav->getMenu());
  47  
  48      $nav->selectFilter(null);
  49  
  50      return $nav;
  51    }
  52  
  53    protected function buildApplicationCrumbs() {
  54      $crumbs = parent::buildApplicationCrumbs();
  55      $crumbs->addTextCrumb(
  56        pht('Backers'),
  57        $this->getApplicationURI('backers/'));
  58  
  59      if ($this->initiative) {
  60        $crumbs->addTextCrumb(
  61          $this->initiative->getMonogram(),
  62          '/'.$this->initiative->getMonogram());
  63      }
  64  
  65      return $crumbs;
  66    }
  67  
  68    private function getEngine() {
  69      $request = $this->getRequest();
  70      $viewer = $request->getUser();
  71  
  72      $engine = id(new FundBackerSearchEngine())
  73        ->setViewer($viewer);
  74  
  75      if ($this->initiative) {
  76        $engine->setInitiative($this->initiative);
  77      }
  78  
  79      return $engine;
  80    }
  81  
  82  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1