Overview

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • auth
        • ldap
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
      • exchange
        • rates
          • currency
            • layer
          • fixer
          • open
            • exchange
              • rates
          • x
            • rates
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • perforated
            • invoice
          • quickbooks
            • invoice
          • templates
            • default
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • reports
        • aging
          • invoices
        • client
          • data
            • portability
        • custom
          • report
        • invoice
          • creation
        • package
          • revenue
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • core
      • Automation
        • Tasks
          • Common
          • Task
        • Type
          • Common
          • Cron
      • Pricing
        • ItemComparator
        • MetaItem
        • Modifier
          • Type
            • Description
              • Type
                • Discount
                • Option
                • Service
                • Tax
            • Discount
            • Price
            • Proration
        • Presenter
          • Build
            • Invoice
            • InvoiceData
            • Options
            • Service
            • ServiceChange
            • ServiceData
          • Collection
          • Format
            • Fields
            • Type
              • Discount
              • Item
              • Option
              • Options
              • Package
              • Pricing
              • Service
              • Tax
          • Items
            • Invoice
            • Service
          • Type
      • ServiceProviders
      • Util
        • Captcha
          • Captchas
          • Common
        • Common
          • Traits
        • Events
          • Common
          • Handlers
          • Observers
        • Filters
          • Common
        • GeoIp
        • Input
          • Fields
            • Common
        • Tax
        • Widgets
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • helpers
      • color
      • data
        • structure
  • None
  • PHP

Classes

  • Accounts
  • Actions
  • ApiKeys
  • Backup
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CouponTerms
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • EmailVerifications
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • MessageGroups
  • Messages
  • MessengerManager
  • ModuleClientMeta
  • ModuleManager
  • ModuleTypes
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • ServiceInvoices
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • SystemEvents
  • Taxes
  • Themes
  • Transactions
  • Users
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class MessengerManager

Messenger manager.

Model
Extended by AppModel uses Blesta\Core\Util\Common\Traits\Container
Extended by MessengerManager uses Blesta\Core\Util\Common\Traits\Container
Package: blesta\app\models
Copyright: Copyright (c) 2020, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/messenger_manager.php
Methods summary
public
# __construct( )

Initialize MessengerManager

Initialize MessengerManager

Overrides

AppModel::__construct()
public mixed
# get( integer $messenger_id )

Fetches a single installed messenger including meta data

Fetches a single installed messenger including meta data

Parameters

$messenger_id
The ID of the messenger to fetch

Returns

mixed
A stdClass object representing the installed messenger, false if no such messenger exists
public array
# getByDir( string $dir, integer $company_id = null )

Fetches a messenger for a given company, or all messengers installed in the system for the given messenger dir

Fetches a messenger for a given company, or all messengers installed in the system for the given messenger dir

Parameters

$dir
The dir name (in file_case)
$company_id
The ID of the company to fetch messengers for (optional, default null for all)

Returns

array
An array of stdClass objects, each representing an installed messenger record
public array
# getAll( integer $company_id, string $sort_by = 'name', string $order = 'asc' )

Lists all installed messengers

Lists all installed messengers

Parameters

$company_id
The company ID
$sort_by
The field to sort by
$order
The direction to order results

Returns

array
An array of stdClass objects representing installed messengers
public stdClass
# getMeta( integer $messenger_id, string $key = null )

Retrieves a list of messenger meta data for a given messenger ID

Retrieves a list of messenger meta data for a given messenger ID

Parameters

$messenger_id
The messenger ID
$key
The messenger meta key representing a specific meta value (optional)

Returns

stdClass
An object representing all messenger meta info
public boolean
# isInstalled( string $dir, string $company_id = null )

Checks whether the given messenger is installed for the specified company

Checks whether the given messenger is installed for the specified company

Parameters

$dir
The messenger directory name (in file_case)
$company_id

The ID of the company to fetch for (null checks if the messenger is installed across any company)

Returns

boolean
True if the messenger is installed, false otherwise
public
# upgrade( integer $messenger_id )

Runs the messenger's upgrade method to upgrade the messenger to match that of the messenger's file version. Sets errors in MessengerManager::errors() if any errors are set by the messenger's upgrade method.

Runs the messenger's upgrade method to upgrade the messenger to match that of the messenger's file version. Sets errors in MessengerManager::errors() if any errors are set by the messenger's upgrade method.

Parameters

$messenger_id
The ID of the messenger to upgrade

See

AppModel::errors()
public integer
# add( array $vars )

Adds the messenger to the system, executing the Messenger::install() method

Adds the messenger to the system, executing the Messenger::install() method

Parameters

$vars

An array of messenger data including:

  • company_id The company ID
  • dir The messenger directory name

Returns

integer
The ID of the messenger installed, void on error
public
# delete( integer $messenger_id )

Permanently and completely removes the messenger from the database, along with all messenger records. Executes the Messenger::uninstall() method

Permanently and completely removes the messenger from the database, along with all messenger records. Executes the Messenger::uninstall() method

Parameters

$messenger_id
The ID of the messenger to permanently and completely remove
public array
# getAvailable( integer $company_id = null )

Lists all available messengers (those that exist on the file system)

Lists all available messengers (those that exist on the file system)

Parameters

$company_id
The ID of the company to get available messengers for

Returns

array
An array of stdClass objects representing available messengers
public
# setMeta( integer $messenger_id, array $vars )

Updates the meta data for the given messenger, removing all existing data and replacing it with the given data

Updates the meta data for the given messenger, removing all existing data and replacing it with the given data

Parameters

$messenger_id
The ID of the messenger to update
$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 Messenger
# initMessenger( integer $messenger_id, integer $company_id = null )

Initializes the messenger if it has been installed and returns its instance

Initializes the messenger if it has been installed and returns its instance

Parameters

$messenger_id
The ID of the messenger to initialize
$company_id
If set will check to ensure the messenger belongs to the given company_id

Returns

Messenger
An object of type Messenger if the requested messenger has been installed and exists, false otherwise
public
# send( string $action, array $tags, array $user_ids )

Send a message for the given action

Send a message for the given action

Parameters

$action
The action for which to send a message
$tags
A list of tags to include in the message
$user_ids
A list of IDs for the users that should receive this message
public string
# buildMessage( string $text, integer $company_id, array $tags = null )

Parses message text using the given data ($tags)

Parses message text using the given data ($tags)

Parameters

$text
The initial text for a message to be parsed
$company_id
The company ID to send this message under
$tags

An array of replacement tags containing the key/value pairs for the replacements where the key is the tag to replace and the value is the value to replace it with

Returns

string
The parsed message template
Methods inherited from AppModel
_(), boolToInt(), currencyToDecimal(), dateToUtc(), errors(), getPerPage(), ifSet(), loadCrypto(), setDefaultIfEmpty(), setPerPage(), setRulesIfSet(), strToBool(), systemDecrypt(), systemEncrypt(), systemHash(), truncateDecimal(), validateExists(), validateStateCountry()
Methods used from Blesta\Core\Util\Common\Traits\Container
getFromContainer()
Properties inherited from AppModel
$logger, $replacement_keys
Blesta API documentation generated by ApiGen