Class: I2CE ModuleFactory (Development): Difference between revisions

From IHRIS Wiki
(Created page with '{{otherversions|Class: I2CE_ModuleFactory}} This article describes the class ''I2CE_ModuleFactory'' . *Location: Part of the module I2CE i…')
 
No edit summary
 
Line 1: Line 1:
{{otherversions|Class: I2CE_ModuleFactory}}
{{otherversions|Class: I2CE_ModuleFactory}}
This article describes the class ''I2CE_ModuleFactory'' .
This article describes the class ''I2CE_ModuleFactory'' .
*Location: Part of the module [[I2CE Module List (Development)#I2CE|I2CE]] in the package [https://launchpad.net/i2ce I2CE] 4.0-dev
*Location: Part of the module [[I2CE Module List (Development)#I2CE|I2CE]] 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:/lib/I2CE_ModuleFactory.php#L36 lib/I2CE_ModuleFactory.php] on line 36
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L36 lib/I2CE_ModuleFactory.php] on line 36
Module Factory  @todo Better Documentation
Module Factory  @todo Better Documentation
==Variables==
==Variables==
===$instance===
===$instance===
The singleton instance of this class.
The singleton instance of this class.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L40 i2ce/lib/I2CE_ModuleFactory.php] on line 40
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L40 i2ce/lib/I2CE_ModuleFactory.php] on line 40
*Type: static protected [[Class: I2CE_ModuleFactory (Development) | I2CE_ModuleFactory]] $instance
*Type: static protected [[Class: I2CE_ModuleFactory (Development) | I2CE_ModuleFactory]] $instance


===$classCache===
===$classCache===
an array indexed by shortname of classes subclassing I2CE_Module
an array indexed by shortname of classes subclassing I2CE_Module
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L72 i2ce/lib/I2CE_ModuleFactory.php] on line 72
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L72 i2ce/lib/I2CE_ModuleFactory.php] on line 72
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $classCache
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $classCache


===$path_categories===
===$path_categories===
An array of path categories together with information if the priorities should be offeset from the postive or negative from 0.  1 indicates positive, -1 indicates negative.  The more negative the quicker they get searched.  If a category is not present, it defaults to -1.
An array of path categories together with information if the priorities should be offeset from the postive or negative from 0.  1 indicates positive, -1 indicates negative.  The more negative the quicker they get searched.  If a category is not present, it defaults to -1.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L79 i2ce/lib/I2CE_ModuleFactory.php] on line 79
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L79 i2ce/lib/I2CE_ModuleFactory.php] on line 79
*Type: static protected $path_categories
*Type: static protected $path_categories


===$loadedPaths===
===$loadedPaths===
protected @var loadedPaths -- an array of the paths that have been loaded
protected @var loadedPaths -- an array of the paths that have been loaded
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L260 i2ce/lib/I2CE_ModuleFactory.php] on line 260
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L260 i2ce/lib/I2CE_ModuleFactory.php] on line 260
*Type: protected $loadedPaths
*Type: protected $loadedPaths


