Class: I2CE FormFactory: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 21: Line 21:
Call a static function in the form's class object.
Call a static function in the form's class object.
*Signature: public function callStatic($form,$func,$args)
*Signature: public function callStatic($form,$func,$args)
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 ] $func<br/>The function to be called.
** [http://www.php.net/manual/en/language.types.string.php string ] $func <br/>The function to be called.
* [http://www.php.net/manual/en/language.types.array.php array ] $args<br/>The arguments to pass to the function.
** [http://www.php.net/manual/en/language.types.array.php array ] $args <br/>The arguments to pass to the function.
**Default Value: array()  
***Default Value: array()  
===createForm()===
===createForm()===
Return an instance of a I2CE_Form from the factory.
Return an instance of a I2CE_Form from the factory.
*Signature: public function createForm($formId)
*Signature: public function createForm($formId)
*Returns: [[Class: I2CE_Form | I2CE_Form]] or null on failure
*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.types.string.php string ] $formId<br/>The name of the form possible with an id
*Returns: [[Class: I2CE_Form | I2CE_Form]]<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.
*Signature: public function exists($form)
*Signature: public function exists($form)
*Parameters:
** [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 ]
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $form<br/>The name of the form.
===getClassHierarchy()===
===getClassHierarchy()===
Get the class hierarchy associated to a class.
Get the class hierarchy associated to a class.
*Signature: public function getClassHierarchy($form)
*Signature: public function getClassHierarchy($form)
*Returns: [http://www.php.net/manual/en/language.types.array.php 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'.
*Parameters:
Returns null in error.
Parameters:
*$form  
*$form  
*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()===
*Signature: public function getClassName($form)
*Signature: public function getClassName($form)
Parameters:
*Parameters:
*$form  
*$form  
===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.
*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()===
===getFieldNames()===
Get the fields for a given form via what is stored in magic data.
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
@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
*Signature: public function getFieldNames($form,$restrictions)
*Signature: public function getFieldNames($form,$restrictions)
*Returns: associative array of string.  key is the field the value is the form class
*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 ] $form<br/>the short name of a form
*$restrictions  
*$restrictions  
**Default Value: array()
***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.
*Signature: public function getForms()
*Signature: public function getForms()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ] 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.
*Signature: public function getStatic($form,$var,$const)
*Signature: public function getStatic($form,$var,$const)
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 variable.
** [http://www.php.net/manual/en/language.types.string.php string ] $var <br/>The name of the variable.
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $const<br/>Set to true to get a constant instead of a variable
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $const <br/>Set to true to get a constant instead of a variable
**Default Value: false  
***Default Value: false  
===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.

Revision as of 22:41, 16 October 2009

This article desrcibes 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.

  • Type: private y $classes

Methods

__construct()

  • Signature: public function __construct()

callStatic()

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

  • Signature: public function callStatic($form,$func,$args)
  • Parameters:
    • string $form
      The name of the form.
    • string $func
      The function to be called.
    • array $args
      The arguments to pass to the function.
      • Default Value: array()

createForm()

Return an instance of a I2CE_Form from the factory.

  • Signature: public function createForm($formId)
  • Parameters:
    • string $formId
      The name of the form possible with an id
  • Returns: I2CE_Form
    or null on failure

exists()

Checks to see if the given form has been registered.

  • Signature: public function exists($form)
  • Parameters:
  • Returns: boolean

getClassHierarchy()

Get the class hierarchy associated to a class.

  • 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()

  • Signature: public function getClassName($form)
  • Parameters:
  • $form

getConst()

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

  • Signature: public function getConst($form,$var)
  • Parameters:
    • string $form
      The name of the form.
    • string $var
      The name of the constant.

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

  • 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.

  • Signature: public function getForms()
  • Returns: array
    with values the form name

getStatic()

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

  • Signature: public function getStatic($form,$var,$const)
  • Parameters:
    • string $form
      The name of the form.
    • string $var
      The name of the variable.
    • boolean $const
      Set to true to get a constant instead of a variable
      • Default Value: false

instance()

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

  • Signature: static public function instance()

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()

Fuzzy Methods

getRecords()

This method is implemented by I2CE_FormStorage->getRecords()