HTML_QuickForm2
[ class tree: HTML_QuickForm2 ] [ index: HTML_QuickForm2 ] [ all elements ]

Class: HTML_QuickForm2_Container

Source Location: /HTML_QuickForm2-2.0.2/HTML/QuickForm2/Container.php

Class Overview

HTML_Common2
   |
   --HTML_QuickForm2_Node
      |
      --HTML_QuickForm2_Container

Abstract base class for simple QuickForm2 containers


Author(s):

Version:

  • Release: 2.0.2

Variables

Methods


Child classes:

HTML_QuickForm2
Class representing a HTML form
HTML_QuickForm2_Container_Repeat
Handles a Container that can be repeated multiple times in the form
HTML_QuickForm2_Container_Group
Base class for QuickForm2 groups of elements
HTML_QuickForm2_Container_Fieldset
Concrete implementation of a container for fieldsets

Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Node

HTML_QuickForm2_Node::__construct()
Class constructor
HTML_QuickForm2_Node::addFilter()
Adds a filter
HTML_QuickForm2_Node::addRecursiveFilter()
Adds a recursive filter
HTML_QuickForm2_Node::addRule()
Adds a validation rule
HTML_QuickForm2_Node::applyFilter()
Helper function for applying filter callback to a value
HTML_QuickForm2_Node::applyFilters()
Applies non-recursive filters on element value
HTML_QuickForm2_Node::createRule()
Creates a validation rule
HTML_QuickForm2_Node::generateId()
Generates an id for the element
HTML_QuickForm2_Node::getContainer()
Returns the element containing current
HTML_QuickForm2_Node::getData()
Returns the element options
HTML_QuickForm2_Node::getDataSources()
Returns the data sources for this element
HTML_QuickForm2_Node::getError()
Returns the error message for the element
HTML_QuickForm2_Node::getId()
Returns the element's id
HTML_QuickForm2_Node::getJavascriptTriggers()
Returns IDs of form fields that should trigger "live" Javascript validation
HTML_QuickForm2_Node::getJavascriptValue()
Returns Javascript code for getting the element's value
HTML_QuickForm2_Node::getLabel()
Returns the element's label(s)
HTML_QuickForm2_Node::getName()
Returns the element's name
HTML_QuickForm2_Node::getRawValue()
Returns the element's value without filters applied
HTML_QuickForm2_Node::getType()
Returns the element's type
HTML_QuickForm2_Node::getValue()
Returns the element's value, possibly with filters applied
HTML_QuickForm2_Node::isRequired()
Checks whether an element is required
HTML_QuickForm2_Node::onAttributeChange()
Intercepts setting 'name' and 'id' attributes
HTML_QuickForm2_Node::persistentFreeze()
Changes the element's persistent freeze behaviour
HTML_QuickForm2_Node::removeRule()
Removes a validation rule
HTML_QuickForm2_Node::render()
Renders the element using the given renderer
HTML_QuickForm2_Node::renderClientRules()
Adds element's client-side validation rules to a builder object
HTML_QuickForm2_Node::setContainer()
Adds the link to the element containing current
HTML_QuickForm2_Node::setError()
Sets the error message to the element
HTML_QuickForm2_Node::setId()
Sets the element's id
HTML_QuickForm2_Node::setLabel()
Sets the element's label(s)
HTML_QuickForm2_Node::setName()
Sets the element's name
HTML_QuickForm2_Node::setValue()
Sets the element's value
HTML_QuickForm2_Node::storeId()
Stores the explicitly given id to prevent duplicate id generation
HTML_QuickForm2_Node::toggleFrozen()
Changes the element's frozen status
HTML_QuickForm2_Node::updateValue()
Called when the element needs to update its value from form's data sources
HTML_QuickForm2_Node::validate()
Performs the server-side validation

Class Details

[line 82]
Abstract base class for simple QuickForm2 containers


[ Top ]


Class Variables

$elements = array()

[line 89]

Array of elements contained in this container
  • Access: protected

Type:   array


[ Top ]



Method Detail

addElement   [line 278]

HTML_QuickForm2_Node addElement( string|HTML_QuickForm2_Node $elementOrType, [string $name = null], [string|array $attributes = null], [ $data = array()])

Appends an element to the container (possibly creating it first)

