public function subscriptionOverview()
{
Piwik::checkUserHasSuperUserAccess();
// we want to make sure to fetch the latest results, eg in case user has purchased a subscription meanwhile
// this is also like a self-repair to clear the caches :)
$this->marketplaceApi->clearAllCacheEntries();
$this->consumer->clearCache();
$hasLicenseKey = $this->licenseKey->has();
$consumer = $this->consumer->getConsumer();
$subscriptions = array();
$loginUrl = '';
if (!empty($consumer['loginUrl'])) {
$loginUrl = $consumer['loginUrl'];
}
if (!empty($consumer['licenses'])) {
foreach ($consumer['licenses'] as $subscription) {
$subscription['start'] = $this->getPrettyLongDate($subscription['startDate']);
$subscription['end'] = $this->getPrettyLongDate($subscription['endDate']);
$subscription['nextPayment'] = $this->getPrettyLongDate($subscription['nextPaymentDate']);
$subscriptions[] = $subscription;
}
}
return $this->renderTemplate('@Marketplace/subscription-overview', array('hasLicenseKey' => $hasLicenseKey, 'subscriptions' => $subscriptions, 'loginUrl' => $loginUrl, 'numUsers' => $this->environment->getNumUsers()));
}