Class PackageGroups
-
Model
-
AppModel
-
PackageGroups
Methods summary
public
|
#
__construct( )
Initialize PackageGroups
Overrides
|
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
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
|
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
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