diff --git a/admin-dev/themes/template/adminHome.tpl b/admin-dev/themes/template/adminHome.tpl index 8bf2d9624..6f4ff26d9 100644 --- a/admin-dev/themes/template/adminHome.tpl +++ b/admin-dev/themes/template/adminHome.tpl @@ -53,54 +53,52 @@ $(document).ready(function() {
{$tips_optimization} - -
-

{l s='Loading...'}

+

{l s='Loading...'}

+

{l s='Loading...'}

- {$discover_prestashop} -
{$HOOK_BACKOFFICEHOME} -
+
 
+ diff --git a/admin-dev/themes/template/header.tpl b/admin-dev/themes/template/header.tpl index d7de60f06..8820d6e38 100644 --- a/admin-dev/themes/template/header.tpl +++ b/admin-dev/themes/template/header.tpl @@ -255,7 +255,7 @@ {/foreach} {/if} - {if $is_multishop} + {if $is_multishop && $shop_context != 'all'}
{if $shop_context == 'group'} {l s='You are configuring your store for group shop '}{$shop_name} diff --git a/classes/AdminController.php b/classes/AdminController.php index d5898b1c5..dbb6edaf2 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -84,6 +84,18 @@ class AdminControllerCore extends Controller public function __construct() { + // retro-compatibility : className for admin without controller + // This can be overriden in controllers (like for AdminCategories or AdminProducts + $controller = get_class($this); + // @todo : move this in class AdminCategoriesController and AdminProductsController + if ($controller == 'AdminCategoriesController' && $controller == 'AdminProductsController') + $controller = 'AdminCatalogController'; + + // temporary fix for Token retrocompatibility + // This has to be done when url is built instead of here) + if(strpos($controller,'Controller')) + $controller = substr($controller,0,-10); + parent::__construct(); // if this->template is empty, // generate the filename from the classname, without "Controller" suffix @@ -95,6 +107,9 @@ class AdminControllerCore extends Controller $this->template = $tpl_name; } + $this->id = Tab::getIdFromClassName($controller); + $this->token = Tools::getAdminToken($controller.(int)$this->id.(int)$this->context->employee->id); + $this->_conf = array( 1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'), 3 => $this->l('Creation successful'), 4 => $this->l('Update successful'), @@ -112,21 +127,8 @@ class AdminControllerCore extends Controller ); if (!$this->identifier) $this->identifier = 'id_'.$this->table; if (!$this->_defaultOrderBy) $this->_defaultOrderBy = $this->identifier; - $className = get_class($this); - // temporary fix for Token retrocompatibility - // This has to be done when url is built instead of here) - if(strpos($className,'Controller')) - $className = substr($className,0,-10); - - if ($className == 'AdminCategories' OR $className == 'AdminProducts') - $className = 'AdminCatalog'; - - $this->className = $className; - $this->id = Tab::getIdFromClassName($className); - $this->token = Tools::getAdminToken($className.(int)$this->id.(int)$this->context->employee->id); - // Fix for AdminHome - if ($className == 'AdminHome') + if ($controller == 'AdminHome') $_POST['token'] = $this->token; if (!Shop::isMultiShopActivated()) @@ -676,17 +678,17 @@ class AdminControllerCore extends Controller if (trim($tab['module']) != '') $img = _MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.gif'; - $tabs[$index]['current'] = ($tab['class_name'] == $this->className) || (Tab::getCurrentParentId() == $tab['id_tab']); + // tab[class_name] does not contains the "Controller" suffix + $tabs[$index]['current'] = ($tab['class_name'].'Controller' == get_class($this)) || (Tab::getCurrentParentId() == $tab['id_tab']); $tabs[$index]['img'] = $img; $tabs[$index]['token'] = Tools::getAdminToken($tab['class_name'].(int)($tab['id_tab']).(int)$this->context->employee->id); $sub_tabs = Tab::getTabs($this->context->language->id, $tab['id_tab']); foreach ($sub_tabs AS $index2 => $sub_tab) { + // class_name is the name of the class controller if (Tab::checkTabRights($sub_tab) === true) - { - $sub_tabs[$index2]['token'] = Tools::getAdminTokenLite($sub_tab['class_name']); - } + $sub_tabs[$index2]['href'] = $this->context->link->getAdminLink($sub_tab['class_name']); else unset($sub_tabs[$index2]); } diff --git a/controllers/admin/AdminHomeController.php b/controllers/admin/AdminHomeController.php index 555d457ea..27748ce03 100644 --- a/controllers/admin/AdminHomeController.php +++ b/controllers/admin/AdminHomeController.php @@ -171,25 +171,25 @@ class AdminHomeControllerCore extends AdminController private function getQuickLinks() { $quick_links['first'] = array( - 'href' => 'index.php?controller=AdminCatalog&addcategory&token='.Tools::getAdminTokenLite('AdminCatalog'), + 'href' => $this->context->link->getAdminLink('AdminCatalog').'&addcategory', 'title' => $this->l('New category'), 'description' => $this->l('Create a new category and organize your products.'), ); $quick_links['second'] = array( - 'href' => 'index.php?controller=AdminCatalog&addproduct&token='.Tools::getAdminTokenLite('AdminCatalog'), + 'href' => $this->context->link->getAdminLink('AdminCatalog').'&addproduct', 'title' => $this->l('New product'), 'description' => $this->l('Fill up your catalog with new articles and attributes.'), ); $quick_links['third'] = array( - 'href' => 'index.php?controller=AdminStats&addproduct&token='.Tools::getAdminTokenLite('AdminStats'), + 'href' => $this->context->link->getAdminLink('AdminStats'), 'title' => $this->l('Statistics'), 'description' => $this->l('Manage your activity with a thorough analysis of your e-shop.'), ); $quick_links['fourth'] = array( - 'href' => 'index.php?controller=AdminEmployee&addproduct&token='.Tools::getAdminTokenLite('AdminEmployee'), + 'href' => $this->context->link->getAdminLink('AdminEmployees').'&addemployee', 'title' => $this->l('New employee'), 'description' => $this->l('Add a new employee account and discharge a part of your duties of shop owner.'), ); @@ -493,7 +493,7 @@ class AdminHomeControllerCore extends AdminController return ''; // NOK } } - public function display() + public function initContent() { $smarty = $this->context->smarty; $smarty->assign('token',$this->token); @@ -515,29 +515,16 @@ class AdminHomeControllerCore extends AdminController $smarty->assign('upgrade', $upgrade); $smarty->assign('show_screencast', $this->context->employee->show_screencast); - $smarty->assign('quick_links', $this->getQuickLinks()); - $smarty->assign('monthly_statistics', $this->getMonthlyStatistics()); - $smarty->assign('customers_service', $this->getCustomersService()); - $smarty->assign('stats_sales', $this->getStatsSales()); - $smarty->assign('last_orders',$this->getLastOrders()); - $smarty->assign('tips_optimization', $this->_displayOptimizationTips()); - - $discover_prestashop = '
-

'.$this->l('Loading...').'

-
-
'; - $smarty->assign('discover_prestashop', $discover_prestashop); $HOOK_BACKOFFICEHOME = Module::hookExec('backOfficeHome'); $smarty->assign('HOOK_BACKOFFICEHOME', $HOOK_BACKOFFICEHOME); - parent::display(); } }