mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-04 12:42:43 +01:00
54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
|
<?php
|
||
|
|
||
|
final class FundInitiativeListController
|
||
|
extends FundController {
|
||
|
|
||
|
private $queryKey;
|
||
|
|
||
|
public function willProcessRequest(array $data) {
|
||
|
$this->queryKey = idx($data, 'queryKey');
|
||
|
}
|
||
|
|
||
|
public function processRequest() {
|
||
|
$request = $this->getRequest();
|
||
|
$controller = id(new PhabricatorApplicationSearchController($request))
|
||
|
->setQueryKey($this->queryKey)
|
||
|
->setSearchEngine(new FundInitiativeSearchEngine())
|
||
|
->setNavigation($this->buildSideNavView());
|
||
|
|
||
|
return $this->delegateToController($controller);
|
||
|
}
|
||
|
|
||
|
public function buildSideNavView() {
|
||
|
$user = $this->getRequest()->getUser();
|
||
|
|
||
|
$nav = new AphrontSideNavFilterView();
|
||
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||
|
|
||
|
id(new FundInitiativeSearchEngine())
|
||
|
->setViewer($user)
|
||
|
->addNavigationItems($nav->getMenu());
|
||
|
$nav->selectFilter(null);
|
||
|
|
||
|
return $nav;
|
||
|
}
|
||
|
|
||
|
public function buildApplicationCrumbs() {
|
||
|
$crumbs = parent::buildApplicationCrumbs();
|
||
|
|
||
|
$can_create = $this->hasApplicationCapability(
|
||
|
FundCreateInitiativesCapability::CAPABILITY);
|
||
|
|
||
|
$crumbs->addAction(
|
||
|
id(new PHUIListItemView())
|
||
|
->setName(pht('Create Initiative'))
|
||
|
->setHref($this->getApplicationURI('create/'))
|
||
|
->setIcon('fa-plus-square')
|
||
|
->setDisabled(!$can_create)
|
||
|
->setWorkflow(!$can_create));
|
||
|
|
||
|
return $crumbs;
|
||
|
}
|
||
|
|
||
|
}
|