/** * Display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. * * @since 1.0.0 */ public function display($tpl = null) { $jinput = JFactory::getApplication()->input; $campaignId = $jinput->get('campaign', 0, 'integer'); $campaigns = JModelLegacy::getInstance('Campaigns', 'CMDonationModel')->getCampaignsForFilter(); $campaignList = array(); $campaign = array(); if (!empty($campaigns)) { foreach ($campaigns as $camp) { $campaignList[$camp->id] = htmlspecialchars($camp->name); if ($camp->id == $campaignId) { $campaign = $camp; } } } $statistics = array(); if (!empty($campaign)) { $statistics = CMDonationHelper::generateStatistics($campaignId); } $params = JComponentHelper::getParams('com_cmdonation'); // Get payment methods. $paymentMethods = CMDonationHelper::getPaymentMethods(); $this->assignRef('paymentMethods', $paymentMethods); $this->assignRef('params', $params); $this->assignRef('campaignList', $campaignList); $this->assignRef('campaignId', $campaignId); $this->assignRef('campaign', $campaign); $this->assignRef('statistics', $statistics); $this->submenu = CMDonationHelper::addSubmenu('statistics'); $this->addToolbar($campaign, $statistics); parent::display($tpl); }
/** * Display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. * * @since 1.0.0 */ public function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->params = $this->state->get('params'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Get payment methods. $paymentMethods = CMDonationHelper::getPaymentMethods(); // Get campaigns. $campaigns = JModelList::getInstance('Campaigns', 'CMDonationModel')->getCampaignsForFilter(); // Build campaign options for filter and index for displaying campaign name. $campaignOptions = array(); $campaignIndex = array(); if (!empty($campaigns)) { foreach ($campaigns as $campaign) { $campaignOptions[] = JHtml::_('select.option', $campaign->id, htmlspecialchars($campaign->name)); $campaignIndex[$campaign->id] = $campaign->name; } } $this->assignRef('paymentMethods', $paymentMethods); $this->assignRef('campaigns', $campaigns); $this->assignRef('campaignOptions', $campaignOptions); $this->assignRef('campaignIndex', $campaignIndex); $this->submenu = CMDonationHelper::addSubmenu('donations'); $this->addToolbar(); parent::display($tpl); }
/** * Display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. * * @since 1.0.0 */ public function display($tpl = null) { // Get campaigns. $this->campaigns = CMDonationHelper::getCampaignStats(); // Get 10 latest donations. $this->latestDonations = JModelLegacy::getInstance('Donations', 'CMDonationModel')->getLatestDonations(0, 10); $this->submenu = CMDonationHelper::addSubmenu('dashboard'); $this->addToolbar(); parent::display($tpl); }
/** * Display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. * * @since 1.0.0 */ public function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->submenu = CMDonationHelper::addSubmenu('campaigns'); $this->addToolbar(); parent::display($tpl); }