mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 19:32:40 +01:00
53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
|
<?php
|
||
|
|
||
|
final class AlmanacDeviceListController
|
||
|
extends AlmanacDeviceController {
|
||
|
|
||
|
public function shouldAllowPublic() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public function handleRequest(AphrontRequest $request) {
|
||
|
$controller = id(new PhabricatorApplicationSearchController())
|
||
|
->setQueryKey($request->getURIData('queryKey'))
|
||
|
->setSearchEngine(new AlmanacDeviceSearchEngine())
|
||
|
->setNavigation($this->buildSideNavView());
|
||
|
|
||
|
return $this->delegateToController($controller);
|
||
|
}
|
||
|
|
||
|
public function buildApplicationCrumbs() {
|
||
|
$crumbs = parent::buildApplicationCrumbs();
|
||
|
|
||
|
$can_create = $this->hasApplicationCapability(
|
||
|
AlmanacCreateDevicesCapability::CAPABILITY);
|
||
|
|
||
|
$crumbs->addAction(
|
||
|
id(new PHUIListItemView())
|
||
|
->setName(pht('Create Device'))
|
||
|
->setHref($this->getApplicationURI('device/edit/'))
|
||
|
->setIcon('fa-plus-square')
|
||
|
->setDisabled(!$can_create)
|
||
|
->setWorkflow(!$can_create));
|
||
|
|
||
|
return $crumbs;
|
||
|
}
|
||
|
|
||
|
public function buildSideNavView() {
|
||
|
$viewer = $this->getViewer();
|
||
|
|
||
|
$nav = new AphrontSideNavFilterView();
|
||
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||
|
|
||
|
id(new AlmanacDeviceSearchEngine())
|
||
|
->setViewer($viewer)
|
||
|
->addNavigationItems($nav->getMenu());
|
||
|
|
||
|
$nav->selectFilter(null);
|
||
|
|
||
|
return $nav;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|