class teampage implements groupposition_interface

Teampage group position class

Teampage position is an ascending list 1, 2, ..., n for items which are displayed. 1 is the first item, n the last.

Constants

GROUP_DISABLED

Group is not displayed

NO_PARENT

No parent item

Properties

protected driver_interface $db

Database object

protected driver_interface $cache

Cache object

Methods

__construct(driver_interface $db, driver_interface $cache)

Constructor

int
get_group_value(int $group_id)

Returns the teampage position for a given group, if the group exists.

array
get_group_values(int $group_id)

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

int
get_teampage_value(int $teampage_id)

Returns the teampage position for a given teampage item, if the item exists.

array
get_teampage_values(int $teampage_id)

Returns the teampage row for a given teampage item, if the item exists.

int
get_group_count()

Get number of groups displayed

bool
add_group(int $group_id)

Addes a group by group_id

bool
add_group_teampage(int $group_id, int $parent_id)

Adds a group by group_id

bool
add_category_teampage(string $category_name)

Adds a new category

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

Deletes a group from the list and closes the gap in the position list.

bool
delete_teampage(int $teampage_id, bool $skip_group = false)

Deletes an item from the list and closes the gap in the position list.

bool
move_up(int $group_id)

Moves a group up by group_id

bool
move_up_teampage(int $teampage_id)

Moves an item up by teampage_id

bool
move_down(int $group_id)

Moves a group down by group_id

bool
move_down_teampage(int $teampage_id)

Moves an item down by teampage_id

bool
move(int $group_id, int $delta)

Moves a group up/down

bool
move_teampage(int $teampage_id, int $delta)

Moves an item up/down

static string
group_type_language(int $group_type)

Get group type language var

Details

at line 51
__construct(driver_interface $db, driver_interface $cache)

Constructor

Parameters

driver_interface $db

Database object

driver_interface $cache

Cache object

at line 64
int get_group_value(int $group_id)

Returns the teampage position 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 92
array get_group_values(int $group_id)

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

Parameters

int $group_id

group_id of the group to be selected

Return Value

array

Data row of the group

Exceptions

exception

at line 120
int get_teampage_value(int $teampage_id)

Returns the teampage position for a given teampage item, if the item exists.

Parameters

int $teampage_id

Teampage_id of the selected item

Return Value

int

Teampage position of the item

Exceptions

exception

at line 145
array get_teampage_values(int $teampage_id)

Returns the teampage row for a given teampage item, if the item exists.

Parameters

int $teampage_id

Teampage_id of the selected item

Return Value

array

Teampage row of the item

Exceptions

exception

at line 167
int get_group_count()

Get number of groups displayed

Return Value

int

value of the last item displayed

at line 182
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 194
bool add_group_teampage(int $group_id, int $parent_id)

Adds a group by group_id

Parameters

int $group_id

group_id of the group to be added

int $parent_id

Teampage ID of the parent item

Return Value

bool

True if the group was added successfully

at line 258
bool add_category_teampage(string $category_name)

Adds a new category

Parameters

string $category_name

Name of the category to be added

Return Value

bool

True if the category was added successfully

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

Deletes a group from the list and closes the gap in the position 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 318
bool delete_teampage(int $teampage_id, bool $skip_group = false)

Deletes an item from the list and closes the gap in the position list.

Parameters

int $teampage_id

teampage_id of the item to be deleted

bool $skip_group

Skip setting the group to GROUP_DISABLED, to save the query, when you need to update it anyway.

Return Value

bool

True if the item was deleted successfully

at line 347
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 358
bool move_up_teampage(int $teampage_id)

Moves an item up by teampage_id

Parameters

int $teampage_id

teampage_id of the item to be move

Return Value

bool

True if the group was moved successfully

at line 366
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 377
bool move_down_teampage(int $teampage_id)

Moves an item down by teampage_id

Parameters

int $teampage_id

teampage_id of the item to be moved

Return Value

bool

True if the group was moved successfully

at line 385
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 473
bool move_teampage(int $teampage_id, int $delta)

Moves an item up/down

Parameters

int $teampage_id

teampage_id of the item 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 573
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.