From b6ca25f6fc021e68275405d78e5b197a43ad4f7c Mon Sep 17 00:00:00 2001 From: vinnl Date: Fri, 21 Mar 2008 12:42:30 +0100 Subject: [PATCH] Notifications are now displayed. --- .../library/Pivip/Controller/Module/Abstract.php | 1 + .../modules/notify/controllers/IndexController.php | 24 +++++++++++++++++++--- .../notify/views/scripts/index/notifications.phtml | 24 +++++++++++++++++++++- .../modules/page/controllers/IndexController.php | 22 ++++++++++++-------- project/modules/page/plugins/SegmentMapper.php | 2 ++ 5 files changed, 60 insertions(+), 13 deletions(-) rewrite project/modules/notify/views/scripts/index/notifications.phtml (100%) diff --git a/project/library/Pivip/Controller/Module/Abstract.php b/project/library/Pivip/Controller/Module/Abstract.php index 21b8eb9..8ea7150 100644 --- a/project/library/Pivip/Controller/Module/Abstract.php +++ b/project/library/Pivip/Controller/Module/Abstract.php @@ -42,5 +42,6 @@ class Pivip_Controller_Module_Abstract extends Zend_Controller_Action array $invokeArgs = array()) { parent::__construct($request, $response, $invokeArgs); + $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger'); } } \ No newline at end of file diff --git a/project/modules/notify/controllers/IndexController.php b/project/modules/notify/controllers/IndexController.php index 6259226..c39305a 100644 --- a/project/modules/notify/controllers/IndexController.php +++ b/project/modules/notify/controllers/IndexController.php @@ -28,7 +28,7 @@ /** * Load a page's blocks */ -class IndexController extends Pivip_Controller_Module_Abstract +class Notify_IndexController extends Pivip_Controller_Module_Abstract { /** * Loads the blocks of a certain page @@ -37,7 +37,25 @@ class IndexController extends Pivip_Controller_Module_Abstract */ public function notificationsAction() { - $this->view->notifications = - $this->_helper->FlashMessenger->getMessages(); + $error = $this->_flashMessenger->setNamespace('error')->getMessages(); + foreach($error as $notification) + { + $this->view->placeholder('error')->set($notification); + } + $warning = $this->_flashMessenger->setNamespace('warning')->getMessages(); + foreach($warning as $notification) + { + $this->view->placeholder('warning')->set($notification); + } + $tip = $this->_flashMessenger->setNamespace('tip')->getMessages(); + foreach($tip as $notification) + { + $this->view->placeholder('information')->set($notification); + } + $information = $this->_flashMessenger->resetNamespace()->getMessages(); + foreach($information as $notification) + { + $this->view->placeholder('information')->set($notification); + } } } \ No newline at end of file diff --git a/project/modules/notify/views/scripts/index/notifications.phtml b/project/modules/notify/views/scripts/index/notifications.phtml dissimilarity index 100% index 0448a69..fe52129 100644 --- a/project/modules/notify/views/scripts/index/notifications.phtml +++ b/project/modules/notify/views/scripts/index/notifications.phtml @@ -1 +1,23 @@ -notifications); \ No newline at end of file +placeholder('error')->setPrefix('
') + ->setSeparator('
') + ->setIndent("\t\t\t") + ->setPostfix('
'); +$this->placeholder('warning')->setPrefix('
') + ->setSeparator('
') + ->setIndent("\t\t\t") + ->setPostfix('
'); +$this->placeholder('tip')->setPrefix('
') + ->setSeparator('
') + ->setIndent("\t\t\t") + ->setPostfix('
'); +$this->placeholder('information')->setPrefix('
') + ->setSeparator('
') + ->setIndent("\t\t\t") + ->setPostfix('
'); + +echo $this->placeholder('error'); +echo $this->placeholder('warning'); +echo $this->placeholder('tip'); +echo $this->placeholder('information'); \ No newline at end of file diff --git a/project/modules/page/controllers/IndexController.php b/project/modules/page/controllers/IndexController.php index b973b27..fa0b9b6 100644 --- a/project/modules/page/controllers/IndexController.php +++ b/project/modules/page/controllers/IndexController.php @@ -46,6 +46,19 @@ class IndexController extends Pivip_Controller_Module_Abstract */ public function commonAction() { + $nextRequest = new Zend_Controller_Request_Simple('notifications', + 'index', + 'notify'); + $this->_helper->actionStack($nextRequest); + } + + /** + * Adds stylesheets and loads the blocks of a certain page + * + * @throws Page_Exception + */ + public function indexAction() + { $pageConfig = new Zend_Config_Ini('./modules/page/config.ini'); try { @@ -84,15 +97,6 @@ class IndexController extends Pivip_Controller_Module_Abstract $this->view->headLink($stylesheet); } } - } - - /** - * Loads the blocks of a certain page - * - * @throws Page_Exception - */ - public function indexAction() - { $this->commonAction(); } } \ No newline at end of file diff --git a/project/modules/page/plugins/SegmentMapper.php b/project/modules/page/plugins/SegmentMapper.php index f2c9a9b..f718f96 100644 --- a/project/modules/page/plugins/SegmentMapper.php +++ b/project/modules/page/plugins/SegmentMapper.php @@ -52,6 +52,8 @@ class SegmentMapper extends Zend_Controller_Plugin_Abstract // Break intentionally omitted case 'menu': // Break intentionally omitted + case 'notifications': + // Break intentionally omitted case 'sidebar': // Break intentionally omitted case 'aside': -- 2.11.4.GIT