public function display($tpl = null)
 {
     $this->option = JFactory::getApplication()->input->get('option');
     $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 rewards number
     $projectsIds = array();
     foreach ($this->items as $item) {
         $projectsIds[] = $item->id;
     }
     $projects = new Crowdfunding\Projects(JFactory::getDbo());
     $this->transactions = $projects->getTransactionsNumber($projectsIds);
     // Prepare sorting data
     $this->prepareSorting();
     // Prepare actions
     $this->addToolbar();
     $this->addSidebar();
     $this->setDocument();
     parent::display($tpl);
 }
 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");
     // Get currency
     $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->state->params->get("project_currency"));
     // Create object "Amount".
     $this->amount = new Crowdfunding\Amount($this->params);
     $this->amount->setCurrency($currency);
     // Get projects IDs
     $projectsIds = array();
     foreach ($this->items as $item) {
         $projectsIds[] = $item->id;
     }
     // Get number of rewards.
     $projects = new Crowdfunding\Projects(JFactory::getDbo());
     $this->rewards = $projects->getRewardsNumber($projectsIds);
     // Add submenu
     CrowdfundingHelper::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->option = JFactory::getApplication()->input->get('option');
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->params = $this->state->get('params');
     // Get currency
     $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->state->params->get('project_currency'));
     // Create object 'Amount'.
     $this->amount = new Crowdfunding\Amount($this->params);
     $this->amount->setCurrency($currency);
     // Get projects IDs
     $projectsIds = array();
     foreach ($this->items as $item) {
         $projectsIds[] = $item->id;
     }
     // Get number of rewards.
     $projects = new Crowdfunding\Projects(JFactory::getDbo());
     $this->rewards = $projects->getRewardsNumber($projectsIds);
     // Prepare sorting data
     $this->prepareSorting();
     if ($this->getLayout() !== 'modal') {
         // Prepare actions
         $this->addToolbar();
         $this->addSidebar();
     }
     $this->setDocument();
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     $this->option = JFactory::getApplication()->input->get('option');
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->params = $this->state->get('params');
     $this->money = $this->money = $this->getMoneyFormatter($this->params);
     // Get projects IDs
     $projectsIds = array();
     foreach ($this->items as $item) {
         $projectsIds[] = $item->id;
     }
     // Get number of rewards.
     $projects = new Crowdfunding\Projects(JFactory::getDbo());
     $this->rewards = $projects->getRewardsNumber($projectsIds);
     // Prepare sorting data
     $this->prepareSorting();
     if ($this->getLayout() !== 'modal') {
         // Prepare actions
         $this->addToolbar();
         $this->addSidebar();
     }
     $this->setDocument();
     parent::display($tpl);
 }
 /**
  * Method to save the submitted ordering values for records via AJAX.
  *
  * @throws Exception
  * @return  void
  */
 public function loadProject()
 {
     // Get the input
     $query = $this->input->get->get('query', "", 'string');
     $response = new Prism\Response\Json();
     try {
         $options = array("published" => Prism\Constants::PUBLISHED, "approved" => Prism\Constants::APPROVED);
         $projects = new Crowdfunding\Projects(JFactory::getDbo());
         $projects->loadByString($query, $options);
         $projectData = $projects->toOptions();
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_SYSTEM'));
     }
     $response->setData($projectData)->success();
     echo $response;
     JFactory::getApplication()->close();
 }
 public function display($tpl = null)
 {
     $this->option = JFactory::getApplication()->input->get('option');
     $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');
     $this->money = $this->getMoneyFormatter($this->cfParams);
     // Get transactions number.
     $projectsIds = Prism\Utilities\ArrayHelper::getIds($this->items);
     $projects = new Crowdfunding\Projects(JFactory::getDbo());
     $this->transactions = $projects->getTransactionsNumber($projectsIds);
     // Prepare sorting data
     $this->prepareSorting();
     // Prepare actions
     $this->addToolbar();
     $this->addSidebar();
     $this->setDocument();
     parent::display($tpl);
 }