\Charcoal\Admin\Template\SystemUserPermissionsTemplate

Base class for all `admin` Templates.

Available (mustache) methods

  • title (Translation) - The page title
  • subtitle (Translation) The page subtitle
  • showHeaderMenu (bool) - Display the header menu or not
  • headerMenu (iterator) - The header menu data
  • showFooterMenu (bool) - Display the footer menu or not
  • footerMenu (iterator) - The footer menu data

Summary

Methods
Properties
Constants
setView()
view()
setCollectionLoader()
setObjType()
objType()
setCollectionIdent()
collectionIdentFallback()
collectionIdent()
collectionMetadata()
collectionConfig()
setCollectionConfig()
mergeCollectionConfig()
page()
numPerPage()
numPages()
setCollection()
collection()
createCollection()
objects()
sortObjects()
sortProperties()
objectRows()
hasObjects()
numObjects()
numTotal()
proto()
setDashboardIdent()
dashboardIdent()
setDashboardConfig()
dashboardConfig()
createDashboardConfig()
dashboard()
setDependencies()
init()
setIdent()
ident()
setLabel()
label()
setTitle()
title()
setSubtitle()
subtitle()
setShowTopHeaderMenu()
showTopHeaderMenu()
setTopHeaderMenu()
topHeaderMenu()
setShowHeaderMenu()
showHeaderMenu()
headerMenu()
setShowFooterMenu()
showFooterMenu()
footerMenu()
setShowSidemenu()
showSidemenu()
sidemenu()
isAuthenticated()
getAuthenticatedUser()
adminUrl()
setBaseUrl()
baseUrl()
headerMenuLogo()
siteName()
documentTitle()
devMode()
lang()
locale()
recaptchaKey()
hasFeedbacks()
numFeedbacks()
feedbacks()
addFeedback()
clearFeedback()
No public properties found
No constants found
setModelFactory()
modelFactory()
collectionLoader()
createCollectionLoader()
parseCollectionConfig()
defaultCollectionConfig()
createCollectionConfig()
setupDisplayPropertyValue()
parsePropertyCell()
parseObjectRow()
createDashboard()
setDashboardBuilder()
dashboardBuilder()
createHeaderMenu()
createSidemenu()
authRequired()
setSiteName()
setWidgetFactory()
widgetFactory()
resolveFeedbackLevel()
$currentObjId
$currentObj
$display
$dashboardIdent
$dashboardConfig
$dashboard
$baseUrl
$adminConfig
$appConfig
$label
$title
$subtitle
$headerMenu
$sidemenu
$feedbacks
N/A
setPropertyDisplayFactory()
propertyDisplayFactory()
createObjTable()
$modelFactory
$collectionLoader
$objType
$collectionIdent
$collectionConfig
$defaultCollectionConfig
$numTotal
$collection
$propertyDisplayFactory
$proto
$view
$dashboardBuilder
$siteName
$ident
$showSidemenu
$showHeaderMenu
$showFooterMenu
$showTopHeaderMenu
$widgetFactory
N/A

Properties

$currentObjId

$currentObjId : mixed

Type

mixed

$currentObj

$currentObj : mixed

Type

mixed

$display

$display : \Charcoal\Admin\Ui\PropertyInputInterface

In memory copy of the PropertyDisplay object

Type

\Charcoal\Admin\Ui\PropertyInputInterface

$dashboardIdent

$dashboardIdent : string

Type

string

$dashboardConfig

$dashboardConfig : mixed

Type

mixed

$dashboard

$dashboard : \Charcoal\Admin\Ui\Dashboard

Type

\Charcoal\Admin\Ui\Dashboard

$baseUrl

$baseUrl : \Psr\Http\Message\UriInterface

The base URI.

Type

\Psr\Http\Message\UriInterface

$adminConfig

$adminConfig : \Charcoal\Admin\Config

Store a reference to the admin configuration.

Type

\Charcoal\Admin\Config

$appConfig

$appConfig : \Charcoal\App\Config

Store a reference to the application configuration.

Type

\Charcoal\App\Config

$label

$label : \Charcoal\Translator\Translation|string|null

Type

\Charcoal\Translator\Translation|string|null

$title

$title : \Charcoal\Translator\Translation|string|null

Type

\Charcoal\Translator\Translation|string|null

$subtitle

$subtitle : \Charcoal\Translator\Translation|string|null

Type

\Charcoal\Translator\Translation|string|null

$headerMenu

$headerMenu : boolean

Type

boolean

$sidemenu

$sidemenu : \Charcoal\Admin\SideMenuWidgetInterface

