當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CrowdfundingHelper::getProjectData方法代碼示例

本文整理匯總了PHP中CrowdfundingHelper::getProjectData方法的典型用法代碼示例。如果您正苦於以下問題:PHP CrowdfundingHelper::getProjectData方法的具體用法?PHP CrowdfundingHelper::getProjectData怎麽用?PHP CrowdfundingHelper::getProjectData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CrowdfundingHelper的用法示例。


在下文中一共展示了CrowdfundingHelper::getProjectData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onContentBeforeDisplay

 /**
  * @param string  $context
  * @param object $article
  * @param Joomla\Registry\Registry $params
  * @param int $page
  *
  * @return null|string
  * @throws Exception
  */
 public function onContentBeforeDisplay($context, &$article, &$params, $page = 0)
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     if ($app->isAdmin()) {
         return null;
     }
     $doc = JFactory::getDocument();
     /**  @var $doc JDocumentHtml */
     // Check document type
     $docType = $doc->getType();
     if (strcmp("html", $docType) != 0) {
         return null;
     }
     if (strcmp("com_crowdfunding.details", $context) != 0) {
         return null;
     }
     // Load language
     $this->loadLanguage();
     $itemId = $app->input->getInt("id");
     $stats = CrowdfundingHelper::getProjectData($itemId);
     $screen = $app->input->getCmd("screen", "home");
     $html = '<ul class="nav nav-pills cf-plg-navigation">';
     if ($this->params->get("display_home")) {
         $class = 'class="cf-plg-nav-home';
         if (strcmp($screen, "home") == 0) {
             $class .= ' active';
         }
         $class .= '"';
         $html .= '<li ' . $class . '><a href="' . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($article->slug, $article->catslug)) . '">' . JText::_("PLG_CONTENT_CROWDFUNDINGNAV_HOME") . "</a></li>";
     }
     if ($this->params->get("display_updates")) {
         $class = 'class="cf-plg-nav-updates';
         if (strcmp($screen, "updates") == 0) {
             $class .= ' active';
         }
         $class .= '"';
         $stat = '<span class="badge">' . Joomla\Utilities\ArrayHelper::getValue($stats, "updates", 0) . '</span>';
         $html .= '<li ' . $class . '><a href="' . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($article->slug, $article->catslug, "updates")) . '">' . JText::_("PLG_CONTENT_CROWDFUNDINGNAV_UPDATES") . ' ' . $stat . '</a></li>';
     }
     if ($this->params->get("display_comments")) {
         $class = 'class="cf-plg-nav-comments';
         if (strcmp($screen, "comments") == 0) {
             $class .= ' active';
         }
         $class .= '"';
         if (!$params->get("comments_enabled", 1)) {
             $stat = '<span class="cf-dclabel">&nbsp;</span>';
         } else {
             $stat = '<span class="badge">' . Joomla\Utilities\ArrayHelper::getValue($stats, "comments", 0) . '</span>';
         }
         $html .= '<li ' . $class . '><a href="' . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($article->slug, $article->catslug, "comments")) . '">' . JText::_("PLG_CONTENT_CROWDFUNDINGNAV_COMMENTS") . ' ' . $stat . '</a></li>';
     }
     if ($this->params->get("display_funders")) {
         $class = 'class="cf-plg-nav-funders';
         if (strcmp($screen, "funders") == 0) {
             $class .= ' active';
         }
         $class .= '"';
         $stat = '<span class="badge">' . Joomla\Utilities\ArrayHelper::getValue($stats, "funders", 0) . '</span>';
         $html .= '<li ' . $class . '><a href="' . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($article->slug, $article->catslug, "funders")) . '">' . JText::_("PLG_CONTENT_CROWDFUNDINGNAV_FUNDERS") . ' ' . $stat . '</a></li>';
     }
     $html .= '</ul>';
     return $html;
 }
開發者ID:pashakiz,項目名稱:crowdf,代碼行數:74,代碼來源:crowdfundingnav.php

示例2: getStatistics

 public function getStatistics($project)
 {
     $params = JComponentHelper::getParams("com_crowdfunding");
     /** @var  $params Joomla\Registry\Registry */
     $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $params->get("project_currency"));
     $amount = new Crowdfunding\Amount($params, $project->funded);
     $amount->setCurrency($currency);
     $projectData = CrowdfundingHelper::getProjectData($project->id);
     $html = array();
     $html[] = '<div class="panel panel-default">';
     $html[] = '<div class="panel-heading"><h5>' . JText::_("PLG_CONTENT_CROWDFUNDINGMANAGER_STATISTICS") . '</h5></div>';
     $html[] = '         <table class="table table-bordered">';
     // Hits
     $html[] = '             <tr>';
     $html[] = '                 <td>' . JText::_("PLG_CONTENT_CROWDFUNDINGMANAGER_HITS") . '</td>';
     $html[] = '                 <td>' . (int) $project->hits . '</td>';
     $html[] = '             </tr>';
     // Updates
     $html[] = '             <tr>';
     $html[] = '                 <td>' . JText::_("PLG_CONTENT_CROWDFUNDINGMANAGER_UPDATES") . '</td>';
     $html[] = '                 <td>' . JArrayHelper::getValue($projectData, "updates", 0, "integer") . '</td>';
     $html[] = '             </tr>';
     // Comments
     $html[] = '             <tr>';
     $html[] = '                 <td>' . JText::_("PLG_CONTENT_CROWDFUNDINGMANAGER_COMMENTS") . '</td>';
     $html[] = '                 <td>' . JArrayHelper::getValue($projectData, "comments", 0, "integer") . '</td>';
     $html[] = '             </tr>';
     // Funders
     $html[] = '             <tr>';
     $html[] = '                 <td>' . JText::_("PLG_CONTENT_CROWDFUNDINGMANAGER_FUNDERS") . '</td>';
     $html[] = '                 <td>' . JArrayHelper::getValue($projectData, "funders", 0, "integer") . '</td>';
     $html[] = '             </tr>';
     // Raised
     $html[] = '             <tr>';
     $html[] = '                 <td>' . JText::_("PLG_CONTENT_CROWDFUNDINGMANAGER_RAISED") . '</td>';
     $html[] = '                 <td>' . $amount->formatCurrency() . '</td>';
     $html[] = '             </tr>';
     $html[] = '         </table>';
     $html[] = '</div>';
     return implode("\n", $html);
 }
開發者ID:pashakiz,項目名稱:crowdf,代碼行數:41,代碼來源:crowdfundingmanager.php


注:本文中的CrowdfundingHelper::getProjectData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。