本文整理汇总了PHP中HelperTreeCategories::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP HelperTreeCategories::setAttribute方法的具体用法?PHP HelperTreeCategories::setAttribute怎么用?PHP HelperTreeCategories::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelperTreeCategories
的用法示例。
在下文中一共展示了HelperTreeCategories::setAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayAjaxCategoriesList
/**
* Listing ajax des catégories
*/
public function displayAjaxCategoriesList()
{
//Insertion des styles admin nécessaire à l'affichage des actions ajax
foreach ($this->css_files as $css_key => $css_type) {
echo '<link rel="stylesheet" type="text/css" href="' . $css_key . '" type="' . $css_type . '"/>';
}
//Géneration du tree des catégories
if (_PS_VERSION_ < '1.6') {
$categoryTree = new Helper();
echo $categoryTree->renderCategoryTree(2, array(), 'id-category-for-insert');
} else {
$categoryTree = new HelperTreeCategories('categories-tree', $this->l('Check the category to display the link'));
echo $categoryTree->setAttribute()->setInputName('id-category-for-insert')->render();
}
}
示例2: _displayForm
private function _displayForm()
{
/* Gets Slides */
$id_lang = $this->context->cookie->id_lang;
$root_cate_id = Configuration::get('ROOT_CATEGORY');
$id_category = Tools::getValue('id_category', $root_cate_id);
$current_cate = new Category($id_category, $id_lang);
$parent_cate = new Category($current_cate->id_parent, $id_lang);
$categories = Category::getChildren($id_category, $id_lang);
$displayList = false;
$slides = array();
if (Tools::getValue('id_category') && $id_category > $root_cate_id) {
$displayList = true;
$slides = $this->getSlides(null, $id_category);
}
//category tree
// Generate category selection tree
$tree = new HelperTreeCategories('categories-tree', $this->l('Filter by category'));
$tree->setAttribute('is_category_filter', (bool) $id_category)->setAttribute('base_url', preg_replace('#&id_category=[0-9]*#', '', AdminController::$currentIndex) . '&token=' . Tools::getAdminTokenLite('AdminModules'))->setInputName('id-category')->setSelectedCategories(array((int) $id_category));
$categoryTree = $tree->render();
$this->context->smarty->assign(array('slide_width' => Configuration::get('CATESLIDER_WIDTH'), 'slide_height' => Configuration::get('CATESLIDER_HEIGHT'), 'slide_speed' => Configuration::get('CATESLIDER_SPEED'), 'slide_pause' => Configuration::get('CATESLIDER_PAUSE'), 'slide_loop' => Configuration::get('CATESLIDER_LOOP'), 'categoryTree' => $categoryTree, 'displayList' => $displayList, 'current_cate' => $current_cate, 'slides' => $slides));
return $this->display(__FILE__, 'views/templates/admin/main.tpl');
}
示例3: initContent
public function initContent($token = null)
{
if ($this->display == 'edit' || $this->display == 'add') {
$this->fields_form = array();
// Check if Module
if (substr($this->tab_display, 0, 6) == 'Module') {
$this->tab_display_module = strtolower(substr($this->tab_display, 6, Tools::strlen($this->tab_display) - 6));
$this->tab_display = 'Modules';
}
if (method_exists($this, 'initForm' . $this->tab_display)) {
$this->tpl_form = strtolower($this->tab_display) . '.tpl';
}
if ($this->ajax) {
$this->content_only = true;
} else {
$product_tabs = array();
// tab_display defines which tab to display first
if (!method_exists($this, 'initForm' . $this->tab_display)) {
$this->tab_display = $this->default_tab;
}
$advanced_stock_management_active = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
$stock_management_active = Configuration::get('PS_STOCK_MANAGEMENT');
foreach ($this->available_tabs as $product_tab => $value) {
// if it's the warehouses tab and advanced stock management is disabled, continue
if ($advanced_stock_management_active == 0 && $product_tab == 'Warehouses') {
continue;
}
$product_tabs[$product_tab] = array('id' => $product_tab, 'selected' => strtolower($product_tab) == strtolower($this->tab_display) || isset($this->tab_display_module) && 'module' . $this->tab_display_module == Tools::strtolower($product_tab), 'name' => $this->available_tabs_lang[$product_tab], 'href' => $this->context->link->getAdminLink('AdminProducts') . '&id_product=' . (int) Tools::getValue('id_product') . '&action=' . $product_tab);
}
$this->tpl_form_vars['product_tabs'] = $product_tabs;
}
} else {
if ($id_category = (int) $this->id_current_category) {
self::$currentIndex .= '&id_category=' . (int) $this->id_current_category;
}
// If products from all categories are displayed, we don't want to use sorting by position
if (!$id_category) {
$this->_defaultOrderBy = $this->identifier;
if ($this->context->cookie->{$this->table . 'Orderby'} == 'position') {
unset($this->context->cookie->{$this->table . 'Orderby'});
unset($this->context->cookie->{$this->table . 'Orderway'});
}
}
if (!$id_category) {
$id_category = 1;
}
$this->tpl_list_vars['is_category_filter'] = (bool) $this->id_current_category;
// Generate category selection tree
$tree = new HelperTreeCategories('categories-tree', $this->l('Filter by category'));
$tree->setAttribute('is_category_filter', (bool) $this->id_current_category)->setAttribute('base_url', preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex) . '&token=' . $this->token)->setInputName('id-category')->setSelectedCategories(array((int) $id_category));
$this->tpl_list_vars['category_tree'] = $tree->render();
// used to build the new url when changing category
$this->tpl_list_vars['base_url'] = preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex) . '&token=' . $this->token;
}
// @todo module free
$this->tpl_form_vars['vat_number'] = file_exists(_PS_MODULE_DIR_ . 'vatnumber/ajax.php');
parent::initContent();
}