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

Class: Formagic_Item_Container

Source Location: /Item/Container.php

Class Overview

Formagic_Item_Abstract
   |
   --Formagic_Item_Container

Formagic Container Item class


Author(s):

  • Florian Sonnenburg

Version:

  • $Id: Container.php 126 2011-05-18 18:41:58Z meweasle $

Copyright:

  • Copyright (c) 2011 Florian Sonnenburg

Implements interfaces:

  • IteratorAggregate (internal interface)
  • Countable (internal interface)

Variables

Methods


Inherited Variables

Inherited Methods

Class: Formagic_Item_Abstract

Formagic_Item_Abstract::__construct()
Constructor
Formagic_Item_Abstract::addAttribute()
Adds an HTML attribute to the attributes stack.
Formagic_Item_Abstract::addFilter()
Adds filter object to Formagic item
Formagic_Item_Abstract::addRule()
Adds rule object to Formagic item
Formagic_Item_Abstract::getAttribute()
Returns the attributes array for this item.
Formagic_Item_Abstract::getAttributes()
Returns the attributes array for this item.
Formagic_Item_Abstract::getAttributeStr()
Returns attribute string for HTML tag.
Formagic_Item_Abstract::getHtml()
HTML template for renderers that use HTML-Code.
Formagic_Item_Abstract::getLabel()
Returns label for this item.
Formagic_Item_Abstract::getName()
Returns the item name.
Formagic_Item_Abstract::getUnfilteredValue()
Returns current unfiltered value for this item.
Formagic_Item_Abstract::getValue()
Returns the current filtered value for this item.
Formagic_Item_Abstract::getViolatedRules()
Returns array of violated rules.
Formagic_Item_Abstract::hasFilter()
Formagic_Item_Abstract::hasRule()
Tells if a rule exists for this item.
Formagic_Item_Abstract::isDisabled()
Returns disabled status of item
Formagic_Item_Abstract::isHidden()
Returns hidden status of item
Formagic_Item_Abstract::isIgnored()
Returns ignore status of item
Formagic_Item_Abstract::printInfo()
Prints item infos.
Formagic_Item_Abstract::setAttributes()
Sets additional attributes for this item.
Formagic_Item_Abstract::setDisabled()
Sets disabled flag for item and removes it from form
Formagic_Item_Abstract::setFixed()
Sets isFixed flag.
Formagic_Item_Abstract::setHidden()
Sets hidden flag for item.
Formagic_Item_Abstract::setIgnore()
Defines if the item will be ignored in form submit.
Formagic_Item_Abstract::setReadonly()
Sets readonly flag
Formagic_Item_Abstract::setRequiredAttributes()
Formagic_Item_Abstract::setValue()
Sets the item value to $value.
Formagic_Item_Abstract::validate()
Performs rule checks
Formagic_Item_Abstract::_buildAttributeStr()
Formagic_Item_Abstract::_filterValue()
Formagic_Item_Abstract::_init()
Allow subclass initialization.
Formagic_Item_Abstract::_makeDomId()
Takes a string and returns a valid DOM ID.
Formagic_Item_Abstract::_validateItemValue()
Perform validation on item value.
Formagic_Item_Abstract::__toString()
Returns the HTML string representation of the form item.

Class Details

[line 40]
Formagic Container Item class

Changes on following flag will be applied recursively to all items added to the container object:

  • _isHidden
  • _isReadonly
  • _isDisabled
Changes on the flag _isPostItem will only be applied to the container item itself (and defaults to false as there is no use posting a container item).




Tags:

author:  Florian Sonnenburg
version:  $Id: Container.php 126 2011-05-18 18:41:58Z meweasle $
copyright:  Copyright (c) 2011 Florian Sonnenburg


[ Top ]


Class Variables

$headline =  ''

[line 52]

Container headline



Tags:

access:  public

Type:   string


[ Top ]

$_items = array()

[line 46]

Pointer to items array section of formagic object



Tags:

access:  protected

Type:   string


[ Top ]

$_requiredAttributes = array('id')

[line 58]

Define what attributes are required for default container item



Tags:

access:  protected

Type:   array
Overrides:   Array


[ Top ]



Class Methods


method addFilter [line 258]

Formagic_Item_Container addFilter( $filter, [ $args = null], mixed $rule)

Adds a filter to this container and all contained items.



Tags:

return:  This object
see:  Formagic_Item_Abstract::addFilter()
throws:  Formagic_Exception
access:  public


Overrides Formagic_Item_Abstract::addFilter() (Adds filter object to Formagic item)

Parameters:

mixed   $rule   Filter type string or Formatic_Filter_Interface object.
array   $args   Optional array of arguments. Will be passed to the filter constructor as array.
   $filter  

