class pagination

Properties

protected template $template
protected user $user
protected helper $helper
protected dispatcher_interface $phpbb_dispatcher

Methods

__construct(template $template, user $user, helper $helper, dispatcher_interface $phpbb_dispatcher)

Constructor

string
generate_page_link(string|array $base_url, string $on_page, string $start_name, int $per_page)

Generate a pagination link based on the url and the page information

void
generate_template_pagination(string|array $base_url, string $block_var_name, string $start_name, int $num_items, int $per_page, int $start = 1, bool $reverse_count = false, bool $ignore_on_page = false)

Generate template rendered pagination Allows full control of rendering of pagination with the template

int
get_on_page(int $per_page, int $start)

Get current page number

string
on_page(int $num_items, int $per_page, int $start)

Return current page

int
validate_start(int $start, int $per_page, int $num_items)

Get current page number

int
reverse_start(int $start, int $limit, int $num_items)

Get new start when searching from the end

int
reverse_limit(int $start, int $per_page, int $num_items)

Get new item limit when searching from the end

Details

at line 38
__construct(template $template, user $user, helper $helper, dispatcher_interface $phpbb_dispatcher)

Constructor

Parameters

template $template
user $user
helper $helper
dispatcher_interface $phpbb_dispatcher

Generate a pagination link based on the url and the page information

Parameters

string|array $base_url

is url prepended to all links generated within the function If you use page numbers inside your controller route, base_url should contains a placeholder (%d) for the page. Also be sure to specify the pagination path information into the start_name argument

string $on_page

is the page for which we want to generate the link

string $start_name

is the name of the parameter containing the first item of the given page (example: start=20) If you use page numbers inside your controller route, start name should be the string that should be removed for the first page (example: /page/%d)

int $per_page

the number of items, posts, etc. to display per page, used to determine the number of pages to produce

Return Value

string

URL for the requested page

at line 137
void generate_template_pagination(string|array $base_url, string $block_var_name, string $start_name, int $num_items, int $per_page, int $start = 1, bool $reverse_count = false, bool $ignore_on_page = false)

Generate template rendered pagination Allows full control of rendering of pagination with the template

Parameters

string|array $base_url

is url prepended to all links generated within the function If you use page numbers inside your controller route, base_url should contains a placeholder (%d) for the page. Also be sure to specify the pagination path information into the start_name argument

string $block_var_name

is the name assigned to the pagination data block within the template (example: )

string $start_name

is the name of the parameter containing the first item of the given page (example: start=20) If you use page numbers inside your controller route, start name should be the string that should be removed for the first page (example: /page/%d)

int $num_items

the total number of items, posts, etc., used to determine the number of pages to produce

int $per_page

the number of items, posts, etc. to display per page, used to determine the number of pages to produce

int $start

the item which should be considered currently active, used to determine the page we're on

bool $reverse_count

determines whether we weight display of the list towards the start (false) or end (true) of the list

bool $ignore_on_page

decides whether we enable an active (unlinked) item, used primarily for embedded lists

Return Value

void

at line 290
int get_on_page(int $per_page, int $start)

Get current page number

Parameters

int $per_page

the number of items, posts, etc. per page

int $start

the item which should be considered currently active, used to determine the page we're on

Return Value

int

Current page number

at line 303
string on_page(int $num_items, int $per_page, int $start)

Return current page

Parameters

int $num_items

the total number of items, posts, topics, etc.

int $per_page

the number of items, posts, etc. per page

int $start

the item which should be considered currently active, used to determine the page we're on

Return Value

string

Descriptive pagination string (e.g. "page 1 of 10")

at line 317
int validate_start(int $start, int $per_page, int $num_items)

Get current page number

Parameters

int $start

the item which should be considered currently active, used to determine the page we're on

int $per_page

the number of items, posts, etc. per page

int $num_items

the total number of items, posts, topics, etc.

Return Value

int

Current page number

at line 337
int reverse_start(int $start, int $limit, int $num_items)

Get new start when searching from the end

If the user is trying to reach late pages, start searching from the end.

Parameters

int $start

the item which should be considered currently active, used to determine the page we're on

int $limit

the number of items, posts, etc. to display

int $num_items

the total number of items, posts, topics, etc.

Return Value

int

Current page number

at line 353
int reverse_limit(int $start, int $per_page, int $num_items)

Get new item limit when searching from the end

If the user is trying to reach late pages, start searching from the end. In this case the items to display might be lower then the actual per_page setting.

Parameters

int $start

the item which should be considered currently active, used to determine the page we're on

int $per_page

the number of items, posts, etc. per page

int $num_items

the total number of items, posts, topics, etc.

Return Value

int

Current page number