|
Ubiquity 2.5.2
php rapid development framework
|
Base class for controllers. More...
Inheritance diagram for Controller:Public Member Functions | |
| index () | |
| Default action. | |
| __construct () | |
| Constructor initialize $view variable. | |
| initialize () | |
| Method called before each action Can be override in derived class. | |
| finalize () | |
| Method called after each action Can be override in derived class. | |
| loadView (string $viewName, $pData=null, bool $asString=false) | |
| Loads the view $viewName possibly passing the variables $pdata. | |
| loadDefaultView ($pData=null, bool $asString=false) | |
| Loads the default view (controllerName/actionName) possibly passing the variables $pdata. | |
| getDefaultViewName () | |
| Returns the default view name for this controller/action i.e ControllerName/actionName.html for the action actionName in ControllerName If there is an activeTheme @activeTheme/ControllerName/actionName.html | |
| isValid ($action) | |
| Returns True if access to the controller is allowed To be override in sub classes. | |
| onInvalidControl () | |
| Called if isValid () returns false To be override in sub classes. | |
| forward (string $controller, string $action='index', $params=[], bool $initialize=false, bool $finalize=false) | |
| Loads the controller $controller and calls its $action method by passing the parameters $params. | |
| redirectToRoute (string $routeName, $parameters=[], bool $initialize=false, bool $finalize=false) | |
| Redirect to a route by its name. | |
| getView () | |
| Returns the associated view instance. | |
Protected Attributes | |
| View | $view |
Base class for controllers.
Ubiquity\controllers$Controller This class is part of Ubiquity
Definition at line 20 of file Controller.php.
| __construct | ( | ) |
Constructor initialize $view variable.
Reimplemented in CRUDController, RestBaseController, and SimpleViewController.
Definition at line 38 of file Controller.php.
| finalize | ( | ) |
Method called after each action Can be override in derived class.
Reimplemented in AuthController, ControllerBase, and RestBaseController.
Definition at line 53 of file Controller.php.
| forward | ( | string | $controller, |
| string | $action = 'index', |
||
$params = [], |
|||
| bool | $initialize = false, |
||
| bool | $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 |
Exception
Definition at line 133 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 If there is an activeTheme @activeTheme/ControllerName/actionName.html
Definition at line 95 of file Controller.php.
| getView | ( | ) |
Returns the associated view instance.
Definition at line 176 of file Controller.php.
|
abstract |
Default action.
Reimplemented in AuthController, CRUDController, RestBaseController, and SeoController.
| initialize | ( | ) |
Method called before each action Can be override in derived class.
Reimplemented in AuthController, AuthControllerConfig, ControllerBase, MultiResourceCRUDController, RestBaseController, and RestResourceController.
Definition at line 46 of file Controller.php.
| isValid | ( | $action | ) |
Returns True if access to the controller is allowed To be override in sub classes.
| string | $action |
Reimplemented in AuthController, and RestBaseController.
Definition at line 109 of file Controller.php.
| loadDefaultView | ( | $pData = null, |
|
| bool | $asString = false |
||
| ) |
Loads the default view (controllerName/actionName) possibly passing the variables $pdata.
(@activeTheme/controllerName/actionName if themes are activated)
| mixed | $pData | Variable or associative array to pass to the view If a variable is passed, it will have the name $data 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) |
Exception
Definition at line 85 of file Controller.php.
| loadView | ( | string | $viewName, |
$pData = null, |
|||
| bool | $asString = false |
||
| ) |
Loads the view $viewName possibly passing the variables $pdata.
| string | $viewName | The name of the view to load |
| mixed | $pData | Variable or associative array to pass to the view If a variable is passed, it will have the name $data 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) |
Exception
Reimplemented in SimpleViewAsyncController, and SimpleViewController.
Definition at line 67 of file Controller.php.
| onInvalidControl | ( | ) |
Called if isValid () returns false To be override in sub classes.
Reimplemented in RestBaseController.
Definition at line 117 of file Controller.php.
| redirectToRoute | ( | string | $routeName, |
$parameters = [], |
|||
| bool | $initialize = false, |
||
| bool | $finalize = false |
||
| ) |
Redirect to a route by its name.
| string | $routeName | The route name |
| array | $parameters | The parameters to pass to the route action |
| boolean | $initialize | Call the initialize method if true |
| boolean | $finalize | Call the finalize method if true |
| RouterException |
Definition at line 152 of file Controller.php.
|
protected |
Definition at line 27 of file Controller.php.