ui 
[ doc home ] [ class tree: ui ] [ index: ui ] [ all elements ]

Class: IsterUIForm

Source Location: /IsterUIForm.php

Class Overview

IsterObject
   |
   --IsterMethodProxy
      |
      --IsterUIForm

This class represents a user interface form.


Author(s): Ingo Schramm   

Copyright: Copyright (c) 2005 Ister.ORG Ingo Schramm

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: IsterMethodProxy

IsterMethodProxy::IsterMethodProxy()
Constructor
IsterMethodProxy::getRegister()
Get the register.
IsterMethodProxy::hasAlias()
Check if an alias has been registerd.
IsterMethodProxy::hasMethod()
Check if a method has been registerd.
IsterMethodProxy::invoke()
Same as invokeNext() but the queue is reset each time the function is called.
IsterMethodProxy::invokeNext()
Invoke a registered method at a subsequent object instance.
IsterMethodProxy::lastError()
Read the last error.
IsterMethodProxy::register()
Register an object's methods to the proxy.
IsterMethodProxy::registerAlias()
Register an alias for a method.
IsterMethodProxy::reset()
Reset the queue for a given method.
IsterMethodProxy::setRegister()
Set the register.

Class: IsterObject

IsterObject::IsterObject()
Constructor
IsterObject::abstractMethodError()
Report attempt to call an abstract method.
IsterObject::addLogger()
Add an IsterLogger to process log messages.
IsterObject::deleteLogger()
Delete an already registered IsterLogger.
IsterObject::getLoggerNames()
Fetch the names of all currently registered IsterLoggers.
IsterObject::getMem()
Return maximum amount of memory an application has allocated at this point.
IsterObject::log()
Trigger a log message.
IsterObject::passPHPmessage()
Catch PHP E_WARNING and E_NOTICE messages.
IsterObject::serialize()
Serialize the object.
IsterObject::setLogLocal()
Set logging local for the current object.
IsterObject::setupLogger()
Setup a logger.
IsterObject::triggerError()
Alias for log();
IsterObject::unserialize()
Unserialize the object.
IsterObject::__sleep()
Executed prior to serialize().
IsterObject::__wakeup()
Executed prior to unserialize().

Class Details

This class represents a user interface form.

copyright:  Copyright (c) 2005 Ister.ORG Ingo Schramm
author:  Ingo Schramm


[ Top ]


Class Methods


constructor IsterUIForm

IsterUIForm IsterUIForm( object IsterHttpRequest &$data)

Constructor

Parameters:

object IsterHttpRequest   &$data  

[ Top ]

method addAction

boolean addAction( string $field, string $method, object &$object)

Add an action to perform.

If a button with the name of $field was pressed, the method $method is called. You may specify a method for a field '__default__'. This is invoked if no button was pressed at all. The action will be called on $object. It should implement $method as a method expecting no parameters and returning a boolean value only.

Note: Only the 'name' attribute of the button is checked, not the 'value' attribute.


Parameters:

string   $field  
string   $method  
object   &$object  

[ Top ]

method addField

boolean addField( string $name, [string $default = null], [boolean $required = false], [mixed $constraints = null])

Add a field to the Form.

If an IsterHttpSecurityPolicy object was set to this form and an array of arrays is passed with the $constraints parameter, a constraint will be added to the policy for each member array of the array. The elements of such a member have the following meaning, according to IsterHttpSecurityPolicy::addConstraint:

  1. $array[0] - constraint type
  2. $array[1] - constraint value
  3. $array[2] - constraint action
  4. $array[3] - default value


Parameters:

string   $name  
string   $default  
boolean   $required  

[ Top ]

method addFieldGroup

boolean addFieldGroup( string $name, array $fields, [boolean $required = false])

Add a form field group (Radio Buttons etc.) to the form.

$fields is an array of key value pairs, each key a field name, each value a default value for the given field.

