1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00
phorge-phorge/src/applications/diviner/controller/DivinerController.php

47 lines
1.1 KiB
PHP
Raw Normal View History

<?php
abstract class DivinerController extends PhabricatorController {
protected function buildSideNavView() {
$menu = $this->buildApplicationMenu();
return AphrontSideNavFilterView::newFromMenu($menu);
}
public function buildApplicationMenu() {
$menu = new PHUIListView();
id(new DivinerAtomSearchEngine())
->setViewer($this->getRequest()->getViewer())
->addNavigationItems($menu);
return $menu;
}
protected function renderAtomList(array $symbols) {
assert_instances_of($symbols, 'DivinerLiveSymbol');
$list = array();
foreach ($symbols as $symbol) {
switch ($symbol->getType()) {
case DivinerAtom::TYPE_FUNCTION:
$title = $symbol->getTitle().'()';
break;
default:
$title = $symbol->getTitle();
break;
}
$item = id(new DivinerBookItemView())
->setTitle($title)
->setHref($symbol->getURI())
->setSubtitle($symbol->getSummary())
->setType(DivinerAtom::getAtomTypeNameString($symbol->getType()));
$list[] = $item;
}
return $list;
}
}