/**
  * Generate and display a list of team members on details page.
  *
  * @param string $context
  * @param object $item
  * @param Joomla\Registry\Registry $params
  *
  * @return null|string
  */
 public function onContentAfterDisplay($context, &$item, &$params)
 {
     if (strcmp("com_crowdfunding.details", $context) != 0) {
         return null;
     }
     if ($this->app->isAdmin()) {
         return null;
     }
     $doc = JFactory::getDocument();
     /**  @var $doc JDocumentHtml */
     // Check document type
     $docType = $doc->getType();
     if (strcmp("html", $docType) != 0) {
         return null;
     }
     $html = "";
     $partners = new CrowdfundingPartners\Partners(JFactory::getDbo());
     $partners->load($item->id);
     if (0 < count($partners)) {
         // Include the project owner to the team.
         if ($this->params->get("display_owner", 0)) {
             $user = JFactory::getUser($item->user_id);
             $owner = array("name" => $user->get("name"), "project_id" => $item->id, "partner_id" => $item->user_id);
             $partners->add($owner);
         }
         // Get a social platform for integration
         $socialPlatform = $params->get("integration_social_platform");
         // Prepare avatars.
         $this->prepareIntegration($partners, $socialPlatform);
         // Get the path for the layout file
         $path = JPath::clean(JPluginHelper::getLayoutPath('content', 'crowdfundingpartners'));
         // Render the login form.
         ob_start();
         include $path;
         $html = ob_get_clean();
     }
     return $html;
 }
Exemple #2
0
 /**
  * This method prepares a code that will be included to step "Extras" on project wizard.
  *
  * @param string    $context This string gives information about that where it has been executed the trigger.
  * @param object    $item    A project data.
  * @param Joomla\Registry\Registry $params  The parameters of the component
  *
  * @return null|string
  */
 public function onExtrasDisplay($context, &$item, &$params)
 {
     if (strcmp("com_crowdfunding.project.extras", $context) != 0) {
         return null;
     }
     if ($this->app->isAdmin()) {
         return null;
     }
     $doc = JFactory::getDocument();
     /**  @var $doc JDocumentHtml */
     // Check document type
     $docType = $doc->getType();
     if (strcmp("html", $docType) != 0) {
         return null;
     }
     if (empty($item->user_id)) {
         return null;
     }
     $partners = new CrowdfundingPartners\Partners(JFactory::getDbo());
     $partners->load($item->id);
     // Get a social platform for integration
     $socialPlatform = $params->get("integration_social_platform");
     // Prepare avatars.
     $this->prepareIntegration($partners, $socialPlatform);
     // Load jQuery
     JHtml::_("jquery.framework");
     JHtml::_("prism.ui.pnotify");
     JHtml::_('prism.ui.joomlaHelper');
     // Include the translation of the confirmation question.
     JText::script('PLG_CROWDFUNDING_PARTNERS_DELETE_QUESTION');
     // Get the path for the layout file
     $path = JPath::clean(JPluginHelper::getLayoutPath('crowdfunding', 'partners'));
     // Render the login form.
     ob_start();
     include $path;
     $html = ob_get_clean();
     return $html;
 }