Line 28: Line 28:
===__construct()===
===__construct()===
Create a new instance of a report factory.
Create a new instance of a report factory.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L56 i2ce/lib/I2CE_ModuleFactory.php] on line 56
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L56 i2ce/lib/I2CE_ModuleFactory.php] on line 56
*Signature: public function __construct()
*Signature: public function __construct()
===_callHooks()===
Method to actually call the hooks
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L734 i2ce/lib/I2CE_ModuleFactory.php] on line 734
*Signature: protected function _callHooks($hook,$arg)
*Parameters:
**$hook
**$arg
===callHooks()===
===callHooks()===
Calls the specified  module hooks with the specifed arguements
Calls the specified  module hooks with the specifed arguements @param string $hook the name of a hook @param mixed $arg1,$arg2,...  The argument to pass to the methods.  Defaults to null, meaning there is no argument.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L726 i2ce/lib/I2CE_ModuleFactory.php] on line 726
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L766 i2ce/lib/I2CE_ModuleFactory.php] on line 766
*Signature: static public function callHooks($hook,$arg)
*Signature: static public function callHooks()
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $hook <br/>the name of a hook
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $arg <br/>The argument to pass to the methods.  Defaults to null, meaning there is no argument.
***Default Value: null
*Returns: an<br/>array containing all the return values of each of the hooked methods.
*Returns: an<br/>array containing all the return values of each of the hooked methods.
===checkForNewModules()===
===checkForNewModules()===
Finds newly available configuration files and stores them in the magic data.
Finds newly available configuration files and stores them in the magic data.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L803 i2ce/lib/I2CE_ModuleFactory.php] on line 803
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L843 i2ce/lib/I2CE_ModuleFactory.php] on line 843
*Signature: public function checkForNewModules($modules)
*Signature: public function checkForNewModules($modules)
*Parameters:
*Parameters:
Line 56: Line 45:
===checkLocalesUptoDate()===
===checkLocalesUptoDate()===
Checks to see if the locales for a given module are up to date
Checks to see if the locales for a given module are up to date
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L999 i2ce/lib/I2CE_ModuleFactory.php] on line 999
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1062 i2ce/lib/I2CE_ModuleFactory.php] on line 1062
*Signature: public function checkLocalesUptoDate($shortname,$file)
*Signature: public function checkLocalesUptoDate($shortname,$file)
*Parameters:
*Parameters:
Line 65: Line 54:
===disable()===
===disable()===
Disable a module by its shortname.  Not intended for casul use. WARNING -- does not remove any modules that this module depends on!!! @param string $shortname
Disable a module by its shortname.  Not intended for casul use. WARNING -- does not remove any modules that this module depends on!!! @param string $shortname
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L564 i2ce/lib/I2CE_ModuleFactory.php] on line 564
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L599 i2ce/lib/I2CE_ModuleFactory.php] on line 599
*Signature: public function disable($shortnames)
*Signature: public function disable($shortnames)
*Parameters:
*Parameters:
Line 71: Line 60:
===enable()===
===enable()===
Enable a module by its shortname.  Takes care of loading paths etc. WARNING -- does not check to see if there are conflicts with enabled modules @param string $shortname
Enable a module by its shortname.  Takes care of loading paths etc. WARNING -- does not check to see if there are conflicts with enabled modules @param string $shortname
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L599 i2ce/lib/I2CE_ModuleFactory.php] on line 599
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L634 i2ce/lib/I2CE_ModuleFactory.php] on line 634
*Signature: public function enable($shortnames)
*Signature: public function enable($shortnames)
*Parameters:
*Parameters:
Line 77: Line 66:
===exists()===
===exists()===
Check to see if this module exists
Check to see if this module exists
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1173 i2ce/lib/I2CE_ModuleFactory.php] on line 1173
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1236 i2ce/lib/I2CE_ModuleFactory.php] on line 1236
*Signature: public function exists($shortname)
*Signature: public function exists($shortname)
*Parameters:
*Parameters:
Line 84: Line 73:
===getAvailable()===
===getAvailable()===
Gets a list of the available modules
Gets a list of the available modules
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1142 i2ce/lib/I2CE_ModuleFactory.php] on line 1142
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1205 i2ce/lib/I2CE_ModuleFactory.php] on line 1205
*Signature: public function getAvailable()
*Signature: public function getAvailable()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string (the modules' shortnames)
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string (the modules' shortnames)
===getClass()===
===getClass()===
Gets the I2CE_Module object, if any, associated to this module.
Gets the I2CE_Module object, if any, associated to this module.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L283 i2ce/lib/I2CE_ModuleFactory.php] on line 283
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L283 i2ce/lib/I2CE_ModuleFactory.php] on line 283
*Signature: public function getClass($shortname)
*Signature: public function getClass($shortname)
*Parameters:
*Parameters:
Line 96: Line 85:
===getClassName()===
===getClassName()===
Gets the class name of the I2CE_Module object, if any, associated to this module.
Gets the class name of the I2CE_Module object, if any, associated to this module.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L265 i2ce/lib/I2CE_ModuleFactory.php] on line 265
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L265 i2ce/lib/I2CE_ModuleFactory.php] on line 265
*Signature: public function getClassName($shortname)
*Signature: public function getClassName($shortname)
*Parameters:
*Parameters:
Line 103: Line 92:
===getEnabled()===
===getEnabled()===
Gets a list of the enabled modules
Gets a list of the enabled modules
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1130 i2ce/lib/I2CE_ModuleFactory.php] on line 1130
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1193 i2ce/lib/I2CE_ModuleFactory.php] on line 1193
*Signature: public function getEnabled()
*Signature: public function getEnabled()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string (the modules' shortnames)
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string (the modules' shortnames)
===getHooks()===
===getHooks()===
Get the (callable) hooked methods associated to a hook.
Get the (callable) hooked methods associated to a hook.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L758 i2ce/lib/I2CE_ModuleFactory.php] on line 758
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L797 i2ce/lib/I2CE_ModuleFactory.php] on line 797
*Signature: public function getHooks($hook,$only_enabled)
*Signature: public function getHooks($hook,$only_enabled)
*Parameters:
*Parameters:
Line 117: Line 106:
===getMethod()===
===getMethod()===
Get the data for the fuzzy method
Get the data for the fuzzy method
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L667 i2ce/lib/I2CE_ModuleFactory.php] on line 667
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L702 i2ce/lib/I2CE_ModuleFactory.php] on line 702
*Signature: public function getMethod($className,$method)
*Signature: public function getMethod($className,$method)
*Parameters:
*Parameters:
Line 125: Line 114:
===getMethods()===
===getMethods()===
Gets the fuzzy methods associated to the class
Gets the fuzzy methods associated to the class
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L647 i2ce/lib/I2CE_ModuleFactory.php] on line 647
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L682 i2ce/lib/I2CE_ModuleFactory.php] on line 682
*Signature: public function getMethods($className,$check_parent_class)
*Signature: public function getMethods($className,$check_parent_class)
*Parameters:
*Parameters:
Line 134: Line 123:
===getOutOfDateConfigFiles()===
===getOutOfDateConfigFiles()===
Checks the registered config files {@see addConfigFile() } to make sure that they have been initialized.  If the modified time is more recent than the last access time, then it will re-initialize the files.  It also checks all loaded config files for enabled modules/components to make sure that they are up-to-date in a simmiar way. @param mixed $module.  A string or an arry of string  of the modules to check.  Othwerwise we check all enabled modules.
Checks the registered config files {@see addConfigFile() } to make sure that they have been initialized.  If the modified time is more recent than the last access time, then it will re-initialize the files.  It also checks all loaded config files for enabled modules/components to make sure that they are up-to-date in a simmiar way. @param mixed $module.  A string or an arry of string  of the modules to check.  Othwerwise we check all enabled modules.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L828 i2ce/lib/I2CE_ModuleFactory.php] on line 828
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L868 i2ce/lib/I2CE_ModuleFactory.php] on line 868
*Signature: public function getOutOfDateConfigFiles($shortnames,$no_messages)
*Signature: public function getOutOfDateConfigFiles($shortnames,$no_messages)
*Parameters:
*Parameters:
Line 143: Line 132:
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>with keys 'updates' and 'removals' and values arrays of string, the shortname of the relevant modules.
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>with keys 'updates' and 'removals' and values arrays of string, the shortname of the relevant modules.
===hasConfigData()===
===hasConfigData()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1116 i2ce/lib/I2CE_ModuleFactory.php] on line 1116
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1179 i2ce/lib/I2CE_ModuleFactory.php] on line 1179
*Signature: public function hasConfigData($shortname)
*Signature: public function hasConfigData($shortname)
*Parameters:
*Parameters:
Line 149: Line 138:
===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:/lib/I2CE_ModuleFactory.php#L45 i2ce/lib/I2CE_ModuleFactory.php] on line 45
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L45 i2ce/lib/I2CE_ModuleFactory.php] on line 45
*Signature: static public function instance()
*Signature: static public function instance()
*Returns: [[Class: I2CE_ModuleFactory (Development) | I2CE_ModuleFactory]]
*Returns: [[Class: I2CE_ModuleFactory (Development) | I2CE_ModuleFactory]]
===isAvailable()===
===isAvailable()===
Checks to see if a module is available
Checks to see if a module is available
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1157 i2ce/lib/I2CE_ModuleFactory.php] on line 1157
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1220 i2ce/lib/I2CE_ModuleFactory.php] on line 1220
*Signature: public function isAvailable($shortname)
*Signature: public function isAvailable($shortname)
*Parameters:
*Parameters:
Line 161: Line 150:
===isEnabled()===
===isEnabled()===
Checks to see if a module is enabled
Checks to see if a module is enabled
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1081 i2ce/lib/I2CE_ModuleFactory.php] on line 1081
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1144 i2ce/lib/I2CE_ModuleFactory.php] on line 1144
*Signature: public function isEnabled($shortname)
*Signature: public function isEnabled($shortname)
*Parameters:
*Parameters:
Line 168: Line 157:
===isInitialized()===
===isInitialized()===
Checks to see if a module is intialized.  Returns true either 1)  there is a class associated to the module and the aciton_initialize() method has been called succesfuuly 2)  there is no class associated with the module but the config data has been processed
Checks to see if a module is intialized.  Returns true either 1)  there is a class associated to the module and the aciton_initialize() method has been called succesfuuly 2)  there is no class associated with the module but the config data has been processed
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1097 i2ce/lib/I2CE_ModuleFactory.php] on line 1097
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L1160 i2ce/lib/I2CE_ModuleFactory.php] on line 1160
*Signature: public function isInitialized($shortname)
*Signature: public function isInitialized($shortname)
*Parameters:
*Parameters:
Line 175: Line 164:
===isUpToDate()===
===isUpToDate()===
Checks to see if a module is up to date according to the given config file
Checks to see if a module is up to date according to the given config file
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L943 i2ce/lib/I2CE_ModuleFactory.php] on line 943
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L997 i2ce/lib/I2CE_ModuleFactory.php] on line 997
*Signature: public function isUpToDate($shortname,$file)
*Signature: public function isUpToDate($shortname,$file)
*Parameters:
*Parameters:
Line 184: Line 173:
===isUpToDateModule()===
===isUpToDateModule()===
Checks to see if a module is up to date according to its module file
Checks to see if a module is up to date according to its module file
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L908 i2ce/lib/I2CE_ModuleFactory.php] on line 908
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L962 i2ce/lib/I2CE_ModuleFactory.php] on line 962
*Signature: public function isUpToDateModule($shortname)
*Signature: public function isUpToDateModule($shortname)
*Parameters:
*Parameters:
Line 191: Line 180:
===loadPaths()===
===loadPaths()===
Loads the class path by the indicated shortnames
Loads the class path by the indicated shortnames
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L115 i2ce/lib/I2CE_ModuleFactory.php] on line 115
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L115 i2ce/lib/I2CE_ModuleFactory.php] on line 115
*Signature: public function loadPaths($shortnames,$category,$force,$fileSearch,$data)
*Signature: public function loadPaths($shortnames,$category,$force,$fileSearch,$data)
*Parameters:
*Parameters:
Line 205: Line 194:
***Default Value: NULL
***Default Value: NULL
===removeClassPaths()===
===removeClassPaths()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L221 i2ce/lib/I2CE_ModuleFactory.php] on line 221
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L221 i2ce/lib/I2CE_ModuleFactory.php] on line 221
*Signature: public function removeClassPaths($shortnames)
*Signature: public function removeClassPaths($shortnames)
*Parameters:
*Parameters:
Line 212: Line 201:
===removeHooks()===
===removeHooks()===
Remove hooks associated to (a) module(s)
Remove hooks associated to (a) module(s)
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L489 i2ce/lib/I2CE_ModuleFactory.php] on line 489
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L526 i2ce/lib/I2CE_ModuleFactory.php] on line 526
*Signature: public function removeHooks($shortnames)
*Signature: public function removeHooks($shortnames)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $shortnames <br/>either a string, a shortname of a module, an array of shortnames, or null to indicate all enabled modules
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $shortnames <br/>either a string, a shortname of a module, an array of shortnames, or null to indicate all enabled modules
===resetStoredLoadedPaths()===
===resetStoredLoadedPaths()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L88 i2ce/lib/I2CE_ModuleFactory.php] on line 88
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L88 i2ce/lib/I2CE_ModuleFactory.php] on line 88
*Signature: public function resetStoredLoadedPaths()
*Signature: public function resetStoredLoadedPaths()
===setModuleClassHash()===
===setModuleClassHash()===
Sets the hashes for the class file for the given module(s)
Sets the hashes for the class file for the given module(s)
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L456 i2ce/lib/I2CE_ModuleFactory.php] on line 456
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L455 i2ce/lib/I2CE_ModuleFactory.php] on line 455
*Signature: public function setModuleClassHash($modules,$strict)
*Signature: public function setModuleClassHash($modules,$strict)
*Parameters:
*Parameters:
Line 227: Line 216:
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $strict <br/>If true (default) then all modules are expected to have a class file
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $strict <br/>If true (default) then all modules are expected to have a class file
***Default Value: true
***Default Value: true
===setModuleHash()===
Sets the hashes for the class file for the given module(s)
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L489 i2ce/lib/I2CE_ModuleFactory.php] on line 489
*Signature: public function setModuleHash($modules)
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $modules <br/>String or array if string
===setStorage()===
===setStorage()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L64 i2ce/lib/I2CE_ModuleFactory.php] on line 64
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L64 i2ce/lib/I2CE_ModuleFactory.php] on line 64
*Signature: public function setStorage()
*Signature: public function setStorage()
===updateHooks()===
===updateHooks()===
Loads/updates the hooks associated with an enabled  module
Loads/updates the hooks associated with an enabled  module
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L308 i2ce/lib/I2CE_ModuleFactory.php] on line 308
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_ModuleFactory.php#L308 i2ce/lib/I2CE_ModuleFactory.php] on line 308
*Signature: public function updateHooks($shortnames,$force,$checkAccessTime)
*Signature: public function updateHooks($shortnames,$force,$checkAccessTime)
*Parameters:
*Parameters:

