// Refacto of controllers PART 2

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8802 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-09-27 13:04:24 +00:00
parent fc88323443
commit 6a1ea62d13
4 changed files with 292 additions and 207 deletions
+13 -3
View File
@@ -25,6 +25,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* @since 1.5.0
*/
abstract class ControllerCore
{
/**
@@ -57,6 +60,11 @@ abstract class ControllerCore
*/
protected $displayFooter = false;
/**
* @var bool If ajax parameter is detected in request, set this flag to true
*/
protected $ajax = false;
/**
* Initialize the page
*/
@@ -64,7 +72,6 @@ abstract class ControllerCore
/**
* Do the page treatment : post process, ajax process, etc.
* Enter description here ...
*/
abstract public function action();
@@ -92,16 +99,19 @@ abstract class ControllerCore
public function __construct()
{
$this->displayHeader(true);
$this->displayFooter(true);
$this->context = Context::getContext();
$this->ajax = Tools::getValue('ajax') || Tools::isSubmit('ajax');
}
/**
* Start controller process
* Start controller process (this method shouldn't be overriden !)
*/
public function run()
{
$this->init();
$this->action();
$this->action(array('titi'), $this);
$this->display();
}