Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 43 → Rev 42

/trunk/Controller.php
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,9 → 57,7
* View class. The default is <code>'View'</code>.
* @param string $template
* Resource path of the template for the view. The default
* is to <code>null</code> (no template).
*
* @see View::__construct()
* is the empty string.
*/
protected function __construct($viewClass = 'View', $template = null)
{
66,9 → 64,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)
{
76,7 → 74,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))
{
85,10 → 83,10
$actionMethod = $this->_actionMap[$action];
}
}
 
$this->$actionMethod();
}
 
/**
* Assigns a value to a template variable (after this,
* <var>$value</var> is available through
111,7 → 109,7
{
return $this->_view->assign($name, $value, $encodeHTML);
}
 
/**
* Renders the {@link View} associated with this controller
* by including the <code>View</code>'s template.