2013-12-26 21:30:36 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class DrydockLeaseController
|
|
|
|
extends DrydockController {
|
|
|
|
|
2015-09-25 00:28:59 +02:00
|
|
|
private $resource;
|
|
|
|
|
|
|
|
public function setResource($resource) {
|
|
|
|
$this->resource = $resource;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getResource() {
|
|
|
|
return $this->resource;
|
|
|
|
}
|
|
|
|
|
2013-12-26 21:30:36 +01:00
|
|
|
public function buildSideNavView() {
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
|
2015-09-25 00:28:59 +02:00
|
|
|
$engine = id(new DrydockLeaseSearchEngine())
|
|
|
|
->setViewer($this->getRequest()->getUser());
|
|
|
|
|
|
|
|
if ($this->getResource()) {
|
|
|
|
$engine->setResource($this->getResource());
|
|
|
|
}
|
|
|
|
|
|
|
|
$engine->addNavigationItems($nav->getMenu());
|
2013-12-26 21:30:36 +01:00
|
|
|
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
|
|
|
|
return $nav;
|
|
|
|
}
|
|
|
|
|
2015-01-06 21:34:58 +01:00
|
|
|
protected function buildApplicationCrumbs() {
|
2013-12-26 21:30:36 +01:00
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
2015-09-25 00:28:59 +02:00
|
|
|
|
|
|
|
$resource = $this->getResource();
|
|
|
|
if ($resource) {
|
|
|
|
$id = $resource->getID();
|
|
|
|
|
|
|
|
$crumbs->addTextCrumb(
|
|
|
|
pht('Resources'),
|
|
|
|
$this->getApplicationURI('resource/'));
|
|
|
|
|
|
|
|
$crumbs->addTextCrumb(
|
|
|
|
$resource->getName(),
|
|
|
|
$this->getApplicationURI("resource/{$id}/"));
|
|
|
|
|
|
|
|
$crumbs->addTextCrumb(
|
|
|
|
pht('Leases'),
|
|
|
|
$this->getApplicationURI("resource/{$id}/leases/"));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$crumbs->addTextCrumb(
|
|
|
|
pht('Leases'),
|
|
|
|
$this->getApplicationURI('lease/'));
|
|
|
|
}
|
2013-12-26 21:30:36 +01:00
|
|
|
return $crumbs;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|