Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/view/PhortuneOrderTableView.php
<?php | <?php | ||||
final class PhortuneOrderTableView extends AphrontView { | final class PhortuneOrderTableView extends AphrontView { | ||||
private $carts; | private $carts; | ||||
private $handles; | |||||
private $noDataString; | private $noDataString; | ||||
private $isInvoices; | private $isInvoices; | ||||
private $isMerchantView; | private $isMerchantView; | ||||
public function setHandles(array $handles) { | |||||
$this->handles = $handles; | |||||
return $this; | |||||
} | |||||
public function getHandles() { | |||||
return $this->handles; | |||||
} | |||||
public function setCarts(array $carts) { | public function setCarts(array $carts) { | ||||
$this->carts = $carts; | $this->carts = $carts; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getCarts() { | public function getCarts() { | ||||
return $this->carts; | return $this->carts; | ||||
} | } | ||||
Show All 22 Lines | final class PhortuneOrderTableView extends AphrontView { | ||||
} | } | ||||
public function getIsMerchantView() { | public function getIsMerchantView() { | ||||
return $this->isMerchantView; | return $this->isMerchantView; | ||||
} | } | ||||
public function render() { | public function render() { | ||||
$carts = $this->getCarts(); | $carts = $this->getCarts(); | ||||
$handles = $this->getHandles(); | |||||
$viewer = $this->getUser(); | $viewer = $this->getUser(); | ||||
$is_invoices = $this->getIsInvoices(); | $is_invoices = $this->getIsInvoices(); | ||||
$is_merchant = $this->getIsMerchantView(); | $is_merchant = $this->getIsMerchantView(); | ||||
$phids = array(); | |||||
foreach ($carts as $cart) { | |||||
$phids[] = $cart->getPHID(); | |||||
foreach ($cart->getPurchases() as $purchase) { | |||||
$phids[] = $purchase->getPHID(); | |||||
} | |||||
$phids[] = $cart->getMerchantPHID(); | |||||
} | |||||
$handles = $viewer->loadHandles($phids); | |||||
$rows = array(); | $rows = array(); | ||||
$rowc = array(); | $rowc = array(); | ||||
foreach ($carts as $cart) { | foreach ($carts as $cart) { | ||||
$cart_link = $handles[$cart->getPHID()]->renderLink(); | $cart_link = $handles[$cart->getPHID()]->renderLink(); | ||||
$purchases = $cart->getPurchases(); | $purchases = $cart->getPurchases(); | ||||
if (count($purchases) == 1) { | if (count($purchases) == 1) { | ||||
$purchase = head($purchases); | $purchase = head($purchases); | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |