[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/diffusion/controller/ -> DiffusionBranchTableController.php (source)

   1  <?php
   2  
   3  final class DiffusionBranchTableController extends DiffusionController {
   4  
   5    public function shouldAllowPublic() {
   6      return true;
   7    }
   8  
   9    public function processRequest() {
  10      $drequest = $this->getDiffusionRequest();
  11      $request = $this->getRequest();
  12      $viewer = $request->getUser();
  13  
  14      $repository = $drequest->getRepository();
  15  
  16      $pager = new AphrontPagerView();
  17      $pager->setURI($request->getRequestURI(), 'offset');
  18      $pager->setOffset($request->getInt('offset'));
  19  
  20      // TODO: Add support for branches that contain commit
  21      $branches = $this->callConduitWithDiffusionRequest(
  22        'diffusion.branchquery',
  23        array(
  24          'offset' => $pager->getOffset(),
  25          'limit' => $pager->getPageSize() + 1,
  26        ));
  27      $branches = $pager->sliceResults($branches);
  28  
  29      $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
  30  
  31      $content = null;
  32      if (!$branches) {
  33        $content = $this->renderStatusMessage(
  34          pht('No Branches'),
  35          pht('This repository has no branches.'));
  36      } else {
  37        $commits = id(new DiffusionCommitQuery())
  38          ->setViewer($viewer)
  39          ->withIdentifiers(mpull($branches, 'getCommitIdentifier'))
  40          ->withRepository($repository)
  41          ->execute();
  42  
  43        $view = id(new DiffusionBranchTableView())
  44          ->setUser($viewer)
  45          ->setBranches($branches)
  46          ->setCommits($commits)
  47          ->setDiffusionRequest($drequest);
  48  
  49        $panel = id(new AphrontPanelView())
  50          ->setNoBackground(true)
  51          ->appendChild($view)
  52          ->appendChild($pager);
  53  
  54        $content = $panel;
  55      }
  56  
  57      $crumbs = $this->buildCrumbs(
  58        array(
  59          'branches' => true,
  60        ));
  61  
  62      return $this->buildApplicationPage(
  63        array(
  64          $crumbs,
  65          $content,
  66        ),
  67        array(
  68          'title' => array(
  69            pht('Branches'),
  70            'r'.$repository->getCallsign(),
  71          ),
  72          'device' => false,
  73        ));
  74    }
  75  
  76  }


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