From b725fd2d4a2139690f83070addd8ac0c96e68ddd Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Fri, 4 Jan 2013 11:45:17 +0100 Subject: [PATCH] //small refacto --- classes/controller/AdminController.php | 30 +++++++------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 31329126b..d4a5d3800 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -1159,33 +1159,19 @@ class AdminControllerCore extends Controller $this->context->smarty->assign('conf', Tools::jsonEncode($this->_conf[(int)$conf])); else $this->context->smarty->assign('conf', $this->_conf[(int)$conf]); - - - if ($this->json) - $this->context->smarty->assign('errors', Tools::jsonEncode($this->errors)); - else - $this->context->smarty->assign('errors', $this->errors); - - if ($this->json) - $this->context->smarty->assign('warnings', Tools::jsonEncode($this->warnings)); - else - $this->context->smarty->assign('warnings', $this->warnings); - - - if ($this->json) - $this->context->smarty->assign('informations', Tools::jsonEncode($this->informations)); - else - $this->context->smarty->assign('informations', $this->informations); - - if ($this->json) - $this->context->smarty->assign('confirmations', Tools::jsonEncode($this->confirmations)); - else - $this->context->smarty->assign('confirmations', $this->confirmations); + + $notifications_type = array('errors', 'warnings', 'informations', 'confirmations'); + foreach($notifications_type as $type) + if ($this->json) + $this->context->smarty->assign($type, Tools::jsonEncode($this->$type)); + else + $this->context->smarty->assign($type, $this->$type); if ($this->json) $this->context->smarty->assign('page', Tools::jsonEncode($page)); else $this->context->smarty->assign('page', $page); + $this->smartyOutputContent($this->layout); }