class UserGroupsHelper

Helper to deal with user groups.

Constants

MODE_SINGLETON

MODE_INSTANCE

Methods

__construct( array $groups = array(), integer $mode = self::MODE_INSTANCE)

Constructor

integer
count()

Count loaded user groups.

static  UserGroupsHelper
getInstance()

Get the helper instance.

mixed
get( integer $id)

Get a user group by its id.

array
getAll()

Get the list of existing user groups.

boolean
has( integer $id)

Check if a group is in the list.

integer
total()

Get total available user groups in database.

mixed
load( integer $id)

Load a group from database.

loadAll()

Load all user groups from the database.

populateGroupData( stdClass $group)

Populate data for a specific user group.

setGroups( array $groups)

Set the groups to be used as source.

Details

__construct( array $groups = array(), integer $mode = self::MODE_INSTANCE)

Constructor

Parameters

array $groups Array of groups
integer $mode Working mode for this class

integer count()

Count loaded user groups.

Return Value

integer

static UserGroupsHelper getInstance()

Get the helper instance.

Return Value

UserGroupsHelper

mixed get( integer $id)

Get a user group by its id.

Parameters

integer $id Group identifier

Return Value

mixed stdClass on success. False otherwise

array getAll()

Get the list of existing user groups.

Return Value

array

boolean has( integer $id)

Check if a group is in the list.

Parameters

integer $id Group identifier

Return Value

boolean

integer total()

Get total available user groups in database.

Return Value

integer

mixed load( integer $id)

Load a group from database.

Parameters

integer $id Group identifier

Return Value

mixed

UserGroupsHelper loadAll()

Load all user groups from the database.

Return Value

UserGroupsHelper

stdClass populateGroupData( stdClass $group)

Populate data for a specific user group.

Parameters

stdClass $group Group

Return Value

stdClass

UserGroupsHelper setGroups( array $groups)

Set the groups to be used as source.

Parameters

array $groups Array of user groups.

Return Value

UserGroupsHelper