public
|
#
__construct( )
Initialize ModuleManager
Overrides
|
public
mixed
|
#
get( integer $module_id, boolean $rows = true, boolean $groups = true )
Fetches a single installed module including all of its module rows and meta
data
Fetches a single installed module including all of its module rows and meta
data
Parameters
- $module_id
integer $module_id The ID of the module to fetch
- $rows
boolean $rows True to fetch all module rows with this entry, false otherwise
- $groups
boolean $groups True to fetch all module groups with this entry, false otherwise
Returns
mixed A stdClass object representing the installed module, false if no such module
exists
|
public
array
|
#
getAll( integer $company_id, string $sort_by = "name", string $order = "asc" )
Lists all installed modules
Lists all installed modules
Parameters
- $company_id
integer $company_id The company ID
- $sort_by
string $sort_by The field to sort by
- $order
string $order The direction to order results
Returns
array An array of stdClass objects representing installed modules
|
public
array
|
#
getRows( integer $module_id, integer $module_group_id = null )
Retrieves a list of module rows for a given module ID, including meta
data
Retrieves a list of module rows for a given module ID, including meta
data
Parameters
- $module_id
integer $module_id The module ID
- $module_group_id
integer $module_group_id The ID of the module group to filter on (optional)
Returns
array An array of stdClass objects reperesenting all module rows for this module
|
public
stdClass
|
#
getRow( integer $module_row_id )
Retrieves a module row, including meta data
Retrieves a module row, including meta data
Parameters
- $module_row_id
integer $module_row_id The ID of the module row to fetch
Returns
stdClass
A stdClass object representing a module row
|
public
array
|
#
getGroups( integer $module_id )
Retrieves a list of module groups for this given module ID
Retrieves a list of module groups for this given module ID
Parameters
- $module_id
integer $module_id The ID of the module to fetch groups for
Returns
array An array of stdClass objects representing module groups
|
public
stdClass
|
#
getGroup( integer $module_group_id )
Retrieves a specific module group
Retrieves a specific module group
Parameters
- $module_group_id
integer $module_group_id The ID of the module group to fetch
Returns
stdClass
A stdClass objects representing the module group
|
public
An
|
#
getMeta( integer $module_id, string $key = null )
Retrieves a list of module meta data for a given module ID
Retrieves a list of module meta data for a given module ID
Parameters
- $module_id
integer $module_id The module ID
- $key
string $key The module meta key representing a specific meta value (optional)
Returns
An array of stdClass objects reperesenting all module meta info for this module
|
public
An
|
#
getRowMeta( integer $module_row_id, string $key = null )
Retrieves a list of module row meta data for a given module row ID
Retrieves a list of module row meta data for a given module row ID
Parameters
- $module_row_id
integer $module_row_id The module row ID
- $key
string $key The module row key representing a specific meta value (optional)
Returns
An array of stdClass objects reperesenting all module rows for this module
|
public
array
|
#
getAvailable( integer $company_id = null )
Lists all available modules (those that exist on the file system)
Lists all available modules (those that exist on the file system)
Parameters
- $company_id
integer $company_id The ID of the company to get available modules for
Returns
array An array of stdClass objects representing available modules
|
public
boolean
|
#
isInstalled( string $class, string $company_id = null )
Checks whether the given module is installed for the specified company
Checks whether the given module is installed for the specified company
Parameters
- $class
string $class The module class (in file_case)
- $company_id
string $company_id The ID of hte company to fetch for (null checks if the module is
installed across any company)
Returns
boolean True if the module is installed, false otherwise
|
public
integer
|
#
add( array $vars )
Adds the module to the system, executing the Module::install() method
Adds the module to the system, executing the Module::install() method
Parameters
- $vars
array $vars An array of module data including: - company_id - class
Returns
integer The ID of the module installed, void on error
|
public
|
#
upgrade( integer $module_id )
Runs the module's upgrade method to upgrade the module to match that of the
module's file version. Sets errors in ModuleManager::errors() if any errors are
set by the module's upgrade method.
Runs the module's upgrade method to upgrade the module to match that of the
module's file version. Sets errors in ModuleManager::errors() if any errors are
set by the module's upgrade method.
Parameters
- $module_id
integer $module_id The ID of the module to upgrade
See
|
public
|
#
setMeta( integer $module_id, array $vars )
Updates the meta data for the given module, removing all existing data and
replacing it with the given data
Updates the meta data for the given module, removing all existing data and
replacing it with the given data
Parameters
- $module_id
integer $module_id The ID of the module to update
- $vars
array $vars A numerically indexed array of meta data containing: - key The key for
this meta field - value The value for this key - encrypted Whether or not this
field should be encrypted (default 0, not encrypted)
|
public
|
#
delete( integer $module_id )
Permanently and completely removes the module from the database, along with
all module records. Executes the Modules::uninstall() method
Permanently and completely removes the module from the database, along with
all module records. Executes the Modules::uninstall() method
Parameters
- $module_id
integer $module_id The ID of the module to permanently and completely remove
|
public
integer
|
#
addRow( integer $module_id, array $vars )
Adds a new module row for the given module
Adds a new module row for the given module
Parameters
- $module_id
integer $module_id The ID of the module to add a row to
- $vars
array $vars An array of key/value pairs to be sent to the module for conversion into
module row meta data
Returns
integer The module Row ID, void on error
See
|
public
integer
|
#
editRow( integer $module_row_id, array $vars )
Edits a module row
Parameters
- $module_row_id
integer $module_row_id The ID of the module row to update
- $vars
array $vars An array of key/value pairs to be sent to the module for conversion into
module row meta data
Returns
integer The module Row ID, void on error
See
|
public
|
#
deleteRow( integer $module_row_id )
Permanently removes a module row and its related meta data if safe to do
so.
Permanently removes a module row and its related meta data if safe to do
so.
Parameters
- $module_row_id
integer $module_row_id The ID of the module row to remove
See
|
public
integer
|
#
addGroup( integer $module_id, array $vars )
Adds a module group to the system
Adds a module group to the system
Parameters
- $module_id
integer $module_id The ID of the module to add the group under
- $vars
array An array of module group data including: - name The name of the module group -
module_rows A numerically indexed array of module row IDs to assign to this
group - add_order A key used to determine the order in which module rows are
selected from this group when provisioning a service
Returns
integer The module group ID, void if error
|
public
|
#
editGroup( integer $module_group_id, array $vars )
Updates a module group to the system
Updates a module group to the system
Parameters
- $module_group_id
integer $module_group_id The ID of the module group to update
- $vars
array An array of module group data including: - name The name of the module group -
module_rows A numerically indexed array of module row IDs to assign to this
group
|
public
|
#
deleteGroup( integer $module_group_id )
Permanently removes the module group if safe to do so.
Permanently removes the module group if safe to do so.
Parameters
- $module_group_id
integer $module_group_id The ID of the module group to remove
See
|
public
mixed
|
#
moduleRpc( integer $module_id, string $method, array $params = null )
Invokes the given method with the given parameters on the give module,
returning the result from the module.
Invokes the given method with the given parameters on the give module,
returning the result from the module.
Parameters
- $module_id
integer $module_id The ID of the module to initialize
- $method
string $method The name of the method to invoke on the module
- $params
array $params An array of parameters to pass to the method to be invoked
Returns
mixed The value returned from the module for the requested method
See
|
public
Module
|
#
initModule( integer $module_id, integer $company_id = null )
Initializes the module if it has been installed and returns its instance
Initializes the module if it has been installed and returns its instance
Parameters
- $module_id
integer $module_id The ID of the module to initialize
- $company_id
integer $company_id If set will check to ensure the module belongs to the given
company_id
Returns
Module
An object of type Module if the requested module has been installed and exists,
false otherwise
|
public
boolean
|
#
validateBelongsToModule( mixed $module_row_id, mixed $module_id )
Validates that the given module row ID belongs to the given module ID
Validates that the given module row ID belongs to the given module ID
Parameters
- $module_row_id
mixed $module_row_id The ID of the module row to check
- $module_id
mixed $module_id The ID of the module to check against the module row ID
Returns
boolean True if the module row ID belongs to the module or is empty, false otherwise.
|
public
boolean
|
#
validateAssignedToService( mixed $module_row_id )
Validates that the given module row ID is not assigned to any active (i.e.
uncanceled) service
Validates that the given module row ID is not assigned to any active (i.e.
uncanceled) service
Parameters
- $module_row_id
mixed $module_row_id The ID of the module row to check
Returns
boolean True if the module row is not assigned to any active service, false if it is
|
private
|
#
setGroupAssignment( integer $module_group_id, array $module_rows )
Sets the group assignment for the given module group and set of rows
Sets the group assignment for the given module group and set of rows
Parameters
- $module_group_id
integer $module_group_id The ID of the module group to record row group assignments on
- $module_rows
array $module_rows A numerically indexed array of module row ID's to assign to this
group
|
private
|
#
setVersion( string $class, string $version )
Updates all installed modules with the version given
Updates all installed modules with the version given
Parameters
- $class
string $class The class name of the module to update
- $version
string $version The version number to set for each module instance
|
private
An
|
#
loadModule( string $class )
Instantiates the given module and returns its instance
Instantiates the given module and returns its instance
Parameters
- $class
string $class The name of the class in file_case to load
Returns
An instance of the module specified
|
private
array
|
#
getModuleInfo( object $module, integer $company_id )
Fetch information about the given module object
Fetch information about the given module object
Parameters
- $module
object $module The module object to fetch info on
- $company_id
integer $company_id The ID of the company to fetch the module info for
Returns
array key=>value pairs of module info
|
private
|
#
formatRawMeta( array $raw_meta )
Formats an array of raw meta stdClass objects into a stdClass object whose
public member variables represent meta keys and whose values are automatically
decrypted and unserialized as necessary.
Formats an array of raw meta stdClass objects into a stdClass object whose
public member variables represent meta keys and whose values are automatically
decrypted and unserialized as necessary.
Parameters
- $raw_meta
array $raw_meta An array of stdClass objects representing meta data
|