-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathEBootstrapLinkPager.php
62 lines (56 loc) · 1.32 KB
/
EBootstrapLinkPager.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* Bootstrap pager
* http://twitter.github.com/bootstrap/components.html#pagination
*
* @author Tim Helfensdörfer <[email protected]>
* @version 0.3.0
* @package bootstrap.yiiwidgets
*/
class EBootstrapLinkPager extends CLinkPager {
/**
* Do not include the default style
*
* If it's set unequal false the css file specified will be included
*
* @access public
* @var mixed
*/
public $cssFile = false;
/**
* Replace the default css with the bootstrap equivalent
*/
const CSS_SELECTED_PAGE = 'active';
const CSS_HIDDEN_PAGE = 'disabled';
/**
* Init the widget
*
* @access public
* @return void
*/
public function init() {
$this->htmlOptions['class'] = 'pagination';
parent::init();
}
/**
* Create a pager button.
*
* @param string $label
* @param string $page
* @param string $class
* @param boolean $hidden
* @param boolean $selected
*
* @access protected
* @return string
*/
protected function createPageButton($label,$page,$class,$hidden,$selected) {
if($hidden || $selected)
$class.=' '.($hidden ? self::CSS_HIDDEN_PAGE : self::CSS_SELECTED_PAGE);
if (!$hidden)
return '<li class="'.$class.'">'.EBootstrap::link($label,$this->createPageUrl($page)).'</li>';
else
return '<li class="'.$class.'">'.EBootstrap::link($label,'').'</li>';
}
}
?>