2013-05-31 19:52:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class DivinerController extends PhabricatorController {
|
|
|
|
|
|
|
|
protected function buildSideNavView() {
|
2015-06-16 23:09:53 +02:00
|
|
|
$menu = $this->buildApplicationMenu();
|
2013-05-31 19:52:25 +02:00
|
|
|
return AphrontSideNavFilterView::newFromMenu($menu);
|
|
|
|
}
|
|
|
|
|
2015-01-15 21:41:26 +01:00
|
|
|
public function buildApplicationMenu() {
|
2013-06-05 17:41:43 +02:00
|
|
|
$menu = new PHUIListView();
|
2013-05-31 19:52:25 +02:00
|
|
|
|
|
|
|
id(new DivinerAtomSearchEngine())
|
2015-06-16 23:09:53 +02:00
|
|
|
->setViewer($this->getRequest()->getViewer())
|
2013-05-31 19:52:25 +02:00
|
|
|
->addNavigationItems($menu);
|
|
|
|
|
|
|
|
return $menu;
|
|
|
|
}
|
|
|
|
|
2013-06-04 20:15:34 +02:00
|
|
|
protected function renderAtomList(array $symbols) {
|
|
|
|
assert_instances_of($symbols, 'DivinerLiveSymbol');
|
|
|
|
|
2013-09-10 18:39:50 +02:00
|
|
|
$list = array();
|
2013-06-04 20:15:34 +02:00
|
|
|
foreach ($symbols as $symbol) {
|
2014-03-11 01:59:13 +01:00
|
|
|
switch ($symbol->getType()) {
|
|
|
|
case DivinerAtom::TYPE_FUNCTION:
|
|
|
|
$title = $symbol->getTitle().'()';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$title = $symbol->getTitle();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-09-10 18:39:50 +02:00
|
|
|
$item = id(new DivinerBookItemView())
|
2014-03-11 01:59:13 +01:00
|
|
|
->setTitle($title)
|
2013-06-04 20:15:34 +02:00
|
|
|
->setHref($symbol->getURI())
|
2013-09-10 18:39:50 +02:00
|
|
|
->setSubtitle($symbol->getSummary())
|
2015-06-16 23:09:53 +02:00
|
|
|
->setType(DivinerAtom::getAtomTypeNameString($symbol->getType()));
|
2013-06-04 20:15:34 +02:00
|
|
|
|
2013-09-10 18:39:50 +02:00
|
|
|
$list[] = $item;
|
2013-06-04 20:15:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $list;
|
|
|
|
}
|
|
|
|
|
2013-05-31 19:52:25 +02:00
|
|
|
}
|