Class: I2CE FormFactory (Development): Difference between revisions

From IHRIS Wiki
(Created page with '{{otherversions|Class: I2CE_FormFactory}} This article describes the class ''I2CE_FormFactory'' . *Extends the class: I2CE_Fuzzy. *Location:…')
 
No edit summary
 
Line 1: Line 1:
{{otherversions|Class: I2CE_FormFactory}}
{{otherversions|Class: I2CE_FormFactory}}
This article describes the class ''I2CE_FormFactory'' .
This article describes the class ''I2CE_FormFactory'' .
*Extends the class: [[Class: I2CE_Fuzzy (Development) | I2CE_Fuzzy]].
*Extends the class: [[Class: I2CE_FieldContainer_Factory (Development) | I2CE_FieldContainer_Factory]].
*Location: Part of the module [[I2CE Module List (Development)#forms|forms]] in the package [https://launchpad.net/i2ce I2CE] 4.0-dev
*Location: Part of the module [[I2CE Module List (Development)#forms|forms]] in the package [https://launchpad.net/i2ce I2CE] 4.0-dev
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L30 modules/Forms/lib/I2CE_FormFactory.php] on line 30
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L30 modules/Forms/lib/I2CE_FormFactory.php] on line 30
Line 9: Line 9:
==Variables==
==Variables==
===$instance===
===$instance===
The single instance of this class.
The single instance of this class. //maybe not needed when updating to php 5.3
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L34 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 34
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L44 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 44
*Type: static private [[Class: I2CE_FormFactory (Development) | I2CE_FormFactory]] $instance
*Type: static protected [[Class: I2CE_FormFactory (Development) | I2CE_FormFactory]] $instance


===$classes===
===$classes===
The classes that have been registered with the factory.
The classes that have been registered with the factory.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L38 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 38
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L60 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 60
*Type: private [http://www.php.net/manual/en/language.types.array.php array ] $classes
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $classes


==Methods==
==Methods==
===__construct()===
===__construct()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L52 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 52
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L63 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 63
*Signature: public function __construct()
*Signature: public function __construct()
===_createContainer()===
Worker method to create an instance of an I2CE_Form from the factory.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L243 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 243
*Signature: protected function _createContainer($factory,$form,$id)
*Parameters:
** [[Class: I2CE_FieldContainer_Factory (Development) | I2CE_FieldContainer_Factory]] $factory
** [http://www.php.net/manual/en/language.types.string.php string ] $form <br/>The form  of the field container
** [http://www.php.net/manual/en/language.types.string.php string ] $id <br/>The id of the field container.  Defaults to null
***Default Value: '0'
*Returns: [[Class: I2CE_FieldContainer (Development) | I2CE_FieldContainer]]<br/>or null on failure
===_getFieldData()===
Get data needed to create all the fields in this field container
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L148 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 148
*Signature: protected function _getFieldData($name)
*Parameters:
**$name
*Returns: array.
===_loadMetaAttributes()===
Returns the array of attributes for this container
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L195 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 195
*Signature: protected function _loadMetaAttributes($name)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $name
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
===callStatic()===
===callStatic()===
Call a static function in the form's class object.
Call a static function in the form's class object.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L164 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 164
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L270 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 270
*Signature: public function callStatic($form,$func,$args)
*Signature: public function callStatic($form,$func,$args)
*Parameters:
*Parameters:
Line 33: Line 57:
===createForm()===
===createForm()===
Return an instance of a I2CE_Form from the factory.
Return an instance of a I2CE_Form from the factory.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L125 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 125
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L231 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 231
*Signature: public function createForm($formId)
*Signature: public function createForm($nameId,$no_cache)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $formId <br/>The name of the form possible with an id
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $nameId <br/>The a string which is either the name of the field container, the name and id in the form of "$name|$id" or an array with two elements, the first is a name and the second is an id
*Returns: [[Class: I2CE_Form (Development) | I2CE_Form]]<br/>or null on failure
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $no_cache <br/>Defaults to false.  If true then we don't check the cache when the id is non-zero
***Default Value: false
*Returns: I2CE_From<br/>or null on failure
===exists()===
===exists()===
Checks to see if the given form has been registered.
Checks to see if the given form has been registered.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L63 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 63
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L74 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 74
*Signature: public function exists($form)
*Signature: public function exists($form)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $form <br/>The name of the form.
** [http://www.php.net/manual/en/language.types.string.php string ] $form <br/>The name of the 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 ]
===getAttributeData()===
Recursive method to rraverse the class hierarchy to get the meta data for the form magic data @param array &$data  array
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L208 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 208
*Signature: protected function getAttributeData($class,$attr)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $class <br/>the form class
**&$attr
===getClassHierarchy()===
===getClassHierarchy()===
Get the class hierarchy associated to a class.
Get the class hierarchy associated to a class.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L84 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 84
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L104 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 104
*Signature: public function getClassHierarchy($form)
*Signature: public function getClassHierarchy($form)
*Parameters:
*Parameters:
Line 53: Line 86:
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>The keys of the array range from 0 to N.  The value of key 0 is the class associated to the form.  The last key is has value 'I2CE_Form'. Returns null in error.
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>The keys of the array range from 0 to N.  The value of key 0 is the class associated to the form.  The last key is has value 'I2CE_Form'. Returns null in error.
===getClassName()===
===getClassName()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L112 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 112
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L132 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 132
*Signature: public function getClassName($form)
*Signature: public function getClassName($form)
*Parameters:
*Parameters:
Line 59: Line 92:
===getConst()===
===getConst()===
Shortcut to retrieving a constant value from a form's class object.
Shortcut to retrieving a constant value from a form's class object.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L252 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 252
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L305 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 305
*Signature: public function getConst($form,$var)
*Signature: public function getConst($form,$var)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $form <br/>The name of the form.
** [http://www.php.net/manual/en/language.types.string.php string ] $form <br/>The name of the form.
** [http://www.php.net/manual/en/language.types.string.php string ] $var <br/>The name of the constant.
** [http://www.php.net/manual/en/language.types.string.php string ] $var <br/>The name of the constant.
===getFieldNames()===
===getContainerType()===
Get the fields for a given form via what is stored in magic data. @param mixed  $restict. Defaults to null which means there are no restrictions. Otherwise it should be an array consisting of any numbder of the following keys 'in_db', 'required', and 'unique'  the values associated to each key should be true or false.  We then only return fields who match the given value
Return  type of  container this factory makes
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L201 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 201
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L37 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 37
*Signature: public function getFieldNames($form,$restrictions)
*Signature: public function getContainerType()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getFormFieldsData()===
Recursive method to rraverse the class hierarchy to get the field data from magic data
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L162 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 162
*Signature: protected function getFormFieldsData($class,$data)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $form <br/>the short name of a form
** [http://www.php.net/manual/en/language.types.string.php string ] $class <br/>the form class
**$restrictions
** [http://www.php.net/manual/en/language.types.array.php array ] &$data <br/>array indexed by field names where data on the fields are stored
***Default Value: array()
*Returns: associative<br/>array of string.  key is the field the value is the form class
===getForms()===
===getForms()===
get the available forms.
get the available forms.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L71 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 71
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L91 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 91
*Signature: public function getForms()
*Signature: public function getForms()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>with values the form name
===getNames()===
get the available forms.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L82 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 82
*Signature: public function getNames()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>with values the form name
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>with values the form name
===getStatic()===
===getStatic()===
Return a static variable from the form's class object.
Return a static variable from the form's class object.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L183 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 183
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L289 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 289
*Signature: public function getStatic($form,$var,$const)
*Signature: public function getStatic($form,$var,$const)
*Parameters:
*Parameters:
Line 89: Line 130:
===instance()===
===instance()===
Return the instance of this factory and create it if it doesn't exist.
Return the instance of this factory and create it if it doesn't exist.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L43 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 43
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L49 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 49
*Signature: static public function instance()
*Signature: static public function instance()
==Inherited Methods==
==Inherited Methods==
===cleanup()===
This public method is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#cleanup() | I2CE_FieldContainer_Factory->cleanup()]]
===createContainer()===
This public method is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#createContainer() | I2CE_FieldContainer_Factory->createContainer()]]
===getFieldData()===
This public method is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#getFieldData() | I2CE_FieldContainer_Factory->getFieldData()]]
===getFieldNames()===
This public method is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#getFieldNames() | I2CE_FieldContainer_Factory->getFieldNames()]]
===getMetaAttribute()===
This public method is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#getMetaAttribute() | I2CE_FieldContainer_Factory->getMetaAttribute()]]
===hasMetaAttribute()===
This public method is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#hasMetaAttribute() | I2CE_FieldContainer_Factory->hasMetaAttribute()]]
===loadMetaAttributes()===
This public method is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#loadMetaAttributes() | I2CE_FieldContainer_Factory->loadMetaAttributes()]]
===removeFromCache()===
This public method is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#removeFromCache() | I2CE_FieldContainer_Factory->removeFromCache()]]
===setMetaAttribute()===
This public method is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#setMetaAttribute() | I2CE_FieldContainer_Factory->setMetaAttribute()]]
===_hasMethod()===
===_hasMethod()===
This public method is inherited from [[Class: I2CE_Fuzzy (Development)#_hasMethod() | I2CE_Fuzzy->_hasMethod()]]
This public method is inherited from [[Class: I2CE_Fuzzy (Development)#_hasMethod() | I2CE_Fuzzy->_hasMethod()]]
==Inherited Variables==
===$instance===
Theis protected variable is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#$instance | I2CE_FieldContainer_Factory->$instance]]
===$meta===
Theis protected variable is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#$meta | I2CE_FieldContainer_Factory->$meta]]
===$fieldData===
Theis protected variable is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#$fieldData | I2CE_FieldContainer_Factory->$fieldData]]
===$containerCache===
Theis protected variable is inherited from [[Class: I2CE_FieldContainer_Factory (Development)#$containerCache | I2CE_FieldContainer_Factory->$containerCache]]
==Inherited Fuzzy Methods==
==Inherited Fuzzy Methods==
===userMessage()===
===userMessage()===

Latest revision as of 07:55, 3 August 2010


This article describes the class I2CE_FormFactory .

This factory is used to create instances of I2CE_Form objects from the form name.

Variables

$instance

The single instance of this class. //maybe not needed when updating to php 5.3

$classes

The classes that have been registered with the factory.

Methods

__construct()

_createContainer()

Worker method to create an instance of an I2CE_Form from the factory.

_getFieldData()

Get data needed to create all the fields in this field container

_loadMetaAttributes()

Returns the array of attributes for this container

callStatic()

Call a static function in the form's class object.

createForm()

Return an instance of a I2CE_Form from the factory.

  • Defined in i2ce/modules/Forms/lib/I2CE_FormFactory.php on line 231
  • Signature: public function createForm($nameId,$no_cache)
  • Parameters:
    • mixed $nameId
      The a string which is either the name of the field container, the name and id in the form of "$name|$id" or an array with two elements, the first is a name and the second is an id
    • boolean $no_cache
      Defaults to false. If true then we don't check the cache when the id is non-zero
      • Default Value: false
  • Returns: I2CE_From
    or null on failure

exists()

Checks to see if the given form has been registered.

getAttributeData()

Recursive method to rraverse the class hierarchy to get the meta data for the form magic data @param array &$data array

getClassHierarchy()

Get the class hierarchy associated to a class.

  • Defined in i2ce/modules/Forms/lib/I2CE_FormFactory.php on line 104
  • Signature: public function getClassHierarchy($form)
  • Parameters:
    • $form
  • Returns: array
    The keys of the array range from 0 to N. The value of key 0 is the class associated to the form. The last key is has value 'I2CE_Form'. Returns null in error.

getClassName()

getConst()

Shortcut to retrieving a constant value from a form's class object.

getContainerType()

Return type of container this factory makes

getFormFieldsData()

Recursive method to rraverse the class hierarchy to get the field data from magic data

getForms()

get the available forms.

getNames()

get the available forms.

getStatic()

Return a static variable from the form's class object.

instance()

Return the instance of this factory and create it if it doesn't exist.

Inherited Methods

cleanup()

This public method is inherited from I2CE_FieldContainer_Factory->cleanup()

createContainer()

This public method is inherited from I2CE_FieldContainer_Factory->createContainer()

getFieldData()

This public method is inherited from I2CE_FieldContainer_Factory->getFieldData()

getFieldNames()

This public method is inherited from I2CE_FieldContainer_Factory->getFieldNames()

getMetaAttribute()

This public method is inherited from I2CE_FieldContainer_Factory->getMetaAttribute()

hasMetaAttribute()

This public method is inherited from I2CE_FieldContainer_Factory->hasMetaAttribute()

loadMetaAttributes()

This public method is inherited from I2CE_FieldContainer_Factory->loadMetaAttributes()

removeFromCache()

This public method is inherited from I2CE_FieldContainer_Factory->removeFromCache()

setMetaAttribute()

This public method is inherited from I2CE_FieldContainer_Factory->setMetaAttribute()

_hasMethod()

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

Inherited Variables

$instance

Theis protected variable is inherited from I2CE_FieldContainer_Factory->$instance

$meta

Theis protected variable is inherited from I2CE_FieldContainer_Factory->$meta

$fieldData

Theis protected variable is inherited from I2CE_FieldContainer_Factory->$fieldData

$containerCache

Theis protected variable is inherited from I2CE_FieldContainer_Factory->$containerCache

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()

Fuzzy Methods

getRecords()

This method is implemented by I2CE_FormStorage->getRecords()