A view object holds output data and references to child views.
It inherits an ArrayAccess interface and is capable to convert its internal
state to a string using a Template.
A Template can be a PHP script or a callback function that receives the
view state.
Usually, PHP templates are kept into View/ directories, but generally they
follow the class naming convention.
Moreover, every module has a View object assigned to it as a parameter during
prepareView() operation.
Methods summary
public
|
|
public
string
|
#
getTargetFormat( )
Get the requested resource format
Get the requested resource format
Deprecated
since 1.6
Returns
string
Api
Implementation of
|
public
Nethgui\View\ViewInterface
|
#
copyFrom( Traversable $data )
Assign data to the View state.
Assign data to the View state.
Parameters
Returns
Api
Implementation of
|
public
Nethgui\View\ViewInterface
|
#
setTemplate( string|callable|boolean $template )
Set the template to be applied to the view
Set the template to be applied to the view
If a string is given, it identifies a PHP Template script (ie. Nethgui\Template\Main);
If a callback function is given, it is invoked with an array representing the view state as argument and is expected to return a string representing the view;
If a boolean FALSE, is given the view is rendered as an empty string.
Parameters
- $template
- The template converting the view state to a string
Returns
Api
Implementation of
|
public
string|callable|boolean
|
#
getTemplate( )
TODO
Returns
string|callable|boolean
See
Api
Implementation of
|
public
Nethgui\View\ViewInterface
|
#
spawnView( Nethgui\Module\ModuleInterface $module, boolean $register = FALSE )
Create a new view object associated to $module
Create a new view object associated to $module
Parameters
- $module
- The associated $module
- $register
- If TRUE the returned view is added to the current object with key equal to the module identifier
Returns
Api
Implementation of
|
public
|
#
getIterator( )
Implementation of
IteratorAggregate::getIterator()
|
public
|
#
offsetExists( $offset )
Implementation of
ArrayAccess::offsetExists()
|
public
|
#
offsetGet( $offset )
Implementation of
ArrayAccess::offsetGet()
|
public
|
#
offsetSet( $offset, $value )
Implementation of
ArrayAccess::offsetSet()
|
public
|
#
offsetUnset( $offset )
Implementation of
ArrayAccess::offsetUnset()
|
public
string
|
#
translate( string $value, array $args = array() )
A method to translate a message according to the user language preferences.
A method to translate a message according to the user language preferences.
Parameters
Returns
string
See
Api
Implementation of
|
public
Nethgui\View\TranslatorInterface
|
#
getTranslator( )
Access to the object performing string translations
Access to the object performing string translations
Returns
See
Api
Implementation of
|
public
Nethgui\Module\ModuleInterface
|
#
getModule( )
The module associated to this view.
The module associated to this view.
Returns
Api
Implementation of
|
public
array
|
#
getModulePath( )
Gets the array of the current module identifier plus all identifiers of
the ancestor modules, starting from the root.
Gets the array of the current module identifier plus all identifiers of
the ancestor modules, starting from the root.
Returns
array
See
ModuleInterface::getParent()
ModuleInterface::getIdentifier()
Api
Implementation of
|
public
array
|
#
resolvePath( string $path )
Obtain the complete path list, starting from root.
Obtain the complete path list, starting from root.
An heading '/' character treat the $path as absolute, otherwise the
$path is considered relative to the current module and a '..' substring
goes one level up.
Parameters
Returns
array The path parts, starting from root
See
Api
Implementation of
|
public
string
|
#
getUniqueId( string $path = '' )
Generate a unique identifier for the given $path. If no parts are given
the identifier refers the the module referenced by the view.
Generate a unique identifier for the given $path. If no parts are given
the identifier refers the the module referenced by the view.
Parameters
- $path
- Relative to the current module
Returns
string
Api
Implementation of
|
public
string
|
#
getClientEventTarget( string $name )
Get the target control identifier for the given view member
Get the target control identifier for the given view member
Parameters
Returns
string
See
358
Api
Implementation of
|
public
string
|
#
getModuleUrl( string $path = '' )
Return an absolute url path.
Return an absolute url path.
Parameters
- $path
- Relative to the current module
Returns
string
See
Api
Implementation of
|
public
string
|
#
getSiteUrl( )
The web site URL without trailing slash
The web site URL without trailing slash
Returns
string
Example
http://www.example.org:8080
Api
Implementation of
|
public
string
|
#
getPathUrl( )
The path component of an URL with a leading slash and trailing
The path component of an URL with a leading slash and trailing
Returns
string
Example
/my/path/to/the/app/
Api
Implementation of
|
public
Nethgui\Log\LogConsumerInterface
|
#
setLog( Nethgui\Log\LogInterface $log )
Change the log attached to the interface implementor
Change the log attached to the interface implementor
Parameters
Returns
Api
Implementation of
|
public
Nethgui\Log\LogInterface
|
#
getLog( )
The log attached to the interface implementor
The log attached to the interface implementor
Returns
Api
Implementation of
|
public
mixed
|
#
executeCommand( Nethgui\View\ViewInterface $origin, string $selector, string $name, array $arguments )
Specify an implementation for the given method and arguments.
Specify an implementation for the given method and arguments.
The original view that generated the command and the selector string
that identifies the logical target provide more contextual informations.
Parameters
- $origin
- $selector
- $name
- $arguments
Returns
mixed
Implementation of
|
public
Nethgui\View\LegacyCommandBag
|
#
getCommandList( string $selector = '' )
Get a command list for the given selector
Get a command list for the given selector
The returned command list is ready to execute().
NOTE: only view objects correctly deliver commands to the client-side.
Widget commands are delivered to widget objects and executed server-side
only.
Deprecated
since version 1.6
Parameters
- $selector
- Routes the command list to the receiver appointed by this parameter.
Returns
Api
Implementation of
|
public
boolean
|
#
hasCommandList( $selector = '' )
Check if one or more commands has been added to the selected command list
Check if one or more commands has been added to the selected command list
Deprecated
since version 1.6
Returns
boolean TRUE, if some command has been added to the list
Api
Implementation of
|
public
|
|
public
Nethgui\View\View
|
#
clearAllCommands( )
Remove all enqueued commands without executing them
Remove all enqueued commands without executing them
Returns
|