ControllerWithTemplateAbstract extends ControllerAbstract
Table of Contents
- $action : string
- $area : string
- $cookie : VanillaCookieExtended
- $currentNavigationVoice : array<string|int, mixed>
- $DIContainer : ContainerInterface
- $labels : object
- $language : object
- $languages : object
- $navigations : array<string|int, mixed>
- $needsAuthentication : bool
- $request : ServerRequestInterface
- $response : ResponseInterface
- $routeParameters : object
- $template : Environment
- $templateParameters : array<string|int, mixed>
- __construct() : mixed
- Constructor
- __invoke() : ResponseInterface
- Get invoked by request handler
- getNavigations() : mixed
- Gets navigations
- addTemplateFilter() : mixed
- Adds a template filter
- addTemplateFunction() : mixed
- Adds a template function
- buildTemplateHelpersBack() : mixed
- Build common template helpers going up the inheritance chain, used to generate templates cache during translations extraction
- checkAtLeastOnePermission() : bool
- Checks whether current user has at least one permission among one set
- checkPermission() : bool
- Checks whether current user has a certain permission
- checkRouteParameters() : mixed
- Checks mandatory route parameters
- doBeforeActionExecution() : mixed
- Performs some operations before action execution
- getAreaCookie() : object
- Gets current area cookie as an object
- getAuthenticatedUserData() : mixed
- Return authenticated user data (if any)
- handleActionExecution() : mixed
- Handles action execution
- initTraits() : mixed
- Inits used traits searching for magic method __initTrait[trait-name]
- isAuthenticated() : bool
- Checks if user is currently authenticated
- isNavigationRouteCurrentRoute() : mixed
- Checks whether a given navigation route corresponds to the current route
- loadAreaNavigation() : mixed
- Loads area navigation
- loadLanguages() : mixed
- Loads configured language
- loadNavigation() : mixed
- Loads area navigation from a file
- loadNavigationLevel() : mixed
- Loads a navigation level
- output() : mixed
- Outputs
- processRecordsetForInput() : array<string|int, mixed>
- Processes a recordset to be used in a radio, checkbox or select mapping fields to value and label
- redirect() : mixed
- Redirects to a route
- renderTemplate() : mixed
- Renders template and injects HTML code into response
- renderTemplateCode() : string
- Renders template and injects HTML code into response
- setAreaCookie() : mixed
- Sets a cookie into current area cookies portion
- setAreaCookieArray() : mixed
- Sets a cookie into current area cookies portion
- setLanguage() : mixed
- Gets & sets language
- setNavigationVoiceParentsActive() : mixed
- Sets recursevely voice parent as active
- setTemplateParameter() : mixed
- pass a parameter to the template angine
- setUploadMaxFilesizeTemplateParameters() : mixed
- Sets template parameters necessary to file upload to be overridden if necessary by derived classes
- storeRequest() : mixed
- Stores request and related informations
- stp() : mixed
- short alias for the - much used - setTemplateParameter method
- turnPathToUrl() : string
- Turns a local path from root into an URL prepending current scheme and domain
- verifyAuthentication() : bool
- Checks if authenticaion is needed and is valid
- buildCommonTemplateHelpers() : mixed
- Builds common template helpers NOTE: do not change visibility
- setCommonTemplateParameters() : mixed
- Sets common template parameters
Properties
$action
protected
string
$action
$area
protected
string
$area
$cookie
protected
VanillaCookieExtended
$cookie
$currentNavigationVoice
protected
array<string|int, mixed>
$currentNavigationVoice
= []
$DIContainer
protected
ContainerInterface
$DIContainer
$labels
protected
object
$labels
$language
protected
object
$language
$languages
protected
object
$languages
= null
$navigations
protected
array<string|int, mixed>
$navigations
= []
$needsAuthentication
protected
bool
$needsAuthentication
= false
$request
protected
ServerRequestInterface
$request
$response
protected
ResponseInterface
$response
$routeParameters
protected
object
$routeParameters
$template
protected
Environment
$template
$templateParameters
protected
array<string|int, mixed>
$templateParameters
= []
Methods
__construct()
Constructor
public
__construct(ContainerInterface $DIContainer, ResponseInterface $response, Environment $templateEngine, VanillaCookieExtended $cookie) : mixed
Parameters
- $DIContainer : ContainerInterface
- $response : ResponseInterface
- $templateEngine : Environment
- $cookie : VanillaCookieExtended
Return values
mixed —__invoke()
Get invoked by request handler
public
__invoke(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Return values
ResponseInterface —getNavigations()
Gets navigations
public
getNavigations() : mixed
Return values
mixed —addTemplateFilter()
Adds a template filter
protected
addTemplateFilter(string $name, callable $function[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $name : string
- $function : callable
- $options : array<string|int, mixed> = []
-
twig filter options
Return values
mixed —addTemplateFunction()
Adds a template function
protected
addTemplateFunction(string $name, callable $function[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $name : string
- $function : callable
- $options : array<string|int, mixed> = []
-
twig filter options
Return values
mixed —buildTemplateHelpersBack()
Build common template helpers going up the inheritance chain, used to generate templates cache during translations extraction
protected
buildTemplateHelpersBack() : mixed
Return values
mixed —checkAtLeastOnePermission()
Checks whether current user has at least one permission among one set
protected
checkAtLeastOnePermission(array<string|int, mixed> $permissions) : bool
Parameters
- $permissions : array<string|int, mixed>
Return values
bool —checkPermission()
Checks whether current user has a certain permission
protected
checkPermission(string $permission) : bool
Parameters
- $permission : string
Return values
bool —checkRouteParameters()
Checks mandatory route parameters
protected
checkRouteParameters(array<string|int, mixed> $mandatoryParameters) : mixed
Parameters
- $mandatoryParameters : array<string|int, mixed>
-
array of mandatory parameters to be searched into $this->routeParameters
Return values
mixed —doBeforeActionExecution()
Performs some operations before action execution
protected
doBeforeActionExecution(ServerRequestInterface $request) : mixed
Parameters
- $request : ServerRequestInterface
Return values
mixed —getAreaCookie()
Gets current area cookie as an object
protected
getAreaCookie([string $propertyName = null ]) : object
Parameters
- $propertyName : string = null
Return values
object —the whole area cookie
getAuthenticatedUserData()
Return authenticated user data (if any)
protected
getAuthenticatedUserData() : mixed
Return values
mixed —object with user data | null
handleActionExecution()
Handles action execution
protected
handleActionExecution() : mixed
Return values
mixed —initTraits()
Inits used traits searching for magic method __initTrait[trait-name]
protected
initTraits() : mixed
Return values
mixed —isAuthenticated()
Checks if user is currently authenticated
protected
isAuthenticated() : bool
Return values
bool —isNavigationRouteCurrentRoute()
Checks whether a given navigation route corresponds to the current route
protected
isNavigationRouteCurrentRoute(string $route) : mixed
Parameters
- $route : string
Return values
mixed —loadAreaNavigation()
Loads area navigation
protected
loadAreaNavigation() : mixed
Return values
mixed —loadLanguages()
Loads configured language
protected
loadLanguages() : mixed
Return values
mixed —loadNavigation()
Loads area navigation from a file
protected
loadNavigation(string $path) : mixed
Parameters
- $path : string
Return values
mixed —loadNavigationLevel()
Loads a navigation level
protected
loadNavigationLevel(string $navigationName, array<string|int, mixed> &$loadedNavigationLevel[, object &$parentVoiceProperties = null ]) : mixed
Parameters
- $navigationName : string
- $loadedNavigationLevel : array<string|int, mixed>
- $parentVoiceProperties : object = null
Return values
mixed —output()
Outputs
protected
output(string $contentType, string $content) : mixed
Parameters
- $contentType : string
- $content : string
Return values
mixed —processRecordsetForInput()
Processes a recordset to be used in a radio, checkbox or select mapping fields to value and label
protected
processRecordsetForInput(string $valueField, mixed $labelTokens, array<string|int, mixed> $recordset[, string $languageCode = null ][, mixed $valueProperty = 'value' ][, mixed $labelProperty = 'label' ][, mixed $extraFields = [] ]) : array<string|int, mixed>
Parameters
- $valueField : string
- $labelTokens : mixed
- $recordset : array<string|int, mixed>
- $languageCode : string = null
- $valueProperty : mixed = 'value'
- $labelProperty : mixed = 'label'
- $extraFields : mixed = []
Return values
array<string|int, mixed> —of records
redirect()
Redirects to a route
protected
redirect(string $route) : mixed
Parameters
- $route : string
Return values
mixed —renderTemplate()
Renders template and injects HTML code into response
protected
renderTemplate([string $templatePath = null ]) : mixed
Parameters
- $templatePath : string = null
Return values
mixed —renderTemplateCode()
Renders template and injects HTML code into response
protected
renderTemplateCode([string $templatePath = null ]) : string
Parameters
- $templatePath : string = null
Return values
string —setAreaCookie()
Sets a cookie into current area cookies portion
protected
setAreaCookie(string $propertyName, mixed $propertyValue) : mixed
Parameters
- $propertyName : string
- $propertyValue : mixed
Return values
mixed —setAreaCookieArray()
Sets a cookie into current area cookies portion
protected
setAreaCookieArray(array<string|int, mixed> $propertyNames, mixed $propertyValue) : mixed
Parameters
- $propertyNames : array<string|int, mixed>
- $propertyValue : mixed
Return values
mixed —setLanguage()
Gets & sets language
protected
setLanguage([mixed $languageCode = null ]) : mixed
Parameters
- $languageCode : mixed = null
Return values
mixed —setNavigationVoiceParentsActive()
Sets recursevely voice parent as active
protected
setNavigationVoiceParentsActive(object $parentVoiceProperties) : mixed
Parameters
- $parentVoiceProperties : object
Tags
Return values
mixed —setTemplateParameter()
pass a parameter to the template angine
protected
setTemplateParameter(string $parameterName, mixed $parameterValue) : mixed
Parameters
- $parameterName : string
- $parameterValue : mixed
Return values
mixed —setUploadMaxFilesizeTemplateParameters()
Sets template parameters necessary to file upload to be overridden if necessary by derived classes
protected
setUploadMaxFilesizeTemplateParameters() : mixed
Return values
mixed —storeRequest()
Stores request and related informations
protected
storeRequest(ServerRequestInterface $request) : mixed
Parameters
- $request : ServerRequestInterface
Return values
mixed —stp()
short alias for the - much used - setTemplateParameter method
protected
stp(string $parameterName, mixed $parameterValue) : mixed
Parameters
- $parameterName : string
- $parameterValue : mixed
Return values
mixed —turnPathToUrl()
Turns a local path from root into an URL prepending current scheme and domain
protected
turnPathToUrl(string $path) : string
Parameters
- $path : string
Return values
string —verifyAuthentication()
Checks if authenticaion is needed and is valid
protected
verifyAuthentication() : bool
Return values
bool —buildCommonTemplateHelpers()
Builds common template helpers NOTE: do not change visibility
private
buildCommonTemplateHelpers() : mixed
Return values
mixed —setCommonTemplateParameters()
Sets common template parameters
private
setCommonTemplateParameters() : mixed