If an IsterHttpSecurityPolicy object was set to this form, a constraint of type HTTPSP_T_REGEXOK will be added automatically, encountered by the keys of the $fields array.


Parameters:

string   $name  
array   $fields  
boolean   $required  

[ Top ]

method addImgButton

boolean addImgButton( string $name, string $method, object &$object, [array $rectangle = array()])

Add an image button to the form.

Unfortunately, the implementation of inputs of type 'image' is very inconsistently between browsers. This method tries its best to make image buttons work.

Some browsers--like IE--omit to include the button's name and value to the POST data, instead the point of click is sent. You may benefit from this behavior in adding an array like this to the parameter list, defining a rectangle:

  1. Array( 'x1' => <number>
  2. 'y1' => <number>
  3. 'x2' => <number>
  4. 'y2' => <number>
  5. )
If no such array is added, only the name attribute of the image button is used.


Parameters:

string   $name  
string   $method  
object   &$object  
array   $rectangle  

[ Top ]

method chgField

boolean chgField( string $name, string $value)

Change the value of a given form field.

Parameters:

string   $name  
string   $value  

[ Top ]

method clear

boolean clear( )

Reset all form data to the default values.

[ Top ]

method execute

boolean execute( [boolean $autoset = true])

Execute the form.

This method calles the first valid action registered by addFormAction().


see:  addFormAction

Parameters:

boolean   $autoset   autoset unset fields to default value or not

[ Top ]

method getField

mixed getField( string $name)

Get the value of a form field.

Parameters:

string   $name  

[ Top ]

method getFieldBool

boolean getFieldBool( string $name)

Test whether a form field is set at all.

Parameters:

string   $name  

[ Top ]

method getFieldGroupChecked

boolean getFieldGroupChecked( string $name)

Check whether a given value of a form field group has been checked.

Parameters:

string   $name  

[ Top ]

method getFields

array getFields( )

Return array of field value pairs, default values if form was not read already.

Useful to fill a template with form values. If the form was read already, all defined security constraints are applied.


[ Top ]

method getMarked

mixed getMarked( string 0)

If an IsterHttpSecurityPolicy was set to this form and the policy has marked some fields the names of these fields are returned.

Parameters:

string   0  

[ Top ]

method getMissing

array getMissing( )

Get an array of required but unset form fields.

[ Top ]

method getSecurityPolicy

object IsterHttpSecurityPolicy getSecurityPolicy( )

Get the IsterHttpSecurityPolicy object.

[ Top ]

method isAction

boolean isAction( string $name, [string $value = null], [string $y_val = null])

Test for a given action.

The method returns true, if the action is active. Is the additional value given, the method returns true only if the active action form field has this value.

If you test for an image button you may add an additional value $y_val (with $value considdered to be $x_val).


Parameters:

string   $name  
string   $value  
string   $y_val  

[ Top ]

method isActionCalled

boolean isActionCalled( )

Returns true if executeForm() has called an action.

[ Top ]

method read

boolean read( [boolean $autoset = true])

Red the supplied data of the form into the IsterUIForm object.

Parameters:

boolean   $autoset   autoset unset fields to default value or not

[ Top ]

method setFieldGroupChecked

boolean setFieldGroupChecked( string $name, array $field)

Set a given value of a form field group as checked.

Parameters:

string   $name  
array   $field  

[ Top ]

method setSecurityPolicy

boolean setSecurityPolicy( object IsterHttpSecurityPolicy &$policy, [array $constraints = null])

Set the security policy object.

The IsterHttpSecurityPolicy object will be initialized with a number of constraints for each form field and form action. You may specify one or more default constraints that will be set for each form field.

Note: The policy must be applied explicitly outside of IsterUIForm


Parameters:

object IsterHttpSecurityPolicy   &$policy  
array   $constraints  

[ Top ]


Documentation generated on Tue, 20 Dec 2005 11:21:29 +0100 by phpDocumentor 1.3.0RC4