2013-05-31 19:52:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class DivinerController extends PhabricatorController {
|
|
|
|
|
|
|
|
protected function buildSideNavView() {
|
|
|
|
$menu = $this->buildMenu();
|
|
|
|
return AphrontSideNavFilterView::newFromMenu($menu);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function buildApplicationMenu() {
|
|
|
|
return $this->buildMenu();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildMenu() {
|
2013-06-05 17:41:43 +02:00
|
|
|
$menu = new PHUIListView();
|
2013-05-31 19:52:25 +02:00
|
|
|
|
|
|
|
id(new DivinerAtomSearchEngine())
|
|
|
|
->setViewer($this->getRequest()->getUser())
|
|
|
|
->addNavigationItems($menu);
|
|
|
|
|
|
|
|
return $menu;
|
|
|
|
}
|
|
|
|
|
2013-06-04 20:15:34 +02:00
|
|
|
protected function renderAtomList(array $symbols) {
|
|
|
|
assert_instances_of($symbols, 'DivinerLiveSymbol');
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
2013-09-09 23:14:34 +02:00
|
|
|
$list = id(new PHUIObjectItemListView())
|
2013-09-10 16:26:00 +02:00
|
|
|
->setUser($user)
|
|
|
|
->setPlain(true)
|
|
|
|
->setFlush(true);
|
2013-06-04 20:15:34 +02:00
|
|
|
|
|
|
|
foreach ($symbols as $symbol) {
|
2013-09-09 23:14:34 +02:00
|
|
|
$item = id(new PHUIObjectItemView())
|
2013-06-04 20:15:34 +02:00
|
|
|
->setHeader($symbol->getTitle())
|
|
|
|
->setHref($symbol->getURI())
|
2013-08-28 18:55:05 +02:00
|
|
|
->addIcon('none',
|
|
|
|
DivinerAtom::getAtomTypeNameString(
|
|
|
|
$symbol->getType()));
|
2013-06-04 20:15:34 +02:00
|
|
|
|
2013-09-08 18:12:33 +02:00
|
|
|
$item->addAttribute($symbol->getSummary());
|
2013-06-04 20:15:34 +02:00
|
|
|
|
|
|
|
$list->addItem($item);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $list;
|
|
|
|
}
|
|
|
|
|
2013-05-31 19:52:25 +02:00
|
|
|
}
|