本文整理汇总了PHP中CrowdfundingHelper::prepareCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP CrowdfundingHelper::prepareCategories方法的具体用法?PHP CrowdfundingHelper::prepareCategories怎么用?PHP CrowdfundingHelper::prepareCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CrowdfundingHelper
的用法示例。
在下文中一共展示了CrowdfundingHelper::prepareCategories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
$this->option = JFactory::getApplication()->input->get('option');
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$this->params = $this->state->get('params');
$this->displayProjectsNumber = $this->params->get('categories_display_projects_number', 0);
$this->numberInRow = $this->params->get('categories_categories_row', 3);
// Get description length
$this->descriptionLength = $this->params->get('categories_description_length', 128);
// Load projects number.
if ($this->displayProjectsNumber) {
$ids = array();
foreach ($this->items as $item) {
$ids[] = $item->id;
}
$categories = new Crowdfunding\Categories();
$categories->setDb(JFactory::getDbo());
$this->projectsNumber = $categories->getProjectsNumber($ids, array('state' => Prism\Constants::PUBLISHED, 'approved' => Prism\Constants::APPROVED));
}
// Prepare items parameters.
if (is_array($this->items)) {
$this->items = CrowdfundingHelper::prepareCategories($this->items, $this->numberInRow);
}
// Get layout
$layout = $this->params->get('categories_layout', 'grid');
$this->templateView = in_array($layout, $this->allowedLayouts, true) ? $layout : 'grid';
// Get params
/** @var $params Joomla\Registry\Registry */
$params = $this->state->get('params');
$this->params = $params;
// Prepare filters
$this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = strcmp($this->listOrder, 'a.ordering') === 0;
$this->prepareDocument();
parent::display($tpl);
}
示例2: prepareSubcategories
private function prepareSubcategories()
{
$app = JFactory::getApplication();
$categoryId = $app->input->getInt("id");
$categories = new Crowdfunding\Categories();
$category = $categories->get($categoryId);
$this->categories = $category->getChildren();
$this->subcategoriesPerRow = $this->params->get("categories_items_row", 3);
$this->displayProjectsNumber = $this->params->get("categories_display_projects_number", 0);
// Load projects number.
if ($this->displayProjectsNumber) {
$ids = array();
foreach ($this->items as $item) {
$ids[] = $item->id;
}
$categories->setDb(JFactory::getDbo());
$this->projectsNumber = $categories->getProjectsNumber($ids, array("state" => 1));
}
$this->categories = CrowdfundingHelper::prepareCategories($this->categories);
}