Latest revision as of 09:15, 6 May 2015


This article describes the class I2CE_ModuleFactory .

Module Factory @todo Better Documentation

Variables

$instance

The singleton instance of this class.

$classCache

an array indexed by shortname of classes subclassing I2CE_Module

$path_categories

An array of path categories together with information if the priorities should be offeset from the postive or negative from 0. 1 indicates positive, -1 indicates negative. The more negative the quicker they get searched. If a category is not present, it defaults to -1.

$loadedPaths

protected @var loadedPaths -- an array of the paths that have been loaded

Methods

__construct()

Create a new instance of a report factory.

callHooks()

Calls the specified module hooks with the specifed arguements @param string $hook the name of a hook @param mixed $arg1,$arg2,... The argument to pass to the methods. Defaults to null, meaning there is no argument.

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 766
  • Signature: static public function callHooks()
  • Returns: an
    array containing all the return values of each of the hooked methods.

checkForNewModules()

Finds newly available configuration files and stores them in the magic data.

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 843
  • Signature: public function checkForNewModules($modules)
  • Parameters:
    • mixed $modules
      a string or array of strings: the shortnames of modules we wish to look for sub-modules. If null (default), we check all enabled modules.
      • Default Value: null
  • Returns: array
    of string the shortname of any modules we found (old and new)

