
Public Member Functions | |
| __construct (spunQ_IField $field) | |
| Constructor. | |
| getField ($index=NULL) | |
| Returns the field for given index. | |
| __clone () | |
| Called after this object was cloned (on the newly created object). | |
| wasSubmitted () | |
| Whether the form the field is in was submitted. | |
| addField (spunQ_IField $field) | |
| Adds a field to this container. | |
| removeField (spunQ_IField $field) | |
| Removes a field from this container. | |
| getTypeString () | |
| Returns a type string for the container. | |
| getFieldHtmlId ($field, $postfix) | |
| Provides the html id of a field. | |
| getFieldHtmlName ($field) | |
| Provides the html name of the field. | |
| getTypePathPart () | |
| The last part of the type path of this field. | |
| show ($value=NULL, $template=NULL, $templateParameters=array(), $htmlIdPostFix= '') | |
| Will generate and display html for this form field. | |
| showValidatorsJs () | |
| Prints javascript for validating this field. | |
| submittedValueValid () | |
| Returns whether the value submitted by the browser is valid This will only check whether the values received are acceptable to this field type. | |
| getFieldByPath ($path) | |
| Returns a field by its field path. | |
| setUseSubmittedValue ($useSubmittedValue=true) | |
| _processSubmission (&$rawValue) | |
| Initializes this field's submitted values. | |
| getDisplayValue ($originalValue) | |
| Returns the value to use for show(). | |
| getForm () | |
| Provides the form this field resides in. | |
| getContainer () | |
| setContainer (spunQ_IFieldContainer $container) | |
| getName () | |
| getTypePath () | |
| addConverter (spunQ_IFieldValueConverter $converter) | |
| addValidator (spunQ_IFieldValidator $validator) | |
| getConverters () | |
| getValidators () | |
| getHtmlId ($postfix= '') | |
| getHtmlName () | |
| getUseSubmittedValue () | |
| getSubmittedRawValue () | |
| getSubmittedValue () | |
| getValue () | |
| getValidationMessages () | |
Static Public Member Functions | |
| static | normalizeTemplateCssParameter ($class) |
Normalizes the $class parameter passed to a field template. | |
Protected Member Functions | |
| rawToSpunQ (&$value) | |
| spunQToRaw ($value) | |
| Will convert a spunQ value to a raw value using registered converters. | |
| getDefaultTemplate () | |
| Provides a template to be used if the parameter was not passed to show(). | |
Protected Attributes | |
| $field | |
| The field to iterate on. | |
| $fieldClones = array() | |
| Clones of the field that will be returned by getField(). | |
| $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. | |
Essentially this makes an array out of another field.
Definition at line 7 of file FieldIterator.class.php.
| spunQ_FieldIterator::__construct | ( | spunQ_IField $ | field | ) |
Constructor.
Will remove the given field from its container and add it to this. Will add itself to the former container of the field, effectively putting itself in between.
| $field | The field to iterate on. |
Definition at line 29 of file FieldIterator.class.php.
| spunQ_FieldIterator::__clone | ( | ) |
Called after this object was cloned (on the newly created object).
Will clone its field and reset its container.
Definition at line 64 of file FieldIterator.class.php.
| spunQ_FieldIterator::_processSubmission | ( | &$ | value | ) |
Initializes this field's submitted values.
Intended to be called by this field's container.
| $value | The raw value that was submitted for this field. The field is expected to return the processed value via this in/out parameter. |
Implements spunQ_IField.
Definition at line 198 of file FieldIterator.class.php.
| spunQ_FieldIterator::addField | ( | spunQ_IField $ | field | ) |
Adds a field to this container.
$field The field to add to this container.
this Implements spunQ_IFieldContainer.
Definition at line 83 of file FieldIterator.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.
Definition at line 391 of file Field.class.php.
| spunQ_FieldIterator::getDisplayValue | ( | $ | originalValue | ) |
Returns the value to use for show().
This is either the value given as parameter or the submitted value, depending on form submission and the value of getUseSubmittedValue().
| $originalValue | The original value to be displayed if the form was not submitted. |
Implements spunQ_IField.
Definition at line 209 of file FieldIterator.class.php.
| spunQ_FieldIterator::getField | ( | $ | index = NULL |
) |
Returns the field for given index.
Will generate a new field by cloning the original field and return the cached result. Will return the original field if the parameter is omitted.
| $index | The index to get the field for. Will return the original field if this parameter is omitted. |
Definition at line 47 of file FieldIterator.class.php.
| spunQ_FieldIterator::getFieldByPath | ( | $ | path | ) |
Returns a field by its field path.
| $path | Either a string or an array. The string should contain only the difference between this fields path and the searched field's path. |
| spunQ_HtmlException | If the field is not found. |
Implements spunQ_IField.
Definition at line 169 of file FieldIterator.class.php.
| spunQ_FieldIterator::getFieldHtmlId | ( | $ | field, | |
| $ | postfix | |||
| ) |
Provides the html id of a field.
The rationale of this function is the same as for getFieldHtmlName().
| $field | The field to get the html id for. |
Implements spunQ_IFieldContainer.
Definition at line 107 of file FieldIterator.class.php.
| spunQ_FieldIterator::getFieldHtmlName | ( | $ | field | ) |
Provides the html name of the field.
The container is respensible for all contained field's names. A form might just return the fields name, a FieldIterator will postfix the square brackets that PHP expects.
| $field | The field to get the html name for. |
Implements spunQ_IFieldContainer.
Definition at line 115 of file FieldIterator.class.php.
| spunQ_Field::getForm | ( | ) | [inherited] |
Provides the form this field resides in.
Definition at line 120 of file Field.class.php.
| spunQ_FieldIterator::getTypePathPart | ( | ) |
The last part of the type path of this field.
Implements spunQ_IField.
Definition at line 124 of file FieldIterator.class.php.
| spunQ_FieldIterator::getTypeString | ( | ) |
Returns a type string for the container.
The type string is - unlike the name - not unique. It is used for grouping forms and fields into types that have common functions. One example is error message translation. Although the forms with the names editUser<user:14> and editUser<user:15> are two completely distinct forms, they might have the exact same error messages for their fields.
Implements spunQ_IFieldContainer.
Definition at line 100 of file FieldIterator.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:
NULL indicating, that no class declaration is to be added.| $class | The value that was passed to the template. Either of the types mentioned in the function description. |
class attribute of an html node. | spunQ_HtmlException | If the parameter has an unexpected type or an invalid css declaration. |
Definition at line 20 of file Field.class.php.
| spunQ_FieldIterator::removeField | ( | spunQ_IField $ | field | ) |
Removes a field from this container.
$field The field to remove.
this Implements spunQ_IFieldContainer.
Definition at line 93 of file FieldIterator.class.php.
| spunQ_FieldIterator::show | ( | $ | value = NULL, |
|
| $ | template = NULL, |
|||
| $ | templateParameters = array(), |
|||
| $ | htmlIdPostfix = '' | |||
| ) |
Will generate and display html for this form field.
| $value | The default value this field shall display. This is expected to be the actual value required in the application. It will be run through all converters before it is passed to the template. This value might be replaced by the value the user submitted if getUseSubmittedValue() yields true. | |
| $template | The template to use for converting this field into html. The template will receive the following parameters:
| |
| $templateParameters | Additional parameters to be passed to the template. | |
| $htmlIdPostfix | A postfix to be added to id attributes of the html form elements that are generated. A unique parameter must be provided each time the form is displayed. |
$this Implements spunQ_IField.
Definition at line 131 of file FieldIterator.class.php.
| spunQ_FieldIterator::showValidatorsJs | ( | ) |
Prints javascript for validating this field.
$this Implements spunQ_IField.
Definition at line 146 of file FieldIterator.class.php.
| spunQ_Field::spunQToRaw | ( | $ | value | ) | [protected, inherited] |
Will convert a spunQ value to a raw value using registered converters.
| $value | The value to convert |
Definition at line 353 of file Field.class.php.
| spunQ_FieldIterator::submittedValueValid | ( | ) |
Returns whether the value submitted by the browser is valid This will only check whether the values received are acceptable to this field type.
It will not check the results of validators.
| spunQ_HtmlException | If the form was not submitted. |
Implements spunQ_IField.
Definition at line 154 of file FieldIterator.class.php.
| spunQ_FieldIterator::wasSubmitted | ( | ) |
Whether the form the field is in was submitted.
Implements spunQ_IFieldContainer.
Definition at line 76 of file FieldIterator.class.php.
spunQ_Field::$container [protected, inherited] |
spunQ_Field::$converters = array() [protected, inherited] |
The converters that have been registered with this field.
Definition at line 63 of file Field.class.php.
spunQ_FieldIterator::$field [protected] |
spunQ_FieldIterator::$fieldClones = array() [protected] |
Clones of the field that will be returned by getField().
The first entry is always $field itself.
Definition at line 20 of file FieldIterator.class.php.
spunQ_Field::$name [protected, inherited] |
spunQ_Field::$submittedRawValue = NULL [protected, inherited] |
Raw value that was submitted for this field.
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().
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.
Definition at line 57 of file Field.class.php.
spunQ_Field::$validationMessages = NULL [protected, inherited] |
Messages generated by validators and converters.
Initialized in _processSubmission().
Definition at line 76 of file Field.class.php.
spunQ_Field::$validators = array() [protected, inherited] |
Registered field validators.
Definition at line 69 of file Field.class.php.
1.5.9