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 ClientGroups

Client group management

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

Initialize ClientGroups

Initialize ClientGroups

Overrides

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

Add a client group using the supplied data

Add a client group using the supplied data

Parameters

$vars

A single dimensional array of keys including:

  • name The name of this group
  • description A description of this group (optional)
  • company_id The company ID this group belongs to color The HTML color that represents this group (optional)

Returns

integer
The client group ID created, or void on error
public
# edit( integer $client_group_id, array $vars )

Edit a client group using the supplied data

Edit a client group using the supplied data

Parameters

$client_group_id
The ID of the group to be updated
$vars

A single dimensional array of keys including:

  • name The name of this group
  • description A description of this group (optional)
  • company_id The company ID this group belongs to
  • color The HTML color that represents this group (optional)
public
# delete( integer $client_group_id )

Delete a client group and all associated client group settings

Delete a client group and all associated client group settings

Parameters

$client_group_id
The ID for this client group
public mixed
# getDefault( integer $company_id )

Finds the default client group for the given company.

Finds the default client group for the given company.

Parameters

$company_id

Returns

mixed
stdClass object representing the default client group, false if no such group exists
public mixed
# get( integer $client_group_id )

Returns the given client group

Returns the given client group

Parameters

$client_group_id
The ID of the client group to fetch

Returns

mixed
A stdClass object representing the client group, false if it does not exist
public mixed
# getList( integer $company_id, integer $page = 1, array $order_by = ['name' => 'ASC'] )

Fetches a list of all client groups

Fetches a list of all client groups

Parameters

$company_id
The company ID
$page
The page to return results for (optional, default 1)
$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 )

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

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

Parameters

$company_id
The ID of the company whose client group count to fetch

Returns

integer
The total number of clients

See

ClientGroups::getList()
public mixed
# getAll( integer $company_id )

Fetches all custom client groups by company

Fetches all custom client groups by company

Parameters

$company_id
The company ID to fetch client groups for

Returns

mixed
An array of stdClass objects representing all client groups for the given company
public mixed
# getSettings( integer $client_group_id, boolean $ignore_inheritence = false )

Fetch all settings that may apply to this client group. Settings are inherited in the order of client_group_settings -> company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Fetch all settings that may apply to this client group. Settings are inherited in the order of client_group_settings -> company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Parameters

$client_group_id
The client group ID to retrieve settings for
$ignore_inheritence

True to fetch only client group settings without inheriting from company or system settings (default false)

Returns

mixed
An array of objects containg key/values for the settings, false if no records found
public mixed
# getSetting( integer $client_group_id, string $key )

Fetch a specific setting that may apply to this client group. Settings are inherited in the order of client_group_settings -> company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Fetch a specific setting that may apply to this client group. Settings are inherited in the order of client_group_settings -> company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Parameters

$client_group_id
The client group ID to retrieve settings for
$key
The key name of the setting to fetch

Returns

mixed
A stdClass object containg key/values for the settings, false if no records found
public
# setSetting( integer $client_group_id, string $key, string $value, mixed $encrypted = null )

Add a client group setting, if duplicate then update the value

Add a client group setting, if duplicate then update the value

Parameters

$client_group_id
The ID for the specified client group
$key
The key for this client group setting
$value
The value for this client group setting
$encrypted

True to encrypt $value, false to store unencrypted, null to encrypt if currently set to encrypt

public
# unsetSetting( integer $client_group_id, string $key )

Delete a client group setting

Delete a client group setting

Parameters

$client_group_id
The ID for the specified client group
$key
The key for this client group setting
public
# unsetSettings( integer $client_group_id )

Deletes all client group settings

Deletes all client group settings

Parameters

$client_group_id
The ID for the specified client group
public
# setSettings( integer $client_group_id, array $vars, array $value_keys = null )

Add multiple client group settings, if duplicate then update the value

Add multiple client group settings, if duplicate then update the value

Parameters

$client_group_id
The ID for the specified client group
$vars
A single dimensional array of key/value pairs of settings
$value_keys
An array of key values to accept as valid fields
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