phpDocumentor SForm
[ class tree: SForm ] [ index: SForm ] [ all elements ]

Class: SForm_Container

Source Location: /SForm.php

Class SForm_Container

Class Overview

Implements interfaces:

  • RecursiveIterator (internal interface)
  • Countable (internal interface)

A container holds one or more elements

A container serves as a parent for as many elements (and other containers) as needed. It also inherits all of the properties of SForm_Element, so you can assign rules to containers, they can produce JavaScript, they have labels, and have opening and closing HTML tags.

Located in /SForm.php [line 1235]

SForm_Element
   |
   --SForm_Container
Author(s):
API Tags:
Abstract:  
Access:  public

Properties

Methods

[ Top ]
Direct descendents
Child Class Description
SForm I am the alpha and the omega, I am the form.
SForm_Group Group elements
SForm_Fieldset Group elements in a '<fieldset>'

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From SForm_Element

SForm_Element::$addName
SForm_Element::$attributes
SForm_Element::$defId
SForm_Element::$errors
SForm_Element::$filters
SForm_Element::$locked
SForm_Element::$parent
SForm_Element::$required
SForm_Element::$rules
SForm_Element::$tag
SForm_Element::$validated
SForm_Element::$valueSet

Inherited From SForm_Element

SForm_Element::__construct()
Construct with an identity. Optionally add a label and more attributes.
SForm_Element::addRule()
Add a rule to this element
SForm_Element::assignParent()
Assign this element's parent
SForm_Element::autoAK()
Generates an access key and updated label
SForm_Element::createRule()
Creates & returns a rule
SForm_Element::escHtml()
Escape HTML in a consistant manner
SForm_Element::filter()
Apply a filter to the value
SForm_Element::filterValue()
Filters the value
SForm_Element::freeze()
Set if this element is frozen
SForm_Element::getAttribute()
Get an attribute in $this
SForm_Element::getAttributesString()
Creates an HTML attribute string from an array
SForm_Element::getErrorHtml()
Do we have any errors?
SForm_Element::getGlobalId()
This is the page-wide unique ID
SForm_Element::getLabel()
Return the label string (no markup)
SForm_Element::getLabelHtml()
Return the label with markup added
SForm_Element::getLocalId()
A Locally usable ID
SForm_Element::getOption()
Get a global option
SForm_Element::getRequest()
Returns a value from the request
SForm_Element::getValue()
The value of this element
SForm_Element::isFrozen()
Is this element marked as frozen?
SForm_Element::isRequired()
Is this element required?
SForm_Element::lock()
Locks & adds any last minute stuff
SForm_Element::render()
Append this leaf element to the render queue
SForm_Element::setAttribute()
Set an attribute in $this
SForm_Element::setDefault()
Set the default value of this element
SForm_Element::setOption()
Set a global option
SForm_Element::setValue()
Set the value of this element
SForm_Element::toHidden()
Do we have any hidden tags to append?
SForm_Element::toHtml()
Create a HTML representation of this element
SForm_Element::toHtmlFin()
Close an open HTML tags
SForm_Element::toJavaScript()
Retrieve any JavaScript that should be run onsubmit
SForm_Element::toString()
How does this value look as a HTML string?
SForm_Element::unsetAttribute()
Unset an attribute
SForm_Element::validate()
Is this a valid element?
SForm_Element::wasSubmitted()
Was this form submitted?

[ Top ]
Property Summary
array   $chFilters   Filters which will be applied to the children of this container
array   $chRules   Rules which will be applied to the children of this container
boolean   $emptyTag   Containers are never empty tags

[ Top ]
Method Summary
static object Created   createElement()   Creates an element
object Added   addElement()   Adds an element to this container
void   applyFilter()   Apply a filter to the elements
integer   count()   Return number of children
object   current()   Return the current element
void   freeze()   Set the frozen status of this container and its children
object The   getChildren()   Return the current element
object Requested   getElement()   Returns an element using the Local ID
object Requested   getGlobalElement()   Returns an element using the Global ID
boolean   hasChildren()   Does the current element have children?
string   key()   Return the key of the current element
void   lock()   Add any requested filters and rules, then lock this container
object New   next()   Advance pointer and return the new current
object The   removeElement()   Removes an element from this group
void   render()   Render this container and all elements in it
void   rewind()   Move the current element to the first one
string   toHtml()   Create a HTML representation of this container
boolean   valid()   Is the current ponter valid?
boolean   validate()   Is this valid?

