Exemple #1
0
 protected function prepareManager()
 {
     $model = JModelLegacy::getInstance("Manager", "CrowdfundingModel", $config = array('ignore_request' => false));
     /** @var $model CrowdfundingModelManager */
     // Get state
     $this->state = $model->getState();
     /** @var  $state Joomla\Registry\Registry */
     $this->imageWidth = $this->params->get("image_width", 200);
     $this->imageHeight = $this->params->get("image_height", 200);
     $this->titleLength = $this->params->get("discover_title_length", 0);
     $this->descriptionLength = $this->params->get("discover_description_length", 0);
     // Get the folder with images
     $this->imageFolder = $this->params->get("images_directory", "images/crowdfunding");
     // Filter the URL.
     $uri = JUri::getInstance();
     $filter = JFilterInput::getInstance();
     $this->returnUrl = $filter->clean($uri->toString());
     // Get item
     $itemId = $this->state->get('manager.id');
     // Get currency
     $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get("project_currency"));
     $this->amount = new Crowdfunding\Amount($this->params);
     $this->amount->setCurrency($currency);
     $this->item = $model->getItem($itemId, $this->userId);
     // Check if the item exists.
     if (!$this->isValid()) {
         return;
     }
     $statistics = new Crowdfunding\Statistics\Project(JFactory::getDbo(), $this->item->id);
     $this->statistics = array("updates" => $statistics->getUpdatesNumber(), "comments" => $statistics->getCommentsNumber(), "funders" => $statistics->getTransactionsNumber());
     // Get rewards
     $this->rewards = new Crowdfunding\Rewards(JFactory::getDbo());
     $this->rewards->load(array("project_id" => $this->item->id));
     $this->pathwayName = JText::_("COM_CROWDFUNDING_STEP_MANAGER");
 }
Exemple #2
0
 protected function prepareManager()
 {
     $model = JModelLegacy::getInstance('Manager', 'CrowdfundingModel', $config = array('ignore_request' => false));
     /** @var $model CrowdfundingModelManager */
     // Get state
     $this->state = $model->getState();
     /** @var  $state Joomla\Registry\Registry */
     $this->imageWidth = $this->params->get('image_width', 200);
     $this->imageHeight = $this->params->get('image_height', 200);
     $this->titleLength = $this->params->get('discover_title_length', 0);
     $this->descriptionLength = $this->params->get('discover_description_length', 0);
     // Get the folder with images
     $this->imageFolder = $this->params->get('images_directory', 'images/crowdfunding');
     // Filter the URL.
     $uri = JUri::getInstance();
     $filter = JFilterInput::getInstance();
     $this->returnUrl = $filter->clean($uri->toString());
     // Get item
     $itemId = $this->state->get('manager.id');
     // Get currency
     $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get('project_currency'));
     $this->amount = new Crowdfunding\Amount($this->params);
     $this->amount->setCurrency($currency);
     $this->item = $model->getItem($itemId, $this->userId);
     // Check if the item exists.
     if (!CrowdfundingHelper::isAuthorized($this->userId, $this->item, 'manager')) {
         $this->app->enqueueMessage(JText::_('COM_CROWDFUNDING_ERROR_SOMETHING_WRONG'), 'notice');
         $this->app->redirect(JRoute::_(CrowdfundingHelperRoute::getDiscoverRoute()));
         return;
     }
     $statistics = new Crowdfunding\Statistics\Project(JFactory::getDbo(), $this->item->id);
     $this->statistics = array('updates' => $statistics->getUpdatesNumber(), 'comments' => $statistics->getCommentsNumber(), 'funders' => $statistics->getTransactionsNumber());
     // Get rewards
     $this->rewards = new Crowdfunding\Rewards(JFactory::getDbo());
     $this->rewards->load(array('project_id' => $this->item->id));
     $this->pathwayName = JText::_('COM_CROWDFUNDING_STEP_MANAGER');
 }