If the first parameter is an instance of HTML_QuickForm2_Node then all other parameters are ignored and the method just calls appendChild(). In the other case the element is first created via HTML_QuickForm2_Factory::createElement() and then added via the same method. This is a convenience method to reduce typing and ease porting from HTML_QuickForm.

  • Return: Added element
  • Throws: HTML_QuickForm2_NotFoundException
  • Throws: HTML_QuickForm2_InvalidArgumentException
  • Access: public

Parameters:

string|HTML_QuickForm2_Node   $elementOrType     Either type name (treated case-insensitively) or an element instance
string   $name     Element name
string|array   $attributes     Element attributes
array   $data     Element-specific data

[ Top ]

appendChild   [line 248]

HTML_QuickForm2_Node appendChild( HTML_QuickForm2_Node $element)

Appends an element to the container

If the element was previously added to the container or to another container, it is first removed there.

  • Return: Added element
  • Throws: HTML_QuickForm2_InvalidArgumentException
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container_Repeat::appendChild()
Appends an element to the prototype container
HTML_QuickForm2_Container_Group::appendChild()
Appends an element to the container

Parameters:

HTML_QuickForm2_Node   $element     Element to add

[ Top ]

arrayMerge   [line 215]

array arrayMerge( array $a, array $b)

Merges two arrays

Merges two arrays like the PHP function array_merge_recursive does, the difference being that existing integer keys will not be renumbered.

  • Return: resulting array
  • Access: public

Parameters:

array   $a     
array   $b     

[ Top ]

count   [line 418]

int count( )

Returns the number of elements in the container
  • Access: public

[ Top ]

getChildValues   [line 135]

array|null getChildValues( [bool $filtered = false])

Returns the array containing child elements' values
  • Access: protected

Overridden in child classes as:

HTML_QuickForm2_Container_Repeat::getChildValues()
Returns the array containing child elements' values
HTML_QuickForm2_Container_Group::getChildValues()

Parameters:

bool   $filtered     Whether child elements should apply filters on values

[ Top ]

getElementById   [line 329]

HTML_QuickForm2_Node|null getElementById( string $id)

Returns an element if its id is found
  • Access: public

Parameters:

string   $id     Element id to search for

[ Top ]

getElements   [line 232]

array getElements( )

Returns an array of this container's elements
  • Return: Container elements
  • Access: public

[ Top ]

getElementsByName   [line 346]

array getElementsByName( string $name)

Returns an array of elements which name corresponds to element
  • Access: public

Parameters:

string   $name     Element name to search for

[ Top ]

getIterator   [line 394]

HTML_QuickForm2_ContainerIterator getIterator( )

Returns a recursive iterator for the container elements
  • Access: public

[ Top ]

getJavascriptTriggers   [line 538]

void getJavascriptTriggers( )

  • Access: public

Overrides HTML_QuickForm2_Node::getJavascriptTriggers() (Returns IDs of form fields that should trigger "live" Javascript validation)
[ Top ]

getJavascriptValue   [line 527]

string getJavascriptValue( [bool $inContainer = false])

Returns Javascript code for getting the element's value
  • Access: public

