7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
16 * @package Zend_Controller
17 * @subpackage Zend_Controller_Action_Helper
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
24 * @see Zend_Controller_Action
26 require_once 'Zend/Controller/Action.php';
30 * @package Zend_Controller
31 * @subpackage Zend_Controller_Action_Helper
32 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
35 abstract class Zend_Controller_Action_Helper_Abstract
40 * @var Zend_Controller_Action $_actionController
42 protected $_actionController = null;
45 * @var mixed $_frontController
47 protected $_frontController = null;
50 * setActionController()
52 * @param Zend_Controller_Action $actionController
53 * @return Zend_Controller_ActionHelper_Abstract Provides a fluent interface
55 public function setActionController(Zend_Controller_Action
$actionController = null)
57 $this->_actionController
= $actionController;
62 * Retrieve current action controller
64 * @return Zend_Controller_Action
66 public function getActionController()
68 return $this->_actionController
;
72 * Retrieve front controller instance
74 * @return Zend_Controller_Front
76 public function getFrontController()
78 return Zend_Controller_Front
::getInstance();
82 * Hook into action controller initialization
86 public function init()
91 * Hook into action controller preDispatch() workflow
95 public function preDispatch()
100 * Hook into action controller postDispatch() workflow
104 public function postDispatch()
111 * @return Zend_Controller_Request_Abstract $request
113 public function getRequest()
115 $controller = $this->getActionController();
116 if (null === $controller) {
117 $controller = $this->getFrontController();
120 return $controller->getRequest();
126 * @return Zend_Controller_Response_Abstract $response
128 public function getResponse()
130 $controller = $this->getActionController();
131 if (null === $controller) {
132 $controller = $this->getFrontController();
135 return $controller->getResponse();
143 public function getName()
145 $full_class_name = get_class($this);
147 if (strpos($full_class_name, '_') !== false) {
148 $helper_name = strrchr($full_class_name, '_');
149 return ltrim($helper_name, '_');
151 return $full_class_name;