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 PackageGroups

Package Group management

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

Initialize PackageGroups

Initialize PackageGroups

Overrides

AppModel::__construct()
public array
# getTypes( )

Returns a list of supported package group types

Returns a list of supported package group types

Returns

array
A list of package group types and their language name
public integer
# getTypeCount( integer $company_id, string $type = 'standard', array $filters = [] )

Retrieves the number of package groups of a given type

Retrieves the number of package groups of a given type

Parameters

$company_id
The ID of the company whose package groups to count
$type
The type of package groups to count ("standard" or "addon", default "standard")
$filters

A list of package groups filters including:

  • hidden Whether or nor to include the hidden package groups

Returns

integer
The number of package groups of the given type
public mixed
# get( integer $package_group_id )

Returns a package group

Returns a package group

Parameters

$package_group_id
The package group ID

Returns

mixed
An stdClass object representing the package group, or false if the package group does not exist
public array
# getAll( integer $company_id, string $type = null, array $order_by = ['name' => 'asc'] )

Fetches all package groups for a given company

Fetches all package groups for a given company

Parameters

$company_id
The company ID
$type
The type of package group to get ('standard' or 'addon', optional, default both)
$order_by
The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Returns

array
An array of stdClass objects representing each package group
public array
# getList( integer $company_id, integer $page = 1, string $type = null, array $order_by = ['name' => 'asc'], array $filters = [] )

Fetches a list of all package groups for a given company

Fetches a list of all package groups for a given company

Parameters

$company_id
The company ID to fetch package groups for
$page
The page to return results for
$type
The type of package group to get ("standard" or "addon", null for both)
$order_by
The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)
$filters

A list of package groups filters including:

  • hidden Whether or nor to include the hidden package groups

Returns

array
An array of objects, each representing a package group
public integer
# getListCount( integer $company_id, string $type = null, array $filters = [] )

Return the total number of package groups returned from PackageGroups::getList(), useful in constructing pagination for the getList() method.

Return the total number of package groups returned from PackageGroups::getList(), useful in constructing pagination for the getList() method.

Parameters

$company_id
The company ID to fetch package groups for
$type
The type of package group to get ("standard" or "addon", null for both)
$filters

A list of package groups filters including:

  • hidden Whether or nor to include the hidden package groups

Returns

integer
The total number of package groups

See

PackageGroups::getList()
public integer
# add( array $vars )

Adds a package group for the given company

Adds a package group for the given company

Parameters

$vars

An array of package group info including:

  • company_id The ID for the company under which to add the package group
  • names A list of names for the package group in different languages, each including:
    • lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
    • name The name in the specified language
  • type The package group type, ('standard', or 'addon', optional, default 'standard')
  • descriptions A list of descriptions for this package group in different languages (optional)
    • lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
    • description The description in the specified language (optional, default null)
  • parents If type is 'addon', an array of 'standard' package groups this group belongs to
  • allow_upgrades Whether or not packages within this group can be changed:
    • 1 = true, 0 = false (optional, default 1)

Returns

integer
The package group ID, void on error
public
# edit( integer $package_group_id, array $vars )

Updates a package group

Updates a package group

Parameters

$package_group_id
The package group ID to update
$vars

An array of package group info including:

  • company_id The ID for the company to which this package group belongs
  • names A list of names for the package group in different languages
    • lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
    • name The name in the specified language
  • type The package group type, 'standard', or 'addon' (optional, default standard)
  • descriptions A list of descriptions for this package group in different languages (optional)
    • lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
    • description The description in the specified language (optional, default null)
  • parents If type is 'addon', a numerically indexed array of 'standard' package groups this group belongs to
  • allow_upgrades Whether or not packages within this group can be changed
    • 1 = true, 0 = false (optional, default 1)
public
# delete( integer $package_group_id )

Permanently removes a package group from the system.

Permanently removes a package group from the system.

Parameters

$package_group_id
The package group ID to delete
public boolean
# validateGroupParents( array $parents, integer $company_id, string $type )

Checks to ensure that every group parent consists of valid data

Checks to ensure that every group parent consists of valid data

Parameters

$parents
A numerically-indexed array of parent group IDs
$company_id
The company ID to which this group belongs
$type
The type of group

Returns

boolean
True if every group parent consists of valid data, false otherwise
public boolean
# validateType( string $type )

Validates that the given type is a valid package group type

Validates that the given type is a valid package group type

Parameters

$type
The package group type

Returns

boolean
True if the package group type is valid, false otherwise
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