// change to Controller workflow
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8813 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+13
-26
@@ -111,37 +111,30 @@ class AdminControllerCore extends Controller
|
||||
return (!empty($token) AND $token === $this->token);
|
||||
}
|
||||
|
||||
public function action()
|
||||
public function postProcess()
|
||||
{
|
||||
if (!$this->ajax)
|
||||
{
|
||||
$this->postProcess();
|
||||
$this->setMedia();
|
||||
$this->initHeader();
|
||||
$this->initFooter();
|
||||
//$adminObj->displayConf();
|
||||
//$adminObj->displayErrors();
|
||||
}
|
||||
else
|
||||
if ($this->ajax)
|
||||
{
|
||||
// from ajax-tab.php
|
||||
if(method_exists($this,'ajaxPreprocess'))
|
||||
if (method_exists($this, 'ajaxPreprocess'))
|
||||
$this->ajaxPreProcess();
|
||||
|
||||
$action = Tools::getValue('action');
|
||||
// no need to use displayConf() here
|
||||
if (!empty($action) AND method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action)) )
|
||||
if (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action)))
|
||||
$this->{'ajaxProcess'.Tools::toCamelCase($action)}();
|
||||
else
|
||||
$this->ajaxProcess();
|
||||
|
||||
// @TODO We should use a displayAjaxError
|
||||
$this->displayErrors();
|
||||
if (!empty($action) AND method_exists($this, 'displayAjax'.Tools::toCamelCase($action)) )
|
||||
$this->{'displayAjax'.$action}();
|
||||
else
|
||||
$this->displayAjax();
|
||||
|
||||
// @TODO We should use a displayAjaxError
|
||||
/*$this->displayErrors();
|
||||
if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action)))
|
||||
$this->{'displayAjax'.$action}();
|
||||
else
|
||||
$this->displayAjax(); */
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,10 +542,4 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
p($this->_errors);
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+25
-4
@@ -73,7 +73,7 @@ abstract class ControllerCore
|
||||
/**
|
||||
* Do the page treatment : post process, ajax process, etc.
|
||||
*/
|
||||
abstract public function action();
|
||||
abstract public function postProcess();
|
||||
|
||||
/**
|
||||
* Display page view
|
||||
@@ -111,12 +111,18 @@ abstract class ControllerCore
|
||||
public function run()
|
||||
{
|
||||
$this->init();
|
||||
$this->action();
|
||||
$this->postProcess();
|
||||
if ($this->displayHeader)
|
||||
{
|
||||
$this->setMedia();
|
||||
$this->initHeader();
|
||||
}
|
||||
$this->initContent();
|
||||
if ($this->displayFooter)
|
||||
$this->initFooter();
|
||||
|
||||
if ($this->ajax)
|
||||
{
|
||||
$this->displayAjax();
|
||||
}
|
||||
else
|
||||
$this->display();
|
||||
}
|
||||
@@ -135,7 +141,22 @@ abstract class ControllerCore
|
||||
{
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign smarty variables for the page header
|
||||
*/
|
||||
abstract public function initHeader();
|
||||
|
||||
/**
|
||||
* Assign smarty variables for the page main content
|
||||
*/
|
||||
abstract public function initContent();
|
||||
|
||||
/**
|
||||
* Assign smarty variables for the page footer
|
||||
*/
|
||||
abstract public function initFooter();
|
||||
|
||||
/**
|
||||
* Add a new stylesheet in page header.
|
||||
*
|
||||
|
||||
+12
-16
@@ -87,6 +87,12 @@ class FrontControllerCore extends Controller
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($this->ajax)
|
||||
{
|
||||
$this->displayHeader(false);
|
||||
$this->displayFooter(false);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
// Switch language if needed and init cookie language
|
||||
@@ -335,7 +341,7 @@ class FrontControllerCore extends Controller
|
||||
$this->context->controller = $this;
|
||||
}
|
||||
|
||||
public function action()
|
||||
public function postProcess()
|
||||
{
|
||||
/*// For retrocompatibility with versions before 1.5, preProcess support will be removed on next release
|
||||
if (method_exists(get_class($this), 'preProcess'))
|
||||
@@ -347,25 +353,15 @@ class FrontControllerCore extends Controller
|
||||
$this->preProcess();
|
||||
}
|
||||
}*/
|
||||
|
||||
if ($this->ajax)
|
||||
{
|
||||
$this->displayHeader(false);
|
||||
$this->displayFooter(false);
|
||||
}
|
||||
$this->preProcess();
|
||||
|
||||
// Prepare generation of page display
|
||||
$this->processHeader();
|
||||
$this->process();
|
||||
$this->processFooter();
|
||||
|
||||
//$this->preProcess();
|
||||
}
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
}
|
||||
|
||||
public function process()
|
||||
public function initContent()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -508,7 +504,7 @@ class FrontControllerCore extends Controller
|
||||
$this->addCSS(_THEME_CSS_DIR_.'rtl.css');
|
||||
}
|
||||
|
||||
public function processHeader()
|
||||
public function initHeader()
|
||||
{
|
||||
// P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
|
||||
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
|
||||
@@ -548,7 +544,7 @@ class FrontControllerCore extends Controller
|
||||
$this->context->smarty->assign('js_files', array_unique($this->js_files));
|
||||
}
|
||||
|
||||
public function processFooter()
|
||||
public function initFooter()
|
||||
{
|
||||
$this->context->smarty->assign(array(
|
||||
'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn', array('cart' => $this->context->cart)),
|
||||
|
||||
Reference in New Issue
Block a user