Class coreui
CoreUI proxy view, extending the legacy HTML builder view proxy to include support for controls and dynamos (dynamic controls with the use of JavaScript).
Features the companion client-side CoreUI JavaScript Framework library to implement dynamic controls.
Evolution Summary from Legacy HTML Builder
IDs can no longer be defined individually but are auto-generated (enforces use of class names instead to identify elements or select input fields by name), element descriptors were updated to omit the ID field, input elements (including select boxes and text areas) feature a new first extra argument, the input name, placing the value argument second.
Resource Management
Resources are grouped into classes. A resource class is the primary type of a resource, i.e. image, CSS or JavaScript.
A resource group is basically a repository of resources that are themselves divided by their type.
Resource names are path and file base names separated by colons (":") or slashes ("/"). To simplify use of different categories of resources, a standard set of common categories is managed by the proxy that are used by controls or elements, i.e. setting an icon automatically uses the icon category for a group. A category acts as a prefix.
In summary, resource paths have the following structure:
'resourcePath/resourceGroup/resourceCategory/resourceName'
If a resource group is not specified, it defaults to the resource class. The file extension of the resource is automatically determined by the class and the existing resources, i.e. images are resolved by first testing for a PNG, then JPG and last GIF image.
- Core\Object implements Core\Chainable
- Core\Set implements Core\Accessor
- Core\Set\Mutable implements Core\Mutator
- Core\Field implements Core\Inquiry
- Core\Field\Mutable implements Core\Variator
- Core\View
- Core\View\Driver\html
- Core\View\Driver\coreui
Package: CoreUI
Link: CoreUI JavaScript Framework
Since: 3.1
Requires: PHP 5.3
Version: 1.0
Located at View/Driver/coreui.inc.php
Methods summary
public
|
#
__construct(
Initialises a new View instance. Sets the HTML encoder as the default encoder if no
encoder is specified in the URI. Sets the HTML encoder as the default encoder if no
encoder is specified by the configuration URI, registers static dependencies
and sets the application revision number to the constant
|
public
|
#
append( $elementID )
Appends an element or control to the internal node buffer and returns the instance. |
public
|
#
appendVerbatim( mixed $data )
Adds an arbitrary object or string verbatim (without encoding) to the internal node buffer. |
public
|
|
public
string
|
#
concatArray( $elementID, array $dataArray )
Returns a concatenated set of elements based on the same description string but different data sets. |
public
|
|
public
|
#
observe(
Registers an event handler on client-side for a given JavaScript event triggered by a given element or control. |
public
|
#
registerDependencies( string $resourceClass, array $targets )
Registers new CoreUI resource dependencies. Registered dependency
resources are resolved via |
public
|
#
registerDynamo(
Registers a control implementing the Dynamo interface for client-side use. |
public
boolean
|
#
render( )
Renders page contents. This applies headers as necessary, formats the node buffer, replaces generic place holders and embeds client-side local JavaScript for dynamic controls. Expected placeholders are: |
public
|
|
public
mixed
|
|
public
|
#
setDataForUndefinedKey( string $key, mixed $value )
Adds a KDC value to the view. Additionally, if the key is the empty string, the value is added to the internal HTML buffer. This allows the use of the array-append operator to append values to the internal HTML buffer verbatim. Additionally, if key is the empty string, the value is added to the internal node buffer. This enables the use of the array-append operator to append values to the internal node buffer verbatim. |
public
string
|
#
resolveResource( $class, $name )
Resolves a server-side resource path relative to the application root. |
public
null|string
|
#
urlForResource( $class, $name, boolean $verifyFlag = null )
Resolves client-side URL for a specified resource. |
Methods inherited from Core\View\Driver\html
Methods inherited from Core\Field\Mutable
offsetSet()
,
offsetUnset()
,
setDataForKey()
,
setDataForKeys()
,
setKeyMasquerade()
,
updateMasqueradedKeys()
Methods inherited from Core\Field
getDataForKey()
,
getDataForKeys()
,
getDataForUndefinedKey()
,
issetDataForKey()
,
offsetExists()
,
offsetGet()
Methods inherited from Core\Set\Mutable
Methods inherited from Core\Object
__autocreateFactory()
,
__call()
,
__processParameters()
,
__toString()
,
attachMethod()
,
getValueForKey()
,
getValueForKeyPath()
,
getValueForUndefinedKey()
,
hash()
,
issetValueForKey()
,
setValueForKey()
,
setValueForKeyPath()
,
setValueForUndefinedKey()
,
uuid()
Constants summary
string |
Version
CoreUI package version (same for client libraries and assets). This version can differ from the view driver module version. |
#
'1.0'
|
string |
CoreUIResourceGroup
Resource group for control extensions subdirectory. |
#
'coreui'
|
string |
CSSResourceClass
Resource class for Cascading Style Sheets (CSS). |
#
'css'
|
string |
ImageResourceClass
Resource class for images. |
#
'image'
|
string |
JSResourceClass
Resource class for JavaScript modules. |
#
'js'
|
string |
IconResourceCategory
Resource category for icons. |
#
'icon'
|
Constants inherited from Core\View
Constants inherited from Core\Object
AnyParameterType
,
AutochainParameterType
,
AutocreateParameterType
,
BooleanParameterType
,
CharParameterType
,
EnumParameterType
,
IntegerParameterType
,
RealParameterType
,
StringParameterType
,
UserParameterType
Properties summary
protected
integer
|
$_v_applicationRevision
KVC property. |
|
protected
array
|
$_v_controls
KVC property. |
#
array ()
|
protected
array
|
$_v_dependencies
KVC property. |
#
array ()
|
protected
array
|
$_v_htmlHeader
KVC property. |
#
array ()
|
protected
array
|
$_v_js
KVC property. |
|
protected
array
|
$_v_nodes
KVC property. |
#
array ()
|
protected
string
|
$_v_resourcePath
KVC property. |
#
'rsrc/'
|
protected
|
$_v_resourceCategoryPaths
Associative array of resource categories with their assigned path prefixes. |
#
array (
self::IconResourceCategory => 'icon',
)
|
protected
array
|
$_v_staticDependencies
KVC property. |
#
array (
self::JSResourceClass =>
array (
'coreui:coreui',
),
self::CSSResourceClass =>
array (
'coreui:coreui',
),
)
|
Properties inherited from Core\View\Driver\html
Properties inherited from Core\View
$_encoder
,
$_v_parameters
,
$_v_proxy
,
$_v_renderers
,
$_v_translator
,
$_v_uri
Properties inherited from Core\Field\Mutable
Properties inherited from Core\Field
Magic properties
public read-only
integer
|
$applicationRevision
Application revision number used as cache tags for resources (to force browsers to reload a resource if the application revision changed). |
public read-only
array
|
$controls
Hash of registered dynamo controls, indexed by control ID. Values are references to the registered controls. |
public read-only
array
|
$dependencies
Hash of registered dependencies, indexed by resource class and resource descriptor. Values are the resolved resource file names. |
public read-only
array
|
$js
Sequential array of generated JavaScript statements that are inserted in order of their generation after client-side CoreUI initialisation. |
public read-only
array
|
$htmlHeader
Array of HTML headers with header-type, key and value triples. |
public read-only
array
|
$nodes
Sequential array of generated nodes. |
public read-only
|
$resourceCategoryPaths
Associative array of resource categories with their assigned path prefixes. Can be directly modified to change path prefixes. Retrieve all keys from array to determine which categories are supported by the current CoreUI version. |
public read-only
string
|
$resourcePath
Path prefix for resources relative to the application root directory. The resource path must end in a directory delimiter. |
public read-only
array
|
$staticDependencies
Hash of static dependencies, indexed by resource class. Values are arrays of resource descriptors that are automatically resolved within the constructor. |
Magic properties inherited from Core\View\Driver\html
Magic properties inherited from Core\View
$encoder
,
$parameters
,
$proxy
,
$renderers
,
$translator
,
$uri