Class: I2CE FormFactory: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 2: Line 2:
*Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]].
*Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]].
*Location: Part of the module [[I2CE Module List#forms|forms]] in the package [https://launchpad.net/i2ce I2CE]
*Location: Part of the module [[I2CE Module List#forms|forms]] in the package [https://launchpad.net/i2ce I2CE]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.1-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php modules/Forms/lib/I2CE_FormFactory.php]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L30 modules/Forms/lib/I2CE_FormFactory.php] on line 30
*Author: Luke Duncan <lduncan@intrahealth.org>
*Author: Luke Duncan <lduncan@intrahealth.org>
*Since: v1.0.0
*Since: v1.0.0
Line 9: Line 9:
===$instance===
===$instance===
The single instance of this class.
The single instance of this class.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L34 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 34
*Type: static private [[Class: I2CE_FormFactory | I2CE_FormFactory]] $instance
*Type: static private [[Class: I2CE_FormFactory | 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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L38 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 38
*Type: private [http://www.php.net/manual/en/language.types.array.php array ] $classes
*Type: private [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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L52 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 52
*Signature: public function __construct()
*Signature: public function __construct()
===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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L164 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 164
*Signature: public function callStatic($form,$func,$args)
*Signature: public function callStatic($form,$func,$args)
*Parameters:
*Parameters:
Line 28: Line 32:
===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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L125 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 125
*Signature: public function createForm($formId)
*Signature: public function createForm($formId)
*Parameters:
*Parameters:
Line 34: Line 39:
===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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L63 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 63
*Signature: public function exists($form)
*Signature: public function exists($form)
*Parameters:
*Parameters:
Line 40: Line 46:
===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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L84 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 84
*Signature: public function getClassHierarchy($form)
*Signature: public function getClassHierarchy($form)
*Parameters:
*Parameters:
Line 45: Line 52:
*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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L112 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 112
*Signature: public function getClassName($form)
*Signature: public function getClassName($form)
*Parameters:
*Parameters:
Line 50: Line 58:
===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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L252 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 252
*Signature: public function getConst($form,$var)
*Signature: public function getConst($form,$var)
*Parameters:
*Parameters:
Line 56: Line 65:
===getFieldNames()===
===getFieldNames()===
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
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
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L201 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 201
*Signature: public function getFieldNames($form,$restrictions)
*Signature: public function getFieldNames($form,$restrictions)
*Parameters:
*Parameters:
Line 64: Line 74:
===getForms()===
===getForms()===
get the available forms.
get the available forms.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L71 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 71
*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
*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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L183 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 183
*Signature: public function getStatic($form,$var,$const)
*Signature: public function getStatic($form,$var,$const)
*Parameters:
*Parameters:
Line 76: Line 88:
===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.2-release/annotate/head:/modules/Forms/lib/I2CE_FormFactory.php#L43 i2ce/modules/Forms/lib/I2CE_FormFactory.php] on line 43
*Signature: static public function instance()
*Signature: static public function instance()
==Inherited Methods==
==Inherited Methods==

Revision as of 08:49, 10 November 2009

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.

$classes

The classes that have been registered with the factory.

Methods

__construct()

callStatic()

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

createForm()

Return an instance of a I2CE_Form from the factory.

exists()

Checks to see if the given form has been registered.

getClassHierarchy()

Get the class hierarchy associated to a class.

  • Defined in i2ce/modules/Forms/lib/I2CE_FormFactory.php on line 84
  • 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.

getFieldNames()

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

  • Defined in i2ce/modules/Forms/lib/I2CE_FormFactory.php on line 201
  • Signature: public function getFieldNames($form,$restrictions)
  • Parameters:
    • string $form
      the short name of a form
    • $restrictions
      • Default Value: array()
  • Returns: associative
    array of string. key is the field the value is the form class

getForms()

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

_hasMethod()

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

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()

Fuzzy Methods

getRecords()

This method is implemented by I2CE_FormStorage->getRecords()