// Helper::renderAdminCategorieTree refactoring

This commit is contained in:
tDidierjean
2012-01-20 13:02:34 +00:00
parent ac42e72599
commit 82109ee134
5 changed files with 15 additions and 71 deletions
+3 -13
View File
@@ -247,21 +247,11 @@ class AdminGroupsControllerCore extends AdminController
)
)
);
$root_category = Category::getRootCategory();
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name[$this->context->language->id]);
$this->fields_value['reduction'] = isset($group->reduction) ? $group->reduction : 0;
$trads = array(
'Root' => $root_category,
'selected' => $this->l('selected'),
'Collapse All' => $this->l('Collapse All'),
'Expand All' => $this->l('Expand All'),
'Check All' => $this->l('Check All'),
'Uncheck All' => $this->l('Uncheck All'),
'search' => $this->l('Search a category')
);
$this->tpl_form_vars['categoryTreeView'] = Helper::renderAdminCategorieTree($trads, array(), 'id_category', true, false, array(), true);
$helper = new Helper();
$this->tpl_form_vars['categoryTreeView'] = $helper->renderCategoryTree(null, array(), 'id_category', true, false, array(), true);
return parent::renderForm();
}
+2 -12
View File
@@ -2477,17 +2477,6 @@ class AdminProductsControllerCore extends AdminController
else
$selected_cat = Product::getProductCategoriesFull($product->id, $this->default_form_language);
}
$root_category = Category::getRootCategory();
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name[$this->context->language->id]);
$translations = array(
'Root' => $root_category,
'selected' => $this->l('selected'),
'Collapse All' => $this->l('Collapse All'),
'Expand All' => $this->l('Expand All'),
'Check All' => $this->l('Check All'),
'Uncheck All' => $this->l('Uncheck All'),
'search' => $this->l('Search a category')
);
// Multishop block
$data->assign('feature_shop_active', Shop::isFeatureActive());
@@ -2515,10 +2504,11 @@ class AdminProductsControllerCore extends AdminController
$product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer);
$helper = new Helper();
$data->assign(array('default_category' => $default_category,
'selected_cat_ids' => implode(',', array_keys($selected_cat)),
'selected_cat' => $selected_cat,
'category_tree' => Helper::renderAdminCategorieTree($translations, $selected_cat, 'categoryBox', false, true),
'category_tree' => $helper->renderCategoryTree(null, $selected_cat, 'categoryBox', false, true),
'product' => $product,
'link' => $this->context->link
));
+5 -19
View File
@@ -176,15 +176,9 @@ class AdminShopControllerCore extends AdminController
{
$root_category = new Category((int)Tools::getValue('id_category'));
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name[$this->context->language->id]);
$trads = array(
'Root' => $root_category,
'selected' => $this->l('selected'),
'Collapse All' => $this->l('Collapse All'),
'Check All' => $this->l('Check All'),
'Uncheck All' => $this->l('Uncheck All'),
'Expand All' => $this->l('Expand All')
);
echo Helper::renderAdminCategorieTree($trads, array($root_category['id_category']));
$helper = new Helper();
echo $helper->renderCategoryTree($root_category, array($root_category['id_category']));
}
}
@@ -507,16 +501,8 @@ class AdminShopControllerCore extends AdminController
else
$root_category = new Category($id_root);
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name[$this->context->language->id]);
$translations = array(
'Root' => $root_category,
'selected' => $this->l('selected'),
'Collapse All' => $this->l('Collapse All'),
'Expand All' => $this->l('Expand All'),
'Check All' => $this->l('Check All'),
'Uncheck All' => $this->l('Uncheck All'),
'search' => $this->l('Search a category')
);
return Helper::renderAdminCategorieTree($translations, $selected_cat, 'categoryBox', false, true);
$helper = new Helper();
return $helper->renderCategoryTree($root_category, $selected_cat, 'categoryBox', false, true);
}
}