// Norm on controllers

This commit is contained in:
rMalie
2011-09-30 13:50:55 +00:00
parent 8d19f130d7
commit f65df2f2ae
38 changed files with 252 additions and 272 deletions
+12 -8
View File
@@ -48,7 +48,7 @@ abstract class ControllerCore
/**
* @var bool check if header will be displayed
*/
protected $displayHeader = false;
protected $display_header;
/**
* @var string template name for page content
@@ -58,7 +58,7 @@ abstract class ControllerCore
/**
* @var string check if footer will be displayed
*/
protected $displayFooter = false;
protected $display_footer;
/**
* @var bool If ajax parameter is detected in request, set this flag to true
@@ -99,8 +99,12 @@ abstract class ControllerCore
public function __construct()
{
$this->displayHeader(true);
$this->displayFooter(true);
if (is_null($this->display_header))
$this->display_header = true;
if (is_null($this->display_footer))
$this->display_footer = true;
$this->context = Context::getContext();
$this->ajax = Tools::getValue('ajax') || Tools::isSubmit('ajax');
}
@@ -117,14 +121,14 @@ abstract class ControllerCore
else
$this->postProcess();
if ($this->displayHeader)
if ($this->display_header)
{
$this->setMedia();
$this->initHeader();
}
$this->initContent();
if ($this->displayFooter)
if ($this->display_footer)
$this->initFooter();
if ($this->ajax && method_exists($this, 'displayAjax'))
@@ -135,12 +139,12 @@ abstract class ControllerCore
public function displayHeader($display = true)
{
$this->displayHeader = $display;
$this->display_header = $display;
}
public function displayFooter($display = true)
{
$this->displayFooter = $display;
$this->display_footer = $display;
}
public function setTemplate($template)
+4 -4
View File
@@ -89,8 +89,8 @@ class FrontControllerCore extends Controller
if ($this->ajax)
{
$this->displayHeader(false);
$this->displayFooter(false);
$this->display_header = false;
$this->display_footer = false;
}
ob_start();
@@ -375,13 +375,13 @@ class FrontControllerCore extends Controller
Tools::safePostVars();
$this->context->smarty->assign('errors', $this->errors);
if ($this->displayHeader)
if ($this->display_header)
$this->context->smarty->display(_PS_THEME_DIR_.'header.tpl');
if ($this->template)
$this->context->smarty->display($this->template);
if ($this->displayFooter)
if ($this->display_footer)
$this->context->smarty->display(_PS_THEME_DIR_.'footer.tpl');
// live edit