Methods summary
public
string
|
#
getName( )
Returns the name of this module
Returns the name of this module
Returns
string The common name of this module
|
public
string
|
#
getDescription( )
Returns the description of this module
Returns the description of this module
Returns
string The description of this module
|
public
string
|
#
getVersion( )
Returns the version of this module
Returns the version of this module
Returns
string The current version of this module
|
public
string
|
#
getType( )
Returns the type of this module
Returns the type of this module
Returns
string The type of this module
|
public
array
|
#
getAuthors( )
Returns the name and URL for the authors of this module
Returns the name and URL for the authors of this module
Returns
array A numerically indexed array that contains an array
with key/value pairs for 'name' and 'url', representing the name
and URL of the authors of this module
|
public
string
|
#
getServiceName( stdClass $service )
Returns the value used to identify a particular service
Returns the value used to identify a particular service
Parameters
- $service
- A stdClass object representing the service
Returns
string A value used to identify this service amongst other similar services
|
public
string
|
#
moduleRowName( )
Returns a noun used to refer to a module row (e.g. "Server", "VPS", "Reseller Account", etc.)
Returns a noun used to refer to a module row (e.g. "Server", "VPS", "Reseller Account", etc.)
Returns
string The noun used to refer to a module row
|
public
string
|
#
moduleRowNamePlural( )
Returns a noun used to refer to a module row in plural form (e.g. "Servers", "VPSs", "Reseller Accounts", etc.)
Returns a noun used to refer to a module row in plural form (e.g. "Servers", "VPSs", "Reseller Accounts", etc.)
Returns
string The noun used to refer to a module row in plural form
|
public
string
|
#
moduleGroupName( )
Returns a noun used to refer to a module group (e.g. "Server Group", "Cloud", etc.)
Returns a noun used to refer to a module group (e.g. "Server Group", "Cloud", etc.)
Returns
string The noun used to refer to a module group
|
public
string
|
#
moduleRowMetaKey( )
Returns the key used to identify the primary field from the set of module row meta fields.
This value can be any of the module row meta fields.
Returns the key used to identify the primary field from the set of module row meta fields.
This value can be any of the module row meta fields.
Returns
string The key used to identify the primary field from the set of module row meta fields
|
public
array
|
#
install( )
Performs any necessary bootstraping actions. Sets Input errors on
failure, preventing the module from being added.
Performs any necessary bootstraping actions. Sets Input errors on
failure, preventing the module from being added.
Returns
array 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
|
#
upgrade( string $current_version )
Performs migration of data from $current_version (the current installed version)
to the given file set version. Sets Input errors on failure, preventing
the module from being upgraded.
Performs migration of data from $current_version (the current installed version)
to the given file set version. Sets Input errors on failure, preventing
the module from being upgraded.
Parameters
- $current_version
- The current installed version of this module
|
public
|
#
uninstall( integer $module_id, boolean $last_instance )
Performs any necessary cleanup actions. Sets Input errors on failure
after the module has been uninstalled.
Performs any necessary cleanup actions. Sets Input errors on failure
after the module has been uninstalled.
Parameters
- $module_id
- The ID of the module being uninstalled
- $last_instance
True if $module_id is the last instance
across all companies for this module, false otherwise
|
public
string
|
#
getLogo( )
Returns the relative path from this module's directory to the logo for
this module. Defaults to views/default/images/logo.png
Returns the relative path from this module's directory to the logo for
this module. Defaults to views/default/images/logo.png
Returns
string The relative path to the module's logo
|
public
|
#
cron( string $key )
Runs the cron task identified by the key used to create the cron task
Runs the cron task identified by the key used to create the cron task
Parameters
- $key
- The key used to create the cron task
See
|
final public
|
#
setModule( stdClass $module )
Sets the module to be used for any subsequent requests
Sets the module to be used for any subsequent requests
Parameters
- $module
- stdClass object representing the module
See
|
final public
|
#
setModuleRow( stdClass $module_row )
Sets the module row to be used for any subsequent requests
Sets the module row to be used for any subsequent requests
Parameters
- $module_row
- stdClass object representing the module row
See
|
final public
stdClass
|
#
getModule( )
Fetches the module currently in use
Fetches the module currently in use
Returns
stdClass A stdClass object representing the module
|
final public
stdClass
|
#
getModuleRow( integer $module_row_id = null )
Fetches the requested module row for the current module
Fetches the requested module row for the current module
Parameters
- $module_row_id
- The ID of the module row to fetch for the current module
Returns
stdClass A stdClass object representing the module row
|
final public
array
|
#
getModuleRows( integer $module_group_id = null )
Returns all module rows available to the current module
Returns all module rows available to the current module
Parameters
- $module_group_id
- The ID of the module group to filter rows by
Returns
array An array of stdClass objects each representing a module row, false if no module set
|
public
string
|
#
getPackageServiceName( stdClass $packages, array $vars = null )
Returns the value used to identify a particular package service which has
not yet been made into a service. This may be used to uniquely identify
an uncreated service of the same package (i.e. in an order form checkout)
Returns the value used to identify a particular package service which has
not yet been made into a service. This may be used to uniquely identify
an uncreated service of the same package (i.e. in an order form checkout)
Parameters
- $packages
- A stdClass object representing the selected package
- $vars
- An array of user supplied info to satisfy the request
Returns
string The value used to identify this package service
See
|
public
boolean
|
#
validateService( stdClass $package, array $vars = null )
Attempts to validate service info. This is the top-level error checking method. Sets Input errors on failure.
Attempts to validate service info. This is the top-level error checking method. Sets Input errors on failure.
Parameters
- $package
- A stdClass object representing the selected package
- $vars
An array of user supplied info to satisfy the request:
- configoptions An array of key/value pairs of package options where
the key is the package option label and the value is the option value (optional)
Returns
boolean True if the service validates, false otherwise. Sets Input errors when false.
|
public
boolean
|
#
validateServiceEdit( stdClass $service, array $vars = null )
Attempts to validate an existing service against a set of service info updates. Sets Input errors on failure.
Attempts to validate an existing service against a set of service info updates. Sets Input errors on failure.
Parameters
- $service
- A stdClass object representing the service to validate for editing
- $vars
An array of user-supplied info to satisfy the request:
- configoptions An array of key/value pairs of package options where
the key is the package option label and the value is the option value (optional)
Returns
boolean True if the service update validates or false otherwise. Sets Input errors when false.
|
public
array
|
#
addService( stdClass $package, array $vars = null, stdClass $parent_package = null, stdClass $parent_service = null, string $status = 'pending' )
Adds the service to the remote server. Sets Input errors on failure,
preventing the service from being added.
Adds the service to the remote server. Sets Input errors on failure,
preventing the service from being added.
Parameters
- $package
- A stdClass object representing the selected package
- $vars
An array of user supplied info to satisfy the request:
- configoptions An array of key/value pairs of package options where
the key is the package option label and the value is the option value (optional)
- $parent_package
A stdClass object representing the parent
service's selected package (if the current service is an addon service)
- $parent_service
A stdClass object representing the parent
service of the service being added (if the current service is an addon
service and parent service has already been provisioned)
- $status
The status of the service being added. These include:
- active
- canceled
- pending
- suspended
Returns
array A numerically indexed array of meta fields to be stored for this service 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)
See
|
public
array
|
#
editService( stdClass $package, stdClass $service, array $vars = [], stdClass $parent_package = null, stdClass $parent_service = null )
Edits the service on the remote server. Sets Input errors on failure,
preventing the service from being edited.
Edits the service on the remote server. Sets Input errors on failure,
preventing the service from being edited.
Parameters
- $package
- A stdClass object representing the current package
- $service
- A stdClass object representing the current service
- $vars
An array of user supplied info to satisfy the request:
- configoptions An array of key/value pairs of package options where
the key is the package option label and the value is the option value (optional)
- $parent_package
A stdClass object representing the parent
service's selected package (if the current service is an addon service)
- $parent_service
A stdClass object representing the parent
service of the service being edited (if the current service is an addon service)
Returns
array A numerically indexed array of meta fields to be stored for this service 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)
See
|
public
mixed
|
#
cancelService( stdClass $package, stdClass $service, stdClass $parent_package = null, stdClass $parent_service = null )
Cancels the service on the remote server. Sets Input errors on failure,
preventing the service from being canceled.
Cancels the service on the remote server. Sets Input errors on failure,
preventing the service from being canceled.
Parameters
- $package
- A stdClass object representing the current package
- $service
- A stdClass object representing the current service
- $parent_package
A stdClass object representing the parent
service's selected package (if the current service is an addon service)
- $parent_service
A stdClass object representing the parent
service of the service being canceled (if the current service is an addon service)
Returns
mixed null to maintain the existing meta fields or a numerically
indexed array of meta fields to be stored for this service 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)
See
|
public
mixed
|
#
suspendService( stdClass $package, stdClass $service, stdClass $parent_package = null, stdClass $parent_service = null )
Suspends the service on the remote server. Sets Input errors on failure,
preventing the service from being suspended.
Suspends the service on the remote server. Sets Input errors on failure,
preventing the service from being suspended.
Parameters
- $package
- A stdClass object representing the current package
- $service
- A stdClass object representing the current service
- $parent_package
A stdClass object representing the parent
service's selected package (if the current service is an addon service)
- $parent_service
A stdClass object representing the parent
service of the service being suspended (if the current service is an addon service)
Returns
mixed null to maintain the existing meta fields or a numerically
indexed array of meta fields to be stored for this service 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)
See
|
public
mixed
|
#
unsuspendService( stdClass $package, stdClass $service, stdClass $parent_package = null, stdClass $parent_service = null )
Unsuspends the service on the remote server. Sets Input errors on failure,
preventing the service from being unsuspended.
Unsuspends the service on the remote server. Sets Input errors on failure,
preventing the service from being unsuspended.
Parameters
- $package
- A stdClass object representing the current package
- $service
- A stdClass object representing the current service
- $parent_package
A stdClass object representing the parent
service's selected package (if the current service is an addon service)
- $parent_service
A stdClass object representing the parent
service of the service being unsuspended (if the current service is an addon service)
Returns
mixed null to maintain the existing meta fields or a numerically
indexed array of meta fields to be stored for this service 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)
See
|
public
mixed
|
#
renewService( stdClass $package, stdClass $service, stdClass $parent_package = null, stdClass $parent_service = null )
Allows the module to perform an action when the service is ready to renew.
Sets Input errors on failure, preventing the service from renewing.
Allows the module to perform an action when the service is ready to renew.
Sets Input errors on failure, preventing the service from renewing.
Parameters
- $package
- A stdClass object representing the current package
- $service
- A stdClass object representing the current service
- $parent_package
A stdClass object representing the parent
service's selected package (if the current service is an addon service)
- $parent_service
A stdClass object representing the parent
service of the service being renewed (if the current service is an addon service)
Returns
mixed null to maintain the existing meta fields or a numerically
indexed array of meta fields to be stored for this service 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)
See
|
public
mixed
|
#
changeServicePackage( stdClass $package_from, stdClass $package_to, stdClass $service, stdClass $parent_package = null, stdClass $parent_service = null )
Updates the package for the service on the remote server. Sets Input
errors on failure, preventing the service's package from being changed.
Updates the package for the service on the remote server. Sets Input
errors on failure, preventing the service's package from being changed.
Parameters
- $package_from
- A stdClass object representing the current package
- $package_to
- A stdClass object representing the new package
- $service
- A stdClass object representing the current service
- $parent_package
A stdClass object representing the parent
service's selected package (if the current service is an addon service)
- $parent_service
A stdClass object representing the parent
service of the service being changed (if the current service is an addon service)
Returns
mixed null to maintain the existing meta fields or a numerically
indexed array of meta fields to be stored for this service 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)
See
|
public
array
|
#
addPackage( array $vars = null )
Validates input data when attempting to add a package, returns the meta
data to save when adding a package. Performs any action required to add
the package on the remote server. Sets Input errors on failure,
preventing the package from being added.
Validates input data when attempting to add a package, returns the meta
data to save when adding a package. Performs any action required to add
the package on the remote server. Sets Input errors on failure,
preventing the package from being added.
Parameters
- $vars
- array of key/value pairs used to add the package
Returns
array A numerically indexed array of meta fields to be stored for this package 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)
See
|
public
array
|
#
editPackage( stdClass $package, array $vars = null )
Validates input data when attempting to edit a package, returns the meta
data to save when editing a package. Performs any action required to edit
the package on the remote server. Sets Input errors on failure,
preventing the package from being edited.
Validates input data when attempting to edit a package, returns the meta
data to save when editing a package. Performs any action required to edit
the package on the remote server. Sets Input errors on failure,
preventing the package from being edited.
Parameters
- $package
- A stdClass object representing the selected package
- $vars
- array of key/value pairs used to edit the package
Returns
array A numerically indexed array of meta fields to be stored for this package 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)
See
|
public
|
#
deletePackage( stdClass $package )
Deletes the package on the remote server. Sets Input errors on failure,
preventing the package from being deleted.
Deletes the package on the remote server. Sets Input errors on failure,
preventing the package from being deleted.
Parameters
- $package
- A stdClass object representing the selected package
See
|
public
string
|
#
manageModule( mixed $module, array & $vars )
Returns the rendered view of the manage module page
Returns the rendered view of the manage module page
Parameters
- $module
- A stdClass object representing the module and its rows
- $vars
An array of post data submitted to or on the manage
module page (used to repopulate fields after an error)
Returns
string HTML content containing information to display when
viewing the manager module page
|
public
string
|
#
manageAddRow( array & $vars )
Returns the rendered view of the add module row page
Returns the rendered view of the add module row page
Parameters
- $vars
An array of post data submitted to or on the add
module row page (used to repopulate fields after an error)
Returns
string HTML content containing information to display when
viewing the add module row page
|
public
string
|
#
manageEditRow( stdClass $module_row, array & $vars )
Returns the rendered view of the edit module row page
Returns the rendered view of the edit module row page
Parameters
- $module_row
- The stdClass representation of the existing module row
- $vars
An array of post data submitted to or on the edit
module row page (used to repopulate fields after an error)
Returns
string HTML content containing information to display when
viewing the edit module row page
|
public
array
|
#
addModuleRow( array & $vars )
Adds the module row on the remote server. Sets Input errors on failure,
preventing the row from being added.
Adds the module row on the remote server. Sets Input errors on failure,
preventing the row from being added.
Parameters
- $vars
- An array of module info to add
Returns
array A numerically indexed array of meta fields for the module row 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
array
|
#
editModuleRow( stdClass $module_row, array & $vars )
Edits the module row on the remote server. Sets Input errors on failure,
preventing the row from being updated.
Edits the module row on the remote server. Sets Input errors on failure,
preventing the row from being updated.
Parameters
- $module_row
- The stdClass representation of the existing module row
- $vars
- An array of module info to update
Returns
array A numerically indexed array of meta fields for the module row 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
|
#
deleteModuleRow( stdClass $module_row )
Deletes the module row on the remote server. Sets Input errors on failure,
preventing the row from being deleted.
Deletes the module row on the remote server. Sets Input errors on failure,
preventing the row from being deleted.
Parameters
- $module_row
- The stdClass representation of the existing module row
|
public
array
|
#
getGroupOrderOptions( )
Returns an array of available service delegation order methods. The module
will determine how each method is defined. For example, the method "first"
may be implemented such that it returns the module row with the least number
of services assigned to it.
Returns an array of available service delegation order methods. The module
will determine how each method is defined. For example, the method "first"
may be implemented such that it returns the module row with the least number
of services assigned to it.
Returns
array An array of order methods in key/value pairs where the key
is the type to be stored for the group and value is the name for that option
See
|
public
integer
|
#
selectModuleRow( integer $module_group_id )
Determines which module row should be attempted when a service is provisioned
for the given group based upon the order method set for that group.
Determines which module row should be attempted when a service is provisioned
for the given group based upon the order method set for that group.
Parameters
- $module_group_id
- The ID of the module group from which to select a row
Returns
integer The module row ID to attempt to add the service with
See
|
protected
|
#
attachPriorityScheduleCallback( PhillipsData\PrioritySchedule\ScheduleInterface $schedule )
Sets a callback function to the schedule for comparing module rows
Sets a callback function to the schedule for comparing module rows
Parameters
- $schedule
- The selected schedule to use for fetching a module row
|
public
ModuleFields
|
#
getPackageFields( $vars = null )
Returns all fields used when adding/editing a package, including any
javascript to execute when the page is rendered with these fields.
Returns all fields used when adding/editing a package, including any
javascript to execute when the page is rendered with these fields.
Parameters
- $vars
- A stdClass object representing a set of post fields
Returns
ModuleFields A ModuleFields object, containg the fields to render
as well as any additional HTML markup to include
|
public
array
|
#
getEmailTags( )
Returns an array of key values for fields stored for a module, package,
and service under this module, used to substitute those keys with their
actual module, package, or service meta values in related emails.
Returns an array of key values for fields stored for a module, package,
and service under this module, used to substitute those keys with their
actual module, package, or service meta values in related emails.
Returns
array A multi-dimensional array of key/value pairs where each key
is one of 'module', 'package', or 'service' and each value is a numerically
indexed array of key values that match meta fields under that category.
See
Modules::addModuleRow()
Modules::editModuleRow()
Modules::addPackage()
Modules::editPackage()
Modules::addService()
Modules::editService()
|
public
array
|
#
getEmailTemplate( )
Returns the email template of this module
Returns the email template of this module
Returns
array A multi-dimensional array of key/value pairs where each key
is the language code and each value is a key/value array containing the 'text'
and 'html' template.
|
public
ModuleFields
|
#
getAdminAddFields( stdClass $package, $vars = null )
Returns all fields to display to an admin attempting to add a service with the module
Returns all fields to display to an admin attempting to add a service with the module
Parameters
- $package
- A stdClass object representing the selected package
- $vars
- A stdClass object representing a set of post fields
Returns
ModuleFields A ModuleFields object, containg the fields to render
as well as any additional HTML markup to include
|
public
ModuleFields
|
#
getClientAddFields( stdClass $package, $vars = null )
Returns all fields to display to a client attempting to add a service with the module
Returns all fields to display to a client attempting to add a service with the module
Parameters
- $package
- A stdClass object representing the selected package
- $vars
- A stdClass object representing a set of post fields
Returns
ModuleFields A ModuleFields object, containg the fields to render
as well as any additional HTML markup to include
|
public
ModuleFields
|
#
getAdminEditFields( stdClass $package, $vars = null )
Returns all fields to display to an admin attempting to edit a service with the module
Returns all fields to display to an admin attempting to edit a service with the module
Parameters
- $package
- A stdClass object representing the selected package
- $vars
- A stdClass object representing a set of post fields
Returns
ModuleFields A ModuleFields object, containg the fields to render
as well as any additional HTML markup to include
|
public
string
|
#
getAdminServiceInfo( stdClass $service, stdClass $package )
Fetches the HTML content to display when viewing the service info in the
admin interface.
Fetches the HTML content to display when viewing the service info in the
admin interface.
Parameters
- $service
- A stdClass object representing the service
- $package
- A stdClass object representing the service's package
Returns
string HTML content containing information to display when viewing the service info
|
public
string
|
#
getClientServiceInfo( stdClass $service, stdClass $package )
Fetches the HTML content to display when viewing the service info in the
client interface.
Fetches the HTML content to display when viewing the service info in the
client interface.
Parameters
- $service
- A stdClass object representing the service
- $package
- A stdClass object representing the service's package
Returns
string HTML content containing information to display when viewing the service info
|
public
array
|
#
getAdminTabs( stdClass $package )
Returns all tabs to display to an admin when managing a service whose
package uses this module
Returns all tabs to display to an admin when managing a service whose
package uses this module
Parameters
- $package
- A stdClass object representing the selected package
Returns
array An array of tabs in the format of method => title.
Example: array('methodName' => "Title", 'methodName2' => "Title2")
|
public
array
|
#
getClientTabs( stdClass $package )
Returns all tabs to display to a client when managing a service whose
package uses this module
Returns all tabs to display to a client when managing a service whose
package uses this module
Parameters
- $package
- A stdClass object representing the selected package
Returns
array An array of tabs in the format of method => title, or method => array where array contains:
- name (required) The name of the link
- icon (optional) use to display a custom icon
- href (optional) use to link to a different URL
Example:
array('methodName' => "Title", 'methodName2' => "Title2")
array('methodName' => array('name' => "Title", 'icon' => "icon"))
|
public
mixed
|
#
errors( )
Return all validation errors encountered
Return all validation errors encountered
Returns
mixed Boolean false if no errors encountered, an array of errors otherwise
|
final protected
|
#
setMessage( string $type, string $message )
Sets a message
Parameters
- $type
- The type of message ('success', 'error", or 'notice')
- $message
- The message text to display
|
final public
array
|
#
getMessages( )
Retrieves a set of messages set by the module
Retrieves a set of messages set by the module
Returns
array An array of messages
|
protected
|
#
httpRequest( string $method, string $url = null, mixed $params = null )
Process a request over HTTP using the supplied method type, url and parameters.
Process a request over HTTP using the supplied method type, url and parameters.
Parameters
- $method
- The method type (e.g. GET, POST)
- $url
- The URL to post to
- $params
- array of parameters or a URL encoded list of key/value pairs
|
protected
string
|
#
log( string $url, string $data = null, string $direction = 'input', boolean $success = false )
Attempts to log the given info to the module log.
Attempts to log the given info to the module log.
Parameters
- $url
- The URL contacted for this request
- $data
- A string of module data sent along with the request (optional)
- $direction
- The direction of the log entry (input or output, default input)
- $success
- True if the request was successful, false otherwise
Returns
string Returns the 8-character group identifier, used to link log entries together
Throws
Exception Thrown if $data was invalid and could not be added to the log
|
protected
stdClass
|
#
serviceFieldsToObject( array $fields )
Converts numerically indexed service field arrays into an object with member variables
Converts numerically indexed service field arrays into an object with member variables
Parameters
- $fields
A numerically indexed array of stdClass objects containing
key and value member variables, or an array containing 'key' and 'value' indexes
Returns
stdClass A stdClass objects with member variables
|
protected
ModuleFields
|
#
arrayToModuleFields( array $arr, ModuleFields $fields = null, stdClass $vars = null )
Converts an array to a ModuleFields object
Converts an array to a ModuleFields object
Parameters
- $arr
array of key/value pairs where each key is the field name and each value is array consisting of:
- label The field label
- type The field type(text, textarea, select, checkbox, radio)
- options A key/value array where each key is the option value and each value
is the option name, or a string to set as the default value for hidden and text inputs
- attributes A key/value array
- $fields
An existing ModuleFields object to append fields to,
null to create create a new object
- $vars
- A stdClass object of input key/value pairs
Returns
|
protected
|
#
loadConfig( string $file )
Loads a given config file
Loads a given config file
Parameters
- $file
- The path to the JSON file to load
|