[ Top ]
Properties
array   $chFilters = array() [line 1255]

Filters which will be applied to the children of this container

API Tags:
Access:  protected


[ Top ]
array   $chRules = array() [line 1262]

Rules which will be applied to the children of this container

API Tags:
Access:  protected


[ Top ]
boolean   $emptyTag = false [line 1241]

Containers are never empty tags

API Tags:
Access:  protected


Redefinition of:
SForm_Element::$emptyTag
Is this element's tag empty?

[ Top ]
Methods
static method createElement  [line 1437]

  static object Created createElement( string $elm, [mixed $arg1 = null], [ $arg2 = null], [ $arg3 = null], [ $arg4 = null], [ $arg5 = null], [ $arg6 = null]  )

Creates an element

Creates whichever argument is specified by the first argument. Valid strings are generally the same as the the element that you are trying to create. A '<select>' element is created with a 'select' string.

Parameters past the first will be passed to the constructor of the created object.

Parameters:
string   $elm:  Type of element to add.
mixed   $arg1:  First argument for object constructor...
   $arg2: 
   $arg3: 
   $arg4: 
   $arg5: 
   $arg6: 

API Tags:
Return:  object.
Usedby:  SForm_Container::addElement()
Access:  public
Uses:  $regElms


[ Top ]
addElement  [line 1400]

  object Added addElement( mixed $elm, [ $arg1 = null], [ $arg2 = null], [ $arg3 = null], [ $arg4 = null], [ $arg5 = null], [ $arg6 = null]  )

Adds an element to this container

This function has behavior that changes depending on the first argument passed to it.

If the first argument is an element object, it is added to this container as a child.

If the first argument is a string, the arguments are first passed through createElement() and an element is created. That element is then added to this container as a child.

The element is then returned.

Parameters:
mixed   $elm:  Element or type of element to add
   $arg1: 
   $arg2: 
   $arg3: 
   $arg4: 
   $arg5: 
   $arg6: 

API Tags:
Return:  element
Access:  public
Uses:  SForm_Container::createElement()
Uses:  $children


[ Top ]
applyFilter  [line 1537]

  void applyFilter( string $element, mixed $filter  )

Apply a filter to the elements

This is the same as using SForm_Element::filter(), but the first argument is the child to apply this filter to.

The filter is not applied to child elements until this container is rendered or validated. If the child doesn't exist at that time, an exception is thrown.

If you wish to apply the filter to this container's value, see filter().

Parameters:
string   $element:  Element to apply the filter too
mixed   $filter:  The filter callback

API Tags:
Access:  public
See:  SForm_Container::validate()
See:  SForm_Container::render()
See:  SForm_Element::filter()


[ Top ]
count  [line 1376]

  integer count( )

Return number of children

Implemented as part of the Countable SPL interface


API Tags:
Return:  How many children are there
Access:  public


Implementation of:
Countable::count

[ Top ]
current  [line 1329]

  object current( )

Return the current element

Implemented as part of the Iterator SPL interface


API Tags:
Access:  public


Implementation of:
RecursiveIterator::current

[ Top ]
freeze  [line 1632]

  void freeze( [boolean $bool = true]  )

Set the frozen status of this container and its children

Setting a container as frozen. Being frozen doesn't have an effect on containers. Frozen elements will prevent their values from being altered, though.

Parameters:
boolean   $bool:  Are we freezing this or thawing it?

API Tags:
Access:  public
Uses:  SForm_Element::freeze()


Redefinition of:
SForm_Element::freeze()
Set if this element is frozen

[ Top ]
getChildren  [line 1303]

  object The getChildren( )

Return the current element

Implemented as part of the RecursiveIterator SPL interface


