[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/transactions/response/ -> PhabricatorApplicationTransactionResponse.php (source)

   1  <?php
   2  
   3  final class PhabricatorApplicationTransactionResponse
   4    extends AphrontProxyResponse {
   5  
   6    private $viewer;
   7    private $transactions;
   8    private $isPreview;
   9    private $transactionView;
  10  
  11    public function setTransactionView($transaction_view) {
  12      $this->transactionView = $transaction_view;
  13      return $this;
  14    }
  15  
  16    public function getTransactionView() {
  17      return $this->transactionView;
  18    }
  19  
  20    protected function buildProxy() {
  21      return new AphrontAjaxResponse();
  22    }
  23  
  24    public function setTransactions($transactions) {
  25      assert_instances_of($transactions, 'PhabricatorApplicationTransaction');
  26  
  27      $this->transactions = $transactions;
  28      return $this;
  29    }
  30  
  31    public function getTransactions() {
  32      return $this->transactions;
  33    }
  34  
  35    public function setViewer(PhabricatorUser $viewer) {
  36      $this->viewer = $viewer;
  37      return $this;
  38    }
  39  
  40    public function getViewer() {
  41      return $this->viewer;
  42    }
  43  
  44    public function setIsPreview($is_preview) {
  45      $this->isPreview = $is_preview;
  46      return $this;
  47    }
  48  
  49    public function reduceProxyResponse() {
  50      if ($this->transactionView) {
  51        $view = $this->transactionView;
  52      } else if ($this->getTransactions()) {
  53        $view = head($this->getTransactions())
  54          ->getApplicationTransactionViewObject();
  55      } else {
  56        $view = new PhabricatorApplicationTransactionView();
  57      }
  58  
  59      $view
  60        ->setUser($this->getViewer())
  61        ->setTransactions($this->getTransactions())
  62        ->setIsPreview($this->isPreview);
  63  
  64      if ($this->isPreview) {
  65        $xactions = mpull($view->buildEvents(), 'render');
  66      } else {
  67        $xactions = mpull($view->buildEvents(), 'render', 'getTransactionPHID');
  68      }
  69  
  70      $content = array(
  71        'xactions' => $xactions,
  72        'spacer'   => PHUITimelineView::renderSpacer(),
  73      );
  74  
  75      return $this->getProxy()->setContent($content);
  76    }
  77  
  78  
  79  }


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