29 abstract public function index();
36 $this->view =
new View ();
66 public function loadView($viewName, $pData = NULL, $asString =
false) {
68 $this->view->setVars ( $pData );
69 return $this->view->render ( $viewName, $asString );
110 \header (
'HTTP/1.1 401 Unauthorized',
true, 401 );
128 public function forward($controller, $action =
"index", $params = array(), $initialize =
false, $finalize =
false) {
129 $u = array ($controller,$action );
130 if (\is_array ( $params )) {
131 $u = \array_merge ( $u, $params );
133 $u = \array_merge ( $u, [ $params ] );
147 public function redirectToRoute($routeName, $parameters = [], $initialize =
false, $finalize =
false) {
149 if ($path !==
false) {
151 if ($route !==
false) {
152 return $this->
forward ( $route [0], $route [1], \array_slice ( $route, 2 ), $initialize, $finalize );
isValid($action)
Returns True if access to the controller is allowed To be override in sub classes.
loadDefaultView($pData=NULL, $asString=false)
Loads the default view (controllerName/actionName) possibly passing the variables $pdata...
static getControllerSimpleName()
finalize()
Method called after each action Can be override in derived class.
getDefaultViewName()
Returns the default view name for this controller/action i.e ControllerName/actionName.html for the action actionName in ControllerName.
loadView($viewName, $pData=NULL, $asString=false)
Loads the view $viewName possibly passing the variables $pdata.
Base class for controllers.
static getRoute($path, $cachedResponse=true)
forward($controller, $action="index", $params=array(), $initialize=false, $finalize=false)
Loads the controller $controller and calls its $action method by passing the parameters $params...
static runAction($u, $initialize=true, $finalize=true)
initialize()
Method called before each action Can be override in derived class.
static getRouteByName($name, $parameters=[], $absolute=true)
Returns the generated path from a route.
static getViewNameFileExtension()
This file is part of Ubiquity framework.
__construct()
Constructor initialize $view variable.
onInvalidControl()
Called if isValid () returns false To be override in sub classes.
redirectToRoute($routeName, $parameters=[], $initialize=false, $finalize=false)
Redirect to a route by its name.