Esempio n. 1
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationAdministrator */
     // Get user ID
     $userId = $app->input->getInt("id");
     $model = $this->getModel();
     $this->state = $model->getState();
     $this->item = $model->getItem($userId);
     $this->params = JComponentHelper::getParams($this->option);
     // Get currency
     $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get("project_currency"));
     $this->amount = new Crowdfunding\Amount($this->params);
     $this->amount->setCurrency($currency);
     // Get number of rewards.
     $statistics = new Crowdfunding\Statistics\User(JFactory::getDbo(), $this->item->id);
     $this->projects = $statistics->getProjectsNumber();
     $amounts = $statistics->getAmounts();
     if (!empty($amounts["invested"])) {
         $this->investedAmount = (double) $amounts["invested"]['amount'];
         $this->investedTransactions = (int) $amounts["invested"]['number'];
     }
     if (!empty($amounts["received"])) {
         $this->receivedAmount = (double) $amounts["received"]['amount'];
         $this->receivedTransactions = (int) $amounts["received"]['number'];
     }
     // Get social profile
     $socialPlatform = $this->params->get("integration_social_platform");
     if (!empty($socialPlatform)) {
         $options = array("social_platform" => $socialPlatform, "user_id" => $this->item->id);
         $profileBuilder = new Prism\Integration\Profile\Builder($options);
         $profileBuilder->build();
         $this->socialProfile = $profileBuilder->getProfile();
         $this->profileLink = $this->socialProfile->getLink();
     }
     $this->rewards = new Crowdfunding\User\Rewards(JFactory::getDbo());
     $this->rewards->load(array("user_id" => $this->item->id));
     $this->returnUrl = base64_encode("index.php?option=com_crowdfunding&view=user&id=" . $this->item->id);
     // Prepare actions, behaviors, scripts and document
     $this->addToolbar();
     $this->setDocument();
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     $this->option = JFactory::getApplication()->input->get('option');
     $this->app = JFactory::getApplication();
     // Get user ID
     $userId = $this->app->input->getInt('id');
     $model = $this->getModel();
     $this->state = $model->getState();
     $this->item = $model->getItem($userId);
     $this->params = JComponentHelper::getParams($this->option);
     $this->money = $this->getMoneyFormatter($this->params);
     // Get number of rewards.
     $statistics = new Crowdfunding\Statistics\User(JFactory::getDbo(), $this->item->id);
     $this->projects = $statistics->getProjectsNumber();
     $amounts = $statistics->getAmounts();
     if (!empty($amounts['invested'])) {
         $this->investedAmount = (double) $amounts['invested']['amount'];
         $this->investedTransactions = (int) $amounts['invested']['number'];
     }
     if (!empty($amounts['received'])) {
         $this->receivedAmount = (double) $amounts['received']['amount'];
         $this->receivedTransactions = (int) $amounts['received']['number'];
     }
     // Get social profile
     if ($this->params->get('integration_social_platform')) {
         $this->socialProfile = CrowdfundingHelper::prepareIntegration($this->params->get('integration_social_platform'), $this->item->id);
         $this->profileLink = $this->socialProfile->getLink();
     }
     $this->rewards = new Crowdfunding\User\Rewards(JFactory::getDbo());
     $this->rewards->load(array('user_id' => $this->item->id));
     $this->returnUrl = base64_encode('index.php?option=com_crowdfunding&view=user&id=' . $this->item->id);
     // Prepare actions, behaviors, scripts and document
     $this->addToolbar();
     $this->setDocument();
     parent::display($tpl);
 }