Class: I2CE FormField: Difference between revisions

From IHRIS Wiki
No edit summary
(Redirected page to Class: I2CE FormField (4.1.12))
 
(14 intermediate revisions by one other user not shown)
Line 1: Line 1:
This article describes the ''abstract'' class ''I2CE_FormField''.
#REDIRECT [[Class: I2CE_FormField (4.1.12)]]
*Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]].
*Child Classes:
** [[Class: I2CE_FormField_DB_BLOB | I2CE_FormField_DB_BLOB]]
*** [[Class: I2CE_FormField_BINARY_FILE | I2CE_FormField_BINARY_FILE]]
**** [[Class: I2CE_FormField_DOCUMENT | I2CE_FormField_DOCUMENT]]
**** [[Class: I2CE_FormField_IMAGE | I2CE_FormField_IMAGE]]
** [[Class: I2CE_FormField_DB_FLOAT | I2CE_FormField_DB_FLOAT]]
*** [[Class: I2CE_FormField_FLOAT | I2CE_FormField_FLOAT]]
** [[Class: I2CE_FormField_DB_DATE | I2CE_FormField_DB_DATE]]
*** [[Class: I2CE_FormField_DATE_HMS | I2CE_FormField_DATE_HMS]]
*** [[Class: I2CE_FormField_DATE_MD | I2CE_FormField_DATE_MD]]
*** [[Class: I2CE_FormField_DATE_TIME | I2CE_FormField_DATE_TIME]]
*** [[Class: I2CE_FormField_DATE_Y | I2CE_FormField_DATE_Y]]
*** [[Class: I2CE_FormField_DATE_YMD | I2CE_FormField_DATE_YMD]]
** [[Class: I2CE_FormField_DB_INT | I2CE_FormField_DB_INT]]
*** [[Class: I2CE_FormField_BOOL | I2CE_FormField_BOOL]]
*** [[Class: I2CE_FormField_INT | I2CE_FormField_INT]]
*** [[Class: I2CE_FormField_INT_GENERATE | I2CE_FormField_INT_GENERATE]]
*** [[Class: I2CE_FormField_YESNO | I2CE_FormField_YESNO]]
** [[Class: I2CE_FormField_DB_STRING | I2CE_FormField_DB_STRING]]
*** [[Class: I2CE_FormField_MAPPED | I2CE_FormField_MAPPED]]
**** [[Class: I2CE_FormField_MAP | I2CE_FormField_MAP]]
***** [[Class: iHRIS_FormField_CURRENCY | iHRIS_FormField_CURRENCY]]
**** [[Class: I2CE_FormField_MAP_MULT | I2CE_FormField_MAP_MULT]]
*** [[Class: I2CE_FormField_INT_LIST | I2CE_FormField_INT_LIST]]
*** [[Class: I2CE_FormField_STRING_LINE | I2CE_FormField_STRING_LINE]]
*** [[Class: I2CE_FormField_STRING_MLINE | I2CE_FormField_STRING_MLINE]]
*** [[Class: I2CE_FormField_STRING_PASS | I2CE_FormField_STRING_PASS]]
** [[Class: I2CE_FormField_DB_TEXT | I2CE_FormField_DB_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]
*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]
*Author: Luke Duncan <lduncan@intrahealth.org>
*Since: v2.0.0
Class for defining all the database fields used by a [[Class: I2CE_Form | ]] 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.
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $name
 
===$options===
An associative array with all the options for this form field.
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $options
 
===$value===
The value of this field.
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
 
===$headers===
A list of headers for this form field.
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $headers
 
===$href===
A URL to be used as a link for this field when displaying the value.
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $href
 
===$form===
A reference to the form object this field is a part of.
*Type: protected [[Class: I2CE_Form | I2CE_Form]] $form
 
===$history===
A list of [[Class: I2CE_Entry | ]] objects for all entries for this field.
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $history
 
===$history_idx===
The index for cycling through all historical entries.
*Type: protected integer $history_idx
 
===$attributes===
A list of attributes for this FormField instance.
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $attributes
 
===$invalid===
error messages to be displayed when a form is invalid. .  string or array of "extra" setInvalid
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $invalid
 
