From ed0037c435b8309c2e00a1ef84bd037f150f85d7 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Tue, 27 Aug 2013 18:21:27 +0200 Subject: [PATCH] [+] BO : New page header toolbar --- admin-dev/themes/default/template/content.tpl | 3 + .../template/helpers/list/list_header.tpl | 2 + .../default/template/page_header_toolbar.tpl | 200 ++++++++++++++++++ classes/controller/AdminController.php | 24 ++- 4 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 admin-dev/themes/default/template/page_header_toolbar.tpl diff --git a/admin-dev/themes/default/template/content.tpl b/admin-dev/themes/default/template/content.tpl index dc873ec14..9fb652427 100644 --- a/admin-dev/themes/default/template/content.tpl +++ b/admin-dev/themes/default/template/content.tpl @@ -24,5 +24,8 @@ *} {if isset($content)} + {if isset($show_page_header_toolbar) && $show_page_header_toolbar} + {include file="page_header_toolbar.tpl" toolbar_btn=$page_header_toolbar_btn title=$page_header_toolbar_title} + {/if} {$content} {/if} diff --git a/admin-dev/themes/default/template/helpers/list/list_header.tpl b/admin-dev/themes/default/template/helpers/list/list_header.tpl index 62fadca9c..f620327f4 100644 --- a/admin-dev/themes/default/template/helpers/list/list_header.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_header.tpl @@ -76,6 +76,7 @@
{if is_array($title)}{$title|end}{else}{$title}{/if} + {if isset($toolbar_btn) && count($toolbar_btn) >0} {foreach from=$toolbar_btn item=btn key=k} @@ -99,6 +100,7 @@ {/if} {/foreach} + {/if} {if $show_toolbar} + {/block} +
+ + + +{block name=pageBreadcrumb} + +{/block} diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 8e803008c..7b2e8e67d 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -273,6 +273,11 @@ class AdminControllerCore extends Controller */ protected $breadcrumbs; + //Bootstrap variable + public $show_page_header_toolbar = false; + public $page_header_toolbar_title; + public $page_header_toolbar_btn = array(); + public function __construct() { global $timer_start; @@ -414,7 +419,7 @@ class AdminControllerCore extends Controller } if ($filter) $this->toolbar_title[] = $filter; - } + } } /** @@ -1082,6 +1087,21 @@ class AdminControllerCore extends Controller $this->confirmations[] = $this->_conf[6]; } + + public function initPageHeaderToolbar() + { + if (is_array($this->page_header_toolbar_btn) + && $this->page_header_toolbar_btn instanceof Traversable + || trim($this->page_header_toolbar_title) != '') + $this->show_page_header_toolbar = true; + + $this->context->smarty->assign(array( + 'show_page_header_toolbar' => $this->show_page_header_toolbar, + 'page_header_toolbar_title' => $this->page_header_toolbar_title, + 'page_header_toolbar_btn' => $this->page_header_toolbar_btn + )); + } + /** * assign default action in toolbar_btn smarty var, if they are not set. * uses override to specifically add, modify or remove items @@ -1583,6 +1603,8 @@ class AdminControllerCore extends Controller */ public function renderList() { + $this->initPageHeaderToolbar(); + if (!($this->fields_list && is_array($this->fields_list))) return false; $this->getList($this->context->language->id);