Methods summary
public
|
#
__construct( )
Initialize ClientGroups
Overrides
|
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
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
|
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
|