Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / fund / controller / FundBackerListController.php
blobab75b123dd3404cf023bb8d247d516a2ec573d87
1 <?php
3 final class FundBackerListController
4 extends FundController {
6 private $initiative;
8 public function shouldAllowPublic() {
9 return true;
12 public function handleRequest(AphrontRequest $request) {
13 $viewer = $request->getViewer();
14 $id = $request->getURIData('id');
15 $querykey = $request->getURIData('queryKey');
17 if ($id) {
18 $this->initiative = id(new FundInitiativeQuery())
19 ->setViewer($viewer)
20 ->withIDs(array($id))
21 ->executeOne();
22 if (!$this->initiative) {
23 return new Aphront404Response();
27 $controller = id(new PhabricatorApplicationSearchController())
28 ->setQueryKey($querykey)
29 ->setSearchEngine($this->getEngine())
30 ->setNavigation($this->buildSideNavView());
32 return $this->delegateToController($controller);
35 public function buildSideNavView() {
36 $user = $this->getRequest()->getUser();
38 $nav = new AphrontSideNavFilterView();
39 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
41 $this->getEngine()->addNavigationItems($nav->getMenu());
43 $nav->selectFilter(null);
45 return $nav;
48 protected function buildApplicationCrumbs() {
49 $crumbs = parent::buildApplicationCrumbs();
50 $crumbs->addTextCrumb(
51 pht('Backers'),
52 $this->getApplicationURI('backers/'));
54 if ($this->initiative) {
55 $crumbs->addTextCrumb(
56 $this->initiative->getMonogram(),
57 '/'.$this->initiative->getMonogram());
60 return $crumbs;
63 private function getEngine() {
64 $viewer = $this->getViewer();
66 $engine = id(new FundBackerSearchEngine())
67 ->setViewer($viewer);
69 if ($this->initiative) {
70 $engine->setInitiative($this->initiative);
73 return $engine;