protected function onBrowse($tpl = null) { // Add toolbar buttons JToolBarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_admintools'); $model = $this->getModel(); $urlredirection = $model->getRedirectionState(); $this->urlredirection = $urlredirection; $this->loadHelper('select'); // Run the parent method parent::onDisplay(); }
protected function onDisplay($tpl = null) { $subIDs = array(); $user = JFactory::getUser(); if ($user->id) { $mysubs = F0FModel::getTmpInstance('Subscriptions', 'AkeebasubsModel')->user_id($user->id)->paystate('C')->getItemList(); if (!empty($mysubs)) { foreach ($mysubs as $sub) { $subIDs[] = $sub->akeebasubs_level_id; } } $subIDs = array_unique($subIDs); } $this->subIDs = $subIDs; parent::onDisplay($tpl); }
protected function onDisplay($tpl = null) { // Makes sure SiteGround's SuperCache doesn't cache the subscription page JResponse::setHeader('X-Cache-Control', 'False', true); parent::onDisplay($tpl); }
public function onDisplay($tpl = null) { $ret = parent::onDisplay($tpl); if ($ret) { // Get all levels and all active levels $rawActiveLevels = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->enabled(1)->getList(); $activeLevels = array(); $allLevels = array(); $ppList = array(); // Let's get all the enabled plugins JPluginHelper::importPlugin('akpayment'); $tempList = JFactory::getApplication()->triggerEvent('onAKPaymentGetIdentity'); // Remove a level for better handling foreach ($tempList as $tempPlugin) { $keys = array_keys($tempPlugin); $name = array_pop($keys); $ppList[$name] = array_pop($tempPlugin); } if (!empty($rawActiveLevels)) { foreach ($rawActiveLevels as $l) { $activeLevels[] = $l->akeebasubs_level_id; $allLevels[$l->akeebasubs_level_id] = $l; } } // Get subscription and subscription level IDs, sort subscriptions // based on status $subIDs = array(); $subscription_ids = array(); $sortTable = array('active' => array(), 'waiting' => array(), 'pending' => array(), 'expired' => array()); if (count($this->items)) { JLoader::import('joomla.utilities.date'); foreach ($this->items as $sub) { $id = $sub->akeebasubs_subscription_id; $subIDs[] = $id; $subscription_ids[] = $id; // Propagate the info the the sub can be cancelled if (isset($ppList[$sub->processor])) { $sub->allow_renew = $ppList[$sub->processor]->recurringCancellation; } else { $sub->allow_renew = true; } if (!$sub->enabled) { $jd = new JDate($sub->publish_up); } if ($sub->enabled) { $sortTable['active'][] = $id; } elseif ($sub->state == 'C' && $jd->toUnix() >= time()) { $sortTable['waiting'][] = $id; } elseif ($sub->state == 'P') { $sortTable['pending'][] = $id; } else { $sortTable['expired'][] = $id; } } } $subIDs = array_unique($subIDs); // Get invoices data $invoices = array(); if (!empty($subscription_ids)) { $rawInvoices = F0FModel::getTmpInstance('Invoices', 'AkeebasubsModel')->subids($subscription_ids)->getList(); if (!empty($rawInvoices)) { foreach ($rawInvoices as $rawInvoice) { $invoices[$rawInvoice->akeebasubs_subscription_id] = $rawInvoice; } } } // Get incoiving extensions $extensions = F0FModel::getTmpInstance('Invoices', 'AkeebasubsModel')->getExtensions(); // Assign variables $this->activeLevels = $activeLevels; $this->allLevels = $allLevels; $this->subIDs = $subIDs; $this->invoices = $invoices; $this->extensions = $extensions; $this->sortTable = $sortTable; } return $ret; }