Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • areyouahuman
      • auth
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
        • default
      • exchange
        • rates
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • quickbooks
            • invoice
      • json
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • recaptcha
      • reports
        • aging
          • invoices
        • custom
          • report
        • invoice
          • creation
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • form
      • html
      • javascript
      • xml
    • lib
  • None
  • PHP

Classes

  • Accounts
  • ApiKeys
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • ModuleClientMeta
  • ModuleManager
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • Taxes
  • Themes
  • Transactions
  • Users

Class ModuleManager

Module manager. Handles installing/uninstalling and configuring modules.

Model
Extended by AppModel
Extended by ModuleManager
Package: blesta\app\models
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/module_manager.php

Methods summary

public
# __construct( )

Initialize ModuleManager

Initialize ModuleManager

Overrides

AppModel::__construct
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
# getInstalled( )

Fetches all modules installed in the system

Fetches all modules installed in the system

Returns

array
An array of stdClass objects, each representing an installed module record
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

AppModel::errors()
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

AppModel::errors()
public integer
# editRow( integer $module_row_id, array $vars )

Edits a module row

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

AppModel::errors()
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

AppModel::errors()
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

AppModel::errors()
public mixed
# moduleRpc( integer $module_id, string $method, array $params = null, integer $module_row_id = 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
$module_row_id
integer
$module_row_id The module row ID to initialize with

Returns

mixed
The value returned from the module for the requested method

See

AppModel::errors()
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
# validateAssignedToPackage( integer $module_id, string $status = null )

Validates that the given module

Validates that the given module

Parameters

$module_id
integer
$module_id The ID of the module to check
$status
string
The status type (null for all services, service type, or ! service type). For example: - active (only active service) - !active (only not active service)

Returns

boolean
True if the module_id is not assigned to any packages, false if it is
public boolean
# validateAssignedToService( integer $module_row_id = null, integer $module_id = null, string $status = null )

Validates that the given module row ID, or module ID, is not assigned to any service

Validates that the given module row ID, or module ID, is not assigned to any service

Parameters

$module_row_id
integer
$module_row_id The ID of the module row to check
$module_id
integer
$module_id The ID of the module to check
$status
string
The status type (null for all services, service type, or ! service type). For example: - active (only active service) - !active (only not active service)

Returns

boolean
True if the module row is not assigned to any active service, false if it is

Methods inherited from AppModel

_(), boolToInt(), currencyToDecimal(), dateToUtc(), errors(), getPerPage(), ifSet(), loadCrypto(), setDefaultIfEmpty(), setPerPage(), setRulesIfSet(), strToBool(), systemDecrypt(), systemEncrypt(), systemHash(), truncateDecimal(), validateExists(), validateStateCountry()

Methods inherited from Model

affectedRows(), begin(), commit(), getConnection(), lastInsertId(), makeDSN(), prepare(), query(), rollBack(), setAttribute(), setFetchMode()

Magic methods summary

Properties summary

Properties inherited from AppModel

$replacement_keys

Blesta API documentation generated by ApiGen 2.8.0