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

Class: Formagic_Item

Source Location: /Item/Item.php

Class Overview


Abstract superclass for Formagic items


Author(s):

  • Florian Sonnenburg

Version:

  • $Id: Item.php 14 2007-08-13 20:33:26Z meweasle $

Copyright:

  • Copyright (c) 2007 Florian Sonnenburg

Variables

Methods


Child classes:

Formagic_Item_Checkbox
Formagic_Item_Checkbox
Formagic_Item_Container
Formagic Container Item class
Formagic_Item_Hidden
Formagic_Item_Hidden
Formagic_Item_Input
Formagic_Item_Input
Formagic_Item_Password
Password type input field für formagic formgenerator
Formagic_Item_Radio
Input type radio for formagic formgenerator
Formagic_Item_Select
formagicItemSelect
Formagic_Item_Submit
Formagic submit button item

Class Details

[line 32]
Abstract superclass for Formagic items



Tags:

author:  Florian Sonnenburg
version:  $Id: Item.php 14 2007-08-13 20:33:26Z meweasle $
copyright:  Copyright (c) 2007 Florian Sonnenburg
abstract:  


[ Top ]


Class Variables

$attributes = array()

[line 62]

Additional attributes for item



Tags:

access:  public

Type:   array


[ Top ]

$defaultValue =  null

[line 118]

Pointer to default value for this item, stored in calling Formagic object



Tags:

see:  FormagicItem::setCaller()
access:  protected

Type:   string


[ Top ]

$id =

[line 50]

Form item ID



Tags:

access:  public

Type:   string


[ Top ]

$isPostItem =  true

[line 98]

Flag that defines if item content will be posted on submit



Tags:

access:  public

Type:   boolean


[ Top ]

$isSubmitted =  false

[line 130]

Flag that tells if this Formagic item has been submitted



Tags:

access:  public

Type:   boolean


[ Top ]

$isWide =  false

[line 142]

Defines if template takes full width



Tags:

access:  public

Type:   boolean


[ Top ]

$name =

[line 44]

Form item name



Tags:

access:  public

Type:   string


[ Top ]

$savedValue =  null

[line 124]

Pointer to mulitpage value for this item, stored in calling Formagic object



Tags:

access:  protected

Type:   string


[ Top ]

$submittedValue =  null

[line 105]

Pointer to submitted value for this item, stored in calling Formagic object



Tags:

see:  Formagic_Item::setCaller()
access:  protected

Type:   string


[ Top ]

$type =

[line 38]

Type of form item



Tags:

access:  public

Type:   string


[ Top ]

$_caller =  null

[line 68]

Formagic object that called and contains item



Tags:

access:  protected

Type:   object


[ Top ]

$_constantValue =  null

[line 111]

Values that are not changed by submitted values



Tags:

access:  protected

Type:   array


[ Top ]

$_isBlocked =  false

[line 80]

Flag that defines if item content can be edited.



Tags:

access:  protected

Type:   boolean


[ Top ]

$_isDisabled =  false

[line 92]

Flag that defines if item is removed from Formagic



Tags:

access:  protected

Type:   boolean


[ Top ]

$_isHidden =  false

[line 86]

Flag that defines if item will be displayed



Tags:

access:  protected

Type:   boolean


[ Top ]

$_label =  'undefined'

[line 56]

Form item label



Tags:

access:  protected

Type:   boolean


[ Top ]

$_rules = array()

[line 74]

Array of rule object that are applied for this item



Tags:

access:  protected

Type:   object


[ Top ]



Class Methods


constructor __construct [line 154]

void __construct( string $type, string $name, [ &$args = null], [ &$caller = null], array $args, object $caller)

Constructor



Tags:

throws:  Formagic_Exception
access:  public


Overridden in child classes as:

Formagic_Item_PageSwitch::__construct()
Formagic_Item_PageSwitch::__construct()

Parameters:

string   $type   Type of item
string   $name   Name of item
array   $args   Additional attributes
object   $caller   containing Formagic object
   &$args  
   &$caller  

[ Top ]

method addRule [line 358]

integer addRule( mixed $rule, [string $errorMessage = null], [array $args = null])

Adds rule object to Formagic item

Formagic items can have multiple rules, which are saved in FormagicItem::rules. First parameter $rule can either be a string or a FormagicRule object. String value is assumed to be the type of rule to be added.

This method throws an exception if no valid role object can be identified.




Tags:

throws:  Formagic_Exception
access:  public


Parameters:

mixed   $rule   Rule type or FormagicRule object.
string   $errorMessage   Message returned if rule is violated
array   $args   Optional.

[ Top ]

method block [line 431]

boolean block( )

Sets blocked flag



Tags:

access:  public


Overridden in child classes as:

Formagic_Item_Container::block()
Blocks container item and all its descendants

[ Top ]

method disable [line 461]

boolean disable( )

Sets disabled flag for item and thus removes it from form



Tags:

access:  public


Overridden in child classes as:

Formagic_Item_Container::disable()
Disables container item and all its descendants and thus removes all involved items from form

[ Top ]

method getCaller [line 255]

Formagic getCaller( )

Returns parent Formagic object



Tags:

access:  public


[ Top ]

method getErrorMessage [line 421]

string getErrorMessage( )

Returns item error message

Returns error message if item check failed or empty string if not




