1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/phortune/view/PhortuneSubscriptionTableView.php
epriestley f6015dbb56 Improve the usability of Phortune
Summary:
Ref T6881.

  - Fix dead links.
  - Let implementations provide more information.
  - Provide more information to implementations.

Test Plan: Links work, invoices show billing periods, fewer "Subscription 6" crumbs, all is well in the world.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6881

Differential Revision: https://secure.phabricator.com/D11601
2015-02-01 12:32:48 -08:00

80 lines
1.7 KiB
PHP

<?php
final class PhortuneSubscriptionTableView extends AphrontView {
private $subscriptions;
private $handles;
private $isMerchantView;
public function setHandles(array $handles) {
$this->handles = $handles;
return $this;
}
public function getHandles() {
return $this->handles;
}
public function setSubscriptions(array $subscriptions) {
$this->subscriptions = $subscriptions;
return $this;
}
public function getSubscriptions() {
return $this->subscriptions;
}
public function setIsMerchantView($is_merchant_view) {
$this->isMerchantView = $is_merchant_view;
return $this;
}
public function getIsMerchantView() {
return $this->isMerchantView;
}
public function render() {
$subscriptions = $this->getSubscriptions();
$handles = $this->getHandles();
$viewer = $this->getUser();
$rows = array();
$rowc = array();
foreach ($subscriptions as $subscription) {
if ($this->getIsMerchantView()) {
$uri = $subscription->getMerchantURI();
} else {
$uri = $subscription->getURI();
}
$subscription_link = $handles[$subscription->getPHID()]->renderLink();
$rows[] = array(
$subscription->getID(),
phutil_tag(
'a',
array(
'href' => $uri,
),
$subscription->getSubscriptionFullName()),
phabricator_datetime($subscription->getDateCreated(), $viewer),
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(
array(
pht('ID'),
pht('Name'),
pht('Created'),
))
->setColumnClasses(
array(
'',
'wide',
'right',
));
return $table;
}
}