1<?php
2/* Copyright (c) 2017 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3namespace ILIAS\UI\Component\ViewControl;
4
5use \ILIAS\UI\Component as C;
6use ILIAS\UI\Component\JavaScriptBindable;
7use ILIAS\UI\Component\Triggerer;
8
9/**
10 * This describes a Pagination Control
11 */
12interface Pagination extends C\Component, JavaScriptBindable, Triggerer
13{
14
15    /**
16     * Get a Pagination with this target-url.
17     * Shy-Buttons in this control will link to this url
18     * and add $parameter_name with the selected value.
19     *
20     * @param 	string 	$url
21     * @param 	string 	$parameter_name
22     *
23     * @return Pagination
24     */
25    public function withTargetURL($url, $parameter_name);
26
27    /**
28     * Get the url this instance should trigger.
29     *
30     * @return 	string
31     */
32    public function getTargetURL();
33
34    /**
35     * Get the parameter this instance uses.
36     *
37     * @return 	string
38     */
39    public function getParameterName();
40
41    /**
42     * Initialize with the total amount of entries
43     * of the controlled data-list
44     *
45     * @param 	int 	$total
46     *
47     * @return Pagination
48     */
49    public function withTotalEntries($total);
50
51    /**
52     * Set the amount of entries per page.
53     *
54     * @param 	int 	$size
55     *
56     * @return Pagination
57     */
58    public function withPageSize($size);
59
60    /**
61     * Get the numebr of entries per page.
62     *
63     * @return int
64     */
65    public function getPageSize();
66
67    /**
68     * Set the selected page.
69     *
70     * @param 	int 	$page
71     *
72     * @return Pagination
73     */
74    public function withCurrentPage($page);
75
76    /**
77     * Get the currently slected page.
78     *
79     * @return int
80     */
81    public function getCurrentPage();
82
83    /**
84     * Get the data's offset according to current page and page size.
85     *
86     * @return int
87     */
88    public function getOffset();
89
90    /**
91     * Register a signal with the control.
92     *
93     * @param C\Signal $signal
94     *
95     * @return Pagination
96     */
97    public function withOnSelect(C\Signal $signal);
98
99    /**
100     * Calculate the total number of pages.
101     *
102     * @return int
103     */
104    public function getNumberOfPages();
105
106    /**
107     * Layout; define, how many page-options are shown (max).
108     *
109     * @param int 	$amount
110     *
111     * @return Pagination
112     */
113    public function withMaxPaginationButtons($amount);
114
115    /**
116     * Get the maximum amount of page-entries (not records per page!)
117     * to be shown.
118     *
119     * @return int
120     */
121    public function getMaxPaginationButtons();
122
123    /**
124     * Layout; when number of page-entries reaches $amount,
125     * the options will be rendered as dropdown.
126     *
127     * @param int 	$amount
128     *
129     * @return Pagination
130     */
131    public function withDropdownAt($amount);
132
133    /**
134     * Below this value, the options are directly rendered as shy-buttons,
135     * on and above this value a dropdown is being used.
136     *
137     * @return int
138     */
139    public function getDropdownAt();
140}
141