1 | <?php |
||
29 | class Pages |
||
30 | { |
||
31 | /** |
||
32 | * Plugin name |
||
33 | **/ |
||
34 | private $_plugin; |
||
35 | |||
36 | /** |
||
37 | * Action name |
||
38 | **/ |
||
39 | private $_action; |
||
40 | |||
41 | /** |
||
42 | * Total amount of entries |
||
43 | **/ |
||
44 | private $_total; |
||
45 | |||
46 | /** |
||
47 | * Limit of entries on a page |
||
48 | **/ |
||
49 | private $_limit; |
||
50 | |||
51 | /** |
||
52 | * Page to start from |
||
53 | **/ |
||
54 | private $_start; |
||
55 | |||
56 | /** |
||
57 | * Additional parameters for url |
||
58 | **/ |
||
59 | private $_params = []; |
||
60 | |||
61 | /** |
||
62 | * Start a new page generator |
||
63 | * |
||
64 | * @param string $plugin Plugin name |
||
65 | * @param string $action Action name |
||
66 | * @param string $total Amount of entries |
||
67 | * @param string $limit Limit of entries per page |
||
68 | * |
||
69 | * @return \csphere\core\pagination\Pages |
||
70 | **/ |
||
71 | |||
72 | public function __construct($plugin, $action, $total, $limit) |
||
88 | |||
89 | /** |
||
90 | * Generate page turn links |
||
91 | * |
||
92 | * @param boolean $light Light version with only last, current and next page |
||
93 | * @param boolean $arrows Whether or not to attach arrows for page turns |
||
94 | * |
||
95 | * @return string |
||
96 | **/ |
||
97 | |||
98 | public function navigation($light = false, $arrows = true) |
||
134 | |||
135 | /** |
||
136 | * Generate light layout |
||
137 | * |
||
138 | * @param integer $pages Amount of pages |
||
139 | * |
||
140 | * @return array |
||
141 | **/ |
||
142 | |||
143 | private function _light($pages) |
||
174 | |||
175 | /** |
||
176 | * Generate full layout |
||
177 | * |
||
178 | * @param integer $pages Amount of pages |
||
179 | * @param integer $end End of first group |
||
180 | * |
||
181 | * @return array |
||
182 | **/ |
||
183 | |||
184 | private function _full($pages, $end) |
||
213 | |||
214 | /** |
||
215 | * Determine page start and end for middle part of full layout |
||
216 | * |
||
217 | * @param integer $pages Amount of pages |
||
218 | * |
||
219 | * @return array |
||
220 | **/ |
||
221 | |||
222 | private function _middle($pages) |
||
249 | |||
250 | /** |
||
251 | * Generate a group of links |
||
252 | * |
||
253 | * @param integer $start Start page |
||
254 | * @param integer $end Last page |
||
255 | * |
||
256 | * @return array |
||
257 | **/ |
||
258 | |||
259 | private function _group($start, $end) |
||
293 | |||
294 | /** |
||
295 | * Generate arrows for navigation |
||
296 | * |
||
297 | * @param integer $pages Amount of pages |
||
298 | * |
||
299 | * @return array |
||
300 | **/ |
||
301 | |||
302 | private function _arrows($pages) |
||
345 | |||
346 | /** |
||
347 | * Create content from template file |
||
348 | * |
||
349 | * @param array $data Data array for template |
||
350 | * @param boolean $arrows Whether or not to attach arrows for page turns |
||
351 | * |
||
352 | * @return string |
||
353 | **/ |
||
354 | |||
355 | private function _build(array $data, $arrows) |
||
378 | |||
379 | /** |
||
380 | * Get offset e.g. for database queries |
||
381 | * |
||
382 | * @return integer |
||
383 | **/ |
||
384 | |||
385 | public function offset() |
||
391 | |||
392 | /** |
||
393 | * Set additional parameters |
||
394 | * |
||
395 | * @param array $params Parameters as an array of key value pairs |
||
396 | * |
||
397 | * @return boolean |
||
398 | **/ |
||
399 | |||
400 | public function params(array $params) |
||
406 | } |
||
407 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.