Class: I2CE Module: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 9: Line 9:
*Signature: public function __construct()
*Signature: public function __construct()
===action_configure()===
===action_configure()===
Method called to perform the configuration for this module
Method called to perform the configuration for this module All the configuration should take place within the div with id 'moduleConfiguration'
All the configuration should take place within the div with id 'moduleConfiguration'
*Signature: public function action_configure()
*Signature: public function action_configure()
===action_disable()===
===action_disable()===
Perform any actions that a module needs to when it is disabled.
Perform any actions that a module needs to when it is disabled.
*Signature: public function action_disable()
*Signature: public function action_disable()
*Returns: boolean.   Returns true on success, returns false on failure and prevents
*Returns: boolean.<br/>Returns true on success, returns false on failure and prevents the module from being disabled.
the module from being disabled.
===action_enable()===
===action_enable()===
Perform any actions that a module needs to when it is enabled.
Perform any actions that a module needs to when it is enabled.
*Signature: public function action_enable()
*Signature: public function action_enable()
*Returns: boolean.   Returns true on success, returns false on failure and prevents
*Returns: boolean.<br/>Returns true on success, returns false on failure and prevents the module from being enabled.
the module from being enabled.
===action_initialize()===
===action_initialize()===
Method called before the module is enabled for the first time.
Method called before the module is enabled for the first time. @param boolean -- returns true on success. false on error.
@param boolean -- returns true on success. false on error.
*Signature: public function action_initialize()
*Signature: public function action_initialize()
===conflict_external()===
===conflict_external()===
Checks to see if a an external conflict is matched
Checks to see if a an external conflict is matched
*Signature: public function conflict_external($ext,$req_data)
*Signature: public function conflict_external($ext,$req_data)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] true if the external conflict is NOT met.  In other words,
*Parameters:
if you have a valid conflict you should return false, otherwise you should return true
** [http://www.php.net/manual/en/language.types.string.php string ] $ext <br/>The external conflicy
Parameters:
** [http://www.php.net/manual/en/language.types.array.php array ] $req_data <br/>The array of conflict data. such as array(0=>array('operator'=>'atLeast','version'=>'3.1'))
* [http://www.php.net/manual/en/language.types.string.php string ] $ext<br/>The external conflicy
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>true if the external conflict is NOT met.  In other words, if you have a valid conflict you should return false, otherwise you should return true
* [http://www.php.net/manual/en/language.types.array.php array ] $req_data<br/>The array of conflict data. such as array(0=>array('operator'=>'atLeast','version'=>'3.1'))
===getCLIHooks()===
===getCLIHooks()===
Method called to get the modules' hooks which are run from the command line pages
Method called to get the modules' hooks which are run from the command line pages
*Signature: static public function getCLIHooks()
*Signature: static public function getCLIHooks()
*Returns: an associative array where the key is the hookname
*Returns: an<br/>associative array where the key is the hookname and the value is mixed. The first option for the value is that it is a string.  This string is the method name to call. <br/> The second option for the value is that it is an array. This array has key 'method' with value the method of the class to call at the indicated hook.  It also has key 'proiority'  which gives a scheduling priority to the action. <br/> Example we may return: array('pre_page_display'=>array('method'=>'doSomething,'prioriy'=>10), 'post_page_display'=>'array('method'=>doSomethingElse,'priority'=>50), 'post_configure'=>'andNowForSomethingCompletelyDifferent') Each of the methods takes either 0 or 1 argument depending on the hook. For a complete list of hooks and their arguments see....
and the value is mixed.
The first option for the value is that it is a string.  This string is the
method name to call.
<br/>
The second option for the value is that it is an array.
This array has key 'method' with value
the method of the class to call at the indicated hook.  It also has
key 'proiority'  which gives a scheduling priority to the action.
<br/>
Example we may return:
array('pre_page_display'=>array('method'=>'doSomething,'prioriy'=>10),
'post_page_display'=>'array('method'=>doSomethingElse,'priority'=>50),
'post_configure'=>'andNowForSomethingCompletelyDifferent')
 
Each of the methods takes either 0 or 1 argument depending on the hook.
For a complete list of hooks and their arguments see....
===getCLIMethods()===
===getCLIMethods()===
Any 'fuzzy' methods that this module implements on the command line.
Any 'fuzzy' methods that this module implements on the command line.
*Signature: static public function getCLIMethods()
*Signature: static public function getCLIMethods()
*Returns: an associative array.
*Returns: an<br/>associative array. the keys are the form of $key = '$class::$method' where $class is the name of a class which is an instance of I2CE_FuzzyMethod and $method is the name of a $method we wish to add to the class $class and which is not already in the class. the value is the name of a public function in the I2CE_Module subclass which will handle the call to $method. Example: array('I2CE_Template->setForm'=>'setForm') You also have the option of array('I2CE_Template->setForm'=>array('method'=>'setForm','priority'=>100) If you wish to set a priority.  The default proiority is the priority of the module
the keys are the form of $key = '$class::$method'
where $class is the name of a class which is an instance of I2CE_FuzzyMethod
and $method is the name of a $method we wish to add to the class $class
and which is not already in the class.
the value is the name of a public function in the I2CE_Module subclass
which will handle the call to $method.
Example:
array('I2CE_Template->setForm'=>'setForm')
You also have the option of
array('I2CE_Template->setForm'=>array('method'=>'setForm','priority'=>100)
If you wish to set a priority.  The default proiority is the priority of the module
===getConfig()===
===getConfig()===
Get the configuration data for this module
Get the configuration data for this module
Line 76: Line 44:
Method called to get the modules' hooks
Method called to get the modules' hooks
*Signature: static public function getHooks()
*Signature: static public function getHooks()
*Returns: an associative array where the key is the hookname
*Returns: an<br/>associative array where the key is the hookname and the value is mixed. The first option for the value is that it is a string.  This string is the method name to call.  The priority for the method in this case is the priority of the module <br/> The second options is is that each value consists of an array with keys integers, the priority, and values the methods <br/> Example we may return: array('post_configure'=>'andNowForSomethingCompletelyDifferent', 'post_junk'=>array( -10=>'method0' 10=>'method1' 100=>'method2' 1004=>'method3' ) ) <br/> Each of the methods takes either 0 or 1 argument depending on the hook. For a complete list of hooks and their arguments see....
and the value is mixed.
The first option for the value is that it is a string.  This string is the
method name to call.  The priority for the method in this case is the priority of the module
<br/>
The second options is is that each value consists of an array
with keys integers, the priority, and values the methods
<br/>
Example we may return:
array('post_configure'=>'andNowForSomethingCompletelyDifferent',
'post_junk'=>array(
-10=>'method0'
10=>'method1'
100=>'method2'
1004=>'method3'
)
)
<br/>
Each of the methods takes either 0 or 1 argument depending on the hook.
For a complete list of hooks and their arguments see....
===getMethods()===
===getMethods()===
Any 'fuzzy' methods that this module implements.
Any 'fuzzy' methods that this module implements.
*Signature: static public function getMethods()
*Signature: static public function getMethods()
*Returns: an associative array.
*Returns: an<br/>associative array. the keys are the form of $key = '$class::$method' where $class is the name of a class which is an instance of I2CE_FuzzyMethod and $method is the name of a $method we wish to add to the class $class and which is not already in the class. the value is the name of a public function in the I2CE_Module subclass which will handle the call to $method. Example: array('I2CE_Template->setForm'=>'setForm') You also have the option of array('I2CE_Template->setForm'=>array('method'=>'setForm','priority'=>100) If you wish to set a priority.  The default proiority is the priority of the module
the keys are the form of $key = '$class::$method'
where $class is the name of a class which is an instance of I2CE_FuzzyMethod
and $method is the name of a $method we wish to add to the class $class
and which is not already in the class.
the value is the name of a public function in the I2CE_Module subclass
which will handle the call to $method.
Example:
array('I2CE_Template->setForm'=>'setForm')
You also have the option of
array('I2CE_Template->setForm'=>array('method'=>'setForm','priority'=>100)
If you wish to set a priority.  The default proiority is the priority of the module
===post_update()===
===post_update()===
Post Update this module if necessary
Post Update this module if necessary
*Signature: public function post_update($old_vers,$new_vers)
*Signature: public function post_update($old_vers,$new_vers)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $old_vers
** [http://www.php.net/manual/en/language.types.string.php string ] $new_vers
*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 ] $old_vers
* [http://www.php.net/manual/en/language.types.string.php string ] $new_vers
===pre_upgrade()===
===pre_upgrade()===
Run the pre upgrade for this module.  This can use the old config data before it
Run the pre upgrade for this module.  This can use the old config data before it has been changed from the config.
has been changed from the config.
*Signature: public function pre_upgrade($old_vers,$new_vers,$new_storage)
*Signature: public function pre_upgrade($old_vers,$new_vers,$new_storage)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $old_vers
** [http://www.php.net/manual/en/language.types.string.php string ] $new_vers
** [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $new_storage
*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 ] $old_vers
* [http://www.php.net/manual/en/language.types.string.php string ] $new_vers
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $new_storage
===requirement_external()===
===requirement_external()===
Checks to see if a an external requirement is avaialable
Checks to see if a an external requirement is avaialable
*Signature: public function requirement_external($ext,$req_data)
*Signature: public function requirement_external($ext,$req_data)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] true if the external reuqirement is available
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $ext <br/>The external requirement.
* [http://www.php.net/manual/en/language.types.string.php string ] $ext<br/>The external requirement.
** [http://www.php.net/manual/en/language.types.array.php array ] $req_data <br/>The array of conflict data. such as array(0=>array('operator'=>'atLeast','version'=>'3.1'))
* [http://www.php.net/manual/en/language.types.array.php array ] $req_data<br/>The array of conflict data. such as array(0=>array('operator'=>'atLeast','version'=>'3.1'))
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>true if the external reuqirement is available
===upgrade()===
===upgrade()===
Upgrade this module if necessary
Upgrade this module if necessary
*Signature: public function upgrade($old_vers,$new_vers)
*Signature: public function upgrade($old_vers,$new_vers)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $old_vers
** [http://www.php.net/manual/en/language.types.string.php string ] $new_vers
*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 ] $old_vers
* [http://www.php.net/manual/en/language.types.string.php string ] $new_vers
==Inherited Fuzzy Methods==
==Inherited Fuzzy Methods==
===userMessage()===
===userMessage()===

Revision as of 22:40, 16 October 2009

This article desrcibes the1 class I2CE_Module.

The abstract class for that all modules must implement

Methods

__construct()

Construct this object

  • Signature: public function __construct()

action_configure()

Method called to perform the configuration for this module All the configuration should take place within the div with id 'moduleConfiguration'

  • Signature: public function action_configure()

action_disable()

Perform any actions that a module needs to when it is disabled.

  • Signature: public function action_disable()
  • Returns: boolean.
    Returns true on success, returns false on failure and prevents the module from being disabled.

action_enable()

Perform any actions that a module needs to when it is enabled.

  • Signature: public function action_enable()
  • Returns: boolean.
    Returns true on success, returns false on failure and prevents the module from being enabled.

action_initialize()

Method called before the module is enabled for the first time. @param boolean -- returns true on success. false on error.

  • Signature: public function action_initialize()

conflict_external()

Checks to see if a an external conflict is matched

  • Signature: public function conflict_external($ext,$req_data)
  • Parameters:
    • string $ext
      The external conflicy
    • array $req_data
      The array of conflict data. such as array(0=>array('operator'=>'atLeast','version'=>'3.1'))
  • Returns: boolean
    true if the external conflict is NOT met. In other words, if you have a valid conflict you should return false, otherwise you should return true

getCLIHooks()

Method called to get the modules' hooks which are run from the command line pages

  • Signature: static public function getCLIHooks()
  • Returns: an
    associative array where the key is the hookname and the value is mixed. The first option for the value is that it is a string. This string is the method name to call.
    The second option for the value is that it is an array. This array has key 'method' with value the method of the class to call at the indicated hook. It also has key 'proiority' which gives a scheduling priority to the action.
    Example we may return: array('pre_page_display'=>array('method'=>'doSomething,'prioriy'=>10), 'post_page_display'=>'array('method'=>doSomethingElse,'priority'=>50), 'post_configure'=>'andNowForSomethingCompletelyDifferent') Each of the methods takes either 0 or 1 argument depending on the hook. For a complete list of hooks and their arguments see....

getCLIMethods()

Any 'fuzzy' methods that this module implements on the command line.

  • Signature: static public function getCLIMethods()
  • Returns: an
    associative array. the keys are the form of $key = '$class::$method' where $class is the name of a class which is an instance of I2CE_FuzzyMethod and $method is the name of a $method we wish to add to the class $class and which is not already in the class. the value is the name of a public function in the I2CE_Module subclass which will handle the call to $method. Example: array('I2CE_Template->setForm'=>'setForm') You also have the option of array('I2CE_Template->setForm'=>array('method'=>'setForm','priority'=>100) If you wish to set a priority. The default proiority is the priority of the module

getConfig()

Get the configuration data for this module

getHooks()

Method called to get the modules' hooks

  • Signature: static public function getHooks()
  • Returns: an
    associative array where the key is the hookname and the value is mixed. The first option for the value is that it is a string. This string is the method name to call. The priority for the method in this case is the priority of the module
    The second options is is that each value consists of an array with keys integers, the priority, and values the methods
    Example we may return: array('post_configure'=>'andNowForSomethingCompletelyDifferent', 'post_junk'=>array( -10=>'method0' 10=>'method1' 100=>'method2' 1004=>'method3' ) )
    Each of the methods takes either 0 or 1 argument depending on the hook. For a complete list of hooks and their arguments see....

getMethods()

Any 'fuzzy' methods that this module implements.

  • Signature: static public function getMethods()
  • Returns: an
    associative array. the keys are the form of $key = '$class::$method' where $class is the name of a class which is an instance of I2CE_FuzzyMethod and $method is the name of a $method we wish to add to the class $class and which is not already in the class. the value is the name of a public function in the I2CE_Module subclass which will handle the call to $method. Example: array('I2CE_Template->setForm'=>'setForm') You also have the option of array('I2CE_Template->setForm'=>array('method'=>'setForm','priority'=>100) If you wish to set a priority. The default proiority is the priority of the module

post_update()

Post Update this module if necessary

  • Signature: public function post_update($old_vers,$new_vers)
  • Parameters:
  • Returns: boolean

pre_upgrade()

Run the pre upgrade for this module. This can use the old config data before it has been changed from the config.

requirement_external()

Checks to see if a an external requirement is avaialable

  • Signature: public function requirement_external($ext,$req_data)
  • Parameters:
    • string $ext
      The external requirement.
    • array $req_data
      The array of conflict data. such as array(0=>array('operator'=>'atLeast','version'=>'3.1'))
  • Returns: boolean
    true if the external reuqirement is available

upgrade()

Upgrade this module if necessary

  • Signature: public function upgrade($old_vers,$new_vers)
  • Parameters:
  • Returns: boolean

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()

Fuzzy Methods

launchBackgroundProcess()

This method is implemented by I2CE_BackgroundProcess->launchBackgroundProcess()

launchBackgroundPHPScript()

This method is implemented by I2CE_BackgroundProcess->launchBackgroundPHPScript()

launchBackgroundPage()

This method is implemented by I2CE_BackgroundProcess->launchBackgroundPage()