Path: blob/master/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelRenderController.php
12242 views
<?php12final class PhabricatorDashboardPanelRenderController3extends PhabricatorDashboardController {45public function shouldAllowPublic() {6return true;7}89public function handleRequest(AphrontRequest $request) {10$viewer = $request->getViewer();11$id = $request->getURIData('id');1213$panel = id(new PhabricatorDashboardPanelQuery())14->setViewer($viewer)15->withIDs(array($id))16->executeOne();17if (!$panel) {18return new Aphront404Response();19}2021if ($request->isAjax()) {22$parent_phids = $request->getStrList('parentPanelPHIDs', null);23if ($parent_phids === null) {24throw new Exception(25pht(26'Required parameter `parentPanelPHIDs` is not present in '.27'request.'));28}29} else {30$parent_phids = array();31}3233$engine = id(new PhabricatorDashboardPanelRenderingEngine())34->setViewer($viewer)35->setPanel($panel)36->setPanelPHID($panel->getPHID())37->setParentPanelPHIDs($parent_phids)38->setMovable($request->getBool('movable'))39->setHeaderMode($request->getStr('headerMode'))40->setPanelKey($request->getStr('panelKey'));4142$context_phid = $request->getStr('contextPHID');43if ($context_phid) {44$context = id(new PhabricatorObjectQuery())45->setViewer($viewer)46->withPHIDs(array($context_phid))47->executeOne();48if (!$context) {49return new Aphront404Response();50}51$engine->setContextObject($context);52}5354$rendered_panel = $engine->renderPanel();5556if ($request->isAjax()) {57return id(new AphrontAjaxResponse())58->setContent(59array(60'panelMarkup' => hsprintf('%s', $rendered_panel),61));62}6364$crumbs = $this->buildApplicationCrumbs()65->addTextCrumb(pht('Panels'), $this->getApplicationURI('panel/'))66->addTextCrumb($panel->getMonogram(), '/'.$panel->getMonogram())67->addTextCrumb(pht('Standalone View'))68->setBorder(true);6970$view = id(new PHUIBoxView())71->addClass('dashboard-view')72->appendChild($rendered_panel);7374return $this->newPage()75->setTitle(array(pht('Panel'), $panel->getName()))76->setCrumbs($crumbs)77->appendChild($view);7879}8081}828384