Type

\Charcoal\Admin\SideMenuWidgetInterface

$feedbacks

$feedbacks : array

Collection of feedback.

Type

array

$modelFactory

$modelFactory : \Charcoal\Factory\FactoryInterface

Type

\Charcoal\Factory\FactoryInterface

$collectionLoader

$collectionLoader : \Charcoal\Loader\CollectionLoader

Type

\Charcoal\Loader\CollectionLoader

$objType

$objType : string

Type

string

$collectionIdent

$collectionIdent : string

Type

string

$collectionConfig

$collectionConfig : array|null

Collection configuration.

Type

array|null

$defaultCollectionConfig

$defaultCollectionConfig : array|null

Default collection configuration.

Type

array|null

$numTotal

$numTotal : integer

Type

integer

$collection

$collection : \Charcoal\Model\Collection

Type

\Charcoal\Model\Collection

$propertyDisplayFactory

$propertyDisplayFactory : \Charcoal\Factory\FactoryInterface

Type

\Charcoal\Factory\FactoryInterface

$proto

$proto : \Charcoal\Model\ModelInterface

Type

\Charcoal\Model\ModelInterface

$view

$view : \Charcoal\View\ViewInterface

Type

\Charcoal\View\ViewInterface

$dashboardBuilder

$dashboardBuilder : \Charcoal\Ui\Dashboard\DashboardBuilder

Type

\Charcoal\Ui\Dashboard\DashboardBuilder

$siteName

$siteName : \Charcoal\Translator\Translation|string|null

The name of the project.

Type

\Charcoal\Translator\Translation|string|null

$ident

$ident : string

Type

string

$showSidemenu

$showSidemenu : boolean

Type

boolean

$showHeaderMenu

$showHeaderMenu : boolean

Type

boolean

$showFooterMenu

$showFooterMenu : boolean

Type

boolean

$showTopHeaderMenu

$showTopHeaderMenu : boolean

Type

boolean

$widgetFactory

$widgetFactory : \Charcoal\Factory\FactoryInterface

Type

\Charcoal\Factory\FactoryInterface

Methods

setView()

setView(\Charcoal\View\ViewInterface|array  $view) : \Charcoal\Admin\Ui\CollectionContainerInterface

Parameters

\Charcoal\View\ViewInterface|array $view

The view instance.

Returns

\Charcoal\Admin\Ui\CollectionContainerInterface

Chainable

view()

view() : \Charcoal\View\ViewInterface

Throws

\Exception

If the view instance is not previously set / injected.

Returns

\Charcoal\View\ViewInterface —

The object's view.

setCollectionLoader()

setCollectionLoader(\Charcoal\Loader\CollectionLoader  $loader) : \Charcoal\Admin\Ui\CollectionContainerInterface

Parameters

\Charcoal\Loader\CollectionLoader $loader

The collection loader.

Returns

\Charcoal\Admin\Ui\CollectionContainerInterface

Chainable

setObjType()

setObjType(string  $objType) : \Charcoal\Admin\Ui\CollectionContainerInterface

Parameters

string $objType

The collection's object type.

Throws

\InvalidArgumentException

If provided argument is not of type 'string'.

Returns

\Charcoal\Admin\Ui\CollectionContainerInterface

Chainable

objType()

objType() : string

Returns

string

setCollectionIdent()

setCollectionIdent(string  $collectionIdent) : \Charcoal\Admin\Ui\CollectionContainerInterface

Set the key for the collection structure to use.

Parameters

string $collectionIdent

The collection identifier.

Throws

\InvalidArgumentException

If the identifier argument is not a string.

Returns

\Charcoal\Admin\Ui\CollectionContainerInterface

Chainable

collectionIdentFallback()

collectionIdentFallback() : string

Retrieve a key for the collection structure to use.

If the collection key is undefined, resolve a fallback.

Returns

string

collectionIdent()

collectionIdent() : string|null

Retrieve the key for the collection structure to use.

Returns

string|null

collectionMetadata()

collectionMetadata() : array

Return the current collection metadata.

Returns

array

collectionConfig()

collectionConfig() : array|null

Retrieve the collection configset.

Returns

array|null

setCollectionConfig()

setCollectionConfig(mixed  $config) : \Charcoal\Admin\Ui\CollectionContainerInterface

Replace the collection's configset with the given parameters.

Parameters

mixed $config

New collection config values.

Returns

\Charcoal\Admin\Ui\CollectionContainerInterface

Chainable

mergeCollectionConfig()

mergeCollectionConfig(array  $config) : self

