spunQ_ChoiceField Class Reference

A field that allows choosing a sub-set of predefined values. More...

Inheritance diagram for spunQ_ChoiceField:

spunQ_IField spunQ_MultipleChoiceField spunQ_SingleChoiceField

List of all members.

Public Member Functions

 setOptions (array $options)
 Set available options.
 addOption ($option, $key=NULL)
 Adds another option.
 getOptions ()
 Provides available options.
 setUseSubmittedValue ($useSubmittedValue=true)
 Sets the return value of getUseSubmittedValue().
 getForm ()
 Provides the form this field resides in.
 __clone ()
 Called after this object was cloned (on the newly created object).
 getContainer ()
 setContainer (spunQ_IFieldContainer $container)
 getName ()
 getTypePath ()
 getTypePathPart ()
 addConverter (spunQ_IFieldValueConverter $converter)
 addValidator (spunQ_IFieldValidator $validator)
 getConverters ()
 getValidators ()
 getHtmlId ($postfix= '')
 getHtmlName ()
 getUseSubmittedValue ()
 show ($value=NULL, $template=NULL, $templateParameters=array(), $htmlIdPostFix= '')
 showValidatorsJs ()
 submittedValueValid ()
 getSubmittedRawValue ()
 getSubmittedValue ()
 getValue ()
 getDisplayValue ($originalValue)
 getValidationMessages ()
 getFieldByPath ($path)
 _processSubmission (&$rawValue)

Static Public Member Functions

static normalizeTemplateCssParameter ($class)
 Normalizes the $class parameter passed to a field template.

Protected Member Functions

 spunQToRaw ($value)
 Will convert a spunQ value to a raw value using registered converters.
 rawToSpunQ (&$value)
 Partial implementation of _processSubmission().
 getDefaultTemplate ()
 Provides a template to be used if the parameter was not passed to show().

Protected Attributes

 $options = array()
 Available options.
 $name
 Name of this field.
 $container
 The container this field is residing in.
 $useSubmittedValue = true
 Whether the submitted value should override the default value.
 $converters = array()
 The converters that have been registered with this field.
 $validators = array()
 Registered field validators.
 $validationMessages = NULL
 Messages generated by validators and converters.
 $submittedValue = NULL
 Value that was submitted for this field.
 $submittedRawValue = NULL
 Raw value that was submitted for this field.


Detailed Description

A field that allows choosing a sub-set of predefined values.

Definition at line 6 of file ChoiceField.class.php.


Member Function Documentation

spunQ_Field::__clone (  )  [inherited]

Called after this object was cloned (on the newly created object).

Will unset its container, so setContainer() must be called on cloned spunQ_Fields.

Returns:
void

Definition at line 133 of file Field.class.php.

spunQ_ChoiceField::addOption ( option,
key = NULL 
)

Adds another option.

Parameters:
$option A new option the user may choose.
$key Additional parameter that may be provided. If it is present, this will be the raw value of this option. Otherwise the option will receive a random numeric raw value.
Returns:
spunQ_ChoiceField $this

Definition at line 35 of file ChoiceField.class.php.

spunQ_Field::getDefaultTemplate (  )  [protected, inherited]

Provides a template to be used if the parameter was not passed to show().

The show() implementation in spunQ_IField uses this value.

Returns:
string

Definition at line 391 of file Field.class.php.

spunQ_Field::getForm (  )  [inherited]

Provides the form this field resides in.

Returns:
spunQ_Form

Definition at line 120 of file Field.class.php.

spunQ_ChoiceField::getOptions (  ) 

Provides available options.

Returns:
array<any>

Definition at line 48 of file ChoiceField.class.php.

static spunQ_Field::normalizeTemplateCssParameter ( class  )  [static, inherited]

Normalizes the $class parameter passed to a field template.

Many field templates have an optional parameter called $class that can be passed either of the following:

  • a string containing css classes
  • an array containing strings as css classes
  • NULL indicating, that no class declaration is to be added.
Parameters:
$class The value that was passed to the template. Either of the types mentioned in the function description.
Returns:
A css string that can be safely inserted into the class attribute of an html node.
Exceptions:
spunQ_HtmlException If the parameter has an unexpected type or an invalid css declaration.

Definition at line 20 of file Field.class.php.

spunQ_Field::rawToSpunQ ( &$  value  )  [protected, inherited]

Partial implementation of _processSubmission().

See also:
_processSubmission()
Parameters:
$value Same as for _processSubmission().
Returns:
boolean

Definition at line 366 of file Field.class.php.

spunQ_ChoiceField::setOptions ( array $  options  ) 

Set available options.

Type:
$options The options the user may choose from.
Returns:
spunQ_ChoiceField $this

Definition at line 19 of file ChoiceField.class.php.

spunQ_Field::setUseSubmittedValue ( useSubmittedValue = true  )  [inherited]

Sets the return value of getUseSubmittedValue().

Parameters:
$useSubmittedValue The new value for getUseSubmittedValue()
Returns:
spunQ_Field $this

Definition at line 111 of file Field.class.php.

spunQ_Field::spunQToRaw ( value  )  [protected, inherited]

Will convert a spunQ value to a raw value using registered converters.

See also:
spunQ_IFieldValueConverter
Parameters:
$value The value to convert
Returns:
any The converted value.

Definition at line 353 of file Field.class.php.


Member Data Documentation

spunQ_Field::$container [protected, inherited]

The container this field is residing in.

Type:
spunQ_IFieldContainer

Definition at line 48 of file Field.class.php.

spunQ_Field::$converters = array() [protected, inherited]

The converters that have been registered with this field.

Type:
array<spunQ_IFieldValueConverter>

Definition at line 63 of file Field.class.php.

spunQ_Field::$name [protected, inherited]

Name of this field.

Type:
string

Definition at line 42 of file Field.class.php.

spunQ_ChoiceField::$options = array() [protected]

Available options.

Type:
array<any>

Definition at line 12 of file ChoiceField.class.php.

spunQ_Field::$submittedRawValue = NULL [protected, inherited]

Raw value that was submitted for this field.

Type:
any

Definition at line 89 of file Field.class.php.

spunQ_Field::$submittedValue = NULL [protected, inherited]

Value that was submitted for this field.

Initialized in _processSubmission().

Type:
any

Definition at line 83 of file Field.class.php.

spunQ_Field::$useSubmittedValue = true [protected, inherited]

Whether the submitted value should override the default value.

In other words: If this is set to true, the field will display the value that was submitted previously instead of the default value.

See also:
spunQ_IField::getUseSubmittedValue()
Type:
boolean

Definition at line 57 of file Field.class.php.

spunQ_Field::$validationMessages = NULL [protected, inherited]

Messages generated by validators and converters.

Initialized in _processSubmission().

Type:
array<string>

Definition at line 76 of file Field.class.php.

spunQ_Field::$validators = array() [protected, inherited]

Registered field validators.

Type:
array<spunQ_IFieldValidator>

Definition at line 69 of file Field.class.php.


The documentation for this class was generated from the following file:

Generated on Fri Jul 1 11:12:39 2011 for spunQ3 by  doxygen 1.5.9