checkLocalesUptoDate()

Checks to see if the locales for a given module are up to date

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 1062
  • Signature: public function checkLocalesUptoDate($shortname,$file)
  • Parameters:
    • string $shortname
      The module
    • string $file
      defaults to null which means use the currently loaded file location for the config file
      • Default Value: null
  • Returns: booolean.
    True if all is up to date.

disable()

Disable a module by its shortname. Not intended for casul use. WARNING -- does not remove any modules that this module depends on!!! @param string $shortname

enable()

Enable a module by its shortname. Takes care of loading paths etc. WARNING -- does not check to see if there are conflicts with enabled modules @param string $shortname

exists()

Check to see if this module exists

getAvailable()

Gets a list of the available modules

getClass()

Gets the I2CE_Module object, if any, associated to this module.

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 283
  • Signature: public function getClass($shortname)
  • Parameters:
    • $shortname
  • Returns: mixed.
    string or null on failure.

getClassName()

Gets the class name of the I2CE_Module object, if any, associated to this module.

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 265
  • Signature: public function getClassName($shortname)
  • Parameters:
    • $shortname
  • Returns: mixed.
    string or null on failure.

getEnabled()

Gets a list of the enabled modules

getHooks()

Get the (callable) hooked methods associated to a hook.

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 797
  • Signature: public function getHooks($hook,$only_enabled)
  • Parameters:
    • string $hook
    • boolean $only_enabled
      Defaults to true. return only the hooked mehtods for enabled modules
      • Default Value: true
  • Returns: array
    indexed by integer of arrays with keys 'module' and 'method. The arrays are indexed by decreasing priority

