2011-02-08 19:53:59 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class ManiphestController extends PhabricatorController {
|
|
|
|
|
2013-09-13 20:29:08 +02:00
|
|
|
public function buildApplicationMenu() {
|
|
|
|
return $this->buildSideNavView(true)->getMenu();
|
2011-02-08 19:53:59 +01:00
|
|
|
}
|
|
|
|
|
2013-09-13 20:29:08 +02:00
|
|
|
public function buildSideNavView($for_app = false) {
|
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
|
2012-03-01 23:19:11 +01:00
|
|
|
$nav = new AphrontSideNavFilterView();
|
2013-09-13 20:29:08 +02:00
|
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
2012-04-10 18:46:04 +02:00
|
|
|
|
2013-03-13 07:30:03 +01:00
|
|
|
if ($for_app) {
|
2013-09-13 20:29:08 +02:00
|
|
|
$nav->addFilter('create', pht('Create Task'));
|
2013-03-13 07:30:03 +01:00
|
|
|
}
|
|
|
|
|
2013-09-13 20:29:08 +02:00
|
|
|
id(new ManiphestTaskSearchEngine())
|
|
|
|
->setViewer($user)
|
|
|
|
->addNavigationItems($nav->getMenu());
|
|
|
|
|
|
|
|
$nav->addLabel(pht('Reports'));
|
2013-09-14 01:56:21 +02:00
|
|
|
$nav->addFilter('report', pht('Reports'));
|
2013-09-13 20:29:08 +02:00
|
|
|
|
|
|
|
$nav->selectFilter(null);
|
2012-03-01 23:19:11 +01:00
|
|
|
|
|
|
|
return $nav;
|
|
|
|
}
|
|
|
|
|
2013-09-13 20:29:08 +02:00
|
|
|
protected function buildApplicationCrumbs() {
|
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
|
|
|
|
$crumbs->addAction(
|
|
|
|
id(new PHUIListItemView())
|
|
|
|
->setName(pht('Create Task'))
|
|
|
|
->setHref($this->getApplicationURI('task/create/'))
|
|
|
|
->setIcon('create'));
|
2013-03-13 07:30:03 +01:00
|
|
|
|
2013-09-13 20:29:08 +02:00
|
|
|
return $crumbs;
|
2012-04-10 18:46:04 +02:00
|
|
|
}
|
|
|
|
|
2013-05-31 03:55:25 +02:00
|
|
|
protected function renderSingleTask(ManiphestTask $task) {
|
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$phids = $task->getProjectPHIDs();
|
|
|
|
if ($task->getOwnerPHID()) {
|
|
|
|
$phids[] = $task->getOwnerPHID();
|
|
|
|
}
|
|
|
|
|
2013-09-11 21:27:28 +02:00
|
|
|
$handles = id(new PhabricatorHandleQuery())
|
2013-05-31 03:55:25 +02:00
|
|
|
->setViewer($user)
|
2013-09-11 21:27:28 +02:00
|
|
|
->withPHIDs($phids)
|
|
|
|
->execute();
|
2013-05-31 03:55:25 +02:00
|
|
|
|
|
|
|
$view = id(new ManiphestTaskListView())
|
|
|
|
->setUser($user)
|
|
|
|
->setShowSubpriorityControls(true)
|
|
|
|
->setShowBatchControls(true)
|
|
|
|
->setHandles($handles)
|
|
|
|
->setTasks(array($task));
|
|
|
|
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
}
|