5 * Copyright (C) 2008 Vincent Tunru
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 * @license http://www.fsf.org/licensing/licenses/info/GPLv2.html GPL v.2
23 * @copyright (C) 2008 Vincent Tunru
24 * @author Vincent Tunru <email@vincentt.org>
30 class Pivip_Controller_Module_Abstract
extends Zend_Controller_Action
33 * Set the view script to the one associated with the current module
35 * @param Zend_Controller_Request_Abstract $request The request object
36 * @param Zend_Controller_Response_Abstract $response The response object
37 * @param array $invokeArgs Any additional invocation arguments
40 public function __construct(Zend_Controller_Request_Abstract
$request,
41 Zend_Controller_Response_Abstract
$response,
42 array $invokeArgs = array())
44 parent
::__construct($request, $response, $invokeArgs);
45 $this->_flashMessenger
= $this->_helper
->getHelper('FlashMessenger');
46 $this->_logger
= Zend_Registry
::get('logger');
47 $parts = explode('_', get_class($this));
48 $moduleName = strtolower($parts[0]);
49 $this->_logger
->setEventItem('module', $moduleName);
53 * Redirect the visitor to the current page
55 * @param string $message A message to display to the user.
57 protected function _refresh($message = null, $namespace = null)
61 $translate = Zend_Registry
::get('Zend_Translate');
64 $this->_flashMessenger
->resetNamespace()
65 ->addMessage($translate->_($message));
67 $this->_flashMessenger
->setNamespace($namespace)
68 ->addMessage($translate->_($message));
71 $this->_redirect($this->_request
->getRequestUri());