Documentation

Roles extends Controller

User Extended by Shawn Clake Class Roles User Extended is licensed under the MIT license.

Tags
author

Shawn Clake shawn.clake@gmail.com

link
https://github.com/ShawnClake/UserExtended
license

https://github.com/ShawnClake/UserExtended/blob/master/LICENSE MIT

Table of Contents

RESULT_LIM  = 8
How many results can be shown in a table
UE_CREATE_GROUP_FORM  = 'create_group_form'
RoleManager render types
UE_CREATE_ROLE_FORM  = 'create_role_form'
UE_LIST_GROUP_BUTTONS  = 'list_group_buttons'
UE_LIST_ROLES_TABLE  = 'list_roles_table'
UE_LIST_ROLES_TABLE_UNASSIGNED  = 'list_roles_table_unassigned'
UE_MANAGE_CREATION_TOOLBAR  = 'manage_creation_toolbar'
UE_MANAGE_GROUP_TOOLBAR  = 'manage_group_toolbar'
UE_MANAGE_OVERALL_TOOLBAR  = 'manage_overall_toolbar'
UE_MANAGE_ROLE_TOOLBAR  = 'manage_role_toolbar'
UE_MANAGE_ROLE_UI  = 'manage_role_ui'
UE_MANAGE_USERS_UI  = 'manage_users_ui'
UE_UPDATE_GROUP_FORM  = 'update_group_form'
UE_UPDATE_ROLE_FORM  = 'update_role_form'
$assetPath  : string
$bodyClass  : string
$formConfig  : mixed
$hiddenActions  : array<string|int, mixed>
$implement  : array<string|int, mixed>
$layout  : string
$listConfig  : mixed
$pageTitle  : string
$pageTitleTemplate  : string
$queue  : array<string|int, mixed>
A queue of all renders that need to be preformed
$suppressLayout  : bool
$suppressView  : bool
$vars  : array<string|int, mixed>
$widget  : array<string|int, mixed>
$action  : string
$assets  : array<string|int, mixed>
$configPath  : string
$extendableCallbacks  : array<string|int, mixed>
$extendableGuardProperties  : bool
$extendableStaticMethods  : array<string|int, mixed>
$extensionData  : array<string|int, mixed>
$fatalError  : string
$guarded  : array<string|int, mixed>
$layoutPath  : string
$middleware  : array<string|int, mixed>
The middleware registered on the controller.
$params  : array<string|int, mixed>
$publicActions  : array<string|int, mixed>
$requiredPermissions  : array<string|int, mixed>
$responseHeaderBag  : ResponseHeaderBag
$responseOverride  : mixed
$statusCode  : int
$user  : object
$viewPath  : string|array<string|int, mixed>
__call()  : mixed
Handle calls to missing methods on the controller.
__callStatic()  : mixed
__construct()  : mixed
Constructor.
__get()  : mixed
__set()  : mixed
actionExists()  : bool
This method is used internally.
actionUrl()  : mixed
Returns a URL for this controller and supplied action.
addCss()  : void
Adds StyleSheet asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
addDynamicMethod()  : mixed
Programmatically adds a method to the extendable class
addDynamicProperty()  : mixed
Programmatically adds a property to the extendable class
addJs()  : void
Adds JavaScript asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
addRss()  : void
Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
addViewPath()  : void
Prepends a path on the available view path locations.
asExtension()  : mixed
Short hand for `getClassExtension()` method, except takes the short extension name, example:
callAction()  : Response
Execute an action on the controller.
clearExtendedClasses()  : void
Clear the list of extended classes so they will be re-extended.
combineAssets()  : string
Run the provided assets through the Asset Combiner
extend()  : mixed
Extend this object properties upon construction.
extendableCall()  : mixed
Magic method for `__call()`
extendableCallStatic()  : mixed
Magic method for `__callStatic()`
extendableConstruct()  : mixed
This method should be called as part of the constructor.
extendableExtendCallback()  : void
Helper method for `::extend()` static method
extendableGet()  : string
Magic method for `__get()`
extendableSet()  : string
Magic method for `__set()`
extendClassWith()  : void
Dynamically extend a class with a specified behavior
fireSystemEvent()  : mixed
Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.
fireViewEvent()  : string
Special event function used for extending within view files, allowing HTML to be injected multiple times.
flushAssets()  : void
Disables the use, and subequent broadcast, of assets. This is useful to call during an AJAX request to speed things up. This method works by specifically targeting the hasAssetsDefined method.
getAjaxHandler()  : string
Returns the AJAX handler for the current request, if available.
getAssetPath()  : string
Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
getAssetPaths()  : array<string|int, mixed>
Returns an array of all registered asset paths.
getClassExtension()  : mixed
Returns a behavior object from an extendable class, example:
getClassMethods()  : array<string|int, mixed>
Get a list of class methods, extension equivalent of get_class_methods()
getConfigPath()  : string
Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.
getDynamicProperties()  : array<string|int, mixed>
Returns all dynamic properties and their values
getFatalError()  : string
getId()  : mixed
Returns a unique ID for the controller and route. Useful in creating HTML markup.
getMiddleware()  : array<string|int, mixed>
Get the middleware assigned to the controller.
getPublicActions()  : mixed
Returns the controllers public actions.
getResponseHeaders()  : ResponseHeaderBag|null
Get the header response bag
getStatusCode()  : int
Returns the status code for the current web response.
getViewPath()  : string
Locates a file based on its definition. The file name can be prefixed with a symbol (~|$) to return in context of the application or plugin base path, otherwise it will be returned in context of this object view path.
getViewPaths()  : array<string|int, mixed>
Returns the active view path locations.
guessConfigPath()  : string
Guess the package path for the called class.
guessConfigPathFrom()  : string
Guess the package path from a specified class.
guessViewPath()  : string
Guess the package path for the called class.
guessViewPathFrom()  : string
Guess the package path from a specified class.
handleError()  : mixed
Sets standard page variables in the case of a controller error.
hasAssetsDefined()  : bool
Returns true if assets any have been added.
hasFatalError()  : bool
isBackendHintHidden()  : bool
Checks if a hint has been hidden by the user.
isClassExtendedWith()  : bool
Check if extendable class is extended with a behavior object
makeAssets()  : string
Outputs `<link>` and `<script>` tags to load assets previously added with addJs and addCss method calls
makeConfig()  : array<string|int, mixed>|stdClass
Reads the contents of the supplied file and applies it to this object.
makeConfigFromArray()  : stdClass
Makes a config object from an array, making the first level keys properties of a new object.
makeFileContents()  : string
Includes a file path using output buffering.
makeFormWidget()  : FormWidgetBase
Makes a form widget object with the supplied form field and widget configuration.
makeHintPartial()  : string
Renders a hint partial, used for displaying informative information that can be hidden by the user. If you don't want to render a partial, you can supply content via the 'content' key of $params.
makeLayout()  : mixed
Render a layout.
makeLayoutPartial()  : string
Renders a layout partial
makePartial()  : mixed
Render a partial file contents located in the views folder.
makeResponse()  : mixed
Prepares a response that considers overrides and custom responses.
makeView()  : string
Loads a view with the name specified. Applies layout if its name is provided by the parent object.
makeViewContent()  : string
Renders supplied contents inside a layout.
makeWidget()  : mixed|WidgetBase
Makes a widget object with the supplied configuration file.
manage()  : mixed
Action used for managing roles such as: their order, some stats, and their properties TODO: This needs a major cleanup and refactor
mergeConfig()  : stdClass
Merges two configuration sources, either prepared or not, and returns them as a single configuration object.
methodExists()  : bool
Checks if a method exists, extension equivalent of method_exists()
middleware()  : ControllerMiddlewareOptions
Register middleware on the controller.
onAssignRole()  : mixed
Handles assigning a role
onAssignUser()  : array<string|int, mixed>
AJAX handler for assigning groups already in a group to a role
onCreateGroup()  : mixed
AJAX handler for creating a group when clicking 'create'
onCreateRole()  : array<string|int, mixed>
AJAX handler for creating a new role when clicking create/save on a create role form.
onDeleteGroup()  : mixed
AJAX handler for deleting a group
onDemoteUser()  : array<string|int, mixed>
Demotes a user
onEditGroup()  : mixed
AJAX handler for saving the update group modal
onEditRole()  : array<string|int, mixed>
AJAX handler called to save the role after the user clicks save in the role editor window
onHideBackendHint()  : void
Ajax handler to hide a backend hint, once hidden the partial will no longer display for the user.
onManageRole()  : array<string|int, mixed>
AJAX handler called when clicking on a different role to manage it
onManageUser()  : mixed
AJAX handler for redirecting when clicking on a users name
onMoveRoleDown()  : array<string|int, mixed>
AJAX handler called when trying to move a role lower in the hierarchy
onMoveRoleUp()  : array<string|int, mixed>
AJAX handler called when trying to move a role higher in the hierarchy
onOpenGroupCreator()  : mixed
AJAX handler for opening the create a group modal
onOpenGroupEditor()  : mixed
AJAX handler to open the update group modal
onOpenRoleCreator()  : mixed
AJAX handler for opening a form for creating a new role
onOpenRoleEditor()  : mixed
AJAX handler called when hitting the edit role button in the role manager.. Used to edit the role.
onPageChoose()  : array<string|int, mixed>|bool
Choose a page for table pagination
onPageLeft()  : array<string|int, mixed>|bool
Page left for table pagination
onPageRight()  : array<string|int, mixed>|bool
Page right for table pagination
onPromoteUser()  : array<string|int, mixed>
Promotes a user
onRemoveRole()  : array<string|int, mixed>
AJAX handler for removing a role
onRemoveUserFromGroup()  : array<string|int, mixed>|false
AJAX handler for removing a group from a user
onResetToDefault()  : mixed
Resets the application to default roles and groups
onSelectGroup()  : array<string|int, mixed>
AJAX handler used when a user clicks on a different group
onUnassignRole()  : array<string|int, mixed>
Handles unassigning a role
onUnassignUser()  : array<string|int, mixed>
Removes a user from a role. This does not remove them from the group.
pageAction()  : mixed
Invokes the current controller action without rendering a view, used by AJAX handler that may rely on the logic inside the action.
propertyExists()  : bool
Checks if a property exists, extension equivalent of `property_exists()`
run()  : mixed
Execute the controller action.
setResponse()  : $this
Sets the response for the current page request cycle, this value takes priority over the standard response prepared by the controller.
setResponseCookie()  : $this
Add a cookie to the response.
setResponseHeader()  : $this
Set a header on the Response.
setStatusCode()  : $this
Sets the status code for the current web response.
addAsset()  : mixed
Adds the provided asset to the internal asset collections
execAjaxHandlers()  : mixed
This method is used internally.
execPageAction()  : mixed
This method is used internally.
extendableIsAccessible()  : bool
Checks if a property is accessible, property equivalent of `is_callable()`
extensionExtractMethods()  : void
Extracts the available methods from a behavior and adds it to the list of callable methods.
getAssetEntryBuildPath()  : string
Internal helper, attaches a build code to an asset path
getAssetScheme()  : string
Internal helper, get asset scheme
getLocalPath()  : mixed
handleViewException()  : void
Handle a view exception.
makeXsrfCookie()  : Cookie
Adds anti-CSRF cookie.
queue()  : bool
Queues the partials for render.
queueBlank()  : bool
Queues a div to be emptied.
queueUeCreateGroupForm()  : bool
Queues the create a group form modal
queueUeCreateRoleForm()  : bool
Queues the create a role form modal
queueUeListGroupButtons()  : bool
Queues the group list buttons
queueUeListRolesTable()  : bool
Queues the role list table
queueUeListRolesTableUnassigned()  : bool
Queues the unassigned-to-group roles table
queueUeManageCreationToolbar()  : bool
Queues the create buttons toolbar
queueUeManageGroupToolbar()  : bool
Queues the group management toolbar
queueUeManageOverallToolbar()  : bool
Queues the overall management toolbar. This is the one which includes stats/analytics and delete groups.
queueUeManageRoleToolbar()  : bool
Queues the role management toolbar
queueUeManageRoleUi()  : bool
Queues the manage role UI
queueUeManageUsersUi()  : bool
Queues the manage users UI
queueUeUpdateGroupForm()  : bool
Queues the update a group form modal
queueUeUpdateRoleForm()  : bool
Queues the update a role form modal
removeDuplicates()  : void
Removes duplicate assets from the entire collection.
render()  : array<string|int, mixed>
Renders each of the passed const's and returns a merged array of them $to_render is an array containing arrays of the following format [UE_CREATE_ROLE_FORM, ['group' => groupCode, 'role' => roleCode]]
runAjaxHandler()  : bool
Tries to find and run an AJAX handler in the page action.
runAjaxHandlerForWidget()  : mixed
Specific code for executing an AJAX handler for a widget.
verifyCsrfToken()  : bool
Checks the request data / headers for a valid CSRF token.
verifyForceSecure()  : bool
Checks if the back-end should force a secure protocol (HTTPS) enabled by config.
flushCurrentPages()  : mixed
Removes the pagination session data
flushQueue()  : mixed
Flushes the queue Remove all renders in queue
flushSession()  : mixed
Flushes the Session Removes session keys used by RoleManager
getCurrentGroup()  : bool|string
Retrieves the current group from the session
getCurrentPage()  : bool|null
Gets the current page from session for pagination
getCurrentRole()  : bool|string
Gets the current role from the session
setCurrentGroup()  : bool
Sets the current group into the session
setCurrentPage()  : bool
Sets the current page for a table into session for pagination
setCurrentRole()  : bool
Sets the current role into the session