API Tags:
Return:  current child
Access:  public


Implementation of:
RecursiveIterator::getChildren

[ Top ]
getElement  [line 1497]

  object Requested getElement( string $id  )

Returns an element using the Local ID

The Local ID is the ID that passed to an element's constructor. It is useful for reequesting a specific child of an element. For iterating through elements, see the Iterator interface. Specifically next().

Parameters:
string   $id:  Local ID to fetch

API Tags:
Return:  obect (or null)
Access:  public


[ Top ]
getGlobalElement  [line 1476]

  object Requested getGlobalElement( string $id  )

Returns an element using the Global ID

The Global ID is the ID used in the HTML document or by getElementById() in JavaScript.

Parameters:
string   $id:  Global ID to fetch

API Tags:
Return:  object (or null)
Access:  public


Redefined in descendants as:

[ Top ]
hasChildren  [line 1291]

  boolean hasChildren( )

Does the current element have children?

Implemented as part of the RecursiveIterator SPL interface


API Tags:
Return:  Is the current element a container?
Access:  public


Implementation of:
RecursiveIterator::hasChildren

[ Top ]
key  [line 1341]

  string key( )

Return the key of the current element

Implemented as part of the Iterator SPL interface


API Tags:
Return:  Returns the current Local ID
Access:  public


Implementation of:
RecursiveIterator::key

[ Top ]
lock  [line 1565]

  void lock( )

Add any requested filters and rules, then lock this container

We override the parent in order to add filters and rules.


API Tags:
Access:  protected
See:  SForm_Container::applyFilter()


Redefinition of:
SForm_Element::lock()
Locks & adds any last minute stuff

[ Top ]
next  [line 1353]

  object New next( )

Advance pointer and return the new current

Implemented as part of the Iterator SPL interface


API Tags:
Return:  current object
Access:  public


Implementation of:
RecursiveIterator::next

[ Top ]
removeElement  [line 1512]

  object The removeElement( string $id  )

Removes an element from this group

Parameters:
string   $id:  The id of the object to remove

API Tags:
Return:  removed object
Access:  public


[ Top ]
render  [line 1645]

  void render( SForm_Renderer $rend  )

Render this container and all elements in it

Parameters:
object The   $rend:  renderer to use

API Tags:
Usedby:  SForm::render()
Access:  protected
Uses:  SForm_Element::render()


Redefinition of:
SForm_Element::render()
Append this leaf element to the render queue

Redefined in descendants as:

[ Top ]
rewind  [line 1317]

  void rewind( )

Move the current element to the first one

Implemented as part of the Iterator SPL interface


API Tags:
Access:  public


Implementation of:
RecursiveIterator::rewind

[ Top ]
toHtml  [line 1552]

  string toHtml( )

Create a HTML representation of this container

Constructs the HTML tag that opens this container. Normally this is either a <form> tag or a <fieldset> tag. The 'id' attribute is automatically filled with this container's Global ID. Other attributes may be added via setAttribute().


API Tags:
Return:  Opening tag for this container
Access:  public
See:  SForm_Element::setAttribute()


Redefinition of:
SForm_Element::toHtml()
Create a HTML representation of this element

Redefined in descendants as:

[ Top ]
valid  [line 1365]

  boolean valid( )

Is the current ponter valid?

Implemented as part of the Iterator SPL interface


API Tags:
Return:  True if the current pointer is valid
Access:  public


Implementation of:
RecursiveIterator::valid

[ Top ]
validate  [line 1605]

  boolean validate( )

Is this valid?

Validates this container and all of its children. Keep in mind that no rules can be added after an element is validated because that would invalidate the validation. If there was no request submitted, it is assumed that validation is not passed.

Rules can be added via addRule().


API Tags:
Return:  Is this container & its children valid?
Usedby:  SForm::validate()
Access:  protected
Uses:  SForm_Element::validate()


Redefinition of:
SForm_Element::validate()
Is this a valid element?

Redefined in descendants as:

[ Top ]

Documentation generated on Mon, 09 Apr 2007 19:08:27 -0500 by phpDocumentor 1.3.0