2011-04-03 23:48:36 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class PhabricatorOwnersController extends PhabricatorController {
|
|
|
|
|
2012-01-10 20:21:49 +01:00
|
|
|
private $filter;
|
|
|
|
|
|
|
|
private function getSideNavFilter() {
|
|
|
|
return $this->filter;
|
|
|
|
}
|
|
|
|
protected function setSideNavFilter($filter) {
|
|
|
|
$this->filter = $filter;
|
|
|
|
return $this;
|
|
|
|
}
|
2013-04-23 18:41:46 +02:00
|
|
|
|
2013-05-22 00:31:24 +02:00
|
|
|
public function buildSideNavView() {
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
|
|
$base_uri = new PhutilURI('/owners/');
|
|
|
|
$nav->setBaseURI($base_uri);
|
2011-04-03 23:48:36 +02:00
|
|
|
|
2013-05-22 00:31:24 +02:00
|
|
|
$nav->addLabel(pht('Packages'));
|
|
|
|
$this->getExtraPackageViews($nav);
|
|
|
|
$nav->addFilter('view/owned', pht('Owned'));
|
|
|
|
$nav->addFilter('view/projects', pht('Projects'));
|
|
|
|
$nav->addFilter('view/all', pht('All'));
|
2011-04-03 23:48:36 +02:00
|
|
|
|
2013-05-22 00:31:24 +02:00
|
|
|
$nav->selectFilter($this->getSideNavFilter(), 'view/owned');
|
2011-04-03 23:48:36 +02:00
|
|
|
|
2013-01-16 00:38:05 +01:00
|
|
|
$filter = $nav->getSelectedFilter();
|
|
|
|
switch ($filter) {
|
|
|
|
case 'view/owned':
|
2013-05-22 00:31:24 +02:00
|
|
|
$title = pht('Owned Packages');
|
|
|
|
break;
|
2013-01-16 00:38:05 +01:00
|
|
|
case 'view/all':
|
2013-05-22 00:31:24 +02:00
|
|
|
$title = pht('All Packages');
|
|
|
|
break;
|
|
|
|
case 'view/projects':
|
|
|
|
$title = pht('Projects');
|
|
|
|
break;
|
|
|
|
case 'new':
|
|
|
|
$title = pht('New Package');
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$title = pht('Package');
|
2013-01-16 00:38:05 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-05-22 00:31:24 +02:00
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
|
|
$crumbs->addCrumb(
|
|
|
|
id(new PhabricatorCrumbView())
|
|
|
|
->setName($title));
|
2012-01-10 20:21:49 +01:00
|
|
|
|
2013-05-22 00:31:24 +02:00
|
|
|
$crumbs->addAction(
|
2013-06-05 17:41:43 +02:00
|
|
|
id(new PHUIListItemView())
|
2013-05-22 00:31:24 +02:00
|
|
|
->setName(pht('Create Package'))
|
|
|
|
->setHref('/owners/new/')
|
|
|
|
->setIcon('create'));
|
2012-02-13 19:03:26 +01:00
|
|
|
|
2013-05-22 00:31:24 +02:00
|
|
|
$nav->setCrumbs($crumbs);
|
2012-01-10 20:21:49 +01:00
|
|
|
|
|
|
|
return $nav;
|
|
|
|
}
|
|
|
|
|
2013-05-22 00:31:24 +02:00
|
|
|
public function buildApplicationMenu() {
|
|
|
|
return $this->buildSideNavView()->getMenu();
|
|
|
|
}
|
|
|
|
|
2012-12-07 22:32:14 +01:00
|
|
|
protected function getExtraPackageViews(AphrontSideNavFilterView $view) {
|
|
|
|
return;
|
2012-01-10 20:21:49 +01:00
|
|
|
}
|
|
|
|
|
2011-04-03 23:48:36 +02:00
|
|
|
}
|