Constants

RESULT_LIM

How many results can be shown in a table

public mixed RESULT_LIM = 8

UE_CREATE_GROUP_FORM

RoleManager render types

public mixed UE_CREATE_GROUP_FORM = 'create_group_form'

UE_CREATE_ROLE_FORM

public mixed UE_CREATE_ROLE_FORM = 'create_role_form'

UE_LIST_GROUP_BUTTONS

public mixed UE_LIST_GROUP_BUTTONS = 'list_group_buttons'

UE_LIST_ROLES_TABLE

public mixed UE_LIST_ROLES_TABLE = 'list_roles_table'

UE_LIST_ROLES_TABLE_UNASSIGNED

public mixed UE_LIST_ROLES_TABLE_UNASSIGNED = 'list_roles_table_unassigned'

UE_MANAGE_CREATION_TOOLBAR

public mixed UE_MANAGE_CREATION_TOOLBAR = 'manage_creation_toolbar'

UE_MANAGE_GROUP_TOOLBAR

public mixed UE_MANAGE_GROUP_TOOLBAR = 'manage_group_toolbar'

UE_MANAGE_OVERALL_TOOLBAR

public mixed UE_MANAGE_OVERALL_TOOLBAR = 'manage_overall_toolbar'

UE_MANAGE_ROLE_TOOLBAR

