class legend implements groupposition_interface

Legend group position class

group_legend is an ascending list 1, 2, ..., n for groups which are displayed. 1 is the first group, n the last. If the value is 0 (self::GROUP_DISABLED) the group is not displayed.

Constants

GROUP_DISABLED

Group is not displayed

Properties

protected driver_interface $db

Database object

protected user $user

User object

Methods

__construct(driver_interface $db, user $user)

Constructor

int
get_group_value(int $group_id)

Returns the group_legend for a given group, if the group exists.

int
get_group_count()

Get number of groups, displayed on the legend

bool
add_group(int $group_id)

Addes a group by group_id

bool
delete_group(int $group_id, bool $skip_group = false)

Deletes a group by setting the field to self::GROUP_DISABLED and closing the gap in the list.

bool
move_up(int $group_id)

Moves a group up by group_id

bool
move_down(int $group_id)

Moves a group down by group_id

bool
move(int $group_id, int $delta)

Moves a group up/down

static string
group_type_language(int $group_type)

Get group type language var

Details

at line 47
__construct(driver_interface $db, user $user)

Constructor

Parameters

driver_interface $db

Database object

user $user

User object

at line 60
int get_group_value(int $group_id)

Returns the group_legend for a given group, if the group exists.

Parameters

int $group_id

group_id of the group to be selected

Return Value

int

position of the group

Exceptions

exception

at line 83
int get_group_count()

Get number of groups, displayed on the legend

Return Value

int

value of the last item displayed

at line 98
bool add_group(int $group_id)

Addes a group by group_id

Parameters

int $group_id

group_id of the group to be added

Return Value

bool

True if the group was added successfully

at line 125
bool delete_group(int $group_id, bool $skip_group = false)

Deletes a group by setting the field to self::GROUP_DISABLED and closing the gap in the list.

Parameters

int $group_id

group_id of the group to be deleted

bool $skip_group

Skip setting the value for this group, to save the query, when you need to update it anyway.

Return Value

bool

True if the group was deleted successfully

at line 157
bool move_up(int $group_id)

Moves a group up by group_id

Parameters

int $group_id

group_id of the group to be moved

Return Value

bool

True if the group was moved successfully

at line 165
bool move_down(int $group_id)

Moves a group down by group_id

Parameters

int $group_id

group_id of the group to be moved

Return Value

bool

True if the group was moved successfully

at line 173
bool move(int $group_id, int $delta)

Moves a group up/down

Parameters

int $group_id

group_id of the group to be moved

int $delta

number of steps:

  • positive = move up
  • negative = move down

Return Value

bool

True if the group was moved successfully

at line 227
static string group_type_language(int $group_type)

Get group type language var

Parameters

int $group_type

group_type from the groups-table

Return Value

string

name of the language variable for the given group-type.