Class: I2CE FormStorage entry (Development): Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
 
Line 2: Line 2:
This article describes the class ''I2CE_FormStorage_entry'' .
This article describes the class ''I2CE_FormStorage_entry'' .
*Extends the class: [[Class: I2CE_FormStorage_DB (Development) | I2CE_FormStorage_DB]].
*Extends the class: [[Class: I2CE_FormStorage_DB (Development) | I2CE_FormStorage_DB]].
*Location: Part of the module [[I2CE Module List (Development)#forms-storage-entry|forms-storage-entry]] in the package [https://launchpad.net/i2ce I2CE] 4.0-dev
*Location: Part of the module [[I2CE Module List (Development)#forms-storage-entry|forms-storage-entry]] in the package [https://launchpad.net/i2ce I2CE] 4.1-dev
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L38 modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 38
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L38 modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 38
*Author: Carl Leitner <litlfred@ibiblio.org> / Luke Duncan <lduncan@intrahealth.org>
*Author: Carl Leitner <litlfred@ibiblio.org> / Luke Duncan <lduncan@intrahealth.org>
*Since: 3.2
*Since: 3.2
Line 10: Line 10:
===$prepared===
===$prepared===
A list of all prepared statements for working with entry data.
A list of all prepared statements for working with entry data.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L43 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 43
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L43 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 43
*Type: static protected [http://www.php.net/manual/en/language.types.array.php array ] $prepared
*Type: static protected [http://www.php.net/manual/en/language.types.array.php array ] $prepared
===$callback===
A list of all cached callback functions.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L48 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 48
*Type: static protected [http://www.php.net/manual/en/language.types.array.php array ] $callback


===$form_field_data_cache===
===$form_field_data_cache===
Keys are form names values are arrays with keys fields and values an array for the form field id and details
Keys are form names values are arrays with keys fields and values an array for the form field id and details
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L49 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 49
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L54 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 54
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $form_field_data_cache
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $form_field_data_cache


===$form_id_cache===
===$form_id_cache===
Keys are form names values are their id's
Keys are form names values are their id's
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L54 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 54
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L59 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 59
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $form_id_cache
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $form_id_cache


Line 26: Line 31:
===FF_IG_setSequence()===
===FF_IG_setSequence()===
Set the value of this field to the next sequence for the form field.
Set the value of this field to the next sequence for the form field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L966 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 966
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1222 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1222
*Signature: public function FF_IG_setSequence($form_field)
*Signature: public function FF_IG_setSequence($form_field)
*Parameters:
*Parameters:
Line 32: Line 37:
===FF_isSameValue()===
===FF_isSameValue()===
Checks to see if the value of the form field is the same as in the db
Checks to see if the value of the form field is the same as in the db
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L900 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 900
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1156 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1156
*Signature: protected function FF_isSameValue($form_field,$do_check)
*Signature: protected function FF_isSameValue($form_field,$do_check)
*Parameters:
*Parameters:
Line 40: Line 45:
===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.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L988 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 988
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1244 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1244
*Signature: public function FF_populateHistory($form_field)
*Signature: public function FF_populateHistory($form_field)
*Parameters:
*Parameters:
Line 47: Line 52:
===FF_save()===
===FF_save()===
Save the FormField to the database.
Save the FormField to the database.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L925 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 925
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1181 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1181
*Signature: public function FF_save($form_field,$do_check,$user)
*Signature: public function FF_save($form_field,$do_check,$user)
*Parameters:
*Parameters:
Line 55: Line 60:
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===__construct()===
===__construct()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L57 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 57
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L62 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 62
*Signature: public function __construct($name,$options)
*Signature: public function __construct($name,$options)
*Parameters:
*Parameters:
**$name  
**$name  
**$options  
**$options  
===_getRequiredFieldsQuery()===
Worker method to construct a query (to be used as a sub-select) to view the fields of the given form.  It always will return the id of the form as well @param callback $field_refernece_callback.  A callback function whose first arguement is the form, the second arguements is the field and which returns the way the field value should be references as a field.  If the callback is null (the default) then the reference used is "$form+$field"
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L133 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 133
*Signature: protected function _getRequiredFieldsQuery($form,$fields,$id,$parent,$field_reference_callback,$mod_time,$last_entry,$user)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $form
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $fields <br/>Either a string, the field, or an array of string, the fields. Can also include the special field "last_modified" to get the last modification time on any of the fields
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $id <br/>Defaults to null.  If non-null it is the id that we wish to limit to.
***Default Value: null
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $parent <br/>Defaults to false.  If true, we include the parent id as a referenced field If it is scalar and non-boolean, it is consider to be the ID of the parent, and then we get all forms with parent the given id.
***Default Value: false
**$field_reference_callback
***Default Value: null
** 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 time greater than or equal to $mod_time.  If the form storage has no way of tracking modifucation time, all entries are listed.
***Default Value: -1
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $last_entry <br/>Detaults to true.  Set to false to construct query on entry table
***Default Value: true
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $user <br/>The user id of the user to limit the results to so it only returns results limited to that user.  This can be a single value or an array
***Default Value: false
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>the query or false on failed.
===changeID()===
Change the id of the given form
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1298 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1298
*Signature: public function changeID($form,$oldid,$newid)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $form
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $oldid
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $newid
*Returns: boolean.<br/>true on success
===createCallback()===
Create a callback function or return it from the cache if it already exists.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L80 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 80
*Signature: static protected function createCallback($code)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $code <br/>The code for the function
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===delete()===
===delete()===
Deletes a form from the entry tables.
Deletes a form from the entry tables.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L818 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 818
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1094 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1094
*Signature: public function delete($form,$transact,$complete,$no_history)
*Signature: public function delete($form,$transact)
*Parameters:
*Parameters:
** [[Class: I2CE_Form (Development) | I2CE_Form]] $form
** [[Class: I2CE_Form (Development) | 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
** [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 ] $no_history <br/>a flag to determine if the record should not go to the deleted_records table. default: false
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===fieldDetails()===
===fieldDetails()===
Return an array of DB details for a given field to be used to build queries for that field.
Return an array of DB details for a given field to be used to build queries for that field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L492 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 492
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L613 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 613
*Signature: protected function fieldDetails($form,$field,$field_count,$table_prefix,$table,$join_field)
*Signature: protected function fieldDetails($form,$field,$field_count,$table_prefix,$table,$join_field)
*Parameters:
*Parameters:
Line 86: Line 125:
***Default Value: null  
***Default Value: null  
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
===generateReferenceCallback_1()===
Generate the reference callback for the given form and field (Type 1) id=>id parent=>parent last_modified=>last_modified $field => `$field`  (or NULL) @param string $field
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1368 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1368
*Signature: protected function generateReferenceCallback_1($form,$fields)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $form
**$fields
*Returns: callable
===generateReferenceCallback_2()===
Generate the reference callback for the given form and field (Type 2) id=>recod.id parent => CONCAT(record.parent_form , '|', record.parent_id) last_modified => record.last_modified $field => last_entry.{$fieldtype}_value  (e.g. last_entry.string_value) or NULL @param string $field
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1408 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1408
*Signature: protected function generateReferenceCallback_2($form,$fields)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $form
**$fields
*Returns: callable
===getFieldId()===
===getFieldId()===
Return the id for the field in the field table. If the field doesn't currently exist then it will be created.
Return the id for the field in the field table. If the field doesn't currently exist then it will be created.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L429 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 429
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L530 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 530
*Signature: protected function getFieldId($name,$type)
*Signature: protected function getFieldId($name,$type)
*Parameters:
*Parameters:
Line 96: Line 151:
===getFields()===
===getFields()===
Generates a SQL to select the required fields. @param mixed $expr array or class implementing ArrayAccess, Iterator, and Countable (e.g. MagicDataNode) . the where data. @param callback $field_refernece_callback.  A callback function whose first arguement is the form, the second arguements is the field and which returns the way the field value should be references as a field.  If the callback is null (the default) then the reference used is "$form+$field"
Generates a SQL to select the required fields. @param mixed $expr array or class implementing ArrayAccess, Iterator, and Countable (e.g. MagicDataNode) . the where data. @param callback $field_refernece_callback.  A callback function whose first arguement is the form, the second arguements is the field and which returns the way the field value should be references as a field.  If the callback is null (the default) then the reference used is "$form+$field"
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L224 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 224
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L325 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 325
*Signature: public function getFields($form,$fields,$parent,$where_data,$ordering,$limit,$field_reference_callback,$mod_time)
*Signature: public function getFields($form,$fields,$parent,$where_data,$ordering,$limit,$field_reference_callback,$mod_time,$user)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $form <br/>The form we are select from
** [http://www.php.net/manual/en/language.types.string.php string ] $form <br/>The form we are select from
Line 113: Line 168:
** 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 time greater than $mod_time.  If the form storage has no way of tracking modifucation time, all entries are listed.
** 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 time greater than $mod_time.  If the form storage has no way of tracking modifucation time, all entries are listed.
***Default Value: -1
***Default Value: -1
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $user <br/>The user id of the user to limit the results to so it only returns results limited to that user.  This can be a single value or an array
***Default Value: false
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>the SQL Query needed to get the form/field data or false on failure.
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>the SQL Query needed to get the form/field data or false on failure.
===getFormFieldIdAndType()===
===getFormFieldIdAndType()===
Return the form field id for the given form and field and the data type for that field. @param string $form The name of the form. @param string $field The name of the field.
Return the form field id for the given form and field and the data type for that field. @param string $form The name of the form. @param string $field The name of the field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L457 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 457
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L578 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 578
*Signature: protected function getFormFieldIdAndType($form_name,$field_name)
*Signature: protected function getFormFieldIdAndType($form_name,$field_name)
*Parameters:
*Parameters:
Line 124: Line 181:
===getFormId()===
===getFormId()===
Returns the id from the form table in the database. If the form doesn't currently exist then it will be created and the new id will be returned.
Returns the id from the form table in the database. If the form doesn't currently exist then it will be created and the new id will be returned.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L391 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 391
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L492 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 492
*Signature: protected function getFormId($form,$nocreate)
*Signature: protected function getFormId($form,$nocreate)
*Parameters:
*Parameters:
Line 133: Line 190:
===getRequiredFieldsQuery()===
===getRequiredFieldsQuery()===
Construct a query (to be used as a sub-select) to view the fields of the given form.  It always will return the id of the form as well @param callback $field_refernece_callback.  A callback function whose first arguement is the form, the second arguements is the field and which returns the way the field value should be references as a field.  If the callback is null (the default) then the reference used is "$form+$field"
Construct a query (to be used as a sub-select) to view the fields of the given form.  It always will return the id of the form as well @param callback $field_refernece_callback.  A callback function whose first arguement is the form, the second arguements is the field and which returns the way the field value should be references as a field.  If the callback is null (the default) then the reference used is "$form+$field"
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L88 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 88
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L114 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 114
*Signature: public function getRequiredFieldsQuery($form,$fields,$id,$parent,$field_reference_callback,$mod_time)
*Signature: public function getRequiredFieldsQuery($form,$fields,$id,$parent,$field_reference_callback,$mod_time,$user)
*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
Line 146: Line 203:
** 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 time greater than or equal to $mod_time.  If the form storage has no way of tracking modifucation time, all entries are listed.
** 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 time greater than or equal to $mod_time.  If the form storage has no way of tracking modifucation time, all entries are listed.
***Default Value: -1
***Default Value: -1
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $user <br/>The user id of the user to limit the results to so it only returns results limited to that user.  This can be a single value or an array
***Default Value: false
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>the query or false on failed.
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>the query or false on failed.
===globalFieldUpdateBySQL()===
update value of each  instance  of a given form field by a sql  function call
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1453 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1453
*Signature: public function globalFieldUpdateBySQL($form_field,$where,$set_sql)
*Parameters:
** [[Class: I2CE_FormField (Development) | I2CE_FormField]] $form_field
** [http://www.php.net/manual/en/language.types.array.php array ] $where <br/>Array of where data
** [http://www.php.net/manual/en/language.types.string.php string ] $set_sql <br/>sql used to update the field
===hasGlobalFieldUpdateBySQL()===
Check to see if there is a quick field update implemented
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1442 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1442
*Signature: public function hasGlobalFieldUpdateBySQL()
*Returns: true<br/>if there is a method to quickly update all instances of a given field via SQL
===hasRecord()===
Checks if the given record exists.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L1336 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 1336
*Signature: public function hasRecord($form_name,$form_id)
*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_id
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
===isWritable()===
===isWritable()===
Checks to see if this storage mechansim implements the writing methods.
Checks to see if this storage mechansim implements the writing methods.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L69 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 69
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L94 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 94
*Signature: public function isWritable()
*Signature: public function isWritable()
===massDelete()===
Deletes a list of records from the database from a list of child form ids and a list of form ids. Any records that are deleted will also delete all child forms. For example, you can pass a list of demographic forms with a parent of person and it will delete the person records and all children.  You can also simply pass the list of person records.  The ids shouldn't have the form name included.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L974 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 974
*Signature: static public function massDelete($records,$children,$calculate,$transact)
*Parameters:
** [http://www.php.net/manual/en/language.types.array.php array ] $records <br/>The list of records to delete
** [http://www.php.net/manual/en/language.types.array.php array ] $children <br/>The list of children records to delete the parents
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $calculate <br/>Only calculate how many records to delete, but don't delete anything
***Default Value: true
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $transact <br/>a flag to use transacations or not
***Default Value: true
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
===populateHistory()===
===populateHistory()===
Populates the history of each field given to the method.
Populates the history of each field given to the method.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L714 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 714
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L868 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 868
*Signature: public function populateHistory($form)
*Signature: public function populateHistory($form)
*Parameters:
*Parameters:
Line 159: Line 251:
===prepareCheckStatement()===
===prepareCheckStatement()===
Prepare the check statements for the given field type
Prepare the check statements for the given field type
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L689 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 689
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L810 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 810
*Signature: protected function prepareCheckStatement($type_string)
*Signature: protected function prepareCheckStatement($type_string)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $type_string
** [http://www.php.net/manual/en/language.types.string.php string ] $type_string
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===prepareDeleteStatement()===
Prepare the delete statements for records and entries. @param $delete_type The type of delete statement to prepare.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L832 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 832
*Signature: protected function prepareDeleteStatement($delete_type)
*Parameters:
**$delete_type
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===prepareRecordStatement()===
===prepareRecordStatement()===
Prepare the record table save statements for insert or update.
Prepare the record table save statements for insert or update.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L626 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 626
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L747 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 747
*Signature: protected function prepareRecordStatement($type)
*Signature: protected function prepareRecordStatement($type)
*Parameters:
*Parameters:
Line 173: Line 272:
===prepareSaveStatement()===
===prepareSaveStatement()===
Prepare the save statement for the given field type.
Prepare the save statement for the given field type.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L599 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 599
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L720 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 720
*Signature: protected function prepareSaveStatement($field_type_db,$field_type_string,$field_type_mdb2)
*Signature: protected function prepareSaveStatement($field_type_db,$field_type_string,$field_type_mdb2)
*Parameters:
*Parameters:
Line 182: Line 281:
===prepareSetupFormStatement()===
===prepareSetupFormStatement()===
Prepare the setupForm statements for select and delete.
Prepare the setupForm statements for select and delete.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L655 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 655
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L776 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 776
*Signature: protected function prepareSetupFormStatement($type)
*Signature: protected function prepareSetupFormStatement($type)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $type
** [http://www.php.net/manual/en/language.types.string.php string ] $type
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===release()===
Release any resourced held by this form storage mechanism for the indicated form
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L557 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 557
*Signature: public function release($form)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $form
===save()===
===save()===
Save a form object into entry tables.
Save a form object into entry tables.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L729 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 729
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L883 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 883
*Signature: public function save($form,$user,$transact)
*Signature: public function save($form,$user,$transact)
*Parameters:
*Parameters:
Line 197: Line 302:
===setupForm()===
===setupForm()===
Populates the form and field ids for all the fields for this form. If the form or fields don't exist yet they will be created.
Populates the form and field ids for all the fields for this form. If the form or fields don't exist yet they will be created.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L532 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 532
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php#L653 i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php] on line 653
*Signature: protected function setupForm($form)
*Signature: protected function setupForm($form)
*Parameters:
*Parameters:
Line 207: Line 312:
===getRecords()===
===getRecords()===
This public method is inherited from [[Class: I2CE_FormStorage_DB (Development)#getRecords() | I2CE_FormStorage_DB->getRecords()]]
This public method is inherited from [[Class: I2CE_FormStorage_DB (Development)#getRecords() | I2CE_FormStorage_DB->getRecords()]]
===hasGlobalFieldUpdateBySql()===
This public method is inherited from [[Class: I2CE_FormStorage_DB (Development)#hasGlobalFieldUpdateBySql() | I2CE_FormStorage_DB->hasGlobalFieldUpdateBySql()]]


===listDisplayFields()===
===listDisplayFields()===
Line 231: Line 339:
===getFormsById()===
===getFormsById()===
This public method is inherited from [[Class: I2CE_FormStorage_Mechanism (Development)#getFormsById() | I2CE_FormStorage_Mechanism->getFormsById()]]
This public method is inherited from [[Class: I2CE_FormStorage_Mechanism (Development)#getFormsById() | I2CE_FormStorage_Mechanism->getFormsById()]]
===globalFieldUpdateByFunction()===
This public method is inherited from [[Class: I2CE_FormStorage_Mechanism (Development)#globalFieldUpdateByFunction() | I2CE_FormStorage_Mechanism->globalFieldUpdateByFunction()]]


===setStorageOptions()===
===setStorageOptions()===

Latest revision as of 08:14, 6 May 2015


This article describes the class I2CE_FormStorage_entry .

I2CE_FormStorage_entry

Variables

$prepared

A list of all prepared statements for working with entry data.

$callback

A list of all cached callback functions.

$form_field_data_cache

Keys are form names values are arrays with keys fields and values an array for the form field id and details

$form_id_cache

Keys are form names values are their id's

Methods

FF_IG_setSequence()

Set the value of this field to the next sequence for the form field.

FF_isSameValue()

Checks to see if the value of the form field is the same as in the db

FF_populateHistory()

Populate the history of entries for the form field if the storage module handles history.

FF_save()

Save the FormField to the database.

__construct()

_getRequiredFieldsQuery()

Worker method to construct a query (to be used as a sub-select) to view the fields of the given form. It always will return the id of the form as well @param callback $field_refernece_callback. A callback function whose first arguement is the form, the second arguements is the field and which returns the way the field value should be references as a field. If the callback is null (the default) then the reference used is "$form+$field"

  • Defined in i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php on line 133
  • Signature: protected function _getRequiredFieldsQuery($form,$fields,$id,$parent,$field_reference_callback,$mod_time,$last_entry,$user)
  • Parameters:
    • string $form
    • mixed $fields
      Either a string, the field, or an array of string, the fields. Can also include the special field "last_modified" to get the last modification time on any of the fields
    • mixed $id
      Defaults to null. If non-null it is the id that we wish to limit to.
      • Default Value: null
    • boolean $parent
      Defaults to false. If true, we include the parent id as a referenced field If it is scalar and non-boolean, it is consider to be the ID of the parent, and then we get all forms with parent the given id.
      • Default Value: false
    • $field_reference_callback
      • Default Value: null
    • 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 time greater than or equal to $mod_time. If the form storage has no way of tracking modifucation time, all entries are listed.
      • Default Value: -1
    • boolean $last_entry
      Detaults to true. Set to false to construct query on entry table
      • Default Value: true
    • mixed $user
      The user id of the user to limit the results to so it only returns results limited to that user. This can be a single value or an array
      • Default Value: false
  • Returns: string
    the query or false on failed.

changeID()

Change the id of the given form

createCallback()

Create a callback function or return it from the cache if it already exists.

delete()

Deletes a form from the entry tables.

fieldDetails()

Return an array of DB details for a given field to be used to build queries for that field.

  • Defined in i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php on line 613
  • Signature: protected function fieldDetails($form,$field,$field_count,$table_prefix,$table,$join_field)
  • Parameters:
    • string $form
      The form.
    • string $field
      The field being looked up.
    • integer $field_count
      If you're building a query with multiple fields this is the count for the table alias.
      • Default Value: 1
    • string $table_prefix
      The table alias prefix to go along with the field count.
      • Default Value: "e"
    • string $table
      The table to do the lookups on. This will most often be last_entry but in some cases you may want to use entry instead.
      • Default Value: "last_entry"
    • string $join_field
      The join field to use for the table's record field to join on. By default it will use the first last_entry (e1) record field.
      • Default Value: null
  • Returns: array

generateReferenceCallback_1()

Generate the reference callback for the given form and field (Type 1) id=>id parent=>parent last_modified=>last_modified $field => `$field` (or NULL) @param string $field

generateReferenceCallback_2()

Generate the reference callback for the given form and field (Type 2) id=>recod.id parent => CONCAT(record.parent_form , '|', record.parent_id) last_modified => record.last_modified $field => last_entry.{$fieldtype}_value (e.g. last_entry.string_value) or NULL @param string $field

getFieldId()

Return the id for the field in the field table. If the field doesn't currently exist then it will be created.

getFields()

Generates a SQL to select the required fields. @param mixed $expr array or class implementing ArrayAccess, Iterator, and Countable (e.g. MagicDataNode) . the where data. @param callback $field_refernece_callback. A callback function whose first arguement is the form, the second arguements is the field and which returns the way the field value should be references as a field. If the callback is null (the default) then the reference used is "$form+$field"

  • Defined in i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php on line 325
  • Signature: public function getFields($form,$fields,$parent,$where_data,$ordering,$limit,$field_reference_callback,$mod_time,$user)
  • Parameters:
    • string $form
      The form we are select from
    • array $fields
      of string. the fields that we want to select. the keys are the fields names, the values are what we wish to select them as.
      • Default Value: array()
    • boolean $parent
      Defaults to false. If true, we include the parent id as a referenced field. If it is scalar and non-boolean, it is consider to be the ID of the parent, and then we get all forms with parent the given id.
    • $where_data
      • 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. If it is as an array of two integers, it is the offset and then number of results to limit to.
      • Default Value: false
    • $field_reference_callback
      • Default Value: null
    • 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 time greater than $mod_time. If the form storage has no way of tracking modifucation time, all entries are listed.
      • Default Value: -1
    • mixed $user
      The user id of the user to limit the results to so it only returns results limited to that user. This can be a single value or an array
      • Default Value: false
  • Returns: string
    the SQL Query needed to get the form/field data or false on failure.

getFormFieldIdAndType()

Return the form field id for the given form and field and the data type for that field. @param string $form The name of the form. @param string $field The name of the field.

getFormId()

Returns the id from the form table in the database. If the form doesn't currently exist then it will be created and the new id will be returned.

getRequiredFieldsQuery()

Construct a query (to be used as a sub-select) to view the fields of the given form. It always will return the id of the form as well @param callback $field_refernece_callback. A callback function whose first arguement is the form, the second arguements is the field and which returns the way the field value should be references as a field. If the callback is null (the default) then the reference used is "$form+$field"

  • Defined in i2ce/modules/Forms/modules/FormStorage/modules/FormStorageEntry/lib/I2CE_FormStorage_entry.php on line 114
  • Signature: public function getRequiredFieldsQuery($form,$fields,$id,$parent,$field_reference_callback,$mod_time,$user)
  • Parameters:
    • string $form
    • mixed $fields
      Either a string, the field, or an array of string, the fields. Can also include the special field "last_modified" to get the last modification time on any of the fields
    • mixed $id
      Defaults to null. If non-null it is the id that we wish to limit to.
      • Default Value: null
    • boolean $parent
      Defaults to false. If true, we include the parent id as a referenced field If it is scalar and non-boolean, it is consider to be the ID of the parent, and then we get all forms with parent the given id.
      • Default Value: false
    • $field_reference_callback
      • Default Value: null
    • 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 time greater than or equal to $mod_time. If the form storage has no way of tracking modifucation time, all entries are listed.
      • Default Value: -1
    • mixed $user
      The user id of the user to limit the results to so it only returns results limited to that user. This can be a single value or an array
      • Default Value: false
  • Returns: string
    the query or false on failed.

globalFieldUpdateBySQL()

update value of each instance of a given form field by a sql function call

hasGlobalFieldUpdateBySQL()

Check to see if there is a quick field update implemented

hasRecord()

Checks if the given record exists.

isWritable()

Checks to see if this storage mechansim implements the writing methods.

massDelete()

Deletes a list of records from the database from a list of child form ids and a list of form ids. Any records that are deleted will also delete all child forms. For example, you can pass a list of demographic forms with a parent of person and it will delete the person records and all children. You can also simply pass the list of person records. The ids shouldn't have the form name included.

populateHistory()

Populates the history of each field given to the method.

prepareCheckStatement()

Prepare the check statements for the given field type

prepareDeleteStatement()

Prepare the delete statements for records and entries. @param $delete_type The type of delete statement to prepare.

prepareRecordStatement()

Prepare the record table save statements for insert or update.

prepareSaveStatement()

Prepare the save statement for the given field type.

prepareSetupFormStatement()

Prepare the setupForm statements for select and delete.

release()

Release any resourced held by this form storage mechanism for the indicated form

save()

Save a form object into entry tables.

setupForm()

Populates the form and field ids for all the fields for this form. If the form or fields don't exist yet they will be created.

Inherited Methods

getIdsAsChild()

This public method is inherited from I2CE_FormStorage_DB->getIdsAsChild()

getRecords()

This public method is inherited from I2CE_FormStorage_DB->getRecords()

hasGlobalFieldUpdateBySql()

This public method is inherited from I2CE_FormStorage_DB->hasGlobalFieldUpdateBySql()

listDisplayFields()

This public method is inherited from I2CE_FormStorage_DB->listDisplayFields()

listFields()

This public method is inherited from I2CE_FormStorage_DB->listFields()

lookupDisplayField()

This public method is inherited from I2CE_FormStorage_DB->lookupDisplayField()

lookupField()

This public method is inherited from I2CE_FormStorage_DB->lookupField()

populate()

This public method is inherited from I2CE_FormStorage_DB->populate()

search()

This public method is inherited from I2CE_FormStorage_DB->search()

queryLastListCount()

This protected method is inherited from I2CE_FormStorage_DB->queryLastListCount()

getFormsById()

This public method is inherited from I2CE_FormStorage_Mechanism->getFormsById()

globalFieldUpdateByFunction()

This public method is inherited from I2CE_FormStorage_Mechanism->globalFieldUpdateByFunction()

setStorageOptions()

This public method is inherited from I2CE_FormStorage_Mechanism->setStorageOptions()

compareFormsByFields()

This protected method is inherited from I2CE_FormStorage_Mechanism->compareFormsByFields()

getLimitedFields()

This protected method is inherited from I2CE_FormStorage_Mechanism->getLimitedFields()

getStorageOptions()

This protected method is inherited from I2CE_FormStorage_Mechanism->getStorageOptions()

_hasMethod()

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

Inherited Variables

$db

Theis protected variable is inherited from I2CE_FormStorage_DB->$db

$name

Theis protected variable is inherited from I2CE_FormStorage_Mechanism->$name

$global_options

Theis protected variable is inherited from I2CE_FormStorage_Mechanism->$global_options

$storage_options_cache

Theis protected variable is inherited from I2CE_FormStorage_Mechanism->$storage_options_cache

$ordering

Theis protected variable is inherited from I2CE_FormStorage_Mechanism->$ordering

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()