Merge given parameters into the collection's configset.

Parameters

array $config

New collection config values.

Returns

self

page()

page() : integer

Returns

integer

numPerPage()

numPerPage() : integer

Returns

integer

numPages()

numPages() : integer

Returns

integer

collection()

collection() : \Charcoal\Model\Collection

Returns

\Charcoal\Model\Collection

createCollection()

createCollection(array  $data = null) : \Charcoal\Loader\CollectionLoader

Parameters

array $data

Optional collection data.

Throws

\Exception

If the object type of the colletion has not been set.

Returns

\Charcoal\Loader\CollectionLoader

objects()

objects() : array

Returns

array

sortObjects()

sortObjects() : array

Sort the objects before they are displayed as rows.

This method is useful for classes using this trait.

Returns

array

sortProperties()

sortProperties() : array

Sort the properties before they are displayed as columns.

This method is useful for classes using this trait.

Returns

array

objectRows()

objectRows() : array

Supplies properties for objects in table template specific to object configuration.

Returns

array —

This metod is a generator.

hasObjects()

hasObjects() : boolean

Returns

boolean

numObjects()

numObjects() : integer

Returns

integer

numTotal()

numTotal() : integer

Throws

\Exception

If obj type was not set.

Returns

integer

proto()

proto(boolean  $reload = false) : object

Parameters

boolean $reload

If true, reload will be forced.

Throws

\InvalidArgumentException

If the object type is not defined / can not create prototype.

Returns

object

setDashboardIdent()

setDashboardIdent(string  $dashboardIdent) : \Charcoal\Admin\Ui\DashboardContainerInterface

Parameters

string $dashboardIdent

The dashboard identifier.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\Admin\Ui\DashboardContainerInterface

Chainable

dashboardIdent()

dashboardIdent() : string

Returns

string

setDashboardConfig()

setDashboardConfig(mixed  $dashboardConfig) : \Charcoal\Admin\Ui\DashboardContainerInterface

Parameters

mixed $dashboardConfig

The dasboard configuration.

Returns

\Charcoal\Admin\Ui\DashboardContainerInterface

Chainable

dashboardConfig()

dashboardConfig() : mixed

Returns

mixed

createDashboardConfig()

createDashboardConfig() : mixed

Returns

mixed

dashboard()

dashboard() : \Charcoal\Ui\Dashboard\DashboardInterface

Returns

\Charcoal\Ui\Dashboard\DashboardInterface

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Set common dependencies (services) used in all admin templates.

Parameters

\Pimple\Container $container

Pimple DI Container.

init()

init(\Psr\Http\Message\RequestInterface  $request) : boolean

Template's init method is called automatically from `charcoal-app`'s Template Route.

For admin templates, initializations is:

  • to start a session, if necessary
  • to authenticate
  • to initialize the template data with $_GET

Parameters

\Psr\Http\Message\RequestInterface $request

PSR-7 request.

Returns

boolean

setIdent()

setIdent(mixed  $ident) : \Charcoal\Admin\AdminTemplate

Parameters

mixed $ident

Template identifier.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

ident()

ident() : string

Returns

string

setLabel()

setLabel(mixed  $label) : \Charcoal\Admin\AdminTemplate

Parameters

mixed $label

Template label.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

label()

label() : \Charcoal\Translator\Translation|string|null

Returns

\Charcoal\Translator\Translation|string|null

setTitle()

setTitle(mixed  $title) : \Charcoal\Admin\AdminTemplate

Set the title of the page.

Parameters

mixed $title

Template title.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

title()

title() : \Charcoal\Translator\Translation

Retrieve the title of the page.

Returns

\Charcoal\Translator\Translation

setSubtitle()

setSubtitle(mixed  $subtitle) : \Charcoal\Admin\AdminTemplate

Set the page's sub-title.

Parameters

mixed $subtitle

Template subtitle.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

subtitle()

subtitle() : \Charcoal\Translator\Translation|string|null

Retrieve the page's sub-title.

Returns

\Charcoal\Translator\Translation|string|null

setShowTopHeaderMenu()

setShowTopHeaderMenu(boolean  $bool) : \Charcoal\Admin\AdminTemplate

Display or not the top right header menu.

Parameters

boolean $bool

Display or not.

Returns

\Charcoal\Admin\AdminTemplate

Chainable.

showTopHeaderMenu()

showTopHeaderMenu() : boolean

Returns

boolean —

Show the top header menu or not.

setTopHeaderMenu()

setTopHeaderMenu(array  $menu) : \Charcoal\Admin\AdminTemplate