Tags:

access:  public


[ Top ]

method getHtml [line 305]

string getHtml( )

HTML template for renderers that use HTML-Code



Tags:

access:  public


Overridden in child classes as:

Formagic_Item_Checkbox::getHtml()
Returns HTML representation of checkbox item
Formagic_Item_Input::getHtml()
HTML string representation of text input field
Formagic_Item_Password::getHtml()
Returns string representation of password item.
Formagic_Item_Radio::getHtml()
Returns string with HTML representation of radio elements
Formagic_Item_Select::getHtml()
HTML representation of Formagic select item
Formagic_Item_Submit::getHtml()
HTML string representation of submit button

[ Top ]

method getLabel [line 295]

string getLabel( )

Returns label for this item.



Tags:

access:  public


Overridden in child classes as:

Formagic_Item_Submit::getLabel()
Override parent::getLabel()

[ Top ]

method getValue [line 284]

mixed &getValue( )

Returns current value for this item

Calls Formagic::getValue() as all value storages are held there.




Tags:

access:  public


Overridden in child classes as:

Formagic_Item_Container::getValue()
Returns values of all stored items.
Formagic_Item_Submit::getValue()
Override paren::getValue()
Formagic_Item_PageSwitch::getValue()
Always return no value

[ Top ]

method hasRule [line 380]

boolean hasRule( string $rule)

Tells if rule exists for this item



Tags:

access:  public


Parameters:

string   $rule  

[ Top ]

method isDisabled [line 471]

boolean isDisabled( )

Returns disabled status of item



Tags:

access:  public


[ Top ]

method isHidden [line 451]

boolean isHidden( )

Returns hidden status of item



Tags:

access:  public


[ Top ]

method setAttributes [line 320]

array setAttributes( array $attArray)

Sets additional attributes for this item

Mainly used for additional HTML attributes other than "name", "id" or "value", such as "style", "class", javascript-handlers etc. Attributes are added corresponding to key->value-pairs in $attArray.




Tags:

access:  public


Parameters:

array   $attArray  

[ Top ]

method setCaller [line 230]

boolean setCaller( &$caller, object $caller)

Can be called to set caller object if not passed to constructor



Tags:

access:  public


Parameters:

object   $caller  
   &$caller  

[ Top ]

method setHidden [line 441]

boolean setHidden( $flag)

Sets hidden flag for item



Tags:

access:  public


Overridden in child classes as:

Formagic_Item_Container::setHidden()
Sets hidden flag on container item and all its descendants

Parameters:

   $flag  

[ Top ]

method validate [line 394]

mixed validate( )

Performs rule checks

Iterates through all defined rules of Formagic item. Returns true if all rules apply or violated Formagic_Rule object




Tags:

return:  Rule object or boolean
throws:  Formagic_Rule_Exception
access:  public


Overridden in child classes as:

Formagic_Item_Container::validate()
Validates containing items

[ Top ]

method _execEvent [line 483]

boolean _execEvent( string $event)

Event dispatcher



Tags:

throws:  Formagic_Exception
access:  public


Parameters:

string   $event  

[ Top ]

method _getAttributeStr [line 330]

string _getAttributeStr( )

Returns attribute string for HTML tag



Tags:

access:  protected


[ Top ]

method _handleArg [line 219]

boolean _handleArg( string $key, mixed $arg)

Handler for additional item arguments



Tags:

access:  protected


Overridden in child classes as:

Formagic_Item_Container::_handleArg()
Generic argument handler
Formagic_Item_Radio::_handleArg()
Argument handler for arguments that are unknown to item parent class
Formagic_Item_Select::_handleArg()
Generic argument handler

Parameters:

string   $key   Argument name
mixed   $arg   Argument value

[ Top ]

method _onCreate [line 525]

boolean _onCreate( )

Executed when object is created



Tags:

access:  protected


Overridden in child classes as:

Formagic_Item_Container::_onCreate()
OnCreate-Handler implementation
Formagic_Item_Hidden::_onCreate()
Formagic_Item_Radio::_onCreate()
Adds empty element to data array after constructor is processed
Formagic_Item_Submit::_onCreate()
Implementation of onCreate-handler

[ Top ]

method _onFetch [line 535]

void _onFetch( )

Executed when Formagic::fetch() is called



Tags:

access:  protected


Overridden in child classes as:

Formagic_Item_Container::_onFetch()
OnFetch-handler implementation
Formagic_Item_PageController::_onFetch()
Implementation of fetch handler

[ Top ]

method _onPostValidate [line 515]

boolean _onPostValidate( )

Executed after item validation is done



Tags:

access:  protected


Overridden in child classes as:

Formagic_Item_PageController::_onPostValidate()
Implementation of postValidate handler

[ Top ]

method _onPreValidate [line 505]

boolean _onPreValidate( )

Executed before item validation

Can be overwritten. Must return true if successful. If not, can either return false or throw exception




Tags:

access:  protected


Overridden in child classes as:

Formagic_Item_PageController::_onPreValidate()
Implementation of preValidate handler

[ Top ]

method __toString [line 265]

string __toString( )

Returns string representation of formItem object



Tags:

access:  public


[ Top ]


Documentation generated on Thu, 23 Aug 2007 00:29:42 +0200 by phpDocumentor 1.4.0