[ Top ]

method addItem [line 73]

Formagic_Item_Container addItem( $item, [string $name = null], [ $args = null], Formagic_Item_Abstract|String $type)

Adds formagic item object to array of items.

Creates new item object and adds this, or adds passed formagicItem object




Tags:

return:  object
access:  public


Parameters:

Formagic_Item_Abstract|String   $type   String with item type or Formagic_Item_Abstract object
string   $name   String with item name. NULL if $type is Formagic_Item_Abstract object
array   $args   Array with additional item information. NULL if $type is Formagic_Item_Abstract object
   $item  

[ Top ]

method addRule [line 240]

Formagic_Item_Container addRule( mixed $rule, [ $args = array()])

Adds a rule to this container and all contained items.



Tags:

return:  This object.
see:  Formagic_Item_Abstract::addRule()
throws:  Formagic_Exception
access:  public


Overrides Formagic_Item_Abstract::addRule() (Adds rule object to Formagic item)

Parameters:

mixed   $rule   Rule type string or Formagic_Rule_Abstract object.
array   $args   Optional array of arguments. Will be passed to the rule constructor as array.

[ Top ]

method count [line 114]

integer count( )

Counts items added to self and all sub-containers.



Tags:

return:  The number of items in this container
access:  public



Implementation of:
Countable::count
[ Top ]

method getItem [line 150]

Formagic_Item_Abstract getItem( string $name, [boolean $throwException = true])

Returns added item $name.

Throws Formagic_Exception by default if item does not exist. This can be altered by setting $throwException to FALSE; the result value will be NULL then.




Tags:

return:  Returns the Formagic item identified by $name or throws exception if not found.
throws:  Formagic_Exception
access:  public


Parameters:

string   $name   Item identifier string.
boolean   $throwException   Returns NULL if set to FALSE.

[ Top ]

method getItems [line 132]

array getItems( )

Returns items array



Tags:

access:  public


[ Top ]

method getIterator [line 371]

ArrayObject getIterator( )

Completes the IteratorAggregate interface.



Tags:

return:  ArrayObject with container items.
access:  public



Implementation of:
IteratorAggregate::getIterator
[ Top ]

method getValue [line 326]

array getValue( )

Returns values of all stored items.

The return value will be an associative array, the keys beeing the name of the item, the value beeing the filtered item value.




Tags:

return:  Array of item values.
access:  public


Overrides Formagic_Item_Abstract::getValue() (Returns the current filtered value for this item.)

[ Top ]

method setDisabled [line 309]

Formagic_Item_Container setDisabled( $flag)

Disables container item and all its descendants and thus removes all involved items from form.

Implements a fluent interface pattern.




Tags:

return:  This object.
see:  Formagic_Item_Abstract::setDisabled()
access:  public


Overrides Formagic_Item_Abstract::setDisabled() (Sets disabled flag for item and removes it from form)

Parameters:

   $flag  

[ Top ]

method setHidden [line 291]

Formagic_Item_Container setHidden( $flag)

Sets hidden flag on container item and all its descendants.

Implements a fluent interface pattern.




Tags:

return:  This object.
see:  Formagic_Item_Abstract::setHidden()
access:  public


Overrides Formagic_Item_Abstract::setHidden() (Sets hidden flag for item.)

Parameters:

   $flag  

[ Top ]

method setReadonly [line 274]

Formagic_Item_Container setReadonly( $flag)

Sets readonly flag to container item and all its descendants.

Implements a fluent interface pattern.




Tags:

return:  This object.
see:  Formagic_Item_Abstract::setReadonly()
access:  public


Overrides Formagic_Item_Abstract::setReadonly() (Sets readonly flag)

Parameters:

   $flag  

[ Top ]

method setValue [line 187]

Formagic_Item_Container setValue( array $value)

Sets new values for all items assigned to this container.

Other than in Formagic_Item_Abstract defined, $value has to be an associative array, the key beeing the name of the item the value belongs to.

Implements a fluent interface pattern.




Tags:

return:  This object.
access:  public


Overrides Formagic_Item_Abstract::setValue() (Sets the item value to $value.)

Parameters:

array   $value   Set of new values for contained items.

[ Top ]

method validate [line 355]

boolean validate( )

Validates contained items.

Iterates through all contained items. If any rule is violated, sub-item will return violated Formagic_Rule item and the container will pass it on.

If all items pass violation, validate() calls onValidate-handler and returns its result.




Tags:

access:  public


Overrides Formagic_Item_Abstract::validate() (Performs rule checks)

[ Top ]


Documentation generated on Sun, 22 May 2011 22:40:09 +0200 by phpDocumentor 1.4.3