Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • components
        • events
          • default
      • controllers
      • models
    • components
      • auth
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • exchange
        • rates
          • foxrate
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
      • json
      • modules
      • net
        • http
        • net
          • amazon
            • s3
          • geo
            • ip
      • plugins
      • recaptcha
      • security
      • session
        • cart
      • settingscollection
      • upgrades
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
  • com
    • tecnick
      • tcpdf
        • blesta
          • components
            • invoice
              • templates
                • quickbooks
                  • invoice
                • templates
                  • default
  • Crypt
    • AES
    • DES
    • Hash
    • Random
    • RC4
    • Rijndael
    • RSA
    • TerraDES
  • File
    • ANSI
    • ASN1
    • X509
  • Math
    • BigInteger
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • html
      • xml
    • lib
  • Net
    • SFTP
    • SSH1
    • SSH2
  • None
  • PHP
  • PHPMailer
  • Services
    • JSON
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

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

Class PackageGroups

Package Group management

Model
Extended by AppModel
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" )

Retrieves the number of package groups of a given type

Retrieves the number of package groups of a given type

Parameters

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

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
integer
$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 )

Fetches all package groups for a given company

Fetches all package groups for a given company

Parameters

$company_id
integer
$company_id The company ID
$type
string
$type The type of package group to get ('standard' or 'addon', optional, default both)

Returns

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

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

Returns

mixed
An array of objects or false if no results.
public integer
# getListCount( integer $company_id, string $type = null )

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
integer
$company_id The company ID to fetch package groups for
$type
string
$type The type of package group to get ("standard" or "addon", null for both)

Returns

integer
The total number of package groups

See

Companies::getList()
private Record
# getPackageGroups( integer $company_id, string $type = null )

Partially constructs the query required by both PackageGroups::getList() and PackageGroups::getListCount()

Partially constructs the query required by both PackageGroups::getList() and PackageGroups::getListCount()

Parameters

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

Returns

Record
The partially constructed query Record object
public integer
# add( array $vars )

Adds a package group for the given company

Adds a package group for the given company

Parameters

$vars
array
$vars An array of package group info including: -company_id The ID for the company under which to add the package group -name The package group name -type The package group type, ('standard', or 'addon', optional, default 'standard') -parents If type is 'addon', an array of 'standard' package groups this group belongs to

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
integer
$package_group_id The package group ID to update
$vars
array
$vars An array of package group info including: -company_id The ID for the company to which this package group belongs -name The package group name -type The package group type, 'standard', or 'addon' (optional, default standard) -parents If type is 'addon', a numerically indexed array of 'standard' package groups this group belongs to
public
# delete( integer $package_group_id )

Permanently removes a package group from the system. Groups can only be removed if there are no packages assigned to the group.

Permanently removes a package group from the system. Groups can only be removed if there are no packages assigned to the group.

Parameters

$package_group_id
integer
$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
array
$parents A numerically-indexed array of parent group IDs
$company_id
integer
$company_id The company ID to which this group belongs
$type
string
$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
string
$type The package group type

Returns

boolean
True if the package group type is valid, false otherwise
private array
# getRules( array $vars, mixed $edit = false )

Returns the rules for adding/editing package groups

Returns the rules for adding/editing package groups

Parameters

$vars
array
$vars Key/value pairs of data to replace in language
$edit

Returns

array
The package group rules

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