34,8 → 34,17 |
protected $_defaultAction = 'index'; |
|
/** |
* If an array, maps an action name to an action method of the controller. |
* |
* Fallback for IE 7 where the content of a <code>button</code> element |
* is submitted as value. |
* |
* @var array |
*/ |
protected $_actionMap = null; |
|
/** |
* The {@link View} used by this controller |
* |
* @var View |
*/ |
protected $_view = null; |
50,8 → 59,7 |
* Resource path of the template for the view. The default |
* is the empty string. |
*/ |
protected function __construct($viewClass = 'View', |
$template = null) |
protected function __construct($viewClass = 'View', $template = null) |
{ |
$this->_view = new $viewClass($template); |
|
65,7 → 73,18 |
$action = $this->_defaultAction; |
} |
|
$this->{lcfirst($action) . 'Action'}(); |
$actionMethod = lcfirst($action) . 'Action'; |
|
/* Fallback for IE 7 where the content of a `button' element is submitted as value */ |
if (!method_exists($this, $actionMethod)) |
{ |
if (is_array($this->_actionMap) && array_key_exists($action, $this->_actionMap)) |
{ |
$actionMethod = $this->_actionMap[$action]; |
} |
} |
|
$this->$actionMethod(); |
} |
|
/** |