public mixed UE_MANAGE_ROLE_TOOLBAR = 'manage_role_toolbar'

UE_MANAGE_ROLE_UI

public mixed UE_MANAGE_ROLE_UI = 'manage_role_ui'

UE_MANAGE_USERS_UI

public mixed UE_MANAGE_USERS_UI = 'manage_users_ui'

UE_UPDATE_GROUP_FORM

public mixed UE_UPDATE_GROUP_FORM = 'update_group_form'

UE_UPDATE_ROLE_FORM

public mixed UE_UPDATE_ROLE_FORM = 'update_role_form'

Properties

$assetPath

public string $assetPath

Specifies a path to the asset directory.

$bodyClass

public string $bodyClass = 'compact-container'

Body class property used for customising the layout on a controller basis.

$formConfig

public mixed $formConfig = 'config_form.yaml'

$hiddenActions

public array<string|int, mixed> $hiddenActions = ['run', 'actionExists', 'pageAction', 'getId', 'setStatusCode', 'handleError', 'makeHintPartial']

Default methods which cannot be called as actions.

$implement

public array<string|int, mixed> $implement = ['Backend.Behaviors.FormController', 'Backend.Behaviors.ListController']

Behaviors implemented by this controller.

$layout

public string $layout

Layout to use for the view.

$listConfig

public mixed $listConfig = 'config_list.yaml'

$pageTitleTemplate

public string $pageTitleTemplate

Page title template

$queue

A queue of all renders that need to be preformed

public static array<string|int, mixed> $queue = []

$suppressLayout

public bool $suppressLayout = false

Prevents the use of a layout.

$suppressView

public bool $suppressView = false

Prevents the automatic view display.

$vars

public array<string|int, mixed> $vars = []

A list of variables to pass to the page.

$widget

public array<string|int, mixed> $widget

Collection of WidgetBase objects used on this page.

$action

protected string $action

Page action being called.

$assets

protected array<string|int, mixed> $assets = ['js' => [], 'css' => [], 'rss' => []]

Collection of assets to display in the layout.

$configPath

protected string $configPath

Specifies a path to the config directory.

$extendableCallbacks

protected static array<string|int, mixed> $extendableCallbacks = []

Used to extend the constructor of an extendable class. Eg:

