Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / phortune / view / PhortuneChargeTableView.php
blob1e8dd2cc9a4d2b867ecea274b9e40dee41adc40d
1 <?php
3 final class PhortuneChargeTableView extends AphrontView {
5 private $charges;
6 private $showOrder;
8 public function setShowOrder($show_order) {
9 $this->showOrder = $show_order;
10 return $this;
13 public function getShowOrder() {
14 return $this->showOrder;
17 public function setCharges(array $charges) {
18 $this->charges = $charges;
19 return $this;
22 public function getCharges() {
23 return $this->charges;
26 public function render() {
27 $charges = $this->getCharges();
28 $viewer = $this->getViewer();
30 $phids = array();
31 foreach ($charges as $charge) {
32 $phids[] = $charge->getCartPHID();
33 $phids[] = $charge->getProviderPHID();
34 $phids[] = $charge->getPaymentMethodPHID();
35 $phids[] = $charge->getMerchantPHID();
38 $handles = $viewer->loadHandles($phids);
40 $rows = array();
41 foreach ($charges as $charge) {
42 $rows[] = array(
43 $charge->getID(),
44 $handles[$charge->getCartPHID()]->renderLink(),
45 $handles[$charge->getProviderPHID()]->renderLink(),
46 $charge->getPaymentMethodPHID()
47 ? $handles[$charge->getPaymentMethodPHID()]->renderLink()
48 : null,
49 $handles[$charge->getMerchantPHID()]->renderLink(),
50 $charge->getAmountAsCurrency()->formatForDisplay(),
51 $charge->getStatusForDisplay(),
52 phabricator_datetime($charge->getDateCreated(), $viewer),
56 $table = id(new AphrontTableView($rows))
57 ->setNoDataString(pht('No charges found.'))
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'),
69 ->setColumnClasses(
70 array(
71 '',
72 '',
73 '',
74 '',
75 '',
76 'wide right',
77 '',
78 '',
80 ->setColumnVisibility(
81 array(
82 true,
83 $this->getShowOrder(),
84 ));
86 return $table;