Happy 2009! Updating copyright years.
[bugdar.git] / includes / pagination.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright (c)2005-2009 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 require_once ISSO . '/Pagination.php';
23
24 /**
25 * Pagination
26 *
27 * Subclass of BSPagination
28 *
29 * @author rsesek
30 * @copyright Copyright (c)2005 - 2009, Blue Static
31 * @package Bugdar
32 *
33 */
34 class Pagination extends BSPagination
35 {
36 /**
37 * Sets the variables used by the system
38 */
39 protected function _setVariables()
40 {
41 $this->page = BSApp::$input->inputClean('p', TYPE_UINT);
42 $this->defaultperpage = bugdar::$options['defaultpp'];
43 $this->perpage = BSApp::$input->inputClean('pp', TYPE_UINT);
44 $this->pagelinks = bugdar::$options['pagelinks'];
45 $this->maxperpage = bugdar::$options['maxpp'];
46 }
47
48 /**
49 * Processes an individual page link
50 */
51 protected function _bitProcessor($baselink, $isCurrent, $pagenumber)
52 {
53 $template = new BSTemplate('pagenav_bit');
54 $template->vars = array(
55 'baselink' => $baselink,
56 'nolink' => $isCurrent,
57 'number' => $pagenumber,
58 'paginator' => $this
59 );
60 return $template->evaluate()->getTemplate();
61 }
62
63 /**
64 * Generates the entire page navigation HTML
65 */
66 protected function _navigationProcessor($baselink, $next, $prev, $show2, $bits)
67 {
68 global $show;
69
70 $show = array_merge($show, $show2);
71
72 $template = new BSTemplate('pagenav');
73 $template->vars = array(
74 'baselink' => $baselink,
75 'nextpage' => $next,
76 'prevpage' => $prev,
77 'pagebits' => $bits,
78 'paginator' => $this
79 );
80 return $template->evaluate()->getTemplate();
81 }
82 }
83
84 ?>