예제 #1
0
 protected function prepareExtras()
 {
     $model = JModelLegacy::getInstance('Extras', 'CrowdfundingModel', $config = array('ignore_request' => false));
     /** @var $model CrowdfundingModelExtras */
     // Get state
     /** @var  $state Joomla\Registry\Registry */
     $this->state = $model->getState();
     // Get item
     $itemId = $this->state->get('extras.id');
     $this->item = $model->getItem($itemId, $this->userId);
     // Check if the item exists.
     if (!CrowdfundingHelper::isAuthorized($this->userId, $this->item, 'extras')) {
         $this->app->enqueueMessage(JText::_('COM_CROWDFUNDING_ERROR_SOMETHING_WRONG'), 'notice');
         $this->app->redirect(JRoute::_(CrowdfundingHelperRoute::getDiscoverRoute()));
         return;
     }
     $this->pathwayName = JText::_('COM_CROWDFUNDING_STEP_EXTRAS');
     // Events
     JPluginHelper::importPlugin('crowdfunding');
     $dispatcher = JEventDispatcher::getInstance();
     $results = $dispatcher->trigger('onExtrasDisplay', array('com_crowdfunding.project.extras', &$this->item, &$this->params));
     $this->item->event = new stdClass();
     $this->item->event->onExtrasDisplay = trim(implode("\n", $results));
 }