1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-08 22:01:03 +01:00
phorge-phorge/src/applications/drydock/controller/DrydockResourceController.php
epriestley 64ed971039 Show recent active leases on Drydock resource detail
Summary: Ref T9252. This is the same as D14157, just for Resources and their leases.

Test Plan: Viewed a resource, saw only active leases, clicked "View All Leases", queried, clicked around, used crumbs.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9252

Differential Revision: https://secure.phabricator.com/D14158
2015-09-24 15:28:59 -07:00

60 lines
1.4 KiB
PHP

<?php
abstract class DrydockResourceController
extends DrydockController {
private $blueprint;
public function setBlueprint($blueprint) {
$this->blueprint = $blueprint;
return $this;
}
public function getBlueprint() {
return $this->blueprint;
}
public function buildSideNavView() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$engine = id(new DrydockResourceSearchEngine())
->setViewer($this->getViewer());
if ($this->getBlueprint()) {
$engine->setBlueprint($this->getBlueprint());
}
$engine->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
}
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$blueprint = $this->getBlueprint();
if ($blueprint) {
$id = $blueprint->getID();
$crumbs->addTextCrumb(
pht('Blueprints'),
$this->getApplicationURI('blueprint/'));
$crumbs->addTextCrumb(
$blueprint->getBlueprintName(),
$this->getApplicationURI("blueprint/{$id}/"));
$crumbs->addTextCrumb(
pht('Resources'),
$this->getApplicationURI("blueprint/{$id}/resources/"));
} else {
$crumbs->addTextCrumb(
pht('Resources'),
$this->getApplicationURI('resource/'));
}
return $crumbs;
}
}