Class::extend(function($obj) { })

$extendableGuardProperties

protected static bool $extendableGuardProperties = true

Indicates if dynamic properties can be created.

$extendableStaticMethods

protected static array<string|int, mixed> $extendableStaticMethods = []

Collection of static methods used by behaviors.

$extensionData

protected array<string|int, mixed> $extensionData = ['extensions' => [], 'methods' => [], 'dynamicMethods' => [], 'dynamicProperties' => []]

Class reflection information, including behaviors.

$fatalError

protected string $fatalError

Object used for storing a fatal error.

$guarded

protected array<string|int, mixed> $guarded = []

Controller specified methods which cannot be called as actions.

$layoutPath

protected string $layoutPath

Specifies a path to the layout directory.

$middleware

The middleware registered on the controller.

protected array<string|int, mixed> $middleware = []

$params

protected array<string|int, mixed> $params

Routed parameters.

$publicActions

protected array<string|int, mixed> $publicActions = []

Defines a collection of actions available without authentication.

$requiredPermissions

protected array<string|int, mixed> $requiredPermissions = []

Permissions required to view this page.

$responseHeaderBag

protected ResponseHeaderBag $responseHeaderBag = null

$responseOverride

protected mixed $responseOverride = null

Override the standard controller response.

$statusCode

protected int $statusCode = 200

Response status code

$user

protected object $user

Reference the logged in admin user.

$viewPath

protected string|array<string|int, mixed> $viewPath

Specifies a path to the views directory.

Methods

__call()

Handle calls to missing methods on the controller.

public __call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string
$parameters : array<string|int, mixed>
Tags
throws
BadMethodCallException
Return values
mixed

__callStatic()

public static __callStatic(mixed $name, mixed $params) : mixed
Parameters
$name : mixed
$params : mixed
Return values
mixed

__construct()

Constructor.

public __construct() : mixed
Return values
mixed

__get()

