32,7 → 32,7 |
* @var string |
*/ |
protected $_defaultAction = 'index'; |
|
|
/** |
* If an array, maps an action name to an action method of the controller. |
* |
42,13 → 42,13 |
* @var array |
*/ |
protected $_actionMap = null; |
|
|
/** |
* The {@link View} used by this controller |
* @var View |
*/ |
protected $_view = null; |
|
|
/** |
* Constructs a controller, initializes the related view, |
* and calls the controller's URI-indicated action method. |
57,7 → 57,9 |
* View class. The default is <code>'View'</code>. |
* @param string $template |
* Resource path of the template for the view. The default |
* is the empty string. |
* is to <code>null</code> (no template). |
* |
* @see View::__construct() |
*/ |
protected function __construct($viewClass = 'View', $template = null) |
{ |
64,9 → 66,9 |
$this->_view = new $viewClass($template); |
|
Application::getInstance()->setCurrentController($this); |
|
|
$action = Application::getParam('action', $_REQUEST); |
|
|
/* NOTE: No `==='; treat empty action like no specific action */ |
if ($action == null) |
{ |
74,7 → 76,7 |
} |
|
$actionMethod = lcfirst($action) . 'Action'; |
|
|
/* Fallback for IE 7 where the content of a `button' element is submitted as value */ |
if (!method_exists($this, $actionMethod)) |
{ |
83,10 → 85,10 |
$actionMethod = $this->_actionMap[$action]; |
} |
} |
|
|
$this->$actionMethod(); |
} |
|
|
/** |
* Assigns a value to a template variable (after this, |
* <var>$value</var> is available through |
109,7 → 111,7 |
{ |
return $this->_view->assign($name, $value, $encodeHTML); |
} |
|
|
/** |
* Renders the {@link View} associated with this controller |
* by including the <code>View</code>'s template. |