getMethod()

Get the data for the fuzzy method

getMethods()

Gets the fuzzy methods associated to the class

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 682
  • Signature: public function getMethods($className,$check_parent_class)
  • Parameters:
    • string $className @param $check_parentclass. Defaults to true. Check the parent classes for fuzzy methods
    • $check_parent_class
      • Default Value: true
  • Returns: array
    indexed by class names of arrays of fuzzy method names

getOutOfDateConfigFiles()

Checks the registered config files {@see addConfigFile() } to make sure that they have been initialized. If the modified time is more recent than the last access time, then it will re-initialize the files. It also checks all loaded config files for enabled modules/components to make sure that they are up-to-date in a simmiar way. @param mixed $module. A string or an arry of string of the modules to check. Othwerwise we check all enabled modules.

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 868
  • Signature: public function getOutOfDateConfigFiles($shortnames,$no_messages)
  • Parameters:
    • $shortnames
      • Default Value: null
    • $no_messages
      • Default Value: true
  • Returns: array
    with keys 'updates' and 'removals' and values arrays of string, the shortname of the relevant modules.

hasConfigData()

instance()

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

isAvailable()

Checks to see if a module is available

isEnabled()

Checks to see if a module is enabled

isInitialized()

Checks to see if a module is intialized. Returns true either 1) there is a class associated to the module and the aciton_initialize() method has been called succesfuuly 2) there is no class associated with the module but the config data has been processed

