本文整理匯總了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);
}