Collection of form elements

This class provides is an array of objects of the base_field class or derived classes. It contains functionality to : - adding objects - performing functions on all objects in the collection

category Form
package Formaid
author Dieter Adriaenssens
copyright 2006-2013 Dieter Adriaenssens
license GPL
link http://formaid.sourceforge.net/

 Methods

Constructor, initialises an instance of Formaid_FormElements collection

__construct() : void

Adds a new instance to the collection

add(object $obj, string $type, string $current_value, array $data, string $title, string $comment) : void

If the object is of the Formaid_FieldInputAbstract class, add it to the collection. If the object is not a class, create a new input field instance.

Parameters

$obj

object

Formaid_FieldInputAbstract instance or name of new input field instance.

$type

string

Type of the input field.

$current_value

string

Initial value.

$data

array

Array of name/ID pairs, values for the selection box.

$title

string

Title/caption that precedes this field.

$comment

string

Comment that is shown after this field.

Displays all objects in the collection

display() : void
Inherited
inherited_from \Formaid_Collection::display()
inherited_from \Formaid_Properties::display()

Get display seperator

getDisplayListSeparator() : string
Inherited
inherited_from \Formaid_Collection::getDisplayListSeparator()
inherited_from \Formaid_Properties::getDisplayListSeparator()

Returns

stringString separating columns

Get display prefix

getDisplayPrefix() : string
Inherited
inherited_from \Formaid_Collection::getDisplayPrefix()
inherited_from \Formaid_Properties::getDisplayPrefix()

Returns

stringPrefix string when displaying collection items

Generate formatted string of all objects

getDisplayString() : string
Inherited

A displaystring is generated from all objects in the collection, all empty strings are removed and the remaining ones are chained together with the listSeparator.

inherited_from \Formaid_Collection::getDisplayString()
inherited_from \Formaid_Properties::getDisplayString()

Returns

string

Get display suffix

getDisplaySuffix() : string
Inherited
inherited_from \Formaid_Collection::getDisplaySuffix()
inherited_from \Formaid_Properties::getDisplaySuffix()

Returns

stringSuffix string when displaying collection items

Returns name of the object

getName(string $name) : string
Inherited
inherited_from \Formaid_Collection::getName()
inherited_from \Formaid_Properties::getName()

Parameters

$name

string

object name

Returns

stringobject name

Returns names of all objects in collection

getNames() : array
Inherited
inherited_from \Formaid_Collection::getNames()
inherited_from \Formaid_Properties::getNames()

Returns

arrayobject names

Returns object

getObject(string $name) : object
Inherited
inherited_from \Formaid_Collection::getObject()
inherited_from \Formaid_Properties::getObject()

Parameters

$name

string

object name

Returns

object

Returns all objects in collection

getObjects() : array
Inherited
inherited_from \Formaid_Collection::getObjects()
inherited_from \Formaid_Properties::getObjects()

Returns

arrayobjects

Get names of objects to be inserted.

getSqlInsertValues() : array

The returned array will be used to generate an INSERT statement

todo low : this method will be replaced by a DbValues composite class generating the same list

Returns

array

Get names of objects to be displayed.

getSqlSelectValues() : array

The returned array will be used to generate a SELECT statement

todo low : this method will be replaced by a DbValues composite class generating the same list

Returns

array

Get names of objects to be updated.

getSqlUpdateValues() : array

The returned array will be used to generate an UPDATE statement

todo low : this method will be replaced by a DbValues composite class generating the same list

Returns

array

Get names and values of all fields that should be used as a parameter when returning to a webpage after a successful submit.

getUrlReturnParamValues() : array

Returns

array

Get current value of the selected property

getValue(string $name) : string
Inherited
inherited_from \Formaid_Properties::getValue()

Parameters

$name

string

property name

Returns

stringreturns current value of property

Checks if current value of the selected property is empty

isEmpty(string $name) : bool
Inherited
inherited_from \Formaid_Properties::isEmpty()

Parameters

$name

string

property name

Returns

booltrue if empty

Checks if name of the selected object is empty

isNameEmpty(string $name) : bool
Inherited
inherited_from \Formaid_Collection::isNameEmpty()
inherited_from \Formaid_Properties::isNameEmpty()

Parameters

$name

string

object name

Returns

booltrue if empty

Returns number of objects in collection

numItems() : int
Inherited
inherited_from \Formaid_Collection::numItems()
inherited_from \Formaid_Properties::numItems()

Returns

intnumber of objects in collection

Reads variables in the $_GET array

