Working to get installation working smootly.
[pivip.git] / project / library / Pivip / Controller / Module / Abstract.php
blobc97b56f86a472e1c945ee83e5cc304dd6994aa69
1 <?php
3 /**
4 * Pivip
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
21 * @category Pivip
22 * @package Pivip
23 * @copyright (C) 2008 Vincent Tunru
24 * @author Vincent Tunru <email@vincentt.org>
27 /**
30 class Pivip_Controller_Module_Abstract extends Zend_Controller_Action
32 /**
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
38 * @return void
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);
52 /**
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)
59 if(!empty($message))
61 $translate = Zend_Registry::get('Zend_Translate');
62 if(empty($namespace))
64 $this->_flashMessenger->resetNamespace()
65 ->addMessage($translate->_($message));
66 } else {
67 $this->_flashMessenger->setNamespace($namespace)
68 ->addMessage($translate->_($message));
71 $this->_redirect($this->_request->getRequestUri());