Class: I2CE FormStorage: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
This article desrcibes the class '''I2CE_FormStorage''' | This article desrcibes the class '''I2CE_FormStorage'''. | ||
*Extends the class: [[Class: I2CE_Module | I2CE_Module]]. | |||
It is contained in the module [[iHRIS Module List#forms-storage|forms-storage]] in the package [https://launchpad.net/i2ce I2CE] | It is contained in the module [[iHRIS Module List#forms-storage|forms-storage]] in the package [https://launchpad.net/i2ce I2CE] | ||
Line 27: | Line 28: | ||
@param I2CE_User I2CE_User The user saving this data. | @param I2CE_User I2CE_User The user saving this data. | ||
*Signature: public function FF_IG_save($form_field,$do_check,$user) | *Signature: public function FF_IG_save($form_field,$do_check,$user) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
*$form_field | *$form_field | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $do_check<br/>A flag to determine if a check should be made for the same value being saved. | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $do_check<br/>A flag to determine if a check should be made for the same value being saved. | ||
*$user | *$user | ||
===FF_IG_setSequence()=== | ===FF_IG_setSequence()=== | ||
Line 41: | Line 42: | ||
@param I2CE_User I2CE_User The user saving this data. | @param I2CE_User I2CE_User The user saving this data. | ||
*Signature: public function FF_SP_save($form_field,$do_check,$user) | *Signature: public function FF_SP_save($form_field,$do_check,$user) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_FormField_STRING_PASS | I2CE_FormField_STRING_PASS]] $form_field | * [[Class: I2CE_FormField_STRING_PASS | I2CE_FormField_STRING_PASS]] $form_field | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $do_check<br/>A flag to determine if a check should be made for the same value being saved. | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $do_check<br/>A flag to determine if a check should be made for the same value being saved. | ||
*$user | *$user | ||
===FF_populateHistory()=== | ===FF_populateHistory()=== | ||
Populate the history of entries for the form field if the storage module handles history. | Populate the history of entries for the form field if the storage module handles history. | ||
*Signature: public function FF_populateHistory($form_field) | *Signature: public function FF_populateHistory($form_field) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_FormField | I2CE_FormField]] $form_field | * [[Class: I2CE_FormField | I2CE_FormField]] $form_field | ||
Line 56: | Line 57: | ||
@param I2CE_User I2CE_User The user saving this data. | @param I2CE_User I2CE_User The user saving this data. | ||
*Signature: public function FF_save($form_field,$do_check,$user) | *Signature: public function FF_save($form_field,$do_check,$user) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_FormField | I2CE_FormField]] $form_field | * [[Class: I2CE_FormField | I2CE_FormField]] $form_field | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $do_check<br/>A flag to determine if a check should be made for the same value being saved. | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $do_check<br/>A flag to determine if a check should be made for the same value being saved. | ||
*$user | *$user | ||
===addChild()=== | ===addChild()=== | ||
Line 67: | Line 68: | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_Form | I2CE_Form]] $form | * [[Class: I2CE_Form | I2CE_Form]] $form | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form_name<br/>: The form name to add | * [http://www.php.net/manual/en/language.types.string.php string ] $form_name<br/>: The form name to add | ||
*$id | *$id | ||
===delete()=== | ===delete()=== | ||
Line 73: | Line 74: | ||
table. default: false | table. default: false | ||
*Signature: public function delete($form,$transact,$complete,$no_history) | *Signature: public function delete($form,$transact,$complete,$no_history) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_Form | I2CE_Form]] $form | * [[Class: I2CE_Form | I2CE_Form]] $form | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $transact<br/>a flag to use transactions or not. default: true | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $transact<br/>a flag to use transactions or not. default: true | ||
**Default Value: true | **Default Value: true | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $complete<br/>a flag to determine if a complete delete should happen. default: false | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $complete<br/>a flag to determine if a complete delete should happen. default: false | ||
**Default Value: false | **Default Value: false | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $no_history<br/>a flag to determine if the record should not go to the deleted_records | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $no_history<br/>a flag to determine if the record should not go to the deleted_records | ||
**Default Value: false | **Default Value: false | ||
===getChildIds()=== | ===getChildIds()=== | ||
Line 86: | Line 87: | ||
If it is as an array of two integers, it is the offset and then number of results to limit to. | If it is as an array of two integers, it is the offset and then number of results to limit to. | ||
*Signature: public function getChildIds($form,$child_form_name,$order_by,$where,$limit) | *Signature: public function getChildIds($form,$child_form_name,$order_by,$where,$limit) | ||
*Returns: [http://www.php.net/manual/en/language.types.array.php array] | *Returns: [http://www.php.net/manual/en/language.types.array.php array ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_Form | I2CE_Form]] $form | * [[Class: I2CE_Form | I2CE_Form]] $form | ||
* [http://www.php.net/manual/en/language.types.string.php string] $child_form_name<br/>the child form name | * [http://www.php.net/manual/en/language.types.string.php string ] $child_form_name<br/>the child form name | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $order_by<br/>A string or array of strings. The fields to oreder by . defaults to empty array. | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $order_by<br/>A string or array of strings. The fields to oreder by . defaults to empty array. | ||
**Default Value: array() | **Default Value: array() | ||
*$where | *$where | ||
**Default Value: array() | **Default Value: array() | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $limit<br/>Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $limit<br/>Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. | ||
**Default Value: false | **Default Value: false | ||
===getComponentizedForms()=== | ===getComponentizedForms()=== | ||
static function which gets a list of all componentized forms | static function which gets a list of all componentized forms | ||
*Signature: static public function getComponentizedForms($use_cache) | *Signature: static public function getComponentizedForms($use_cache) | ||
*Returns: [http://www.php.net/manual/en/language.types.array.php array] of string, the componentized forms | *Returns: [http://www.php.net/manual/en/language.types.array.php array ] of string, the componentized forms | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $use_cache<br/>Use the cached value of the list for componentized forms if possible. Defualts to true | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $use_cache<br/>Use the cached value of the list for componentized forms if possible. Defualts to true | ||
**Default Value: true | **Default Value: true | ||
===getHooks()=== | ===getHooks()=== | ||
Line 110: | Line 111: | ||
*Returns: [[Class: I2CE_FormStorage_Mechanism | I2CE_FormStorage_Mechanism]] or false on failure | *Returns: [[Class: I2CE_FormStorage_Mechanism | I2CE_FormStorage_Mechanism]] or false on failure | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $storage | * [http://www.php.net/manual/en/language.types.string.php string ] $storage | ||
===getMethods()=== | ===getMethods()=== | ||
*Signature: static public function getMethods() | *Signature: static public function getMethods() | ||
Line 116: | Line 117: | ||
Get the new value for a field that has been migrated. | Get the new value for a field that has been migrated. | ||
*Signature: static public function getMigratedValue($migrate_node,$form,$old_id,$field,$map_form) | *Signature: static public function getMigratedValue($migrate_node,$form,$old_id,$field,$map_form) | ||
*Returns: [http://www.php.net/manual/en/language.types.string.php string] | *Returns: [http://www.php.net/manual/en/language.types.string.php string ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $migrate_node | * [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $migrate_node | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form | * [http://www.php.net/manual/en/language.types.string.php string ] $form | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $old_id | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $old_id | ||
* [http://www.php.net/manual/en/language.types.string.php string] $field | * [http://www.php.net/manual/en/language.types.string.php string ] $field | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $map_form | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $map_form | ||
===getNewMigratedValue()=== | ===getNewMigratedValue()=== | ||
Get the new migrated value for from the old value. | Get the new migrated value for from the old value. | ||
@param mixed $old_id | @param mixed $old_id | ||
*Signature: static public function getNewMigratedValue($migrate_node,$map_form,$old_value,$old_amt) | *Signature: static public function getNewMigratedValue($migrate_node,$map_form,$old_value,$old_amt) | ||
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed] | *Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $migrate_node | * [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $migrate_node | ||
* [http://www.php.net/manual/en/language.types.string.php string] $map_form | * [http://www.php.net/manual/en/language.types.string.php string ] $map_form | ||
*$old_value | *$old_value | ||
* integer $old_amt<br/>For currency data this is the amount | * integer $old_amt<br/>For currency data this is the amount | ||
Line 137: | Line 138: | ||
Get the old value for a field that has been migrated. | Get the old value for a field that has been migrated. | ||
*Signature: static public function getOldMigratedValue($migrate_node,$form,$old_id,$field,$map_form) | *Signature: static public function getOldMigratedValue($migrate_node,$form,$old_id,$field,$map_form) | ||
*Returns: [http://www.php.net/manual/en/language.types.array.php array] array( 'map_form', 'old_value' ); | *Returns: [http://www.php.net/manual/en/language.types.array.php array ] array( 'map_form', 'old_value' ); | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $migrate_node | * [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $migrate_node | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form | * [http://www.php.net/manual/en/language.types.string.php string ] $form | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $old_id | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $old_id | ||
* [http://www.php.net/manual/en/language.types.string.php string] $field | * [http://www.php.net/manual/en/language.types.string.php string ] $field | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $map_form | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $map_form | ||
===getRecords()=== | ===getRecords()=== | ||
Return an array of all the record ids for a given form. | Return an array of all the record ids for a given form. | ||
*Signature: public function getRecords($factory,$form_name) | *Signature: public function getRecords($factory,$form_name) | ||
*Returns: [http://www.php.net/manual/en/language.types.array.php array] | *Returns: [http://www.php.net/manual/en/language.types.array.php array ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_FormFactory | I2CE_FormFactory]] $factory | * [[Class: I2CE_FormFactory | I2CE_FormFactory]] $factory | ||
Line 154: | Line 155: | ||
Return the storage class for the given form. | Return the storage class for the given form. | ||
*Signature: static public function getStorage($form_name,$no_cache) | *Signature: static public function getStorage($form_name,$no_cache) | ||
*Returns: [http://www.php.net/manual/en/language.types.string.php string] | *Returns: [http://www.php.net/manual/en/language.types.string.php string ] | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form_name | * [http://www.php.net/manual/en/language.types.string.php string ] $form_name | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $no_cache<br/>Check from the source, not the cached array | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $no_cache<br/>Check from the source, not the cached array | ||
**Default Value: false | **Default Value: false | ||
===getStorageMechanism()=== | ===getStorageMechanism()=== | ||
Line 163: | Line 164: | ||
*Returns: [[Class: I2CE_FormStorage_Mechanism | I2CE_FormStorage_Mechanism]] or false on failure | *Returns: [[Class: I2CE_FormStorage_Mechanism | I2CE_FormStorage_Mechanism]] or false on failure | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form_name | * [http://www.php.net/manual/en/language.types.string.php string ] $form_name | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $no_cache<br/>Check from the source, not the cached array | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $no_cache<br/>Check from the source, not the cached array | ||
**Default Value: false | **Default Value: false | ||
===isComponentized()=== | ===isComponentized()=== | ||
static function to determine if a form is componentized | static function to determine if a form is componentized | ||
*Signature: static public function isComponentized($form) | *Signature: static public function isComponentized($form) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form | * [http://www.php.net/manual/en/language.types.string.php string ] $form | ||
===isComponentizedForm()=== | ===isComponentizedForm()=== | ||
Fuzzy method to check if a form instance is componentized | Fuzzy method to check if a form instance is componentized | ||
*Signature: public function isComponentizedForm($formClass) | *Signature: public function isComponentizedForm($formClass) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_Form | I2CE_Form]] $formClass | * [[Class: I2CE_Form | I2CE_Form]] $formClass | ||
Line 182: | Line 183: | ||
*Signature: static public function isWritable($form) | *Signature: static public function isWritable($form) | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $form<br/>string, I2CE_Form or I2CE_FormField | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $form<br/>string, I2CE_Form or I2CE_FormField | ||
===listDisplayFields()=== | ===listDisplayFields()=== | ||
Lists the display values for a field | Lists the display values for a field | ||
Line 189: | Line 190: | ||
time greater than or equal to $mod_time. If the form storage has no way of tracking modifucation time, all entries are listed. | time greater than or equal to $mod_time. If the form storage has no way of tracking modifucation time, all entries are listed. | ||
*Signature: static public function listDisplayFields($form,$fields,$parent,$where_data,$ordering,$limit,$mod_time) | *Signature: static public function listDisplayFields($form,$fields,$parent,$where_data,$ordering,$limit,$mod_time) | ||
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed] an array with key id's and value and array of values. the array of values has as keys the fields with their corresponding value. | *Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ] an array with key id's and value and array of values. the array of values has as keys the fields with their corresponding value. | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form<br/>The form name | * [http://www.php.net/manual/en/language.types.string.php string ] $form<br/>The form name | ||
* [http://www.php.net/manual/en/language.types.array.php array] $fields<br/>of string. The fields we want returned | * [http://www.php.net/manual/en/language.types.array.php array ] $fields<br/>of string. The fields we want returned | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $parent<br/>Defaults to false. If it is scalar and non-boolean, it is consider to be the ID of the parent, | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $parent<br/>Defaults to false. If it is scalar and non-boolean, it is consider to be the ID of the parent, | ||
**Default Value: false | **Default Value: false | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $where_data<br/>Either I2CE_MagicDataNode or array. contains the where clause information about this form or a nested | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $where_data<br/>Either I2CE_MagicDataNode or array. contains the where clause information about this form or a nested | ||
**Default Value: array() | **Default Value: array() | ||
* [http://www.php.net/manual/en/language.types.array.php array] $ordering<br/>An array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order. | * [http://www.php.net/manual/en/language.types.array.php array ] $ordering<br/>An array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order. | ||
**Default Value: array() | **Default Value: array() | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $limit<br/>Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $limit<br/>Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. | ||
**Default Value: false | **Default Value: false | ||
* integer $mod_time<br/>Defaults to -1. If non-negative, we only list the requested fields for an id if at least one of them has a modification | * integer $mod_time<br/>Defaults to -1. If non-negative, we only list the requested fields for an id if at least one of them has a modification | ||
Line 208: | Line 209: | ||
time greater than or equal to $mod_time. If the form storage has no way of tracking modifucation time, all entries are listed. | time greater than or equal to $mod_time. If the form storage has no way of tracking modifucation time, all entries are listed. | ||
*Signature: static public function listFields($form,$fields,$parent,$where_data,$ordering,$limit,$mod_time) | *Signature: static public function listFields($form,$fields,$parent,$where_data,$ordering,$limit,$mod_time) | ||
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed] an array with key id's and value and array of values. the array of values has as keys the fields with their corresponding value. | *Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ] an array with key id's and value and array of values. the array of values has as keys the fields with their corresponding value. | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form<br/>The form name | * [http://www.php.net/manual/en/language.types.string.php string ] $form<br/>The form name | ||
* [http://www.php.net/manual/en/language.types.array.php array] $fields<br/>of string. The fields we want returned | * [http://www.php.net/manual/en/language.types.array.php array ] $fields<br/>of string. The fields we want returned | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $parent<br/>Defaults to false. If it is scalar and non-boolean, it is consider to be the ID of the parent, | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $parent<br/>Defaults to false. If it is scalar and non-boolean, it is consider to be the ID of the parent, | ||
**Default Value: false | **Default Value: false | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $where_data<br/>Either I2CE_MagicDataNode or array. contains the where clause information about this form or a nested | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $where_data<br/>Either I2CE_MagicDataNode or array. contains the where clause information about this form or a nested | ||
**Default Value: array() | **Default Value: array() | ||
* [http://www.php.net/manual/en/language.types.array.php array] $ordering<br/>An array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order. | * [http://www.php.net/manual/en/language.types.array.php array ] $ordering<br/>An array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order. | ||
**Default Value: array() | **Default Value: array() | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $limit<br/>Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $limit<br/>Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. | ||
**Default Value: false | **Default Value: false | ||
* integer $mod_time<br/>Defaults to -1. If non-negative, we only list the requested fields for an id if at least one of them has a modification | * integer $mod_time<br/>Defaults to -1. If non-negative, we only list the requested fields for an id if at least one of them has a modification | ||
Line 229: | Line 230: | ||
than one. If false , then we return as an array. Defaults to '-' | than one. If false , then we return as an array. Defaults to '-' | ||
*Signature: static public function lookupDisplayField($form,$id,$fields,$delim) | *Signature: static public function lookupDisplayField($form,$id,$fields,$delim) | ||
*Returns: [http://www.php.net/manual/en/language.types.string.php string] or false on failure | *Returns: [http://www.php.net/manual/en/language.types.string.php string ] or false on failure | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form<br/>The name of the form in the database. | * [http://www.php.net/manual/en/language.types.string.php string ] $form<br/>The name of the form in the database. | ||
* integer $id<br/>The code of the entry to lookup. | * integer $id<br/>The code of the entry to lookup. | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $fields<br/>A field or an array of fields to look up and return. Defaults to 'name' | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $fields<br/>A field or an array of fields to look up and return. Defaults to 'name' | ||
**Default Value: array('name') | **Default Value: array('name') | ||
* [http://www.php.net/manual/en/language.types.string.php string] $delim<br/>The delimiter to put between returned fields if there are more | * [http://www.php.net/manual/en/language.types.string.php string ] $delim<br/>The delimiter to put between returned fields if there are more | ||
**Default Value: '-' | **Default Value: '-' | ||
===lookupField()=== | ===lookupField()=== | ||
Line 244: | Line 245: | ||
than one. If false , then we return as an array. Defaults to '-' | than one. If false , then we return as an array. Defaults to '-' | ||
*Signature: static public function lookupField($form,$id,$fields,$delim) | *Signature: static public function lookupField($form,$id,$fields,$delim) | ||
*Returns: [http://www.php.net/manual/en/language.types.string.php string] or false on failure | *Returns: [http://www.php.net/manual/en/language.types.string.php string ] or false on failure | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form<br/>The name of the form in the database. | * [http://www.php.net/manual/en/language.types.string.php string ] $form<br/>The name of the form in the database. | ||
* integer $id<br/>The code of the entry to lookup. | * integer $id<br/>The code of the entry to lookup. | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $fields<br/>A field or an array of fields to look up and return. Defaults to 'name' | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $fields<br/>A field or an array of fields to look up and return. Defaults to 'name' | ||
**Default Value: array('name') | **Default Value: array('name') | ||
* [http://www.php.net/manual/en/language.types.string.php string] $delim<br/>The delimiter to put between returned fields if there are more | * [http://www.php.net/manual/en/language.types.string.php string ] $delim<br/>The delimiter to put between returned fields if there are more | ||
**Default Value: '-' | **Default Value: '-' | ||
===migrateField()=== | ===migrateField()=== | ||
Line 260: | Line 261: | ||
for when the field name was changed. | for when the field name was changed. | ||
*Signature: static public function migrateField($form_name,$field_list,$migrate_path,$user) | *Signature: static public function migrateField($form_name,$field_list,$migrate_path,$user) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form_name | * [http://www.php.net/manual/en/language.types.string.php string ] $form_name | ||
* [http://www.php.net/manual/en/language.types.array.php array] $field_list<br/>The list of fields that need to be changed as an array of field => map_form. | * [http://www.php.net/manual/en/language.types.array.php array ] $field_list<br/>The list of fields that need to be changed as an array of field => map_form. | ||
* [http://www.php.net/manual/en/language.types.string.php string] $migrate_path<br/>Where the migrate data has been saved. | * [http://www.php.net/manual/en/language.types.string.php string ] $migrate_path<br/>Where the migrate data has been saved. | ||
* [[Class: I2CE_User | I2CE_User]] $user<br/>The user to save the new form field. | * [[Class: I2CE_User | I2CE_User]] $user<br/>The user to save the new form field. | ||
===migrateForm()=== | ===migrateForm()=== | ||
Line 274: | Line 275: | ||
so the data can be retrieved from there. | so the data can be retrieved from there. | ||
*Signature: static public function migrateForm($form_name,$storage,$user,$migrate_path,$id_field,$skip_fields,$migrate_fields,$callback) | *Signature: static public function migrateForm($form_name,$storage,$user,$migrate_path,$id_field,$skip_fields,$migrate_fields,$callback) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form_name | * [http://www.php.net/manual/en/language.types.string.php string ] $form_name | ||
* [http://www.php.net/manual/en/language.types.string.php string] $storage<br/>The old storage mechanism | * [http://www.php.net/manual/en/language.types.string.php string ] $storage<br/>The old storage mechanism | ||
* [[Class: I2CE_User | I2CE_User]] $user<br/>The user object to use to save the new forms. | * [[Class: I2CE_User | I2CE_User]] $user<br/>The user object to use to save the new forms. | ||
* [http://www.php.net/manual/en/language.types.string.php string] $migrate_path<br/>The full path in MagicData to save the old to new mappings. | * [http://www.php.net/manual/en/language.types.string.php string ] $migrate_path<br/>The full path in MagicData to save the old to new mappings. | ||
**Default Value: false | **Default Value: false | ||
* [http://www.php.net/manual/en/language.types.string.php string] $id_field<br/>The old field name to use the value of for the new form id. | * [http://www.php.net/manual/en/language.types.string.php string ] $id_field<br/>The old field name to use the value of for the new form id. | ||
**Default Value: false | **Default Value: false | ||
* [http://www.php.net/manual/en/language.types.array.php array] $skip_fields<br/>A list of fields to not migrate to the new form. | * [http://www.php.net/manual/en/language.types.array.php array ] $skip_fields<br/>A list of fields to not migrate to the new form. | ||
**Default Value: array() | **Default Value: array() | ||
* [http://www.php.net/manual/en/language.types.array.php array] $migrate_fields<br/>A list of fields that have already been migrated and need to use | * [http://www.php.net/manual/en/language.types.array.php array ] $migrate_fields<br/>A list of fields that have already been migrated and need to use | ||
**Default Value: array() | **Default Value: array() | ||
*$callback | *$callback | ||
Line 303: | Line 304: | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_Form | I2CE_Form]] $form | * [[Class: I2CE_Form | I2CE_Form]] $form | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form_name<br/>: The form name to populate | * [http://www.php.net/manual/en/language.types.string.php string ] $form_name<br/>: The form name to populate | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $order_by<br/>A field or array of fields to sort by. Preceded by "-" to sort in reverse order. | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $order_by<br/>A field or array of fields to sort by. Preceded by "-" to sort in reverse order. | ||
**Default Value: null | **Default Value: null | ||
*$where | *$where | ||
**Default Value: null | **Default Value: null | ||
* [http://www.php.net/manual/en/language.types.string.php string] $type<br/>Defaults to 'default' | * [http://www.php.net/manual/en/language.types.string.php string ] $type<br/>Defaults to 'default' | ||
**Default Value: 'default' | **Default Value: 'default' | ||
===populateChildren()=== | ===populateChildren()=== | ||
Line 318: | Line 319: | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_Form | I2CE_Form]] $form | * [[Class: I2CE_Form | I2CE_Form]] $form | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $forms<br/>A string or an array such, the form names (the child forms to populate) | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $forms<br/>A string or an array such, the form names (the child forms to populate) | ||
* [http://www.php.net/manual/en/language.types.array.php array] $orderBy<br/>An associative array of form names with an array of either string, field to sort by or an array of the fields | * [http://www.php.net/manual/en/language.types.array.php array ] $orderBy<br/>An associative array of form names with an array of either string, field to sort by or an array of the fields | ||
**Default Value: array() | **Default Value: array() | ||
===populateFirst()=== | ===populateFirst()=== | ||
Line 326: | Line 327: | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_Form | I2CE_Form]] $form | * [[Class: I2CE_Form | I2CE_Form]] $form | ||
* [http://www.php.net/manual/en/language.types.array.php array] $forms<br/>an associative array with keys form names and values field names or ordering array | * [http://www.php.net/manual/en/language.types.array.php array ] $forms<br/>an associative array with keys form names and values field names or ordering array | ||
**Default Value: array() | **Default Value: array() | ||
===populateHistory()=== | ===populateHistory()=== | ||
Line 338: | Line 339: | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_Form | I2CE_Form]] $form | * [[Class: I2CE_Form | I2CE_Form]] $form | ||
* [http://www.php.net/manual/en/language.types.array.php array] $forms<br/>an associative array with keys form names and values field names or ordering array | * [http://www.php.net/manual/en/language.types.array.php array ] $forms<br/>an associative array with keys form names and values field names or ordering array | ||
**Default Value: array() | **Default Value: array() | ||
===save()=== | ===save()=== | ||
Line 346: | Line 347: | ||
* [[Class: I2CE_Form | I2CE_Form]] $form | * [[Class: I2CE_Form | I2CE_Form]] $form | ||
* [[Class: I2CE_User | I2CE_User]] $user | * [[Class: I2CE_User | I2CE_User]] $user | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $transact<br/>Defaults to true. | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $transact<br/>Defaults to true. | ||
**Default Value: true | **Default Value: true | ||
===search()=== | ===search()=== | ||
Line 352: | Line 353: | ||
If it is as an array of two integers, it is the offset and then number of results to limit to. | If it is as an array of two integers, it is the offset and then number of results to limit to. | ||
*Signature: static public function search($form,$parent,$where_data,$ordering,$limit) | *Signature: static public function search($form,$parent,$where_data,$ordering,$limit) | ||
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed] an array of matching form ids. However, ff $limit_one is true or 1 or | *Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ] an array of matching form ids. However, ff $limit_one is true or 1 or | ||
array ($offset,1) then then we return either the id or false, if none found or there was an error. | array ($offset,1) then then we return either the id or false, if none found or there was an error. | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $form<br/>The form name. | * [http://www.php.net/manual/en/language.types.string.php string ] $form<br/>The form name. | ||
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $parent<br/>Defaults to false. If it is scalar and non-boolean, it is consider to be the ID of the parent, | * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $parent<br/>Defaults to false. If it is scalar and non-boolean, it is consider to be the ID of the parent, | ||
**Default Value: false | **Default Value: false | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $where_data<br/>array or class implementing ArrayAccess, Iterator, and Countable (e.g. MagicDataNode) . the where data. | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $where_data<br/>array or class implementing ArrayAccess, Iterator, and Countable (e.g. MagicDataNode) . the where data. | ||
**Default Value: array() | **Default Value: array() | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $ordering<br/>An field or an array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order. | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $ordering<br/>An field or an array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order. | ||
**Default Value: array() | **Default Value: array() | ||
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $limit<br/>Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. | * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $limit<br/>Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. | ||
**Default Value: false | **Default Value: false | ||
===setChangeType()=== | ===setChangeType()=== | ||
Line 372: | Line 373: | ||
* integer $change_type<br/>: the change type to set Defautls to I2CE_FormStorage::CHANGE_UPDATE | * integer $change_type<br/>: the change type to set Defautls to I2CE_FormStorage::CHANGE_UPDATE | ||
**Default Value: I2CE_FormStorage_Mechanism::CHANGE_UPDATE | **Default Value: I2CE_FormStorage_Mechanism::CHANGE_UPDATE | ||
* [http://www.php.net/manual/en/language.types.string.php string] $field<br/>Defaults to 'default'. optional field name to set the change type to. | * [http://www.php.net/manual/en/language.types.string.php string ] $field<br/>Defaults to 'default'. optional field name to set the change type to. | ||
**Default Value: 'default' | **Default Value: 'default' | ||
===storeMigrateData()=== | ===storeMigrateData()=== | ||
Line 380: | Line 381: | ||
*Signature: static public function storeMigrateData($forms,$migrate_path) | *Signature: static public function storeMigrateData($forms,$migrate_path) | ||
Parameters: | Parameters: | ||
* [http://www.php.net/manual/en/language.types.array.php array] $forms<br/>An array of forms with an array of fields for each: | * [http://www.php.net/manual/en/language.types.array.php array ] $forms<br/>An array of forms with an array of fields for each: | ||
* [http://www.php.net/manual/en/language.types.string.php string] $migrate_path<br/>The path in magic data to save the data | * [http://www.php.net/manual/en/language.types.string.php string ] $migrate_path<br/>The path in magic data to save the data | ||
===validate_formfield()=== | ===validate_formfield()=== | ||
Hooked Function to check if a field is unique or unique restricted to a certain field | Hooked Function to check if a field is unique or unique restricted to a certain field | ||
*Signature: public function validate_formfield($field_obj) | *Signature: public function validate_formfield($field_obj) | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
Parameters: | Parameters: | ||
* [[Class: I2CE_FormField | I2CE_FormField]] $field_obj | * [[Class: I2CE_FormField | I2CE_FormField]] $field_obj |
Revision as of 22:26, 16 October 2009
This article desrcibes the class I2CE_FormStorage.
- Extends the class: I2CE_Module.
It is contained in the module forms-storage in the package I2CE
The class is defined in the file: modules/Forms/modules/FormStorage/lib/I2CE_FormStorage.php
I2CE_Module_FormStorage @subpackage Core
- Author: Carl Leitner <litlfred@ibiblio.org>
- Since: 3.2
Variables
$componentized_forms
A cached list of componentized forms. of string, the form names
- Type: static protected y $componentized_forms
$storage
An array with a cache of the storage type for a form.
- Type: static protected y $storage
$storageMechs
An array with a cache of the storage mechanisms
- Type: static protected y $storageMechs
Methods
FF_IG_save()
Save the FormField to the database. @param I2CE_User I2CE_User The user saving this data.
- Signature: public function FF_IG_save($form_field,$do_check,$user)
- Returns: boolean
Parameters:
- $form_field
- boolean $do_check
A flag to determine if a check should be made for the same value being saved. - $user
FF_IG_setSequence()
Set the value of this field to the next sequence for the form field.
- Signature: public function FF_IG_setSequence($form_field)
Parameters:
- I2CE_FormField_INT_GENERATE $form_field
FF_SP_save()
Save the FormField_STRING_PASS to the database. @param I2CE_User I2CE_User The user saving this data.
- Signature: public function FF_SP_save($form_field,$do_check,$user)
- Returns: boolean
Parameters:
- I2CE_FormField_STRING_PASS $form_field
- boolean $do_check
A flag to determine if a check should be made for the same value being saved. - $user
FF_populateHistory()
Populate the history of entries for the form field if the storage module handles history.
- Signature: public function FF_populateHistory($form_field)
- Returns: boolean
Parameters:
- I2CE_FormField $form_field
FF_save()
Save the FormField to the database. @param I2CE_User I2CE_User The user saving this data.
- Signature: public function FF_save($form_field,$do_check,$user)
- Returns: boolean
Parameters:
- I2CE_FormField $form_field
- boolean $do_check
A flag to determine if a check should be made for the same value being saved. - $user
addChild()
add the given child to the form for this object. @param string the id of this form
- Signature: public function addChild($form,$form_name,$id)
Parameters:
delete()
Delete a form object. table. default: false
- Signature: public function delete($form,$transact,$complete,$no_history)
- Returns: boolean
Parameters:
- I2CE_Form $form
- boolean $transact
a flag to use transactions or not. default: true- Default Value: true
- boolean $complete
a flag to determine if a complete delete should happen. default: false- Default Value: false
- boolean $no_history
a flag to determine if the record should not go to the deleted_records- Default Value: false
getChildIds()
Gets the id's for the given child for this form. If it is as an array of two integers, it is the offset and then number of results to limit to.
- Signature: public function getChildIds($form,$child_form_name,$order_by,$where,$limit)
- Returns: array
Parameters:
- I2CE_Form $form
- string $child_form_name
the child form name - mixed $order_by
A string or array of strings. The fields to oreder by . defaults to empty array.- Default Value: array()
- $where
- Default Value: array()
- mixed $limit
Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to.- Default Value: false
getComponentizedForms()
static function which gets a list of all componentized forms
- Signature: static public function getComponentizedForms($use_cache)
- Returns: array of string, the componentized forms
Parameters:
- boolean $use_cache
Use the cached value of the list for componentized forms if possible. Defualts to true- Default Value: true
getHooks()
- Signature: static public function getHooks()
getMechanismByStorage()
Returns the storage mechanism for the given storage type.
- Signature: static public function getMechanismByStorage($storage)
- Returns: I2CE_FormStorage_Mechanism or false on failure
Parameters:
- string $storage
getMethods()
- Signature: static public function getMethods()
getMigratedValue()
Get the new value for a field that has been migrated.
- Signature: static public function getMigratedValue($migrate_node,$form,$old_id,$field,$map_form)
- Returns: string
Parameters:
- I2CE_MagicDataNode $migrate_node
- string $form
- mixed $old_id
- string $field
- mixed $map_form
getNewMigratedValue()
Get the new migrated value for from the old value. @param mixed $old_id
- Signature: static public function getNewMigratedValue($migrate_node,$map_form,$old_value,$old_amt)
- Returns: mixed
Parameters:
- I2CE_MagicDataNode $migrate_node
- string $map_form
- $old_value
- integer $old_amt
For currency data this is the amount- Default Value: 0
getOldMigratedValue()
Get the old value for a field that has been migrated.
- Signature: static public function getOldMigratedValue($migrate_node,$form,$old_id,$field,$map_form)
- Returns: array array( 'map_form', 'old_value' );
Parameters:
- I2CE_MagicDataNode $migrate_node
- string $form
- mixed $old_id
- string $field
- mixed $map_form
getRecords()
Return an array of all the record ids for a given form.
- Signature: public function getRecords($factory,$form_name)
- Returns: array
Parameters:
- I2CE_FormFactory $factory
- $form_name
getStorage()
Return the storage class for the given form.
- Signature: static public function getStorage($form_name,$no_cache)
- Returns: string
Parameters:
getStorageMechanism()
- Signature: static public function getStorageMechanism($form_name,$no_cache)
- Returns: I2CE_FormStorage_Mechanism or false on failure
Parameters:
isComponentized()
static function to determine if a form is componentized
- Signature: static public function isComponentized($form)
- Returns: boolean
Parameters:
- string $form
isComponentizedForm()
Fuzzy method to check if a form instance is componentized
- Signature: public function isComponentizedForm($formClass)
- Returns: boolean
Parameters:
- I2CE_Form $formClass
isWritable()
Check to see if this form is considered to be writable.
- Signature: static public function isWritable($form)
Parameters:
- mixed $form
string, I2CE_Form or I2CE_FormField
listDisplayFields()
Lists the display values for a field and then we get all forms with parent the given id. If it is as an array of two integers, it is the offset and then number of results to limit to. time greater than or equal to $mod_time. If the form storage has no way of tracking modifucation time, all entries are listed.
- Signature: static public function listDisplayFields($form,$fields,$parent,$where_data,$ordering,$limit,$mod_time)
- Returns: mixed an array with key id's and value and array of values. the array of values has as keys the fields with their corresponding value.
Parameters:
- string $form
The form name - array $fields
of string. The fields we want returned - boolean $parent
Defaults to false. If it is scalar and non-boolean, it is consider to be the ID of the parent,- Default Value: false
- mixed $where_data
Either I2CE_MagicDataNode or array. contains the where clause information about this form or a nested- Default Value: array()
- array $ordering
An array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order.- Default Value: array()
- mixed $limit
Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to.- Default Value: false
- integer $mod_time
Defaults to -1. If non-negative, we only list the requested fields for an id if at least one of them has a modification- Default Value: -1
listFields()
and then we get all forms with parent the given id. If it is as an array of two integers, it is the offset and then number of results to limit to. time greater than or equal to $mod_time. If the form storage has no way of tracking modifucation time, all entries are listed.
- Signature: static public function listFields($form,$fields,$parent,$where_data,$ordering,$limit,$mod_time)
- Returns: mixed an array with key id's and value and array of values. the array of values has as keys the fields with their corresponding value.
Parameters:
- string $form
The form name - array $fields
of string. The fields we want returned - boolean $parent
Defaults to false. If it is scalar and non-boolean, it is consider to be the ID of the parent,- Default Value: false
- mixed $where_data
Either I2CE_MagicDataNode or array. contains the where clause information about this form or a nested- Default Value: array()
- array $ordering
An array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order.- Default Value: array()
- mixed $limit
Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to.- Default Value: false
- integer $mod_time
Defaults to -1. If non-negative, we only list the requested fields for an id if at least one of them has a modification- Default Value: -1
lookupDisplayField()
Looks up the display value of the item based on the code.
This is the default method that most implementations of {@link lookup()} use. It finds the description of the object based on the code and saves it in the {@link cache} and returns it. than one. If false , then we return as an array. Defaults to '-'
- Signature: static public function lookupDisplayField($form,$id,$fields,$delim)
- Returns: string or false on failure
Parameters:
- string $form
The name of the form in the database. - integer $id
The code of the entry to lookup. - mixed $fields
A field or an array of fields to look up and return. Defaults to 'name'- Default Value: array('name')
- string $delim
The delimiter to put between returned fields if there are more- Default Value: '-'
lookupField()
Looks up the dbvalue of the item based on the code.
This is the default method that most implementations of {@link lookup()} use. It finds the description of the object based on the code and saves it in the {@link cache} and returns it. than one. If false , then we return as an array. Defaults to '-'
- Signature: static public function lookupField($form,$id,$fields,$delim)
- Returns: string or false on failure
Parameters:
- string $form
The name of the form in the database. - integer $id
The code of the entry to lookup. - mixed $fields
A field or an array of fields to look up and return. Defaults to 'name'- Default Value: array('name')
- string $delim
The delimiter to put between returned fields if there are more- Default Value: '-'
migrateField()
Migrate field data from an old setMap reference to a new MAP form field type. The old data should have been saved in a migrate_data magic data (see {@link storeMigrateData}). Optionally the field list can be: array( "field" => array( "prev_field" => "prev_map_form" ) ) The field will get the old value from the list of fields (with mapped forms) for when the field name was changed.
- Signature: static public function migrateField($form_name,$field_list,$migrate_path,$user)
- Returns: boolean
Parameters:
- string $form_name
- array $field_list
The list of fields that need to be changed as an array of field => map_form. - string $migrate_path
Where the migrate data has been saved. - I2CE_User $user
The user to save the new form field.
migrateForm()
Migrate a given form from one storage method to the current storage method. This should only be used when upgrading a module that moved a form storage from one type to another. the migrate path to convert the data. Format is array( "field" => "map_form" ) These forms and fields should have already been passed to {@link storeMigrateData} so the data can be retrieved from there.
- Signature: static public function migrateForm($form_name,$storage,$user,$migrate_path,$id_field,$skip_fields,$migrate_fields,$callback)
- Returns: boolean
Parameters:
- string $form_name
- string $storage
The old storage mechanism - I2CE_User $user
The user object to use to save the new forms. - string $migrate_path
The full path in MagicData to save the old to new mappings.- Default Value: false
- string $id_field
The old field name to use the value of for the new form id.- Default Value: false
- array $skip_fields
A list of fields to not migrate to the new form.- Default Value: array()
- array $migrate_fields
A list of fields that have already been migrated and need to use- Default Value: array()
- $callback
- Default Value: null
populate()
Populate a form object.
- Signature: public function populate($form)
Parameters:
- I2CE_Form $form
populateChild()
Populate all instances of the given child form for this object. - array( "-start_date", "name" ). Defaults to null in which case if get the default sort order that is registered for the type (which defaults to none) @param mixed @where an aarray of where information to limit getting the child id's by. If null, we get the default limits for the type (which defaults to none)
- Signature: public function populateChild($form,$form_name,$order_by,$where,$type)
Parameters:
- I2CE_Form $form
- string $form_name
: The form name to populate - mixed $order_by
A field or array of fields to sort by. Preceded by "-" to sort in reverse order.- Default Value: null
- $where
- Default Value: null
- string $type
Defaults to 'default'- Default Value: 'default'
populateChildren()
Populate the given child form for this object. - array( "demographic", "contact" ) Defaults to empty array - array( "contact" => "contact_type" )
- Signature: public function populateChildren($form,$forms,$orderBy)
Parameters:
- I2CE_Form $form
- mixed $forms
A string or an array such, the form names (the child forms to populate) - array $orderBy
An associative array of form names with an array of either string, field to sort by or an array of the fields- Default Value: array()
populateFirst()
Populate the first child of a form object based on the given field
- Signature: public function populateFirst($form,$forms)
Parameters:
- I2CE_Form $form
- array $forms
an associative array with keys form names and values field names or ordering array- Default Value: array()
populateHistory()
Populate Last of a form object.
- Signature: public function populateHistory($form)
Parameters:
- I2CE_Form $form
populateLast()
Populate the last child of a form object based on the given field
- Signature: public function populateLast($form,$forms)
Parameters:
- I2CE_Form $form
- array $forms
an associative array with keys form names and values field names or ordering array- Default Value: array()
save()
Save a form object.
- Signature: public function save($form,$user,$transact)
Parameters:
search()
and then we get all forms with parent the given id. If it is as an array of two integers, it is the offset and then number of results to limit to.
- Signature: static public function search($form,$parent,$where_data,$ordering,$limit)
- Returns: mixed an array of matching form ids. However, ff $limit_one is true or 1 or
array ($offset,1) then then we return either the id or false, if none found or there was an error. Parameters:
- string $form
The form name. - boolean $parent
Defaults to false. If it is scalar and non-boolean, it is consider to be the ID of the parent,- Default Value: false
- mixed $where_data
array or class implementing ArrayAccess, Iterator, and Countable (e.g. MagicDataNode) . the where data.- Default Value: array()
- mixed $ordering
An field or an array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order.- Default Value: array()
- mixed $limit
Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to.- Default Value: false
setChangeType()
Set the change type for the given form. If this method isn't called then the change type will be I2CE_FormStorage::CHANGE_UPDATE
- Signature: public function setChangeType($form,$change_type,$field)
Parameters:
- I2CE_Form $form
- integer $change_type
: the change type to set Defautls to I2CE_FormStorage::CHANGE_UPDATE- Default Value: I2CE_FormStorage_Mechanism::CHANGE_UPDATE
- string $field
Defaults to 'default'. optional field name to set the change type to.- Default Value: 'default'
storeMigrateData()
Save the given fields to the given magic data node so it can later be referenced when migrating the form. array( "form_name" => array( "field1", "field2" ) );
- Signature: static public function storeMigrateData($forms,$migrate_path)
Parameters:
- array $forms
An array of forms with an array of fields for each: - string $migrate_path
The path in magic data to save the data
validate_formfield()
Hooked Function to check if a field is unique or unique restricted to a certain field
- Signature: public function validate_formfield($field_obj)
- Returns: boolean
Parameters:
- I2CE_FormField $field_obj
Inherited Fuzzy Methods
launchBackgroundProcess()
This method is inherited from I2CE_Module->launchBackgroundProcess()
launchBackgroundPHPScript()
This method is inherited from I2CE_Module->launchBackgroundPHPScript()
launchBackgroundPage()
This method is inherited from I2CE_Module->launchBackgroundPage()
userMessage()
This method is inherited from I2CE_Fuzzy->userMessage()