Overrides HTML_QuickForm2_Node::getJavascriptValue() (Returns Javascript code for getting the element's value)

Parameters:

bool   $inContainer     Whether it should return a parameter for qf.form.getContainerValue()

[ Top ]

getRawValue   [line 184]

array|null getRawValue( )

Returns the container's value without filters applied

The default implementation for Containers is to return an array with contained elements' values. The array is indexed the same way $_GET and $_POST arrays would be for these elements.

  • Access: public

Overrides HTML_QuickForm2_Node::getRawValue() (Returns the element's value without filters applied)
[ Top ]

getRecursiveIterator   [line 406]

RecursiveIteratorIterator getRecursiveIterator( [int $mode = RecursiveIteratorIterator::SELF_FIRST])

Returns a recursive iterator iterator for the container elements
  • Access: public

Parameters:

int   $mode     mode passed to RecursiveIteratorIterator

[ Top ]

getValue   [line 198]

array|null getValue( )

Returns the container's value, possibly with filters applied

The default implementation for Containers is to return an array with contained elements' values. The array is indexed the same way $_GET and $_POST arrays would be for these elements.

  • Access: public

Overrides HTML_QuickForm2_Node::getValue() (Returns the element's value, possibly with filters applied)
[ Top ]

insertBefore   [line 367]

HTML_QuickForm2_Node insertBefore( HTML_QuickForm2_Node $element, [HTML_QuickForm2_Node $reference = null])

Inserts an element in the container

If the reference object is not given, the element will be appended.

  • Return: Inserted element
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container_Repeat::insertBefore()
Inserts an element to the prototype container
HTML_QuickForm2_Container_Group::insertBefore()
Inserts an element in the container

Parameters:

HTML_QuickForm2_Node   $element     Element to insert
HTML_QuickForm2_Node   $reference     Reference to insert before

[ Top ]

persistentFreeze   [line 108]

void persistentFreeze( [ $persistent = null])

  • Access: public

Overrides HTML_QuickForm2_Node::persistentFreeze() (Changes the element's persistent freeze behaviour)

Parameters:

   $persistent     

[ Top ]

prependsName   [line 123]

bool prependsName( )

Whether container prepends its name to names of contained elements
  • Access: protected

Overridden in child classes as:

HTML_QuickForm2_Container_Group::prependsName()

[ Top ]

removeChild   [line 298]

HTML_QuickForm2_Node removeChild( HTML_QuickForm2_Node $element)

Removes the element from this container
  • Return: Removed object
  • Throws: HTML_QuickForm2_NotFoundException
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container_Repeat::removeChild()
Removes the element from the prototype container
HTML_QuickForm2_Container_Group::removeChild()
Removes the element from this container

Parameters:

HTML_QuickForm2_Node   $element     Element to remove

[ Top ]

render   [line 499]

HTML_QuickForm2_Renderer render( HTML_QuickForm2_Renderer $renderer)

Renders the container using the given renderer
  • Access: public

Overridden in child classes as:

HTML_QuickForm2::render()
Renders the form using the given renderer
HTML_QuickForm2_Container_Repeat::render()
Renders the container using the given renderer
HTML_QuickForm2_Container_Group::render()
Renders the group using the given renderer
HTML_QuickForm2_Element_Hierselect::render()
Renders the hierselect using the given renderer

Overrides HTML_QuickForm2_Node::render() (Renders the element using the given renderer)

Parameters:

HTML_QuickForm2_Renderer   $renderer     

[ Top ]

setName   [line 92]

void setName( $name)

  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container_Group::setName()
HTML_QuickForm2_Element_Hierselect::setName()
Sets the element's name
HTML_QuickForm2_Container_Fieldset::setName()

Overrides HTML_QuickForm2_Node::setName() (Sets the element's name)

Parameters:

   $name     

[ Top ]

toggleFrozen   [line 98]

void toggleFrozen( [ $freeze = null])

  • Access: public

Overrides HTML_QuickForm2_Node::toggleFrozen() (Changes the element's frozen status)

Parameters:

   $freeze     

[ Top ]

updateValue   [line 429]

void updateValue( )

Called when the element needs to update its value from form's data sources

The default behaviour is just to call the updateValue() methods of contained elements, since default Container doesn't have any value itself

  • Access: protected

Overridden in child classes as:

HTML_QuickForm2_Container_Repeat::updateValue()
Called when the element needs to update its value from form's data sources
HTML_QuickForm2_Element_Date::updateValue()
Called when the element needs to update its value from form's data sources
HTML_QuickForm2_Element_Hierselect::updateValue()
Called when the element needs to update its value from form's data sources

Overrides HTML_QuickForm2_Node::updateValue() (Called when the element needs to update its value from form's data sources)
[ Top ]

validate   [line 444]

boolean validate( )

Performs the server-side validation

This method also calls validate() on all contained elements.

  • Return: Whether the container and all contained elements are valid
  • Access: protected

Overridden in child classes as:

HTML_QuickForm2::validate()
Performs the server-side validation
HTML_QuickForm2_Container_Repeat::validate()
Performs the server-side validation

Overrides HTML_QuickForm2_Node::validate() (Performs the server-side validation)
[ Top ]

__call   [line 478]

HTML_QuickForm2_Node __call( string $m, array $a)

Appends an element to the container, creating it first

The element will be created via HTML_QuickForm2_Factory::createElement() and then added via the appendChild() method. The element type is deduced from the method name. This is a convenience method to reduce typing.

  • Return: Added element
  • Throws: HTML_QuickForm2_NotFoundException
  • Throws: HTML_QuickForm2_InvalidArgumentException
  • Access: public

Parameters:

string   $m     Method name
array   $a     Method arguments

[ Top ]

__toString   [line 510]

void __toString( )

  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container_Group::__toString()

[ Top ]


Documentation generated on Sat, 28 Jun 2014 09:30:11 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.