本文整理汇总了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"> </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;
}
示例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);
}