Overview

Namespaces

  • Nethgui
    • Adapter
    • Authorization
    • Component
    • Controller
      • Collection
      • Table
    • Exception
    • Log
    • Model
    • Module
      • Help
      • Notification
    • Renderer
    • Serializer
    • System
    • Test
      • Tool
      • Unit
        • Nethgui
          • Adapter
            • ParameterSet
          • Authorization
          • Log
          • Module
            • Notification
          • Renderer
          • Serializer
          • System
          • Utility
          • View
        • Test
          • Tool
    • Utility
    • View
    • Widget
      • Xhtml
  • None
  • Test
    • Tool

Classes

  • LegacyCommandBag
  • Translator
  • View

Interfaces

  • CommandReceiverInterface
  • TranslatorInterface
  • ViewableInterface
  • ViewInterface
  • Overview
  • Namespace
  • Class
  • Deprecated

Interface ViewInterface

Each module receives a view object in prepareView() operation. A view contains three types of elements:

  • primitive types (int, string, array, boolean..)

  • ViewInterface objects

  • Traversable objects

Nethgui\View\ViewInterface implements ArrayAccess, IteratorAggregate

Direct known implementers

Nethgui\Renderer\ReadonlyView, Nethgui\View\View

Indirect known implementers

Nethgui\Module\Help\Renderer, Nethgui\Renderer\AbstractRenderer, Nethgui\Renderer\Json, Nethgui\Renderer\TemplateRenderer, Nethgui\Renderer\Xhtml, Nethgui\Widget\Xhtml\ElementRenderer
Namespace: Nethgui\View
Author: Davide Principi davide.principi@nethesis.it
Since: 1.0
Api
Located at View/ViewInterface.php
Methods summary
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

Nethgui\View\ViewInterface

Api

public string|callable|boolean
# getTemplate( )

TODO

TODO

Returns

string|callable|boolean

See

Nethgui\View\ViewInterface::setTemplate()

Api

public Nethgui\View\ViewInterface
# copyFrom( Traversable $data )

Assign data to the View state.

Assign data to the View state.

Parameters

$data

Returns

Nethgui\View\ViewInterface

Api

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

Nethgui\View\ViewInterface
The new view object, of the same type of the actual.

Api

public Nethgui\Module\ModuleInterface
# getModule( )

The module associated to this view.

The module associated to this view.

Returns

Nethgui\Module\ModuleInterface

Api

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

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

$path
The path

Returns

array
The path parts, starting from root

See

Nethgui\View\ViewInterface::getModulePath()
Nethgui\View\ViewInterface::getModule()

Api

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

Nethgui\View\ViewInterface::resolvePath()

Api

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

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

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

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

$name

Returns

string

See

358


Api

public string
# translate( string $message, 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

$message
$value
$args

Returns

string

See

TranslatorInterface::translate()
Nethgui\View\ViewInterface::getTranslator()

Api

public Nethgui\View\TranslatorInterface
# getTranslator( )

Access to the object performing string translations

Access to the object performing string translations

Returns

Nethgui\View\TranslatorInterface

See

Nethgui\View\ViewInterface::translate()

Api

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

Nethgui\View\LegacyCommandBag

Api

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

public string
# getTargetFormat( )

Get the requested resource format

Get the requested resource format

Deprecated

since 1.6

Returns

string

Api

Methods inherited from ArrayAccess
offsetExists(), offsetGet(), offsetSet(), offsetUnset()
Methods inherited from IteratorAggregate
getIterator()
Constants summary
string TARGET_XHTML

Deprecated

since 1.6
# 'xhtml'
string TARGET_JSON

Deprecated

since 1.6
# 'json'
Nethgui Framework API documentation generated by ApiGen