Ejemplo 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
     jimport("crowdfunding.currency");
     $currencyId = $this->params->get("project_currency");
     $this->currency = CrowdFundingCurrency::getInstance(JFactory::getDbo(), $currencyId, $this->params);
     // Get number of rewards.
     jimport("crowdfunding.statistics.user");
     $statistics = new CrowdFundingStatisticsUser(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);
         jimport("itprism.integrate.profile.builder");
         $profileBuilder = new ITPrismIntegrateProfileBuilder($options);
         $profileBuilder->build();
         $this->socialProfile = $profileBuilder->getProfile();
         $this->profileLink = $this->socialProfile->getLink();
     }
     jimport("crowdfunding.user.rewards");
     $this->rewards = new CrowdFundingUserRewards(JFactory::getDbo());
     $this->rewards->load($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);
 }
Ejemplo n.º 2
0
 protected function prepareDefaultLayout()
 {
     jimport("crowdfunding.user.rewards");
     $this->rewards = new CrowdFundingUserRewards(JFactory::getDbo());
     $this->rewards->loadByRewardId($this->item->id);
     $this->rewardOwnerId = CrowdFundingHelper::getUserIdByRewardId($this->item->id);
     $dateValidator = new ITPrismValidatorDate($this->item->delivery);
     $this->deliveryDate = $dateValidator->isValid() ? JHtml::_('date', $this->item->delivery, JText::_('DATE_FORMAT_LC3')) : "--";
     $this->imagesFolder = CrowdFundingHelper::getImagesFolderUri($this->rewardOwnerId);
     // Get social profile
     $socialPlatform = $this->params->get("integration_social_platform");
     if (!empty($socialPlatform)) {
         $options = array("social_platform" => $socialPlatform, "user_id" => $this->rewardOwnerId);
         jimport("itprism.integrate.profile.builder");
         $profileBuilder = new ITPrismIntegrateProfileBuilder($options);
         $profileBuilder->build();
         $this->socialProfile = $profileBuilder->getProfile();
         $this->profileLink = $this->socialProfile->getLink();
     }
     $this->returnUrl = base64_encode("index.php?option=com_crowdfunding&view=reward&id=" . $this->item->id);
 }