public __get(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

__set()

public __set(mixed $name, mixed $value) : mixed
Parameters
$name : mixed
$value : mixed
Return values
mixed

actionExists()

This method is used internally.

public actionExists(string $name[, bool $internal = false ]) : bool

Determines whether an action with the specified name exists. Action must be a class public method. Action name can not be prefixed with the underscore character.

Parameters
$name : string

Specifies the action name.

$internal : bool = false

Allow protected actions.

Return values
bool

actionUrl()

Returns a URL for this controller and supplied action.

public actionUrl([mixed $action = null ][, mixed $path = null ]) : mixed
Parameters
$action : mixed = null
$path : mixed = null
Return values
mixed

addCss()

Adds StyleSheet asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.

public addCss(string $name[, array<string|int, mixed> $attributes = [] ]) : void
Parameters
$name : string

Specifies a path (URL) to the script.

$attributes : array<string|int, mixed> = []

Adds extra HTML attributes to the asset link.

Return values
void

addDynamicMethod()

Programmatically adds a method to the extendable class

public addDynamicMethod(string $dynamicName, callable $method[, string $extension = null ]) : mixed
Parameters
$dynamicName : string
$method : callable
$extension : string = null
Return values
mixed

addDynamicProperty()

Programmatically adds a property to the extendable class

public addDynamicProperty(string $dynamicName[, string $value = null ]) : mixed
Parameters
$dynamicName : string
$value : string = null
Return values
mixed

addJs()

Adds JavaScript asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.

public addJs(string $name[, array<string|int, mixed> $attributes = [] ]) : void
Parameters
$name : string

Specifies a path (URL) to the script.

$attributes : array<string|int, mixed> = []

Adds extra HTML attributes to the asset link.

Return values
void

addRss()

Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.

public addRss(string $name[, array<string|int, mixed> $attributes = [] ]) : void
Parameters
$name : string

Specifies a path (URL) to the RSS channel

$attributes : array<string|int, mixed> = []

Adds extra HTML attributes to the asset link.

Return values
void

addViewPath()

Prepends a path on the available view path locations.

public addViewPath(string|array<string|int, mixed> $path) : void
Parameters
$path : string|array<string|int, mixed>
Return values
void

asExtension()

Short hand for `getClassExtension()` method, except takes the short extension name, example:

public asExtension(string $shortName) : mixed

$this->asExtension('FormController')

Parameters
$shortName : string
Return values
mixed

callAction()

Execute an action on the controller.

public callAction(string $method, array<string|int, mixed> $parameters) : Response
Parameters
$method : string
$parameters : array<string|int, mixed>
Return values
Response

clearExtendedClasses()

Clear the list of extended classes so they will be re-extended.

public static clearExtendedClasses() : void
Return values
void

combineAssets()

Run the provided assets through the Asset Combiner

public combineAssets(array<string|int, mixed> $assets[, string $localPath = '' ]) : string
Parameters
$assets : array<string|int, mixed>

Collection of assets

$localPath : string = ''

Prefix all assets with this path (optional)

Return values
string

extend()

Extend this object properties upon construction.

public static extend(Closure $callback) : mixed
Parameters
$callback : Closure
Return values
mixed

extendableCall()

Magic method for `__call()`

public extendableCall(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
$name : string
$params : array<string|int, mixed> = null
Return values
mixed

extendableCallStatic()

Magic method for `__callStatic()`

public static extendableCallStatic(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
$name : string
$params : array<string|int, mixed> = null
Return values
mixed

extendableConstruct()

This method should be called as part of the constructor.

public extendableConstruct() : mixed
Return values
mixed

extendableExtendCallback()

Helper method for `::extend()` static method

public static extendableExtendCallback(callable $callback) : void
Parameters
$callback : callable
Return values
void

extendableGet()

Magic method for `__get()`

public extendableGet(string $name) : string
Parameters
$name : string
Return values
string

extendableSet()

Magic method for `__set()`

public extendableSet(string $name, string $value) : string
Parameters
$name : string
$value : string
Return values
string

extendClassWith()

Dynamically extend a class with a specified behavior

public extendClassWith(string $extensionName) : void
Parameters
$extensionName : string
Return values
void

fireSystemEvent()

Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.

public fireSystemEvent(string $event[, array<string|int, mixed> $params = [] ][, bool $halt = true ]) : mixed

For example:

$this->fireSystemEvent('backend.list.myEvent', ['my value']);

Is equivalent to:

$this->fireEvent('list.myEvent', ['myvalue'], true);

Event::fire('backend.list.myEvent', [$this, 'myvalue'], true);
Parameters
$event : string

Event name

$params : array<string|int, mixed> = []

Event parameters

$halt : bool = true

Halt after first non-null result

Return values
mixed

fireViewEvent()

Special event function used for extending within view files, allowing HTML to be injected multiple times.

public fireViewEvent(string $event[, array<string|int, mixed> $params = [] ]) : string

For example:

fireViewEvent('backend.auth.extendSigninView') ?>
Parameters
$event : string

Event name

$params : array<string|int, mixed> = []

Event parameters

Return values
string

flushAssets()

Disables the use, and subequent broadcast, of assets. This is useful to call during an AJAX request to speed things up. This method works by specifically targeting the hasAssetsDefined method.

public flushAssets() : void
Return values
void

getAjaxHandler()

Returns the AJAX handler for the current request, if available.

public getAjaxHandler() : string
Return values
string

getAssetPath()

Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.

public getAssetPath(string $fileName[, string $assetPath = null ]) : string
Parameters
$fileName : string

File to load.

$assetPath : string = null

Explicitly define an asset path.

Return values
string

Relative path to the asset file.

getAssetPaths()

Returns an array of all registered asset paths.

public getAssetPaths() : array<string|int, mixed>
Return values
array<string|int, mixed>

getClassExtension()

Returns a behavior object from an extendable class, example:

public getClassExtension(string $name) : mixed

$this->getClassExtension('Backend.Behaviors.FormController')

Parameters
$name : string

Fully qualified behavior name

Return values
mixed

getClassMethods()

Get a list of class methods, extension equivalent of get_class_methods()

public getClassMethods() : array<string|int, mixed>
Return values
array<string|int, mixed>

getConfigPath()

Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.

public getConfigPath(string $fileName[, mixed $configPath = null ]) : string
Parameters
$fileName : string

File to load.

$configPath : mixed = null

Explicitly define a config path.

Return values
string

Full path to the config file.

getDynamicProperties()

Returns all dynamic properties and their values

public getDynamicProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>

['property' => 'value']

getFatalError()

public getFatalError() : string
Return values
string

The fatal error message

getId()

Returns a unique ID for the controller and route. Useful in creating HTML markup.

public getId([mixed $suffix = null ]) : mixed
Parameters
$suffix : mixed = null
Return values
mixed

getMiddleware()

Get the middleware assigned to the controller.

public getMiddleware() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPublicActions()

Returns the controllers public actions.

public getPublicActions() : mixed
Return values
mixed

getResponseHeaders()

Get the header response bag

public getResponseHeaders() : ResponseHeaderBag|null
Return values
ResponseHeaderBag|null

getStatusCode()

Returns the status code for the current web response.

public getStatusCode() : int
Return values
int

Status code

getViewPath()

Locates a file based on its definition. The file name can be prefixed with a symbol (~|$) to return in context of the application or plugin base path, otherwise it will be returned in context of this object view path.

public getViewPath(string $fileName[, mixed $viewPath = null ]) : string
Parameters
$fileName : string

File to load.

$viewPath : mixed = null

Explicitly define a view path.

Return values
string

Full path to the view file.

getViewPaths()

Returns the active view path locations.

public getViewPaths() : array<string|int, mixed>
Return values
array<string|int, mixed>

guessConfigPath()

Guess the package path for the called class.

public guessConfigPath([string $suffix = '' ]) : string
Parameters
$suffix : string = ''

An extra path to attach to the end

Return values
string

guessConfigPathFrom()

Guess the package path from a specified class.

public guessConfigPathFrom(string $class[, string $suffix = '' ]) : string
Parameters
$class : string

Class to guess path from.

$suffix : string = ''

An extra path to attach to the end

Return values
string

guessViewPath()

Guess the package path for the called class.

public guessViewPath([string $suffix = '' ][, bool $isPublic = false ]) : string
Parameters
$suffix : string = ''

An extra path to attach to the end

$isPublic : bool = false

Returns public path instead of an absolute one

Return values
string

guessViewPathFrom()

Guess the package path from a specified class.

public guessViewPathFrom(string $class[, string $suffix = '' ][, bool $isPublic = false ]) : string
Parameters
$class : string

Class to guess path from.

$suffix : string = ''

An extra path to attach to the end

$isPublic : bool = false

Returns public path instead of an absolute one

Return values
string

handleError()

Sets standard page variables in the case of a controller error.

public handleError(mixed $exception) : mixed
Parameters
$exception : mixed
Return values
mixed

hasAssetsDefined()

Returns true if assets any have been added.

public hasAssetsDefined() : bool
Return values
bool

hasFatalError()

public hasFatalError() : bool
Return values
bool

Whether a fatal error has been set or not.

isBackendHintHidden()

Checks if a hint has been hidden by the user.

public isBackendHintHidden(string $name) : bool
Parameters
$name : string

Unique key name

Return values
bool

isClassExtendedWith()

Check if extendable class is extended with a behavior object

public isClassExtendedWith(string $name) : bool
Parameters
$name : string

Fully qualified behavior name

Return values
bool

makeAssets()

Outputs `<link>` and `<script>` tags to load assets previously added with addJs and addCss method calls

public makeAssets([string $type = null ]) : string
Parameters
$type : string = null

Return an asset collection of a given type (css, rss, js) or null for all.

Return values
string

makeConfig()

Reads the contents of the supplied file and applies it to this object.

public makeConfig([array<string|int, mixed> $configFile = [] ][, array<string|int, mixed> $requiredConfig = [] ]) : array<string|int, mixed>|stdClass
Parameters
$configFile : array<string|int, mixed> = []
$requiredConfig : array<string|int, mixed> = []
Return values
array<string|int, mixed>|stdClass

makeConfigFromArray()

Makes a config object from an array, making the first level keys properties of a new object.

public makeConfigFromArray([array<string|int, mixed> $configArray = [] ]) : stdClass
Parameters
$configArray : array<string|int, mixed> = []

Config array.

Return values
stdClass

The config object

makeFileContents()

Includes a file path using output buffering.

public makeFileContents(string $filePath[, array<string|int, mixed> $extraParams = [] ]) : string

Ensures that vars are available.

Parameters
$filePath : string

Absolute path to the view file.

$extraParams : array<string|int, mixed> = []

Parameters that should be available to the view.

Return values
string

makeFormWidget()

Makes a form widget object with the supplied form field and widget configuration.

public makeFormWidget(string $class[, mixed $fieldConfig = [] ][, array<string|int, mixed> $widgetConfig = [] ]) : FormWidgetBase
Parameters
$class : string

Widget class name

$fieldConfig : mixed = []

A field name, an array of config or a FormField object.

$widgetConfig : array<string|int, mixed> = []

An array of config.

Return values
FormWidgetBase

The widget object

makeHintPartial()

Renders a hint partial, used for displaying informative information that can be hidden by the user. If you don't want to render a partial, you can supply content via the 'content' key of $params.

public makeHintPartial(string $name[, string $partial = null ][, array<string|int, mixed> $params = [] ]) : string
Parameters
$name : string

Unique key name

$partial : string = null

Reference to content (partial name)

$params : array<string|int, mixed> = []

Extra parameters

Return values
string

makeLayout()

Render a layout.

public makeLayout([string $name = null ][, array<string|int, mixed> $params = [] ][, bool $throwException = true ]) : mixed
Parameters
$name : string = null

Specifies the layout name. If this parameter is omitted, the $layout property will be used.

$params : array<string|int, mixed> = []

Parameter variables to pass to the view.

$throwException : bool = true

Throw an exception if the layout is not found

Return values
mixed

The layout contents, or false.

makeLayoutPartial()

Renders a layout partial

public makeLayoutPartial(string $partial[, array<string|int, mixed> $params = [] ]) : string
Parameters
$partial : string

The view to load.

$params : array<string|int, mixed> = []

Parameter variables to pass to the view.

Return values
string

The layout partial contents

makePartial()

Render a partial file contents located in the views folder.

public makePartial(string $partial[, array<string|int, mixed> $params = [] ][, bool $throwException = true ]) : mixed
Parameters
$partial : string

The view to load.

$params : array<string|int, mixed> = []

Parameter variables to pass to the view.

$throwException : bool = true

Throw an exception if the partial is not found.

Return values
mixed

Partial contents or false if not throwing an exception.

makeResponse()

Prepares a response that considers overrides and custom responses.

public makeResponse(mixed $contents) : mixed
Parameters
$contents : mixed
Return values
mixed

makeView()

Loads a view with the name specified. Applies layout if its name is provided by the parent object.

public makeView(string $view) : string

The view file must be situated in the views directory, and has the extension "htm".

Parameters
$view : string

Specifies the view name, without extension. Eg: "index".

Return values
string

makeViewContent()

Renders supplied contents inside a layout.

public makeViewContent(string $contents[, string $layout = null ]) : string
Parameters
$contents : string

The inner contents as a string.

$layout : string = null

Specifies the layout name.

Return values
string

makeWidget()

Makes a widget object with the supplied configuration file.

public makeWidget(string $class[, array<string|int, mixed> $widgetConfig = [] ]) : mixed|WidgetBase
Parameters
$class : string

Widget class name

$widgetConfig : array<string|int, mixed> = []

An array of config.

Return values
mixed|WidgetBase

The widget object

manage()

Action used for managing roles such as: their order, some stats, and their properties TODO: This needs a major cleanup and refactor

public manage() : mixed
Return values
mixed

mergeConfig()

Merges two configuration sources, either prepared or not, and returns them as a single configuration object.

public mergeConfig(mixed $configA, mixed $configB) : stdClass
Parameters
$configA : mixed
$configB : mixed
Return values
stdClass

The config object

methodExists()

Checks if a method exists, extension equivalent of method_exists()

public methodExists(string $name) : bool
Parameters
$name : string
Return values
bool

middleware()

Register middleware on the controller.

public middleware(array<string|int, mixed>|string|Closure $middleware[, array<string|int, mixed> $options = [] ]) : ControllerMiddlewareOptions
Parameters
$middleware : array<string|int, mixed>|string|Closure
$options : array<string|int, mixed> = []
Return values
ControllerMiddlewareOptions

onAssignRole()

Handles assigning a role

public onAssignRole() : mixed
Return values
mixed

onAssignUser()

AJAX handler for assigning groups already in a group to a role

public onAssignUser() : array<string|int, mixed>
Return values
array<string|int, mixed>

onCreateGroup()

AJAX handler for creating a group when clicking 'create'

public onCreateGroup() : mixed
Return values
mixed

onCreateRole()

AJAX handler for creating a new role when clicking create/save on a create role form.

public onCreateRole() : array<string|int, mixed>
Return values
array<string|int, mixed>

onDeleteGroup()

AJAX handler for deleting a group

public onDeleteGroup() : mixed
Return values
mixed

onDemoteUser()

Demotes a user

public onDemoteUser() : array<string|int, mixed>
Return values
array<string|int, mixed>

onEditGroup()

AJAX handler for saving the update group modal

public onEditGroup() : mixed
Return values
mixed

onEditRole()

AJAX handler called to save the role after the user clicks save in the role editor window

public onEditRole() : array<string|int, mixed>
Return values
array<string|int, mixed>

onHideBackendHint()

Ajax handler to hide a backend hint, once hidden the partial will no longer display for the user.

public onHideBackendHint() : void
Return values
void

onManageRole()

AJAX handler called when clicking on a different role to manage it

public onManageRole() : array<string|int, mixed>
Return values
array<string|int, mixed>

onManageUser()

AJAX handler for redirecting when clicking on a users name

public onManageUser() : mixed
Return values
mixed

onMoveRoleDown()

AJAX handler called when trying to move a role lower in the hierarchy

public onMoveRoleDown() : array<string|int, mixed>
Return values
array<string|int, mixed>

onMoveRoleUp()

AJAX handler called when trying to move a role higher in the hierarchy

public onMoveRoleUp() : array<string|int, mixed>
Return values
array<string|int, mixed>

onOpenGroupCreator()

AJAX handler for opening the create a group modal

public onOpenGroupCreator() : mixed
Return values
mixed

onOpenGroupEditor()

AJAX handler to open the update group modal

public onOpenGroupEditor() : mixed
Return values
mixed

onOpenRoleCreator()

AJAX handler for opening a form for creating a new role

public onOpenRoleCreator() : mixed
Return values
mixed

onOpenRoleEditor()

AJAX handler called when hitting the edit role button in the role manager.. Used to edit the role.

public onOpenRoleEditor() : mixed
Return values
mixed

onPageChoose()

Choose a page for table pagination

public onPageChoose() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

onPageLeft()

Page left for table pagination

public onPageLeft() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

onPageRight()

Page right for table pagination

public onPageRight() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

onPromoteUser()

Promotes a user

public onPromoteUser() : array<string|int, mixed>
Return values
array<string|int, mixed>

onRemoveRole()

AJAX handler for removing a role

public onRemoveRole() : array<string|int, mixed>
Return values
array<string|int, mixed>

onRemoveUserFromGroup()

AJAX handler for removing a group from a user

public onRemoveUserFromGroup() : array<string|int, mixed>|false
Return values
array<string|int, mixed>|false

onResetToDefault()

Resets the application to default roles and groups

public onResetToDefault() : mixed
Return values
mixed

onSelectGroup()

AJAX handler used when a user clicks on a different group

public onSelectGroup() : array<string|int, mixed>
Return values
array<string|int, mixed>

onUnassignRole()

Handles unassigning a role

public onUnassignRole() : array<string|int, mixed>
Return values
array<string|int, mixed>

onUnassignUser()

Removes a user from a role. This does not remove them from the group.

public onUnassignUser() : array<string|int, mixed>

It only sets their role_id to 0 in UsersGroups tbl

Return values
array<string|int, mixed>

pageAction()

Invokes the current controller action without rendering a view, used by AJAX handler that may rely on the logic inside the action.

public pageAction() : mixed
Return values
mixed

propertyExists()

Checks if a property exists, extension equivalent of `property_exists()`

public propertyExists(string $name) : bool
Parameters
$name : string
Return values
bool

run()

Execute the controller action.

public run([string $action = null ][, array<string|int, mixed> $params = [] ]) : mixed
Parameters
$action : string = null

The action name.

$params : array<string|int, mixed> = []

Routing parameters to pass to the action.

Return values
mixed

The action result.

setResponse()

Sets the response for the current page request cycle, this value takes priority over the standard response prepared by the controller.

public setResponse(mixed $response) : $this
Parameters
$response : mixed

Response object or string

Return values
$this

setResponseCookie()

Add a cookie to the response.

public setResponseCookie(Cookie|mixed $cookie) : $this
Parameters
$cookie : Cookie|mixed
Return values
$this

setResponseHeader()

Set a header on the Response.

public setResponseHeader(string $key, array<string|int, mixed>|string $values[, bool $replace = true ]) : $this
Parameters
$key : string
$values : array<string|int, mixed>|string
$replace : bool = true
Return values
$this

setStatusCode()

Sets the status code for the current web response.

public setStatusCode(int $code) : $this
Parameters
$code : int

Status code

Return values
$this

addAsset()

Adds the provided asset to the internal asset collections

protected addAsset(string $type, string $path, array<string|int, mixed> $attributes) : mixed
Parameters
$type : string

The type of the asset: 'js' || 'css' || 'rss'

$path : string

The path to the asset

$attributes : array<string|int, mixed>

The attributes for the asset

Return values
mixed

execAjaxHandlers()

This method is used internally.

protected execAjaxHandlers() : mixed

Invokes a controller event handler and loads the supplied partials.

Return values
mixed

execPageAction()

This method is used internally.

protected execPageAction(string $actionName, array<string|int, mixed> $parameters) : mixed

Invokes the controller action and loads the corresponding view.

Parameters
$actionName : string

Specifies a action name to execute.

$parameters : array<string|int, mixed>

A list of the action parameters.

Return values
mixed

extendableIsAccessible()

Checks if a property is accessible, property equivalent of `is_callable()`

protected extendableIsAccessible(mixed $class, string $propertyName) : bool
Parameters
$class : mixed
$propertyName : string
Return values
bool

extensionExtractMethods()

Extracts the available methods from a behavior and adds it to the list of callable methods.

protected extensionExtractMethods(string $extensionName, object $extensionObject) : void
Parameters
$extensionName : string
$extensionObject : object
Return values
void

getAssetEntryBuildPath()

Internal helper, attaches a build code to an asset path

protected getAssetEntryBuildPath(array<string|int, mixed> $asset) : string
Parameters
$asset : array<string|int, mixed>

Stored asset array

Return values
string

getAssetScheme()

Internal helper, get asset scheme

protected getAssetScheme(string $asset) : string
Parameters
$asset : string

Specifies a path (URL) to the asset.

Return values
string

getLocalPath()

protected getLocalPath(string $relativePath) : mixed
Parameters
$relativePath : string
Return values
mixed

handleViewException()

Handle a view exception.

protected handleViewException(Exception $e, int $obLevel) : void
Parameters
$e : Exception
$obLevel : int
Return values
void

makeXsrfCookie()

Adds anti-CSRF cookie.

protected makeXsrfCookie() : Cookie

Adds a cookie with a token for CSRF checks to the response.

Return values
Cookie

queue()

Queues the partials for render.

protected queue(array<string|int, mixed> $to_queue) : bool

This function requires an array of partials const's to signify which partials to render. Any session data should be changed prior to calling Queue. This does not also preform the render.

Parameters
$to_queue : array<string|int, mixed>
Return values
bool

queueBlank()

Queues a div to be emptied.

protected queueBlank(array<string|int, mixed> $to_queue) : bool
Parameters
$to_queue : array<string|int, mixed>
Return values
bool

queueUeCreateGroupForm()

Queues the create a group form modal

protected queueUeCreateGroupForm() : bool
Return values
bool

queueUeCreateRoleForm()

Queues the create a role form modal

protected queueUeCreateRoleForm() : bool
Return values
bool

queueUeListGroupButtons()

Queues the group list buttons

protected queueUeListGroupButtons() : bool
Return values
bool

queueUeListRolesTable()

Queues the role list table

protected queueUeListRolesTable() : bool
Return values
bool

queueUeListRolesTableUnassigned()

Queues the unassigned-to-group roles table

protected queueUeListRolesTableUnassigned() : bool
Return values
bool

queueUeManageCreationToolbar()

Queues the create buttons toolbar

protected queueUeManageCreationToolbar() : bool
Return values
bool

queueUeManageGroupToolbar()

Queues the group management toolbar

protected queueUeManageGroupToolbar() : bool
Return values
bool

queueUeManageOverallToolbar()

Queues the overall management toolbar. This is the one which includes stats/analytics and delete groups.

protected queueUeManageOverallToolbar() : bool
Return values
bool

queueUeManageRoleToolbar()

Queues the role management toolbar

protected queueUeManageRoleToolbar() : bool
Return values
bool

queueUeManageRoleUi()

Queues the manage role UI

protected queueUeManageRoleUi() : bool
Return values
bool

queueUeManageUsersUi()

Queues the manage users UI

protected queueUeManageUsersUi() : bool
Return values
bool

queueUeUpdateGroupForm()

Queues the update a group form modal

protected queueUeUpdateGroupForm([null $groupCode = null ]) : bool
Parameters
$groupCode : null = null
Return values
bool

queueUeUpdateRoleForm()

Queues the update a role form modal

protected queueUeUpdateRoleForm([null $roleCode = null ]) : bool
Parameters
$roleCode : null = null
Return values
bool

removeDuplicates()

Removes duplicate assets from the entire collection.

protected removeDuplicates() : void
Return values
void

render()

Renders each of the passed const's and returns a merged array of them $to_render is an array containing arrays of the following format [UE_CREATE_ROLE_FORM, ['group' => groupCode, 'role' => roleCode]]

protected render([array<string|int, mixed> $to_render = [] ]) : array<string|int, mixed>
Parameters
$to_render : array<string|int, mixed> = []
Return values
array<string|int, mixed>

runAjaxHandler()

Tries to find and run an AJAX handler in the page action.

protected runAjaxHandler(mixed $handler) : bool

The method stops as soon as the handler is found.

Parameters
$handler : mixed
Return values
bool

Returns true if the handler was found. Returns false otherwise.

runAjaxHandlerForWidget()

Specific code for executing an AJAX handler for a widget.

protected runAjaxHandlerForWidget(mixed $widget, mixed $handler) : mixed

This will append the widget view paths to the controller and merge the vars.

Parameters
$widget : mixed
$handler : mixed
Return values
mixed

verifyCsrfToken()

Checks the request data / headers for a valid CSRF token.

protected verifyCsrfToken() : bool

Returns false if a valid token is not found. Override this method to disable the check.

Return values
bool

verifyForceSecure()

Checks if the back-end should force a secure protocol (HTTPS) enabled by config.

protected verifyForceSecure() : bool
Return values
bool

flushCurrentPages()

Removes the pagination session data

private flushCurrentPages() : mixed
Return values
mixed

flushQueue()

Flushes the queue Remove all renders in queue

private flushQueue() : mixed
Return values
mixed

flushSession()

Flushes the Session Removes session keys used by RoleManager

private flushSession() : mixed
Return values
mixed

getCurrentGroup()

Retrieves the current group from the session

private getCurrentGroup() : bool|string
Return values
bool|string

getCurrentPage()

Gets the current page from session for pagination

private getCurrentPage( $tbl) : bool|null
Parameters
$tbl :
Return values
bool|null

getCurrentRole()

Gets the current role from the session

private getCurrentRole() : bool|string
Return values
bool|string

setCurrentGroup()

Sets the current group into the session

private setCurrentGroup( $groupCode) : bool
Parameters
$groupCode :
Return values
bool

setCurrentPage()

Sets the current page for a table into session for pagination

private setCurrentPage( $tbl,  $page) : bool
Parameters
$tbl :
$page :
Return values
bool

setCurrentRole()

Sets the current role into the session

private setCurrentRole( $roleCode) : bool
Parameters
$roleCode :
Return values
bool

Search results