Differential D20362 Diff 48631 src/applications/dashboard/controller/PhabricatorDashboardProfileController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/dashboard/controller/PhabricatorDashboardProfileController.php
<?php | <?php | ||||
abstract class PhabricatorDashboardProfileController | abstract class PhabricatorDashboardProfileController | ||||
extends PhabricatorController { | extends PhabricatorController { | ||||
private $dashboard; | private $dashboard; | ||||
public function setDashboard(PhabricatorDashboard $dashboard) { | public function setDashboard(PhabricatorDashboard $dashboard) { | ||||
$this->dashboard = $dashboard; | $this->dashboard = $dashboard; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getDashboard() { | public function getDashboard() { | ||||
return $this->dashboard; | return $this->dashboard; | ||||
} | } | ||||
public function buildApplicationMenu() { | |||||
return $this->buildSideNavView()->getMenu(); | |||||
} | |||||
protected function buildHeaderView() { | protected function buildHeaderView() { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$dashboard = $this->getDashboard(); | $dashboard = $this->getDashboard(); | ||||
$id = $dashboard->getID(); | $id = $dashboard->getID(); | ||||
if ($dashboard->isArchived()) { | if ($dashboard->isArchived()) { | ||||
$status_icon = 'fa-ban'; | $status_icon = 'fa-ban'; | ||||
$status_color = 'dark'; | $status_color = 'dark'; | ||||
Show All 15 Lines | abstract class PhabricatorDashboardProfileController | ||||
} | } | ||||
protected function buildApplicationCrumbs() { | protected function buildApplicationCrumbs() { | ||||
$crumbs = parent::buildApplicationCrumbs(); | $crumbs = parent::buildApplicationCrumbs(); | ||||
$crumbs->setBorder(true); | $crumbs->setBorder(true); | ||||
$dashboard = $this->getDashboard(); | $dashboard = $this->getDashboard(); | ||||
if ($dashboard) { | if ($dashboard) { | ||||
$id = $dashboard->getID(); | $crumbs->addTextCrumb($dashboard->getName(), $dashboard->getURI()); | ||||
$dashboard_uri = $this->getApplicationURI("/view/{$id}/"); | |||||
$crumbs->addTextCrumb($dashboard->getName(), $dashboard_uri); | |||||
} | } | ||||
return $crumbs; | return $crumbs; | ||||
} | } | ||||
protected function buildSideNavView($filter = null) { | |||||
$viewer = $this->getViewer(); | |||||
$dashboard = $this->getDashboard(); | |||||
$id = $dashboard->getID(); | |||||
$can_edit = PhabricatorPolicyFilter::hasCapability( | |||||
$viewer, | |||||
$dashboard, | |||||
PhabricatorPolicyCapability::CAN_EDIT); | |||||
$nav = id(new AphrontSideNavFilterView()) | |||||
->setBaseURI(new PhutilURI($this->getApplicationURI())); | |||||
$nav->addLabel(pht('Dashboard')); | |||||
$nav->addFilter( | |||||
'view', | |||||
pht('View Dashboard'), | |||||
$this->getApplicationURI("/view/{$id}/"), | |||||
'fa-dashboard'); | |||||
$nav->addFilter( | |||||
'arrange', | |||||
pht('Arrange Panels'), | |||||
$this->getApplicationURI("/arrange/{$id}/"), | |||||
'fa-columns'); | |||||
$nav->addFilter( | |||||
'manage', | |||||
pht('Manage Dashboard'), | |||||
$this->getApplicationURI("/manage/{$id}/"), | |||||
'fa-gears'); | |||||
$nav->selectFilter($filter); | |||||
return $nav; | |||||
} | |||||
} | } |