Class ClientGroups
-
Model
-
AppModel
-
ClientGroups
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
array $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
integer $client_group_id The ID of the group to be updated
- $vars
array $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
integer $client_group_id The ID for this client group
|
public
mixed
|
#
get( integer $client_group_id )
Returns the given client group
Returns the given client group
Parameters
- $client_group_id
integer $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 = array('name'=>"ASC") )
Fetches a list of all client groups
Fetches a list of all client groups
Parameters
- $company_id
integer $company_id The company ID
- $page
integer $page The page to return results for (optional, default 1)
- $order_by
string $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( mixed $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.
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
integer $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
|
private
Record
|
#
getClientGroups( mixed $company_id )
Partially constructs the query required by ClientGroups::getList(),
ClientGroups::getListCount(), and ClientGroups::getAll()
Partially constructs the query required by ClientGroups::getList(),
ClientGroups::getListCount(), and ClientGroups::getAll()
Returns
Record
The partially constructed query Record object
|
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
integer $client_group_id The client group ID to retrieve settings for
- $ignore_inheritence
boolean $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
integer $client_group_id The client group ID to retrieve settings for
- $key
string $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
integer $client_group_id The ID for the specified client group
- $key
string $key The key for this client group setting
- $value
string $value The value for this client group setting
- $encrypted
mixed $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
integer $client_group_id The ID for the specified client group
- $key
string $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
integer $client_group_id The ID for the specified client group
|
public
|
#
setSettings( integer $client_group_id, array $vars )
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
integer $client_group_id The ID for the specified client group
- $vars
array $vars A single dimensional array of key/value pairs of settings
|
private
array
|
#
getRules( )
Returns the rule set for adding/editing groups
Returns the rule set for adding/editing groups
Returns
array A list of client 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