2011-02-21 03:41:23 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class PhabricatorProjectController extends PhabricatorController {
|
|
|
|
|
2015-01-12 19:04:01 +01:00
|
|
|
public function buildApplicationMenu() {
|
|
|
|
return $this->buildSideNavView(true)->getMenu();
|
|
|
|
}
|
|
|
|
|
2013-07-22 17:34:35 +02:00
|
|
|
public function buildSideNavView($for_app = false) {
|
2013-02-13 18:22:14 +01:00
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
2013-07-22 17:34:35 +02:00
|
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
2013-02-13 18:22:14 +01:00
|
|
|
|
2015-01-12 19:04:01 +01:00
|
|
|
$id = null;
|
2013-02-13 18:22:14 +01:00
|
|
|
if ($for_app) {
|
2015-01-12 19:04:01 +01:00
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
$id = $this->getRequest()->getURIData('id');
|
|
|
|
if ($id) {
|
|
|
|
$nav->addFilter("profile/{$id}/", pht('Profile'));
|
|
|
|
$nav->addFilter("board/{$id}/", pht('Workboard'));
|
|
|
|
$nav->addFilter("members/{$id}/", pht('Members'));
|
|
|
|
$nav->addFilter("feed/{$id}/", pht('Feed'));
|
|
|
|
$nav->addFilter("edit/{$id}/", pht('Edit'));
|
|
|
|
}
|
2013-07-22 17:34:35 +02:00
|
|
|
$nav->addFilter('create', pht('Create Project'));
|
2013-02-13 18:22:14 +01:00
|
|
|
}
|
|
|
|
|
2015-01-12 19:04:01 +01:00
|
|
|
if (!$id) {
|
|
|
|
id(new PhabricatorProjectSearchEngine())
|
|
|
|
->setViewer($user)
|
|
|
|
->addNavigationItems($nav->getMenu());
|
|
|
|
}
|
2013-07-22 17:34:35 +02:00
|
|
|
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
|
2013-02-13 18:22:14 +01:00
|
|
|
return $nav;
|
|
|
|
}
|
|
|
|
|
2015-01-12 19:04:01 +01:00
|
|
|
public function buildIconNavView(PhabricatorProject $project) {
|
|
|
|
$id = $project->getID();
|
|
|
|
$picture = $project->getProfileImageURI();
|
|
|
|
$name = $project->getName();
|
|
|
|
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
|
|
$nav->setIconNav(true);
|
|
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
$nav->addIcon("profile/{$id}/", $name, null, $picture);
|
|
|
|
$nav->addIcon("board/{$id}/", pht('Workboard'), 'fa-columns');
|
|
|
|
$nav->addIcon("feed/{$id}/", pht('Feed'), 'fa-newspaper-o');
|
|
|
|
$nav->addIcon("members/{$id}/", pht('Members'), 'fa-group');
|
|
|
|
$nav->addIcon("edit/{$id}/", pht('Edit'), 'fa-pencil');
|
|
|
|
|
|
|
|
return $nav;
|
|
|
|
}
|
|
|
|
|
2011-02-21 03:41:23 +01:00
|
|
|
}
|