public function render($data = null) { if (!isset($data)) { $data = $this->getData(); } if (isset($this->_disabled_categories) && !empty($this->_disabled_categories)) { $this->_disableCategories($data, $this->getDisabledCategories()); } if (isset($this->_selected_categories) && !empty($this->_selected_categories)) { $this->_getSelectedChildNumbers($data, $this->getSelectedCategories()); } //Default bootstrap style of search is push-right, so we add this button first if ($this->useSearch()) { $this->addAction(new TreeToolbarSearchCategories('Find a category:', $this->getId() . '-categories-search')); $this->setAttribute('use_search', $this->useSearch()); } $collapse_all = new TreeToolbarLink('Collapse All', '#', '$(\'#' . $this->getId() . '\').tree(\'collapseAll\');$(\'#collapse-all-' . $this->getId() . '\').hide();$(\'#expand-all-' . $this->getId() . '\').show(); return false;', 'icon-collapse-alt'); $collapse_all->setAttribute('id', 'collapse-all-' . $this->getId()); $expand_all = new TreeToolbarLink('Expand All', '#', '$(\'#' . $this->getId() . '\').tree(\'expandAll\');$(\'#collapse-all-' . $this->getId() . '\').show();$(\'#expand-all-' . $this->getId() . '\').hide(); return false;', 'icon-expand-alt'); $expand_all->setAttribute('id', 'expand-all-' . $this->getId()); $this->addAction($collapse_all); $this->addAction($expand_all); if ($this->useCheckBox()) { $check_all = new TreeToolbarLink('Check All', '#', 'checkAllAssociatedCategories($(\'#' . $this->getId() . '\')); return false;', 'icon-check-sign'); $check_all->setAttribute('id', 'check-all-' . $this->getId()); $uncheck_all = new TreeToolbarLink('Uncheck All', '#', 'uncheckAllAssociatedCategories($(\'#' . $this->getId() . '\')); return false;', 'icon-check-empty'); $uncheck_all->setAttribute('id', 'uncheck-all-' . $this->getId()); $this->addAction($check_all); $this->addAction($uncheck_all); $this->setNodeFolderTemplate('tree_node_folder_checkbox.tpl'); $this->setNodeItemTemplate('tree_node_item_checkbox.tpl'); $this->setAttribute('use_checkbox', $this->useCheckBox()); } $this->setAttribute('selected_categories', $this->getSelectedCategories()); $this->getContext()->smarty->assign('root_category', Configuration::get('PS_ROOT_CATEGORY')); $this->getContext()->smarty->assign('token', Tools::getAdminTokenLite('AdminProducts')); return parent::render($data); }
public function render($data = null, $use_default_actions = true, $use_selected_shop = true) { if (!isset($data)) { $data = $this->getData(); } if ($use_default_actions) { $this->setActions(array(new TreeToolbarLink('Collapse All', '#', '$(\'#' . $this->getId() . '\').tree(\'collapseAll\'); return false;', 'icon-collapse-alt'), new TreeToolbarLink('Expand All', '#', '$(\'#' . $this->getId() . '\').tree(\'expandAll\'); return false;', 'icon-expand-alt'), new TreeToolbarLink('Check All', '#', 'checkAllAssociatedShops($(\'#' . $this->getId() . '\')); return false;', 'icon-check-sign'), new TreeToolbarLink('Uncheck All', '#', 'uncheckAllAssociatedShops($(\'#' . $this->getId() . '\')); return false;', 'icon-check-empty'))); } if ($use_selected_shop) { $this->setAttribute('selected_shops', $this->getSelectedShops()); } return parent::render($data); }
public function getTemplateFile($template, $loadLocal = false) { if (!$loadLocal) { return parent::getTemplateFile($template); } $template = "{$this->_module_template_dir}{$template}"; if (file_exists($template)) { return $template; } }