SystemComponentBackendController
extends Controller
in package
Backend controller to create a default backend view.
Create a subclass of this in order to create a normal backend view
Tags
Table of Contents
Properties
- $cx : Cx
- Main class instance
- $defaultPermission : Permission
- Default permission
- $isViewTranslatable : bool
- Whether the current view contains translatable content
Methods
- __call() : mixed
- Route methods like getName(), getType(), getDirectory(), etc.
- __construct() : mixed
- Creates new controller
- getAllViewGeneratorOptions() : array<string|int, mixed>
- This function returns an array which contains the vgOptions array for all entities
- getCommands() : array<string|int, mixed>
- Returns a list of available commands (?act=XY)
- getPage() : mixed
- This is called by the default ComponentController and does all the repeating work
- getParsedCommands() : array<string|int, mixed>
- Returns a unified representation of commands
- getSystemComponentController() : SystemComponentController
- Returns the main controller
- parseNavigation() : Sigma
- Parse the navigation
- parsePage() : ViewGenerator|null
- Use this to parse your backend page
- checkAndModifyCmdByPermission() : mixed
- Check and modify the cmd based on the permission
- getEntityClassesWithView() : array<string|int, mixed>
- Returns all entities of this component which can have an auto-generated view
- getViewGeneratorOptions() : array<string|int, mixed>
- This function returns the ViewGeneration options for a given entityClass
- getViewGeneratorParseObjectForEntityClass() : string|array<string|int, mixed>|object
- Returns the object to parse a view with
- hasAccess() : bool
- Check the access permission
- hasAccessToCommand() : bool
- Check the access permission based on the command
- hasEntityData() : bool
- Tells whether the given entity class name has stored entities
- hasNoEntityData() : bool
- Tells whether the given entity class name has no stored entities
- parseCommands() : void
- Parses the command list into a consistent form
- parseCurrentNavItem() : mixed
- Parse the current navigation item
- parseEntityClassPage() : mixed
- showOverviewPage() : bool
- Return true here if you want the first tab to be an entity view
- showSplash() : bool
- Returns whether to show the splash screen or not. Every module "should" have an introductionary splash screen. This method can be used to define conditions on when to show it.
Properties
$cx
Main class instance
protected
Cx
$cx
= null
$defaultPermission
Default permission
protected
Permission
$defaultPermission
$isViewTranslatable
Whether the current view contains translatable content
protected
bool
$isViewTranslatable
= false
Methods
__call()
Route methods like getName(), getType(), getDirectory(), etc.
public
__call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
- $methodName : string
-
Name of method to call
- $arguments : array<string|int, mixed>
-
List of arguments for the method to call
Attributes
- #[ReturnTypeWillChange]
Return values
mixed —Return value of the method to call
__construct()
Creates new controller
public
__construct(SystemComponentController $systemComponentController, Cx $cx) : mixed
Parameters
- $systemComponentController : SystemComponentController
-
Main controller for this system component
- $cx : Cx
-
Main class instance
getAllViewGeneratorOptions()
This function returns an array which contains the vgOptions array for all entities
public
getAllViewGeneratorOptions([mixed $dataSetIdentifier = '' ]) : array<string|int, mixed>
Parameters
- $dataSetIdentifier : mixed = ''
Tags
Return values
array<string|int, mixed>getCommands()
Returns a list of available commands (?act=XY)
public
getCommands() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of acts
getPage()
This is called by the default ComponentController and does all the repeating work
public
getPage(Page $page) : mixed
This loads a template named after current $act and calls parsePage($actTemplate)
Parameters
- $page : Page
-
Resolved page
Tags
getParsedCommands()
Returns a unified representation of commands
public
getParsedCommands() : array<string|int, mixed>
Returns a list of CMDs indexed by their key. Each entry is an array with the following keys:
- permission \Cx\Core_Modules\Access\Model\Entity\Permission needed to access this CMD or NULL
- translatable True if this CMD contains frontend-translated stuff, false otherwise
- children An array in the same form (recursion)
- langKey The key for use in $_CORELANG or this components $_ARRAYLANG
Return values
array<string|int, mixed> —See description
getSystemComponentController()
Returns the main controller
public
getSystemComponentController() : SystemComponentController
Return values
SystemComponentController —Main controller for this system component
parseNavigation()
Parse the navigation
public
parseNavigation([array<string|int, mixed> &$cmd = array() ]) : Sigma
Parameters
- $cmd : array<string|int, mixed> = array()
Return values
SigmaparsePage()
Use this to parse your backend page
public
parsePage(Sigma $template, array<string|int, mixed> $cmd[, bool &$isSingle = false ]) : ViewGenerator|null
You will get the template located in /View/Template/{CMD}.html You can access Cx class using $this->cx To show messages, use \Message class
Parameters
- $template : Sigma
-
Template for current CMD
- $cmd : array<string|int, mixed>
-
CMD separated by slashes
- $isSingle : bool = false
-
Wether edit view or not
Return values
ViewGenerator|null —Used ViewGenerator or null
checkAndModifyCmdByPermission()
Check and modify the cmd based on the permission
protected
checkAndModifyCmdByPermission(array<string|int, mixed> &$cmd, array<string|int, mixed> $currentCommands) : mixed
Parameters
- $cmd : array<string|int, mixed>
- $currentCommands : array<string|int, mixed>
getEntityClassesWithView()
Returns all entities of this component which can have an auto-generated view
protected
getEntityClassesWithView() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getViewGeneratorOptions()
This function returns the ViewGeneration options for a given entityClass
protected
getViewGeneratorOptions(mixed $entityClassName[, mixed $dataSetIdentifier = '' ]) : array<string|int, mixed>
Parameters
- $entityClassName : mixed
-
contains the FQCN from entity
- $dataSetIdentifier : mixed = ''
-
if $entityClassName is DataSet, this is used for better partition
Tags
Return values
array<string|int, mixed> —with options
getViewGeneratorParseObjectForEntityClass()
Returns the object to parse a view with
protected
getViewGeneratorParseObjectForEntityClass(mixed $entityClassName) : string|array<string|int, mixed>|object
If you overwrite this and return anything else than string, filter will not work
Parameters
- $entityClassName : mixed
Return values
string|array<string|int, mixed>|object —An entity class name, entity, array of entities or DataSet
hasAccess()
Check the access permission
protected
hasAccess(array<string|int, mixed> $command) : bool
Parameters
- $command : array<string|int, mixed>
Return values
boolhasAccessToCommand()
Check the access permission based on the command
protected
hasAccessToCommand([array<string|int, mixed> $commands = array() ]) : bool
Parameters
- $commands : array<string|int, mixed> = array()
Return values
boolhasEntityData()
Tells whether the given entity class name has stored entities
protected
hasEntityData(string $entityClassName) : bool
This method is intended for use in showSplash(). Instead of the fully qualified class name the entity name can be specified relative to the component's entity namespace. If $entityClassName does not start with component's entity namespace it is prepended. Therefore only entities within this component's entity namespace can be checked with this method. The component's entity namespace is: \Cx<component_type><component_name>\Model\Entity\
Parameters
- $entityClassName : string
-
Fully qualified entity class name or according to description
Return values
bool —True if entity has data, false otherwise
hasNoEntityData()
Tells whether the given entity class name has no stored entities
protected
hasNoEntityData(string $entityClassName) : bool
This method is intended for use in showSplash(). Instead of the fully qualified class name the entity name can be specified relative to the component's entity namespace. If $entityClassName does not start with component's entity namespace it is prepended. Therefore only entities within this component's entity namespace can be checked with this method. The component's entity namespace is: \Cx<component_type><component_name>\Model\Entity\
Parameters
- $entityClassName : string
-
Fully qualified entity class name or according to description
Return values
bool —True if entity has no data, false otherwise
parseCommands()
Parses the command list into a consistent form
protected
parseCommands(array<string|int, mixed> &$currentLayer[, bool $firstLayer = true ]) : void
See {$this->getParsedCommands()} for the format $currentLayer is turned into.
Parameters
- $currentLayer : array<string|int, mixed>
-
(reference) CMDs as provided by getCommands()
- $firstLayer : bool = true
-
Defaults to true, is set to false for recursions
parseCurrentNavItem()
Parse the current navigation item
protected
parseCurrentNavItem(Sigma $navigation, string $blockName, string $currentCmd, string $mainCmd, bool $isActiveNav, bool $isSubNav) : mixed
Parameters
- $navigation : Sigma
- $blockName : string
- $currentCmd : string
- $mainCmd : string
- $isActiveNav : bool
- $isSubNav : bool
Tags
parseEntityClassPage()
protected
parseEntityClassPage(mixed $template, mixed $entityClassName, mixed $classIdentifier[, mixed $filter = array() ][, mixed &$isSingle = false ]) : mixed
Parameters
- $template : mixed
- $entityClassName : mixed
- $classIdentifier : mixed
- $filter : mixed = array()
- $isSingle : mixed = false
showOverviewPage()
Return true here if you want the first tab to be an entity view
protected
showOverviewPage() : bool
Use showSplash() instead
Return values
bool —True if overview should be shown, false otherwise
showSplash()
Returns whether to show the splash screen or not. Every module "should" have an introductionary splash screen. This method can be used to define conditions on when to show it.
protected
showSplash() : bool
Tags
Return values
bool —True if splash is to be shown.