[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/dashboard/controller/ -> PhabricatorDashboardPanelRenderController.php (source)

   1  <?php
   2  
   3  final class PhabricatorDashboardPanelRenderController
   4    extends PhabricatorDashboardController {
   5  
   6    private $id;
   7  
   8    public function shouldAllowPublic() {
   9      return true;
  10    }
  11  
  12    public function willProcessRequest(array $data) {
  13      $this->id = $data['id'];
  14    }
  15  
  16    public function processRequest() {
  17      $request = $this->getRequest();
  18      $viewer = $request->getUser();
  19  
  20      $panel = id(new PhabricatorDashboardPanelQuery())
  21        ->setViewer($viewer)
  22        ->withIDs(array($this->id))
  23        ->executeOne();
  24      if (!$panel) {
  25        return new Aphront404Response();
  26      }
  27  
  28      if ($request->isAjax()) {
  29        $parent_phids = $request->getStrList('parentPanelPHIDs', null);
  30        if ($parent_phids === null) {
  31          throw new Exception(
  32            pht(
  33              'Required parameter `parentPanelPHIDs` is not present in '.
  34              'request.'));
  35        }
  36      } else {
  37        $parent_phids = array();
  38      }
  39  
  40      $rendered_panel = id(new PhabricatorDashboardPanelRenderingEngine())
  41        ->setViewer($viewer)
  42        ->setPanel($panel)
  43        ->setParentPanelPHIDs($parent_phids)
  44        ->setHeaderMode($request->getStr('headerMode'))
  45        ->setDashboardID($request->getInt('dashboardID'))
  46        ->renderPanel();
  47  
  48      if ($request->isAjax()) {
  49        return id(new AphrontAjaxResponse())
  50          ->setContent(
  51            array(
  52              'panelMarkup' => hsprintf('%s', $rendered_panel),
  53            ));
  54      }
  55  
  56      $crumbs = $this->buildApplicationCrumbs()
  57        ->addTextCrumb(pht('Panels'), $this->getApplicationURI('panel/'))
  58        ->addTextCrumb($panel->getMonogram(), '/'.$panel->getMonogram())
  59        ->addTextCrumb(pht('Standalone View'));
  60  
  61      $view = id(new PHUIBoxView())
  62        ->addClass('dashboard-view')
  63        ->appendChild($rendered_panel);
  64  
  65      return $this->buildApplicationPage(
  66        array(
  67          $crumbs,
  68          $view,
  69        ),
  70        array(
  71          'title' => array(pht('Panel'), $panel->getName()),
  72        ));
  73    }
  74  
  75  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1