Changeset View
Changeset View
Standalone View
Standalone View
src/applications/nuance/controller/NuanceItemViewController.php
Show All 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$crumbs->addTextCrumb( | $crumbs->addTextCrumb( | ||||
pht('Items'), | pht('Items'), | ||||
$this->getApplicationURI('item/')); | $this->getApplicationURI('item/')); | ||||
$crumbs->addTextCrumb($title); | $crumbs->addTextCrumb($title); | ||||
$crumbs->setBorder(true); | $crumbs->setBorder(true); | ||||
$curtain = $this->buildCurtain($item); | $curtain = $this->buildCurtain($item); | ||||
$content = $this->buildContent($item); | $content = $this->buildContent($item); | ||||
$commands = $this->buildCommands($item); | |||||
$timeline = $this->buildTransactionTimeline( | $timeline = $this->buildTransactionTimeline( | ||||
$item, | $item, | ||||
new NuanceItemTransactionQuery()); | new NuanceItemTransactionQuery()); | ||||
$main = array( | $main = array( | ||||
$commands, | |||||
$content, | $content, | ||||
$timeline, | $timeline, | ||||
); | ); | ||||
$header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
->setHeader($name); | ->setHeader($name); | ||||
$view = id(new PHUITwoColumnView()) | $view = id(new PHUITwoColumnView()) | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | final class NuanceItemViewController extends NuanceController { | ||||
private function buildContent(NuanceItem $item) { | private function buildContent(NuanceItem $item) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$impl = $item->getImplementation(); | $impl = $item->getImplementation(); | ||||
$impl->setViewer($viewer); | $impl->setViewer($viewer); | ||||
return $impl->buildItemView($item); | return $impl->buildItemView($item); | ||||
} | } | ||||
private function buildCommands(NuanceItem $item) { | |||||
$viewer = $this->getViewer(); | |||||
$commands = id(new NuanceItemCommandQuery()) | |||||
->setViewer($viewer) | |||||
->withItemPHIDs(array($item->getPHID())) | |||||
->execute(); | |||||
$commands = msort($commands, 'getID'); | |||||
if (!$commands) { | |||||
return null; | |||||
} | |||||
$rows = array(); | |||||
foreach ($commands as $command) { | |||||
$rows[] = array( | |||||
$command->getCommand(), | |||||
); | |||||
} | |||||
$table = id(new AphrontTableView($rows)) | |||||
->setHeaders( | |||||
array( | |||||
pht('Command'), | |||||
)); | |||||
return id(new PHUIObjectBoxView()) | |||||
->setHeaderText(pht('Pending Commands')) | |||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | |||||
->setTable($table); | |||||
} | |||||
} | } |