public function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); // Get parameters of com_crowdfunding. /** @var $cParams Joomla\Registry\Registry */ $cParams = JComponentHelper::getParams("com_crowdfunding"); $this->cfParams = $cParams; $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->cfParams->get("project_currency")); $this->amount = new Crowdfunding\Amount($this->cfParams); $this->amount->setCurrency($currency); // Get transactions number. $projectsIds = array(); foreach ($this->items as $item) { $projectsIds[] = $item->id; } $projects = new Crowdfunding\Projects(JFactory::getDbo()); $this->transactions = $projects->getTransactionsNumber($projectsIds); // Add submenu CrowdfundingFinanceHelper::addSubmenu($this->getName()); // Prepare sorting data $this->prepareSorting(); // Prepare actions $this->addToolbar(); $this->addSidebar(); $this->setDocument(); parent::display($tpl); }
public function display($tpl = null) { $this->version = new CrowdfundingFinance\Version(); // Load ITPrism library version if (!class_exists("Prism\\Version")) { $this->itprismVersion = JText::_("COM_CROWDFUNDINGFINANCE_PRISM_LIBRARY_DOWNLOAD"); } else { $itprismVersion = new Prism\Version(); $this->itprismVersion = $itprismVersion->getShortVersion(); } /** @var $cfParams Joomla\Registry\Registry */ $cfParams = JComponentHelper::getParams("com_crowdfunding"); $this->cfParams = $cfParams; // Get latest transactions. $this->latest = new Crowdfunding\Statistics\Transactions\Latest(JFactory::getDbo()); $this->latest->load(5); $basic = new Crowdfunding\Statistics\Basic(JFactory::getDbo()); $this->totalProjects = $basic->getTotalProjects(); $this->totalTransactions = $basic->getTotalTransactions(); $this->totalAmount = $basic->getTotalAmount(); // Get currency. $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->cfParams->get("project_currency")); $this->amount = new Crowdfunding\Amount($this->cfParams); $this->amount->setCurrency($currency); // Add submenu CrowdfundingFinanceHelper::addSubmenu($this->getName()); $this->addToolbar(); $this->addSidebar(); $this->setDocument(); parent::display($tpl); }
/** * Add a menu on the sidebar of page */ protected function addSidebar() { // Add submenu CrowdfundingFinanceHelper::addSubmenu($this->getName()); // Prepare options $approvedOptions = array(JHtml::_('select.option', 1, JText::_('COM_CROWDFUNDINGFINANCE_APPROVED')), JHtml::_('select.option', 0, JText::_('COM_CROWDFUNDINGFINANCE_DISAPPROVED'))); $featuredOptions = array(JHtml::_('select.option', 1, JText::_('COM_CROWDFUNDINGFINANCE_FEATURED')), JHtml::_('select.option', 0, JText::_('COM_CROWDFUNDINGFINANCE_NOT_FEATURED'))); JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName()); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true)); JHtmlSidebar::addFilter(JText::_('COM_CROWDFUNDINGFINANCE_SELECT_APPROVED_STATUS'), 'filter_approved', JHtml::_('select.options', $approvedOptions, 'value', 'text', $this->state->get('filter.approved'), true)); JHtmlSidebar::addFilter(JText::_('COM_CROWDFUNDINGFINANCE_SELECT_FEATURED_STATUS'), 'filter_featured', JHtml::_('select.options', $featuredOptions, 'value', 'text', $this->state->get('filter.featured'), true)); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_crowdfunding'), 'value', 'text', $this->state->get('filter.category_id'))); $filters = Crowdfunding\Filters::getInstance(JFactory::getDbo()); $typesOptions = $filters->getProjectsTypes(); JHtmlSidebar::addFilter(JText::_('COM_CROWDFUNDINGFINANCE_SELECT_TYPE'), 'filter_type_id', JHtml::_('select.options', $typesOptions, 'value', 'text', $this->state->get('filter.type_id'))); $this->sidebar = JHtmlSidebar::render(); }
public function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); // Get parameters of com_crowdfunding. $this->cfParams = JComponentHelper::getParams("com_crowdfunding"); // Get currencies foreach ($this->items as $item) { $currencies[] = $item->txn_currency; $currencies = array_unique($currencies); } if (!empty($currencies)) { $this->currencies = new Crowdfunding\Currencies(JFactory::getDbo()); $this->currencies->load(array("codes" => $currencies)); $this->amount = new Crowdfunding\Amount($this->cfParams); } // Get project title. $search = $this->state->get("filter.search"); if (!empty($search) and 0 === strpos($search, "pid")) { $projectId = (int) substr($search, 4); $this->projectTitle = CrowdfundingHelper::getProjectTitle($projectId); } // Get enabled specific plugins. $extensions = new Prism\Extensions(JFactory::getDbo(), $this->specificPlugins); $this->enabledSpecificPlugins = $extensions->getEnabled(); // Add submenu CrowdfundingFinanceHelper::addSubmenu($this->getName()); // Prepare sorting data $this->prepareSorting(); // Prepare actions $this->addToolbar(); $this->addSidebar(); $this->setDocument(); // Include HTML helper JLoader::register('JHtmlString', JPATH_LIBRARIES . '/joomla/html/html/string.php'); parent::display($tpl); }
/** * Add a menu on the sidebar of page */ protected function addSidebar() { CrowdfundingFinanceHelper::addSubmenu($this->getName()); // Create object Filters and load some filters options. $filters = Crowdfunding\Filters::getInstance(JFactory::getDbo()); // Get payment services. $paymentServices = $filters->getPaymentServices(); JHtmlSidebar::addFilter(JText::_('COM_CROWDFUNDINGFINANCE_SELECT_PAYMENT_SERVICES'), 'filter_payment_service', JHtml::_('select.options', $paymentServices, 'value', 'text', $this->state->get('filter.payment_service'), true)); // Get payment statuses. $paymentStatuses = $filters->getPaymentStatuses(); JHtmlSidebar::addFilter(JText::_('COM_CROWDFUNDINGFINANCE_SELECT_PAYMENT_STATUS'), 'filter_payment_status', JHtml::_('select.options', $paymentStatuses, 'value', 'text', $this->state->get('filter.payment_status'), true)); // Get reward states. $rewardDistributionStatuses = $filters->getRewardDistributionStatuses(); JHtmlSidebar::addFilter(JText::_('COM_CROWDFUNDINGFINANCE_SELECT_REWARD_STATUS'), 'filter_reward_state', JHtml::_('select.options', $rewardDistributionStatuses, 'value', 'text', $this->state->get('filter.reward_state'), true)); $this->sidebar = JHtmlSidebar::render(); }