Page MenuHomePhorge

SemiStructuredObjectTypeController.php
No OneTemporary

SemiStructuredObjectTypeController.php

<?php
abstract class SemiStructuredObjectTypeController
extends SemiStructuredBaseController {
private $objectType;
public function setObjectType(SemiStructuredObjectType $object_type) {
$this->objectType = $object_type;
return $this;
}
public function getObjectType() {
return $this->objectType;
}
// TODO ???
public function buildApplicationMenu() {
return $this->buildSideNavView()->getMenu();
}
protected function buildHeaderView() {
$viewer = $this->getViewer();
$object_type = $this->getObjectType();
if ($object_type->isArchived()) {
$status_icon = 'fa-ban';
$status_color = 'dark';
} else {
$status_icon = 'fa-check';
$status_color = 'bluegrey';
}
$status_name = idx(
SemiStructuredObjectType::getStatusNameMap(),
$object_type->getStatus());
return id(new PHUIHeaderView())
->setHeader($object_type->getName())
->setUser($viewer)
->setPolicyObject($object_type)
->setStatus($status_icon, $status_color, $status_name)
->setHeaderIcon('fa-trophy');
}
protected function buildApplicationCrumbs() {
$object_type = $this->getObjectType();
$uri = $object_type->getURI();
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb($object_type->getName(), $uri);
$crumbs->setBorder(true);
return $crumbs;
}
protected function buildSideNavView($filter = null) {
$viewer = $this->getViewer();
$object_type = $this->getObjectType();
$id = $object_type->getID();
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$object_type,
PhabricatorPolicyCapability::CAN_EDIT);
$nav = id(new AphrontSideNavFilterView())
->setBaseURI(new PhutilURI($this->getApplicationURI()));
$nav->addLabel(pht('Object Type'));
$nav->addFilter(
'view',
pht('View Object Type'),
$object_type->getURI(),
'fa-trophy');
$nav->addFilter(
'instances',
pht('View Instances'),
$this->getApplicationURI("/type/{$id}/items/"),
'fa-group');
$nav->selectFilter($filter);
return $nav;
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Jan 19, 19:59 (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128228
Default Alt Text
SemiStructuredObjectTypeController.php (2 KB)

Event Timeline