[*] BO : you can noww override header and footer for each controller

This commit is contained in:
Damien Metzger
2013-10-02 17:04:18 +02:00
parent f63e1065b3
commit 84a251a575
5 changed files with 92 additions and 25 deletions
@@ -0,0 +1,51 @@
{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7 lt-ie6 " lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8 ie7" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9 ie8" lang="en"> <![endif]-->
<!--[if gt IE 8]> <html lang="fr" class="no-js ie9" lang="en"> <![endif]-->
<html lang="{$iso}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="robots" content="NOFOLLOW, NOINDEX">
<title>{$shop_name} {if $meta_title != ''}{if isset($navigationPipe)}{$navigationPipe|escape:'htmlall':'UTF-8'}{else}&gt;{/if} {$meta_title}{/if} (PrestaShop&trade;)</title>
{foreach from=$css_files key=css_uri item=media}
<link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" />
{/foreach}
{foreach from=$js_files item=js_uri}
<script type="text/javascript" src="{$js_uri}"></script>
{/foreach}
<link rel="icon" type="image/vnd.microsoft.icon" href="{$img_dir}favicon.ico" />
<link rel="shortcut icon" type="image/x-icon" href="{$img_dir}favicon.ico" />
<!--[if IE]>
<link type="text/css" rel="stylesheet" href="{$base_url}css/admin-ie.css" />
<![endif]-->
</head>
<body>
<div id="main">
<div id="content" class="page-content">
+12 -7
View File
@@ -33,7 +33,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="robots" content="NOFOLLOW, NOINDEX">
<title>{$shop_name} {if $meta_title != ''}{$navigationPipe|escape:'htmlall':'UTF-8'} {$meta_title}{/if} (PrestaShop&trade;)</title>
<title>{$shop_name} {if $meta_title != ''}{if isset($navigationPipe)}{$navigationPipe|escape:'htmlall':'UTF-8'}{else}&gt;{/if} {$meta_title}{/if} (PrestaShop&trade;)</title>
{if $display_header}
<script type="text/javascript">
var help_class_name = '{$controller_name}';
@@ -102,9 +102,9 @@
{/if}
</head>
<body class="{if $employee->bo_menu}page-sidebar {* page-sidebar-closed *}{else}page-topbar{/if}">
{if $display_header}
<body class="{if $employee->bo_menu}page-sidebar {* page-sidebar-closed *}{else}page-topbar{/if}">
{* begin HEADER *}
<header id="header">
<nav id="header_infos" role="navigation">
@@ -280,23 +280,28 @@
</nav>{* end header_infos*}
</header>
{* end header*}
{/if}
<div id="main">
{include file='nav.tpl'}
<div id="content" class="page-content">
{if $display_header && $install_dir_exists}
{if $install_dir_exists}
<div class="alert alert-warning">
{l s='For security reasons, you must also:'}&nbsp;{l s='delete the /install folder'}
</div>
{/if}
{if $display_header && $is_multishop && $shop_list && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)}
{if $is_multishop && $shop_list && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)}
<fieldset class="multishop_toolbar">
<div class="col-lg-12 form-horizontal">
<label class="control-label col-lg-3"><i class="icon-sitemap"></i> {l s='Multistore configuration for'}</label>
<div class="col-lg-9">{$shop_list}</div>
</div>
</fieldset>
{/if}
{* end display_header*}
{else}
<body>
<div id="main">
<div id="content" class="page-content">
{/if}
+1 -3
View File
@@ -22,7 +22,7 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{include file='header.tpl'}
{if isset($conf)}
<div class="alert alert-success">
{$conf}
@@ -91,5 +91,3 @@
{if !$bootstrap}<div id="nobootstrap">{/if}
{$page}
{if !$bootstrap}</div>{/if}
{include file='footer.tpl'}
+23 -14
View File
@@ -679,8 +679,7 @@ class AdminControllerCore extends Controller
'export_precontent' => "\xEF\xBB\xBF",
'export_headers' => $headers,
'export_content' => $content
)
);
));
$this->layout = 'layout-export.tpl';
}
@@ -1284,20 +1283,32 @@ class AdminControllerCore extends Controller
public function display()
{
$this->context->smarty->assign(array(
'display_header' => $this->display_header,
'display_footer' => $this->display_footer,
)
);
'display_header' => $this->display_header,
'display_footer' => $this->display_footer,
));
// Use page title from meta_title if it has been set else from the breadcrumbs array
if (!$this->meta_title)
$this->meta_title = strip_tags(is_array($this->toolbar_title) ? implode(' '.Configuration::get('PS_NAVIGATION_PIPE').' ', $this->toolbar_title) : $this->toolbar_title);
$this->context->smarty->assign('meta_title', $this->meta_title);
$template_dirs = $this->context->smarty->getTemplateDir();
// Check if header/footer have been overriden
$header_tpl = 'header.tpl';
$footer_tpl = 'footer.tpl';
foreach ($template_dirs as $template_dir)
{
if (file_exists($template_dir.DIRECTORY_SEPARATOR.'header.tpl'))
$header_tpl = $template_dir.DIRECTORY_SEPARATOR.'header.tpl';
if (file_exists($template_dir.DIRECTORY_SEPARATOR.'footer.tpl'))
$footer_tpl = $template_dir.DIRECTORY_SEPARATOR.'footer.tpl';
}
$tpl_action = $this->tpl_folder.$this->display.'.tpl';
// Check if action template has been overriden
foreach ($this->context->smarty->getTemplateDir() as $template_dir)
foreach ($template_dirs as $template_dir)
if (file_exists($template_dir.DIRECTORY_SEPARATOR.$tpl_action) && $this->display != 'view' && $this->display != 'options')
{
if (method_exists($this, $this->display.Tools::toCamelCase($this->className)))
@@ -1321,7 +1332,7 @@ class AdminControllerCore extends Controller
$this->context->smarty->assign($type, $this->json ? Tools::jsonEncode(array_unique($this->$type)) : array_unique($this->$type));
$this->context->smarty->assign('page', $this->json ? Tools::jsonEncode($page) : $page);
$this->smartyOutputContent($this->layout);
$this->smartyOutputContent(array($header_tpl, $this->layout, $footer_tpl));
}
/**
@@ -1973,12 +1984,10 @@ class AdminControllerCore extends Controller
if ($this->display_header)
$this->context->smarty->assign('displayBackOfficeHeader', Hook::exec('displayBackOfficeHeader', array()));
$this->context->smarty->assign(
array(
'displayBackOfficeTop' => Hook::exec('displayBackOfficeTop', array()),
'submit_form_ajax' => (int)Tools::getValue('submitFormAjax')
)
);
$this->context->smarty->assign(array(
'displayBackOfficeTop' => Hook::exec('displayBackOfficeTop', array()),
'submit_form_ajax' => (int)Tools::getValue('submitFormAjax')
));
$this->initProcess();
}
+5 -1
View File
@@ -354,7 +354,11 @@ abstract class ControllerCore
protected function smartyOutputContent($content)
{
$this->context->cookie->write();
$this->context->smarty->display($content);
if (is_array($content))
foreach ($content as $tpl)
$this->context->smarty->display($tpl);
else
$this->context->smarty->display($content);
}
protected function isCached($template, $cacheId = null, $compileId = null)