Path: blob/master/src/applications/diviner/controller/DivinerMainController.php
12256 views
<?php12final class DivinerMainController extends DivinerController {34public function shouldAllowPublic() {5return true;6}78public function handleRequest(AphrontRequest $request) {9$viewer = $request->getViewer();1011$books = id(new DivinerBookQuery())12->setViewer($viewer)13->execute();1415$crumbs = $this->buildApplicationCrumbs();16$crumbs->setBorder(true);17$crumbs->addTextCrumb(pht('Books'));1819$query_button = id(new PHUIButtonView())20->setTag('a')21->setHref($this->getApplicationURI('query/'))22->setText(pht('Advanced Search'))23->setIcon('fa-search');2425$header = id(new PHUIHeaderView())26->setHeader(pht('Documentation Books'))27->addActionLink($query_button);2829$document = new PHUIDocumentView();30$document->setHeader($header);31$document->addClass('diviner-view');3233if ($books) {34$books = msort($books, 'getTitle');35$list = array();36foreach ($books as $book) {37$item = id(new DivinerBookItemView())38->setTitle($book->getTitle())39->setHref('/book/'.$book->getName().'/')40->setSubtitle($book->getPreface());41$list[] = $item;42}43$list = id(new PHUIBoxView())44->addPadding(PHUI::PADDING_MEDIUM_TOP)45->appendChild($list);4647$document->appendChild($list);48} else {49$text = pht(50"(NOTE) **Looking for documentation?** ".51"If you're looking for help and information about %s, ".52"you can [[https://secure.phabricator.com/diviner/ | ".53"browse the public %s documentation]] on the live site.\n\n".54"Diviner is the documentation generator used to build this ".55"documentation.\n\n".56"You haven't generated any Diviner documentation books yet, so ".57"there's nothing to show here. If you'd like to generate your own ".58"local copy of the documentation and have it appear ".59"here, run this command:\n\n".60" %s\n\n",61PlatformSymbols::getPlatformServerName(),62PlatformSymbols::getPlatformServerName(),63'$ ./bin/diviner generate');6465$text = new PHUIRemarkupView($viewer, $text);66$document->appendChild($text);67}6869return $this->newPage()70->setTitle(pht('Documentation Books'))71->setCrumbs($crumbs)72->appendChild(array(73$document,74));75}76}777879