==Methods==
===__construct()===
Create a new instance of a I2CE_FormField
*Signature: public function __construct($name,$options)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $name
** [http://www.php.net/manual/en/language.types.array.php array ] $options <br/>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.
*Signature: public function addHistory($entry)
*Parameters:
** [[Class: I2CE_Entry | I2CE_Entry]] $entry <br/>The historical entry
===compare()===
Compares this form field agains the given form field.
*Signature: public function compare($db_value)
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $db_value <br/>Either a DB Value or an I2CE_FormField
*Returns: -1,0,1
===createField()===
Instantiantiate a field given its short class name
*Signature: static public function createField($formfield,$name,$args)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $formfield <br/>the short name of a form field (e.g. STRING_LINE or DATE_YMD)
** [http://www.php.net/manual/en/language.types.string.php string ] $name <br/>The name of the field
** [http://www.php.net/manual/en/language.types.array.php array ] $args <br/>Defaults to empty array.  The field arguments passed to the constructor
***Default Value: array()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]<br/>I2CE_FormField  or false on failure
===displayInvalid()===
Displays invalid/error messages on the given node @var I2CE_Template $template @var DOMNode $node
*Signature: protected function displayInvalid($template,$node)
*Parameters:
**$template
**$node
===firstHistory()===
Reset the history_idx history index and return the first element
*Signature: public function firstHistory()
*Returns: DBEntry
===getAttribute()===
Return the attribute value for a given attribute.
*Signature: public function getAttribute($key)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $key
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
===getDBType()===
Return the DB field type for this type.
*Signature: public function getDBType()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getDBValue()===
Returns the value of this field ready to be stored in the database.
*Signature: public function getDBValue()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
===getDisplayNode()===
Return the display value of this form field as a DOM Node.
*Signature: public function getDisplayNode($node,$template)
*Parameters:
** [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node
** [[Class: I2CE_Template | I2CE_Template]] $template
*Returns: [http://www.php.net/manual/en/class.domnode.php DOMNode ]
===getDisplayValue()===
Returns the value of this field as a human readable format.
*Signature: public function getDisplayValue($entry)
*Parameters:
** [[Class: I2CE_Entry | I2CE_Entry]] $entry <br/>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: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
===getDisplays()===
Get the display styles registered for this form field.  Will always include 'default'
*Signature: public function getDisplays()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
===getElement()===
*Signature: protected function getElement()
===getForm()===
Returns the form object for this field.
*Signature: public function getForm()
===getFromDB()===
Return the value of this field from the database format for the given type
*Signature: public function getFromDB($value)
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
===getHTMLName()===
Return the value for the name attribute to be used for this field in a form.
*Signature: public function getHTMLName($prefix)
*Parameters:
**$prefix
***Default Value: 'fields'
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getHeader()===
Return the given header by type
*Signature: public function getHeader($type)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $type
***Default Value: "default"
===getHref()===
Return the URL to be used as a link for this field for display.
*Signature: public function getHref()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getInvalid()===
Return the invalid information.
*Signature: public function getInvalid()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
===getMDB2Type()===
Return the MDB2 field type for this field. If it isn't set return the DB type.
*Signature: public function getMDB2Type()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getName()===
Returns the field name of this field.
*Signature: public function getName()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getOption()===
Get the value stored at a named option exists
*Signature: public function getOption($option)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $option
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]*
===getOptionsByPath()===
*Signature: protected function getOptionsByPath($path)
*Parameters:
**$path
===getString()===
Return the type string for this field.
*Signature: public function getString()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getTypeString()===
Return the string name for a given type.
*Signature: public function getTypeString()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getValue()===
Returns the value of this field.
*Signature: public function getValue()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
===hasAttribute()===
Return true if a given attribute exists for this form.
*Signature: public function hasAttribute($key)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $key
*Returns: boolean;
===hasDisplay()===
Checks to see if the given display type is registed for this form field.
*Signature: public function hasDisplay($type)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $type <br/>The display type.    'default' always returns true
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===hasHeader()===
Check to see if the given header type exists
*Signature: public function hasHeader($type)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $type
***Default Value: "default"
===hasInvalid()===
Checks to see if there are any entries in the invalid  array.
*Signature: public function hasInvalid()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===hasNextHistory()===
Check to see if there are remaining DBEntry elements in history  array.
*Signature: public function hasNextHistory()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===hasOption()===
Check if a named option exists
*Signature: public function hasOption($option)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $option
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]*
===isInDB()===
Checks to see if this field is saved in the database.
*Signature: public function isInDB()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===isSameValue()===
Check to see if the given DB value is equivalent to this value.
*Signature: public function isSameValue($db_value)
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $db_value <br/>Either a DB Value or an I2CE_FormField
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===isValid()===
Checks to see if the current value for this is set and valid.
*Signature: abstract public function isValid()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===issetValue()===
Checks to see if the value has been set.
*Signature: public function issetValue()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===nextHistory()===
Return the next DBEntry element from the history  array.
*Signature: public function nextHistory()
*Returns: DBEntry
===optionsHasPath()===
*Signature: protected function optionsHasPath($path)
*Parameters:
**$path
===processDOM()===
Process this form field as a DOM element to place it in the template at the given node.
*Signature: public function processDOM($node,$template)
*Parameters:
** [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node
** [[Class: I2CE_Template | I2CE_Template]] $template
===processDOMEditable()===
*Signature: abstract public function processDOMEditable($node,$template,$form_node)
*Parameters:
**$node
**$template
**$form_node
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of DOMNode
===processDOMNotEditable()===
*Signature: public function processDOMNotEditable($node,$template,$form_node)
*Parameters:
** [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node
** [[Class: I2CE_Template | I2CE_Template]] $template
** [http://www.php.net/manual/en/class.domnode.php DOMNode ] $form_node
===setAttribute()===
Set an attribute for this form.
*Signature: public function setAttribute($key,$value)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $key
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
===setElement()===
*Signature: protected function setElement($element)
*Parameters:
**$element
===setForm()===
Sets the form object for this field.
*Signature: public function setForm($form)
*Parameters:
** [[Class: I2CE_Form | I2CE_Form]] $form
===setFromDB()===
Sets the value of this field from the database format.
*Signature: public function setFromDB($value)
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
===setFromPost()===
Sets the value of this field from the posted form.
*Signature: public function setFromPost($post)
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $post
===setHeaders()===
Set the headers for this form field.
*Signature: public function setHeaders($headers)
*Parameters:
** [http://www.php.net/manual/en/language.types.array.php array ] $headers
===setHref()===
Set the URL for this field
*Signature: public function setHref($href)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $href
===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.
*Signature: public function setInvalid($message,$extra)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $message <br/>The error message to display.
** [http://www.php.net/manual/en/language.types.array.php array ] $extra <br/>Any extra information to be formatted and displayed.
***Default Value: null
===setValue()===
Sets the value of this field.
*Signature: public function setValue($value)
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
===unsetValue()===
Unsets the value of this field.
*Signature: public function unsetValue()
==Inherited Methods==
===_hasMethod()===
This public method is inherited from [[Class: I2CE_Fuzzy#_hasMethod() | I2CE_Fuzzy->_hasMethod()]]
==Inherited Fuzzy Methods==
===userMessage()===
This method is inherited from [[Class: I2CE_Fuzzy#userMessage() | I2CE_Fuzzy->userMessage()]]
==Fuzzy Methods==
===cachedTableReference()===
This method is implemented by [[Class: I2CE_Module_CachedForms#cachedTableReference() | I2CE_Module_CachedForms->cachedTableReference() ]]
===isNumeric()===
This method is implemented by [[Class: I2CE_Module_CustomReports#isNumericField() | I2CE_Module_CustomReports->isNumericField() ]]
===getLimitStyles()===
This method is implemented by [[Class: I2CE_Module_FormLimits#getFieldLimitStyles() | I2CE_Module_FormLimits->getFieldLimitStyles() ]]
===generateLimit()===
This method is implemented by [[Class: I2CE_Module_FormLimits#generateFieldLimit() | I2CE_Module_FormLimits->generateFieldLimit() ]]
===generateLimit_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#generateLimit_null() | I2CE_Module_FormLimits->generateLimit_null() ]]
===generateLimit_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#generateLimit_not_null() | I2CE_Module_FormLimits->generateLimit_not_null() ]]
===generateLimit_null_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#generateLimit_not_null() | I2CE_Module_FormLimits->generateLimit_not_null() ]]
===checkLimit_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#checkLimit_null() | I2CE_Module_FormLimits->checkLimit_null() ]]
===checkLimit_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#checkLimit_not_null() | I2CE_Module_FormLimits->checkLimit_not_null() ]]
===checkLimit_null_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#checkLimit_not_null() | I2CE_Module_FormLimits->checkLimit_not_null() ]]
===checkLimitString_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#checkLimitString_null() | I2CE_Module_FormLimits->checkLimitString_null() ]]
===checkLimitString_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#checkLimitString_not_null() | I2CE_Module_FormLimits->checkLimitString_not_null() ]]
===checkLimitString_null_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#checkLimitString_not_null() | I2CE_Module_FormLimits->checkLimitString_not_null() ]]
===getLimitMenu_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_DISPLAYFIELDSTYLE_null() | I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_null() ]]
===getLimitMenu_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_DISPLAYFIELDSTYLE_not_null() | I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_not_null() ]]
===getLimitMenu_null_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_DISPLAYFIELDSTYLE_null_not_null() | I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_null_not_null() ]]
===processLimitMenu_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_PROCESSFIELDSTYLE_null() | I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_null() ]]
===processLimitMenu_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_PROCESSFIELDSTYLE_not_null() | I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_not_null() ]]
===processLimitMenu_null_not_null()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_PROCESSFIELDSTYLE_null_not_null() | I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_null_not_null() ]]
===generateLimit_max_parent()===
This method is implemented by [[Class: I2CE_Module_FormLimits#generateLimit_max_parent() | I2CE_Module_FormLimits->generateLimit_max_parent() ]]
===generateLimit_min_parent()===
This method is implemented by [[Class: I2CE_Module_FormLimits#generateLimit_min_parent() | I2CE_Module_FormLimits->generateLimit_min_parent() ]]
===generateLimit_max_parent_form()===
This method is implemented by [[Class: I2CE_Module_FormLimits#generateLimit_max_parent_form() | I2CE_Module_FormLimits->generateLimit_max_parent_form() ]]
===generateLimit_min_parent_form()===
This method is implemented by [[Class: I2CE_Module_FormLimits#generateLimit_min_parent_form() | I2CE_Module_FormLimits->generateLimit_min_parent_form() ]]
===getLimitMenu_max_parent()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_DISPLAYFIELDSTYLE_max_parent() | I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_max_parent() ]]
===getLimitMenu_min_parent()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_DISPLAYFIELDSTYLE_min_parent() | I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_min_parent() ]]
===getLimitMenu_max_parent_form()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_DISPLAYFIELDSTYLE_max_parent_form() | I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_max_parent_form() ]]
===getLimitMenu_min_parent_form()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_DISPLAYFIELDSTYLE_min_parent_form() | I2CE_Module_FormLimits->I2CE_FormField_DISPLAYFIELDSTYLE_min_parent_form() ]]
===processLimitMenu_max_parent()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_PROCESSFIELDSTYLE_max_parent() | I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_max_parent() ]]
===processLimitMenu_min_parent()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_PROCESSFIELDSTYLE_min_parent() | I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_min_parent() ]]
===processLimitMenu_max_parent_form()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_PROCESSFIELDSTYLE_max_parent_form() | I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_max_parent_form() ]]
===processLimitMenu_min_parent_form()===
This method is implemented by [[Class: I2CE_Module_FormLimits#I2CE_FormField_PROCESSFIELDSTYLE_min_parent_form() | I2CE_Module_FormLimits->I2CE_FormField_PROCESSFIELDSTYLE_min_parent_form() ]]
===save()===
This method is implemented by [[Class: I2CE_FormStorage#FF_save() | I2CE_FormStorage->FF_save() ]]
===populateHistory()===
This method is implemented by [[Class: I2CE_FormStorage#FF_populateHistory() | I2CE_FormStorage->FF_populateHistory() ]]
 
 
[[Category:Class Documentation]]

Latest revision as of 10:43, 18 August 2015