readGetValues() : void

Reads the values in the $_GET array of all objects in the collection.

Reads variables submitted with webpage

readPageRequestVariables() : void

Reads the webpage submitted values of all objects in the collection.

Reads variables in the $_POST array

readPostValues() : void

Reads the values in the $_POST array of all objects in the collection.

Reads variables from an sql row

readSqlValues(array $sql_row) : void

Reads the values from an sql row (array) of all objects in the collection.

Parameters

$sql_row

array

row from sql_result

Removes the object from the collection

remove(string $name) : void
Inherited
inherited_from \Formaid_Collection::remove()
inherited_from \Formaid_Properties::remove()

Parameters

$name

string

object name

Resets current values of all property instances in the collection

resetAll() : void
Inherited
inherited_from \Formaid_Properties::resetAll()

Resets current value of the selected property

resetValue(string $name) : void
Inherited
inherited_from \Formaid_Properties::resetValue()

Parameters

$name

string

property name

Set current value of the selected property to default

setDefault(string $name, string $value) : void
Inherited
inherited_from \Formaid_Properties::setDefault()

Parameters

$name

string

property name

$value

string

new default value

Set display pre- and suffix

setDisplayAffixes(string $prefix, string $suffix) : void
Inherited
inherited_from \Formaid_Collection::setDisplayAffixes()
inherited_from \Formaid_Properties::setDisplayAffixes()

Parameters

$prefix

string

prefix string when displaying collection items

$suffix

string

suffix string when displaying collection items

Set display seperator for list mode

setDisplayListSeparator(string $separator) : void
Inherited
inherited_from \Formaid_Collection::setDisplayListSeparator()
inherited_from \Formaid_Properties::setDisplayListSeparator()

Parameters

$separator

string

string separating columns

Set display prefix

setDisplayPrefix(string $prefix) : void
Inherited
inherited_from \Formaid_Collection::setDisplayPrefix()
inherited_from \Formaid_Properties::setDisplayPrefix()

Parameters

$prefix

string

prefix string when displaying collection items

Set display suffix

setDisplaySuffix(string $suffix) : void
Inherited
inherited_from \Formaid_Collection::setDisplaySuffix()
inherited_from \Formaid_Properties::setDisplaySuffix()

Parameters

$suffix

string

suffix string when displaying collection items

Sets new name for the object

setName(string $name, string $new_name) : void
Inherited
inherited_from \Formaid_Collection::setName()
inherited_from \Formaid_Properties::setName()

Parameters

$name

string

object name

$new_name

string

new name

Set property for all objects in the collection.

setPropertyValue(string $name, string $value) : void

Parameters

$name

string

property name

$value

string

property value

Sets current value of the selected property

setValue(string $name, string $new_value) : void
Inherited
inherited_from \Formaid_Properties::setValue()

Parameters

$name

string

property name

$new_value

string

new value

Show all objects in collection

show() : void
Inherited

The show method of every object is called. These functions print the object (name, value, ...) to stdout.

inherited_from \Formaid_Collection::show()
inherited_from \Formaid_Properties::show()

Add pre- and suffixes to display string

addDisplayAffixes(string $displayString) : string
Inherited

The pre- and suffix should only be displayed when at least one item is displayed.

inherited_from \Formaid_Collection::addDisplayAffixes()
inherited_from \Formaid_Properties::addDisplayAffixes()

Parameters

$displayString

string

String with collection items to be displayed

Returns

stringString with added affixes

Callback method used by getDisplayString()

callbackDisplayString(object $object) : string
InheritedStatic

It calls the getDisplayString() method of the instance

static
inherited_from \Formaid_Collection::callbackDisplayString()
inherited_from \Formaid_Properties::callbackDisplayString()

Parameters

$object

object

Instance to apply the method to

Returns

stringDisplaystring of object

 Properties

 

$collection : array
Inherited
access protected
inherited_from \Formaid_Collection::$$collection
inherited_from \Formaid_Properties::$$collection
 

$_displayListSeparator : string
Inherited
access private
inherited_from \Formaid_Collection::$$_displayListSeparator
inherited_from \Formaid_Properties::$$_displayListSeparator
 

$_displayPrefix : string
Inherited
access private
inherited_from \Formaid_Collection::$$_displayPrefix
inherited_from \Formaid_Properties::$$_displayPrefix
 

$_displaySuffix : string
Inherited
access private
inherited_from \Formaid_Collection::$$_displaySuffix
inherited_from \Formaid_Properties::$$_displaySuffix