isUpToDate()

Checks to see if a module is up to date according to the given config file

isUpToDateModule()

Checks to see if a module is up to date according to its module file

loadPaths()

Loads the class path by the indicated shortnames

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 115
  • Signature: public function loadPaths($shortnames,$category,$force,$fileSearch,$data)
  • Parameters:
    • mixed $shortnames
      either a string, a shortname of a module, an array of shortnames, or null to indicate all enabled modules
      • Default Value: NULL
    • mixed $category
      A string or an array of strings of the categories to load. Defaults to null which means to load all paths.
      • Default Value: NULL
    • boolean $force
      Defaults to false. Load the class path even if the module is not enabled. @param I2CE_FileSearch A file search to use to store the module paths. If null(default) uses I2CE::getFileSearch() @param $data Defaults to null meaninging use the config data stored in I2CE::getConfig(). If non-null uses the given value for the config data. NOTE: This needs to be cleaned up!
      • Default Value: FALSE
    • $fileSearch
      • Default Value: NULL
    • $data
      • Default Value: NULL

removeClassPaths()

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 221
  • Signature: public function removeClassPaths($shortnames)
  • Parameters:
    • $shortnames
      • Default Value: null

removeHooks()

Remove hooks associated to (a) module(s)

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 526
  • Signature: public function removeHooks($shortnames)
  • Parameters:
    • mixed $shortnames
      either a string, a shortname of a module, an array of shortnames, or null to indicate all enabled modules

resetStoredLoadedPaths()

setModuleClassHash()

Sets the hashes for the class file for the given module(s)

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 455
  • Signature: public function setModuleClassHash($modules,$strict)
  • Parameters:
    • mixed $modules
      String or array if string
    • boolean $strict
      If true (default) then all modules are expected to have a class file
      • Default Value: true

setModuleHash()

Sets the hashes for the class file for the given module(s)

setStorage()

updateHooks()

Loads/updates the hooks associated with an enabled module

  • Defined in i2ce/lib/I2CE_ModuleFactory.php on line 308
  • Signature: public function updateHooks($shortnames,$force,$checkAccessTime)
  • Parameters:
    • mixed $shortnames
      either a string, a shortname of a module, an array of shortnames, or null to indicate all enabled modules
      • Default Value: null
    • boolean $force
      If true (defaults to false) then we update the hooks even if the module is not enabled
      • Default Value: false
    • boolean $checkAccessTime
      defaults to true which means that we only update the hooks if the last recorded access time (in magic data) for the module's config file is less than its last modified time.
      • Default Value: true