Class: I2CE FormField: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 31: Line 31:
*** [[Class: I2CE_FormField_STRING_TEXT | I2CE_FormField_STRING_TEXT]]
*** [[Class: I2CE_FormField_STRING_TEXT | I2CE_FormField_STRING_TEXT]]
*Location: Part of the module [[I2CE Module List#forms|forms]] in the package [https://launchpad.net/i2ce I2CE]
*Location: Part of the module [[I2CE Module List#forms|forms]] in the package [https://launchpad.net/i2ce I2CE]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.1-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php modules/Forms/lib/I2CE_FormField.php]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L31 modules/Forms/lib/I2CE_FormField.php] on line 31
*Author: Luke Duncan <lduncan@intrahealth.org>
*Author: Luke Duncan <lduncan@intrahealth.org>
*Since: v2.0.0
*Since: v2.0.0
Line 48: Line 48:
===$name===
===$name===
The name of this field.
The name of this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L50 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 50
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $name
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $name


===$options===
===$options===
An associative array with all the options for this form field.
An associative array with all the options for this form field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L54 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 54
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $options
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $options


===$value===
===$value===
The value of this field.
The value of this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L58 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 58
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value


===$headers===
===$headers===
A list of headers for this form field.
A list of headers for this form field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L62 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 62
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $headers
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $headers


===$href===
===$href===
A URL to be used as a link for this field when displaying the value.
A URL to be used as a link for this field when displaying the value.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L66 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 66
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $href
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $href


===$form===
===$form===
A reference to the form object this field is a part of.
A reference to the form object this field is a part of.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L70 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 70
*Type: protected [[Class: I2CE_Form | I2CE_Form]] $form
*Type: protected [[Class: I2CE_Form | I2CE_Form]] $form


===$history===
===$history===
A list of [[Class: I2CE_Entry | ]] objects for all entries for this field.
A list of [[Class: I2CE_Entry | ]] objects for all entries for this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L74 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 74
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $history
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $history


===$history_idx===
===$history_idx===
The index for cycling through all historical entries.
The index for cycling through all historical entries.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L78 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 78
*Type: protected integer $history_idx
*Type: protected integer $history_idx


===$attributes===
===$attributes===
A list of attributes for this FormField instance.
A list of attributes for this FormField instance.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L82 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 82
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $attributes
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $attributes


===$invalid===
===$invalid===
error messages to be displayed when a form is invalid. .  string or array of "extra" setInvalid  
error messages to be displayed when a form is invalid. .  string or array of "extra" setInvalid  
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L162 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 162
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $invalid
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $invalid


Line 89: Line 99:
===__construct()===
===__construct()===
Create a new instance of a I2CE_FormField
Create a new instance of a I2CE_FormField
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L173 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 173
*Signature: public function __construct($name,$options)
*Signature: public function __construct($name,$options)
*Parameters:
*Parameters:
Line 96: Line 107:
===addHistory()===
===addHistory()===
Add a history entry to this field.
Add a history entry to this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L523 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 523
*Signature: public function addHistory($entry)
*Signature: public function addHistory($entry)
*Parameters:
*Parameters:
Line 101: Line 113:
===compare()===
===compare()===
Compares this form field agains the given form field.
Compares this form field agains the given form field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L454 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 454
*Signature: public function compare($db_value)
*Signature: public function compare($db_value)
*Parameters:
*Parameters:
Line 107: Line 120:
===createField()===
===createField()===
Instantiantiate a field given its short class name
Instantiantiate a field given its short class name
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L94 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 94
*Signature: static public function createField($formfield,$name,$args)
*Signature: static public function createField($formfield,$name,$args)
*Parameters:
*Parameters:
Line 116: Line 130:
===displayInvalid()===
===displayInvalid()===
Displays invalid/error messages on the given node @var I2CE_Template $template @var DOMNode $node
Displays invalid/error messages on the given node @var I2CE_Template $template @var DOMNode $node
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L805 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 805
*Signature: protected function displayInvalid($template,$node)
*Signature: protected function displayInvalid($template,$node)
*Parameters:
*Parameters:
Line 122: Line 137:
===firstHistory()===
===firstHistory()===
Reset the history_idx history index and return the first element
Reset the history_idx history index and return the first element
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L543 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 543
*Signature: public function firstHistory()
*Signature: public function firstHistory()
*Returns: DBEntry
*Returns: DBEntry
===getAttribute()===
===getAttribute()===
Return the attribute value for a given attribute.
Return the attribute value for a given attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L863 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 863
*Signature: public function getAttribute($key)
*Signature: public function getAttribute($key)
*Parameters:
*Parameters:
Line 132: Line 149:
===getDBType()===
===getDBType()===
Return the DB field type for this type.
Return the DB field type for this type.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L207 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 207
*Signature: public function getDBType()
*Signature: public function getDBType()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getDBValue()===
===getDBValue()===
Returns the value of this field ready to be stored in the database.
Returns the value of this field ready to be stored in the database.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L412 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 412
*Signature: public function getDBValue()
*Signature: public function getDBValue()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
===getDisplayNode()===
===getDisplayNode()===
Return the display value of this form field as a DOM Node.
Return the display value of this form field as a DOM Node.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L582 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 582
*Signature: public function getDisplayNode($node,$template)
*Signature: public function getDisplayNode($node,$template)
*Parameters:
*Parameters:
Line 147: Line 167:
===getDisplayValue()===
===getDisplayValue()===
Returns the value of this field as a human readable format.
Returns the value of this field as a human readable format.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L422 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 422
*Signature: public function getDisplayValue($entry)
*Signature: public function getDisplayValue($entry)
*Parameters:
*Parameters:
Line 154: Line 175:
===getDisplays()===
===getDisplays()===
Get the display styles registered for this form field.  Will always include 'default'
Get the display styles registered for this form field.  Will always include 'default'
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L343 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 343
*Signature: public function getDisplays()
*Signature: public function getDisplays()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
===getElement()===
===getElement()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L835 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 835
*Signature: protected function getElement()
*Signature: protected function getElement()
===getForm()===
===getForm()===
Returns the form object for this field.
Returns the form object for this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L359 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 359
*Signature: public function getForm()
*Signature: public function getForm()
===getFromDB()===
===getFromDB()===
Return the value of this field from the database format for the given type
Return the value of this field from the database format for the given type
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L229 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 229
*Signature: public function getFromDB($value)
*Signature: public function getFromDB($value)
*Parameters:
*Parameters:
Line 168: Line 193:
===getHTMLName()===
===getHTMLName()===
Return the value for the name attribute to be used for this field in a form.
Return the value for the name attribute to be used for this field in a form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L367 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 367
*Signature: public function getHTMLName($prefix)
*Signature: public function getHTMLName($prefix)
*Parameters:
*Parameters:
Line 175: Line 201:
===getHeader()===
===getHeader()===
Return the given header by type
Return the given header by type
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L510 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 510
*Signature: public function getHeader($type)
*Signature: public function getHeader($type)
*Parameters:
*Parameters:
Line 181: Line 208:
===getHref()===
===getHref()===
Return the URL to be used as a link for this field for display.
Return the URL to be used as a link for this field for display.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L568 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 568
*Signature: public function getHref()
*Signature: public function getHref()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getInvalid()===
===getInvalid()===
Return the invalid information.
Return the invalid information.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L154 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 154
*Signature: public function getInvalid()
*Signature: public function getInvalid()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
===getMDB2Type()===
===getMDB2Type()===
Return the MDB2 field type for this field. If it isn't set return the DB type.
Return the MDB2 field type for this field. If it isn't set return the DB type.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L216 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 216
*Signature: public function getMDB2Type()
*Signature: public function getMDB2Type()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getName()===
===getName()===
Returns the field name of this field.
Returns the field name of this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L237 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 237
*Signature: public function getName()
*Signature: public function getName()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getOption()===
===getOption()===
Get the value stored at a named option exists
Get the value stored at a named option exists
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L268 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 268
*Signature: public function getOption($option)
*Signature: public function getOption($option)
*Parameters:
*Parameters:
Line 202: Line 234:
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]*
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]*
===getOptionsByPath()===
===getOptionsByPath()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L305 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 305
*Signature: protected function getOptionsByPath($path)
*Signature: protected function getOptionsByPath($path)
*Parameters:
*Parameters:
Line 207: Line 240:
===getString()===
===getString()===
Return the type string for this field.
Return the type string for this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L244 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 244
*Signature: public function getString()
*Signature: public function getString()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getTypeString()===
===getTypeString()===
Return the string name for a given type.
Return the string name for a given type.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L199 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 199
*Signature: public function getTypeString()
*Signature: public function getTypeString()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getValue()===
===getValue()===
Returns the value of this field.
Returns the value of this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L404 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 404
*Signature: public function getValue()
*Signature: public function getValue()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
===hasAttribute()===
===hasAttribute()===
Return true if a given attribute exists for this form.
Return true if a given attribute exists for this form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L876 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 876
*Signature: public function hasAttribute($key)
*Signature: public function hasAttribute($key)
*Parameters:
*Parameters:
Line 225: Line 262:
===hasDisplay()===
===hasDisplay()===
Checks to see if the given display type is registed for this form field.
Checks to see if the given display type is registed for this form field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L328 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 328
*Signature: public function hasDisplay($type)
*Signature: public function hasDisplay($type)
*Parameters:
*Parameters:
Line 231: Line 269:
===hasHeader()===
===hasHeader()===
Check to see if the given header type exists
Check to see if the given header type exists
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L503 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 503
*Signature: public function hasHeader($type)
*Signature: public function hasHeader($type)
*Parameters:
*Parameters:
Line 237: Line 276:
===hasInvalid()===
===hasInvalid()===
Checks to see if there are any entries in the invalid  array.
Checks to see if there are any entries in the invalid  array.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L139 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 139
*Signature: public function hasInvalid()
*Signature: public function hasInvalid()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===hasNextHistory()===
===hasNextHistory()===
Check to see if there are remaining DBEntry elements in history  array.
Check to see if there are remaining DBEntry elements in history  array.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L531 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 531
*Signature: public function hasNextHistory()
*Signature: public function hasNextHistory()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===hasOption()===
===hasOption()===
Check if a named option exists
Check if a named option exists
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L260 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 260
*Signature: public function hasOption($option)
*Signature: public function hasOption($option)
*Parameters:
*Parameters:
Line 251: Line 293:
===isInDB()===
===isInDB()===
Checks to see if this field is saved in the database.
Checks to see if this field is saved in the database.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L251 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 251
*Signature: public function isInDB()
*Signature: public function isInDB()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===isSameValue()===
===isSameValue()===
Check to see if the given DB value is equivalent to this value.
Check to see if the given DB value is equivalent to this value.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L436 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 436
*Signature: public function isSameValue($db_value)
*Signature: public function isSameValue($db_value)
*Parameters:
*Parameters:
Line 261: Line 305:
===isValid()===
===isValid()===
Checks to see if the current value for this is set and valid.
Checks to see if the current value for this is set and valid.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L470 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 470
*Signature: abstract public function isValid()
*Signature: abstract public function isValid()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===issetValue()===
===issetValue()===
Checks to see if the value has been set.
Checks to see if the value has been set.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L477 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 477
*Signature: public function issetValue()
*Signature: public function issetValue()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===nextHistory()===
===nextHistory()===
Return the next DBEntry element from the history  array.
Return the next DBEntry element from the history  array.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L552 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 552
*Signature: public function nextHistory()
*Signature: public function nextHistory()
*Returns: DBEntry
*Returns: DBEntry
===optionsHasPath()===
===optionsHasPath()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L289 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 289
*Signature: protected function optionsHasPath($path)
*Signature: protected function optionsHasPath($path)
*Parameters:
*Parameters:
Line 277: Line 325:
===processDOM()===
===processDOM()===
Process this form field as a DOM element to place it in the template at the given node.
Process this form field as a DOM element to place it in the template at the given node.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L601 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 601
*Signature: public function processDOM($node,$template)
*Signature: public function processDOM($node,$template)
*Parameters:
*Parameters:
Line 282: Line 331:
** [[Class: I2CE_Template | I2CE_Template]] $template
** [[Class: I2CE_Template | I2CE_Template]] $template
===processDOMEditable()===
===processDOMEditable()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L846 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 846
*Signature: abstract public function processDOMEditable($node,$template,$form_node)
*Signature: abstract public function processDOMEditable($node,$template,$form_node)
*Parameters:
*Parameters:
Line 289: Line 339:
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of DOMNode
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of DOMNode
===processDOMNotEditable()===
===processDOMNotEditable()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L789 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 789
*Signature: public function processDOMNotEditable($node,$template,$form_node)
*Signature: public function processDOMNotEditable($node,$template,$form_node)
*Parameters:
*Parameters:
Line 296: Line 347:
===setAttribute()===
===setAttribute()===
Set an attribute for this form.
Set an attribute for this form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L854 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 854
*Signature: public function setAttribute($key,$value)
*Signature: public function setAttribute($key,$value)
*Parameters:
*Parameters:
Line 301: Line 353:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
===setElement()===
===setElement()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L839 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 839
*Signature: protected function setElement($element)
*Signature: protected function setElement($element)
*Parameters:
*Parameters:
Line 306: Line 359:
===setForm()===
===setForm()===
Sets the form object for this field.
Sets the form object for this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L281 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 281
*Signature: public function setForm($form)
*Signature: public function setForm($form)
*Parameters:
*Parameters:
Line 311: Line 365:
===setFromDB()===
===setFromDB()===
Sets the value of this field from the database format.
Sets the value of this field from the database format.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L388 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 388
*Signature: public function setFromDB($value)
*Signature: public function setFromDB($value)
*Parameters:
*Parameters:
Line 316: Line 371:
===setFromPost()===
===setFromPost()===
Sets the value of this field from the posted form.
Sets the value of this field from the posted form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L396 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 396
*Signature: public function setFromPost($post)
*Signature: public function setFromPost($post)
*Parameters:
*Parameters:
Line 321: Line 377:
===setHeaders()===
===setHeaders()===
Set the headers for this form field.
Set the headers for this form field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L492 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 492
*Signature: public function setHeaders($headers)
*Signature: public function setHeaders($headers)
*Parameters:
*Parameters:
Line 326: Line 383:
===setHref()===
===setHref()===
Set the URL for this field
Set the URL for this field
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L560 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 560
*Signature: public function setHref($href)
*Signature: public function setHref($href)
*Parameters:
*Parameters:
Line 331: Line 389:
===setInvalid()===
===setInvalid()===
Add or replace an entry in the invalid  array. The format for the $extra parameter is: array( "URL" => array( 'id' => 'display' ) ); The id value will be appended to the URL and the display part will be displayed as the link text.
Add or replace an entry in the invalid  array. The format for the $extra parameter is: array( "URL" => array( 'id' => 'display' ) ); The id value will be appended to the URL and the display part will be displayed as the link text.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L125 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 125
*Signature: public function setInvalid($message,$extra)
*Signature: public function setInvalid($message,$extra)
*Parameters:
*Parameters:
Line 338: Line 397:
===setValue()===
===setValue()===
Sets the value of this field.
Sets the value of this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L381 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 381
*Signature: public function setValue($value)
*Signature: public function setValue($value)
*Parameters:
*Parameters:
Line 343: Line 403:
===unsetValue()===
===unsetValue()===
Unsets the value of this field.
Unsets the value of this field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormField.php#L483 i2ce/modules/Forms/lib/I2CE_FormField.php] on line 483
*Signature: public function unsetValue()
*Signature: public function unsetValue()
==Inherited Methods==
==Inherited Methods==

Revision as of 09:49, 10 November 2009

This article describes the abstract class I2CE_FormField.

Class for defining all the database fields used by a object.

Constants

I2CE_FormField::FIELD_TYPE_I2CE

A string type for the field Defined as: "string"

I2CE_FormField::FIELD_TYPE_DB

The database type for the field Defined as: "varchar( 255 ) COLLATE utf8_bin default NULL"

I2CE_FormField::FIELD_TYPE_MDB2

The MDB2 type for the field. Defined as: "text"

Variables

$name

The name of this field.

$options

An associative array with all the options for this form field.

$value

The value of this field.

$headers

A list of headers for this form field.

$href

A URL to be used as a link for this field when displaying the value.

$form

A reference to the form object this field is a part of.

$history

A list of objects for all entries for this field.

$history_idx

The index for cycling through all historical entries.

$attributes

A list of attributes for this FormField instance.

$invalid

error messages to be displayed when a form is invalid. . string or array of "extra" setInvalid

Methods

__construct()

Create a new instance of a I2CE_FormField

  • Defined in i2ce/modules/Forms/lib/I2CE_FormField.php on line 173
  • Signature: public function __construct($name,$options)
  • Parameters:
    • string $name
    • array $options
      A list of options for this form field. The keys used are: in_db, required, unique and unique_field
      • Default Value: array()

addHistory()

Add a history entry to this field.

compare()

Compares this form field agains the given form field.

createField()

Instantiantiate a field given its short class name

  • Defined in i2ce/modules/Forms/lib/I2CE_FormField.php on line 94
  • Signature: static public function createField($formfield,$name,$args)
  • Parameters:
    • string $formfield
      the short name of a form field (e.g. STRING_LINE or DATE_YMD)
    • string $name
      The name of the field
    • array $args
      Defaults to empty array. The field arguments passed to the constructor
      • Default Value: array()
  • Returns: mixed
    I2CE_FormField or false on failure

displayInvalid()

Displays invalid/error messages on the given node @var I2CE_Template $template @var DOMNode $node

firstHistory()

Reset the history_idx history index and return the first element

getAttribute()

Return the attribute value for a given attribute.

getDBType()

Return the DB field type for this type.

getDBValue()

Returns the value of this field ready to be stored in the database.

getDisplayNode()

Return the display value of this form field as a DOM Node.

getDisplayValue()

Returns the value of this field as a human readable format.

  • Defined in i2ce/modules/Forms/lib/I2CE_FormField.php on line 422
  • Signature: public function getDisplayValue($entry)
  • Parameters:
    • I2CE_Entry $entry
      If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an entry for this field.
      • Default Value: false
  • Returns: mixed

getDisplays()

Get the display styles registered for this form field. Will always include 'default'

getElement()

getForm()

Returns the form object for this field.

getFromDB()

Return the value of this field from the database format for the given type

getHTMLName()

Return the value for the name attribute to be used for this field in a form.

getHeader()

Return the given header by type

getHref()

Return the URL to be used as a link for this field for display.

getInvalid()

Return the invalid information.

getMDB2Type()

Return the MDB2 field type for this field. If it isn't set return the DB type.

getName()

Returns the field name of this field.

getOption()

Get the value stored at a named option exists

getOptionsByPath()

getString()

Return the type string for this field.

getTypeString()

Return the string name for a given type.

getValue()

Returns the value of this field.

hasAttribute()

Return true if a given attribute exists for this form.

hasDisplay()

Checks to see if the given display type is registed for this form field.

hasHeader()

Check to see if the given header type exists

hasInvalid()

Checks to see if there are any entries in the invalid array.

hasNextHistory()

Check to see if there are remaining DBEntry elements in history array.

hasOption()

Check if a named option exists

isInDB()

Checks to see if this field is saved in the database.

isSameValue()

Check to see if the given DB value is equivalent to this value.

isValid()

Checks to see if the current value for this is set and valid.

issetValue()

Checks to see if the value has been set.

nextHistory()

Return the next DBEntry element from the history array.

optionsHasPath()

processDOM()

Process this form field as a DOM element to place it in the template at the given node.

processDOMEditable()

processDOMNotEditable()

setAttribute()

Set an attribute for this form.

setElement()

setForm()

Sets the form object for this field.

setFromDB()

Sets the value of this field from the database format.

setFromPost()

Sets the value of this field from the posted form.

setHeaders()

Set the headers for this form field.

setHref()

Set the URL for this field

setInvalid()

Add or replace an entry in the invalid array. The format for the $extra parameter is: array( "URL" => array( 'id' => 'display' ) ); The id value will be appended to the URL and the display part will be displayed as the link text.

setValue()

Sets the value of this field.

unsetValue()

Unsets the value of this field.

Inherited Methods

_hasMethod()

This public method is inherited from I2CE_Fuzzy->_hasMethod()

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()

Fuzzy Methods

cachedTableReference()

This method is implemented by I2CE_Module_CachedForms->cachedTableReference()

isNumeric()

This method is implemented by I2CE_Module_CustomReports->isNumericField()

getLimitStyles()

This method is implemented by I2CE_Module_FormLimits->getFieldLimitStyles()

generateLimit()

This method is implemented by I2CE_Module_FormLimits->generateFieldLimit()

generateLimit_null()

This method is implemented by I2CE_Module_FormLimits->generateLimit_null()

generateLimit_not_null()

This method is implemented by I2CE_Module_FormLimits->generateLimit_not_null()

generateLimit_null_not_null()

This method is implemented by I2CE_Module_FormLimits->generateLimit_not_null()

checkLimit_null()

This method is implemented by I2CE_Module_FormLimits->checkLimit_null()

checkLimit_not_null()

This method is implemented by I2CE_Module_FormLimits->checkLimit_not_null()

checkLimit_null_not_null()

This method is implemented by I2CE_Module_FormLimits->checkLimit_not_null()

checkLimitString_null()

This method is implemented by I2CE_Module_FormLimits->checkLimitString_null()

checkLimitString_not_null()

This method is implemented by I2CE_Module_FormLimits->checkLimitString_not_null()

checkLimitString_null_not_null()

This method is implemented by I2CE_Module_FormLimits->checkLimitString_not_null()

getLimitMenu_null()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_null()

getLimitMenu_not_null()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_not_null()

getLimitMenu_null_not_null()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_null_not_null()

processLimitMenu_null()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_null()

processLimitMenu_not_null()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_not_null()

processLimitMenu_null_not_null()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_null_not_null()

generateLimit_max_parent()

This method is implemented by I2CE_Module_FormLimits->generateLimit_max_parent()

generateLimit_min_parent()

This method is implemented by I2CE_Module_FormLimits->generateLimit_min_parent()

generateLimit_max_parent_form()

This method is implemented by I2CE_Module_FormLimits->generateLimit_max_parent_form()

generateLimit_min_parent_form()

This method is implemented by I2CE_Module_FormLimits->generateLimit_min_parent_form()

getLimitMenu_max_parent()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_max_parent()

getLimitMenu_min_parent()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_min_parent()

getLimitMenu_max_parent_form()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_max_parent_form()

getLimitMenu_min_parent_form()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_min_parent_form()

processLimitMenu_max_parent()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_max_parent()

processLimitMenu_min_parent()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_min_parent()

processLimitMenu_max_parent_form()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_max_parent_form()

processLimitMenu_min_parent_form()

This method is implemented by I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_min_parent_form()

save()

This method is implemented by I2CE_FormStorage->FF_save()

populateHistory()

This method is implemented by I2CE_FormStorage->FF_populateHistory()