Ubiquity
2.0.3
php rapid development framework
|
Base class for controllers. More...
Public Member Functions | |
index () | |
Default action. More... | |
__construct () | |
Constructor initialize $view variable. More... | |
initialize () | |
Method called before each action Can be override in derived class. More... | |
finalize () | |
Method called after each action Can be override in derived class. More... | |
loadView ($viewName, $pData=NULL, $asString=false) | |
Loads the view $viewName possibly passing the variables $pdata. More... | |
loadDefaultView ($pData=NULL, $asString=false) | |
Loads the default view (controllerName/actionName) possibly passing the variables $pdata. More... | |
getDefaultViewName () | |
Returns the default view name for this controller/action i.e ControllerName/actionName.html for the action actionName in ControllerName. More... | |
isValid ($action) | |
Returns True if access to the controller is allowed To be override in sub classes. More... | |
onInvalidControl () | |
Called if isValid () returns false To be override in sub classes. More... | |
forward ($controller, $action="index", $params=array(), $initialize=false, $finalize=false) | |
Loads the controller $controller and calls its $action method by passing the parameters $params. More... | |
redirectToRoute ($routeName, $parameters=[], $initialize=false, $finalize=false) | |
Redirect to a route by its name. More... | |
getView () | |
Protected Attributes | |
$view | |
__construct | ( | ) |
Constructor initialize $view variable.
Definition at line 35 of file Controller.php.
finalize | ( | ) |
Method called after each action Can be override in derived class.
Definition at line 50 of file Controller.php.
forward | ( | $controller, | |
$action = "index" , |
|||
$params = array() , |
|||
$initialize = false , |
|||
$finalize = false |
|||
) |
Loads the controller $controller and calls its $action method by passing the parameters $params.
string | $controller | The Controller |
string | $action | The action to call |
mixed | $params | Parameters passed to the $action method |
boolean | $initialize | If true, the controller's initialize method is called before $action |
boolean | $finalize | If true, the controller's finalize method is called after $action |
Definition at line 128 of file Controller.php.
getDefaultViewName | ( | ) |
Returns the default view name for this controller/action i.e ControllerName/actionName.html for the action actionName in ControllerName.
Definition at line 90 of file Controller.php.
getView | ( | ) |
Definition at line 165 of file Controller.php.
|
abstract |
Default action.
initialize | ( | ) |
Method called before each action Can be override in derived class.
Definition at line 43 of file Controller.php.
isValid | ( | $action | ) |
Returns True if access to the controller is allowed To be override in sub classes.
string | $action |
Definition at line 101 of file Controller.php.
loadDefaultView | ( | $pData = NULL , |
|
$asString = false |
|||
) |
Loads the default view (controllerName/actionName) possibly passing the variables $pdata.
mixed | $pData | Variable or associative array to pass to the view If a variable is passed, it will have the name $ data </ b> in the view, If an associative array is passed, the view retrieves variables from the table's key names |
boolean | $asString | If true, the view is not displayed but returned as a string (usable in a variable) |
Definition at line 82 of file Controller.php.
loadView | ( | $viewName, | |
$pData = NULL , |
|||
$asString = false |
|||
) |
Loads the view $viewName possibly passing the variables $pdata.
string | $viewName | view name to load |
mixed | $pData | Variable or associative array to pass to the view If a variable is passed, it will have the name $ data </ b> in the view, If an associative array is passed, the view retrieves variables from the table's key names |
boolean | $asString | If true, the view is not displayed but returned as a string (usable in a variable) |
Definition at line 66 of file Controller.php.
onInvalidControl | ( | ) |
Called if isValid () returns false
To be override in sub classes.
Definition at line 109 of file Controller.php.
redirectToRoute | ( | $routeName, | |
$parameters = [] , |
|||
$initialize = false , |
|||
$finalize = false |
|||
) |
Redirect to a route by its name.
string | $routeName | |
array | $parameters | |
boolean | $initialize | |
boolean | $finalize |
RouterException |
Definition at line 147 of file Controller.php.
|
protected |
Definition at line 24 of file Controller.php.