[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/phortune/view/ -> PhortuneChargeTableView.php (source)

   1  <?php
   2  
   3  final class PhortuneChargeTableView extends AphrontView {
   4  
   5    private $charges;
   6    private $handles;
   7    private $showOrder;
   8  
   9    public function setShowOrder($show_order) {
  10      $this->showOrder = $show_order;
  11      return $this;
  12    }
  13  
  14    public function getShowOrder() {
  15      return $this->showOrder;
  16    }
  17  
  18    public function setHandles(array $handles) {
  19      $this->handles = $handles;
  20      return $this;
  21    }
  22  
  23    public function getHandles() {
  24      return $this->handles;
  25    }
  26  
  27    public function setCharges(array $charges) {
  28      $this->charges = $charges;
  29      return $this;
  30    }
  31  
  32    public function getCharges() {
  33      return $this->charges;
  34    }
  35  
  36    public function render() {
  37      $charges = $this->getCharges();
  38      $handles = $this->getHandles();
  39      $viewer = $this->getUser();
  40  
  41      $rows = array();
  42      foreach ($charges as $charge) {
  43        $rows[] = array(
  44          $charge->getID(),
  45          $handles[$charge->getCartPHID()]->renderLink(),
  46          $handles[$charge->getProviderPHID()]->renderLink(),
  47          $charge->getPaymentMethodPHID()
  48            ? $handles[$charge->getPaymentMethodPHID()]->renderLink()
  49            : null,
  50          $handles[$charge->getMerchantPHID()]->renderLink(),
  51          $charge->getAmountAsCurrency()->formatForDisplay(),
  52          $charge->getStatusForDisplay(),
  53          phabricator_datetime($charge->getDateCreated(), $viewer),
  54        );
  55      }
  56  
  57      $table = id(new AphrontTableView($rows))
  58        ->setHeaders(
  59          array(
  60            pht('ID'),
  61            pht('Cart'),
  62            pht('Provider'),
  63            pht('Method'),
  64            pht('Merchant'),
  65            pht('Amount'),
  66            pht('Status'),
  67            pht('Created'),
  68          ))
  69        ->setColumnClasses(
  70          array(
  71            '',
  72            '',
  73            '',
  74            '',
  75            '',
  76            'wide right',
  77            '',
  78            '',
  79          ))
  80        ->setColumnVisibility(
  81          array(
  82            true,
  83            $this->getShowOrder(),
  84          ));
  85  
  86      return $table;
  87    }
  88  
  89  }


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