Sets the top right header menu.

Parameters

array $menu

Menu as link and labels.

Returns

\Charcoal\Admin\AdminTemplate

Chainable.

topHeaderMenu()

topHeaderMenu() : array

Header menu links and labels.

Returns

array —

The menu.

setShowHeaderMenu()

setShowHeaderMenu(boolean  $show) : \Charcoal\Admin\AdminTemplate

Parameters

boolean $show

The show header menu flag.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

showHeaderMenu()

showHeaderMenu() : boolean

Returns

boolean

headerMenu()

headerMenu() : array

Returns

array

setShowFooterMenu()

setShowFooterMenu(boolean  $show) : \Charcoal\Admin\AdminTemplate

Parameters

boolean $show

The show footer menu flag.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

showFooterMenu()

showFooterMenu() : boolean

Returns

boolean

footerMenu()

footerMenu() : array

Returns

array

setShowSidemenu()

setShowSidemenu(boolean  $show) : \Charcoal\Admin\AdminTemplate

Parameters

boolean $show

The show sidemenu flag.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

showSidemenu()

showSidemenu() : boolean

Returns

boolean

sidemenu()

sidemenu() : \Charcoal\Admin\SidemenuWidgetInterface|null

Retrieve the sidemenu.

Returns

\Charcoal\Admin\SidemenuWidgetInterface|null

isAuthenticated()

isAuthenticated() : boolean

Determine if the current user is authenticated.

Returns

boolean

getAuthenticatedUser()

getAuthenticatedUser() : \Charcoal\User\UserInterface|null

Retrieve the currently authenticated user.

Returns

\Charcoal\User\UserInterface|null

adminUrl()

adminUrl() : \Psr\Http\Message\UriInterface|string

Retrieve the base URI of the administration area.

Returns

\Psr\Http\Message\UriInterface|string

setBaseUrl()

setBaseUrl(\Psr\Http\Message\UriInterface|string  $uri) : self

Set the base URI of the application.

Parameters

\Psr\Http\Message\UriInterface|string $uri

The base URI.

Returns

self

baseUrl()

baseUrl() : \Psr\Http\Message\UriInterface|string

Retrieve the base URI of the application.

Returns

\Psr\Http\Message\UriInterface|string

headerMenuLogo()

headerMenuLogo() : string

Returns

string

siteName()

siteName() : \Charcoal\Translator\Translation|string|null

Retrieve the name of the project.

Returns

\Charcoal\Translator\Translation|string|null

documentTitle()

documentTitle() : \Charcoal\Translator\Translation|string|null

Retrieve the document title.

Returns

\Charcoal\Translator\Translation|string|null

devMode()

devMode() : boolean

Application Debug Mode.

Returns

boolean

lang()

lang() : string

Retrieve the current language.

Returns

string

locale()

locale() : string

Retrieve the current language.

Returns

string

recaptchaKey()

recaptchaKey() : string

Returns

string

hasFeedbacks()

hasFeedbacks() : boolean

Determine if there's feedback.

Returns

boolean

numFeedbacks()

numFeedbacks() : integer

Count feedback.

Returns

integer

feedbacks()

feedbacks(string|null  $level = null) : array

Retrieve the feedback collection.

Optionally retrieve only the feedback for the given level.

Parameters

string|null $level

Optional level to filter collection.

Throws

\InvalidArgumentException

If the feedback level is invalid.

Returns

array

addFeedback()

addFeedback(string  $level, mixed  $message) : \Charcoal\Admin\Ui\FeedbackContainerTrait

Add feedback.

Parameters

string $level

The feedback level.

mixed $message

The feedback message.

Returns

\Charcoal\Admin\Ui\FeedbackContainerTrait

Chainable

setModelFactory()

setModelFactory(\Charcoal\Factory\FactoryInterface  $factory) : void

As a convenience, all admin templates have a model factory to easily create objects.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The factory used to create models.

modelFactory()

modelFactory() : \Charcoal\Factory\FactoryInterface

Throws

\Exception

If the factory is not set.

Returns

\Charcoal\Factory\FactoryInterface —

The model factory.

collectionLoader()

collectionLoader() : \Charcoal\Loader\CollectionLoader

Safe Collection Loader getter.

Create the loader if it was not set / injected.

Returns

\Charcoal\Loader\CollectionLoader

createCollectionLoader()

createCollectionLoader() : \Charcoal\Loader\CollectionLoader

Create a collection loader.

Returns

\Charcoal\Loader\CollectionLoader

parseCollectionConfig()

parseCollectionConfig(array  $config) : array

