Standard XML Representations of Field Data
API
This is for version 4.1 of I2CE/iHRIS.
I2CE_FormField
- add in a (final) method getXMLData($as_node = false). Calls _getXMLData(). If $as_node == false, the simply pass it along. If $as_node == true, first convert it to a DOMNode and return that
- add in a abstract method _getXMLData() which return strings
Sub-Classes of I2CE_FormField
- each non-abstract class should implement _getXMLData()
XML Format
Each _getXMLData() should return a string that looks like <field type='XXX'>YYYY<field> where XXX is the form field type such as MAP, STRING, DATE_YMD, etc and YYY is as defined below
I2CE_FormField_BINARY_FILE
I2CE_FormField_DB_BLOB
I2CE_FormField_DOCUMENT
I2CE_FormField_IMAGE
I2CE_FormField_ASSOC_FLOAT
Same as ASSOC_INT but with type='ASSOC_FLOAT'
I2CE_FormField_ASSOC_INT
<field type='ASSOC_INT'><value key='$key0' >$value[$key0]<value>...<value key='$keyn'>$value[$keyn]</value></field> where key0...keyn runs through the array keys
I2CE_FormField_ASSOC_LIST
<field type='ASSOC_INT'><value key='$key0' >$string_value[$key0]<value>...<value key='$keyn'>$string_value[$keyn]</value></field> where key0...keyn runs through the array keys. Here $string_value should follow the same rules is as in #I2CE_FormField_STRING_LINE adding in the attribute encode='base64' as needed
I2CE_FormField_ASSOC_PERCENT
Same as ASSOC_INT but with type='ASSOC_PERCENT'
I2CE_FormField_BOOL
I2CE_FormField_DATE_HMS
I2CE_FormField_DATE_MD
I2CE_FormField_DATE_TIME
I2CE_FormField_DATE_Y
I2CE_FormField_DATE_YMD
I2CE_FormField_INT
<field type='INT'>$value</field>
I2CE_FormField_INT_GENERATE
I2CE_FormField_INT_LIST
<field type='INT_LIST'><value>$value[0]<value>...<value>$value[n]</value></field> where 0...n runs through the array keys
I2CE_FormField_INT_RANGE
I2CE_FormField_STRING_LINE
<field type='STRING'>YYYY</field> where YYYY is:
- If the string is less than 1000 characters
- If the string does not contain a "<" character, then YYYY = <value>$value</value>
- If the string contains as "<", then follow the rules for >= 1000 characters
- If the string is >= 1000 characters:
- If the $value contains CDATA a string, then YYYY= <value encoding='base64'>base64($value)</value>
- If the $value does not contains "CDATA" then YYYY= <value><![CDATA[$value]]><value>
I2CE_FormField_STRING_MLINE
same as STRING_LINE but with the type='STRING_MLINE'
I2CE_FormField_STRING_PASS
I2CE_FormField_STRING_TEXT
same as STRING_LINE but with the type='STRING_TEXT'
I2CE_FormField_TOGGLE
same as YESNO but with the type='TOGGLE'
I2CE_FormField_YESNO
- if $value == 1 then <field type='YESNO'>1</value>
- otherwise<field type='YESNO'>0</value>
I2CE_FormField_PERCENT_INT
I2CE_FormField_DB_FLOAT
I2CE_FormField_FLOAT
I2CE_FormField_PERCENT
I2CE_FormField_MAP
<field type='MAP'><value form='$form'>$id</value></field>
I2CE_FormField_MAP_LINE
I2CE_FormField_MAP_MULT
<field type='MAP'><value form='$form0'>$id1</value>...<value form='$formN'>$idN</value></field>