Stub: Parse given parameters into the collection's config set.

Parameters

array $config

New collection config values.

Returns

array

defaultCollectionConfig()

defaultCollectionConfig() : array|null

Retrieve the default collection configuration.

The default configset is determined by the collection ident and object type, if assigned.

Returns

array|null

createCollectionConfig()

createCollectionConfig() : mixed

Stub: reimplement in classes using this trait.

Returns

mixed

setupDisplayPropertyValue()

setupDisplayPropertyValue(\Charcoal\Model\ModelInterface  $object, \Charcoal\Property\PropertyInterface  $property) : void

Setup the property's display value before its assigned to the object row.

This method is useful for classes using this trait.

Parameters

\Charcoal\Model\ModelInterface $object

The current row's object.

\Charcoal\Property\PropertyInterface $property

The current property.

parsePropertyCell()

parsePropertyCell(\Charcoal\Model\ModelInterface  $object, \Charcoal\Property\PropertyInterface  $property, string  $propertyValue) : array

Filter the property before its assigned to the object row.

This method is useful for classes using this trait.

Parameters

\Charcoal\Model\ModelInterface $object

The current row's object.

\Charcoal\Property\PropertyInterface $property

The current property.

string $propertyValue

The property $key's display value.

Returns

array

parseObjectRow()

parseObjectRow(\Charcoal\Model\ModelInterface  $object, array  $objectProperties) : array

Filter the object before its assigned to the row.

This method is useful for classes using this trait.

Parameters

\Charcoal\Model\ModelInterface $object

The current row's object.

array $objectProperties

The $object's display properties.

Returns

array

createDashboard()

createDashboard() : \Charcoal\Ui\Dashboard\DashboardInterface

Returns

\Charcoal\Ui\Dashboard\DashboardInterface

setDashboardBuilder()

setDashboardBuilder(\Charcoal\Ui\Dashboard\DashboardBuilder  $builder) : void

Parameters

\Charcoal\Ui\Dashboard\DashboardBuilder $builder

The builder, to create customized dashboard objects.

dashboardBuilder()

dashboardBuilder() : \Charcoal\Ui\Dashboard\DashboardBuilder

Throws

\Exception

If the dashboard builder dependency was not previously set / injected.

Returns

\Charcoal\Ui\Dashboard\DashboardBuilder

createHeaderMenu()

createHeaderMenu(mixed  $options = null) : array

Parameters

mixed $options

The sidemenu widget ID or config.

Throws

\InvalidArgumentException

If the menu is missing, invalid, or malformed.

Returns

array

createSidemenu()

createSidemenu(mixed  $options = null) : \Charcoal\Admin\SidemenuWidgetInterface|null

Parameters

mixed $options

The sidemenu widget ID or config.

Throws

\InvalidArgumentException

If the sidemenu widget is invalid.

Returns

\Charcoal\Admin\SidemenuWidgetInterface|null

authRequired()

authRequired() : boolean

Determine if user authentication is required.

Authentication is required by default. If unnecessary, replace this method in the inherited template class.

For example, the "Login" / "Reset Password" templates should return false.

Returns

boolean

setSiteName()

setSiteName(string  $name) : \Charcoal\Admin\AdminTemplate

Set the name of the project.

Parameters

string $name

Name of the project.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

setWidgetFactory()

setWidgetFactory(\Charcoal\Factory\FactoryInterface  $factory) : void

Parameters

\Charcoal\Factory\FactoryInterface $factory

The widget factory, to create the dashboard and sidemenu widgets.

widgetFactory()

widgetFactory() : \Charcoal\Factory\FactoryInterface

Throws

\Exception

If the widget factory dependency was not previously set / injected.

Returns

\Charcoal\Factory\FactoryInterface

resolveFeedbackLevel()

resolveFeedbackLevel(string  $level) : string

Resolve the given feedback level.

Parameters

string $level

The feedback level.

Returns

string —

The level.

setPropertyDisplayFactory()

setPropertyDisplayFactory(\Charcoal\Factory\FactoryInterface  $factory) : \Charcoal\Admin\Ui\CollectionContainerInterface

Parameters

\Charcoal\Factory\FactoryInterface $factory

The property display factory.

Returns

\Charcoal\Admin\Ui\CollectionContainerInterface

Chainable

propertyDisplayFactory()

propertyDisplayFactory() : \Charcoal\Factory\FactoryInterface

Throws

\Exception

If the property display factory was not previously injected / set.

Returns

\Charcoal\Factory\FactoryInterface

createObjTable()

createObjTable() : void