-
Notifications
You must be signed in to change notification settings - Fork 33
/
EBootstrapListView.php
59 lines (50 loc) · 1.28 KB
/
EBootstrapListView.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
<?php
Yii::import('zii.widgets.CListView');
/**
* Wrapper class for CListView
* Render the ListView. Please refer to {@link EBootstrapListViewItem}
*
* @author Tim Helfensdörfer <[email protected]>
* @version 0.3.0
* @package bootstrap.yiiwidgets
*/
class EBootstrapListView extends CListView {
/**
* Default pager class
*/
public $pagerCssClass = 'pagination';
/**
* Do not include the default style
*
* If it's set unequal false the css file specified will be included
*/
public $cssFile = false;
/**
* Align of the pager
*
* Possible values: centered|right
* Default: left
*/
public $pagerAlign = '';
/**
* Init the widget
*/
public function init() {
parent::init();
EBootstrap::mergeClass($this->htmlOptions, array('bootstrap-list-view'));
switch ($this->pagerAlign) {
case 'centered':
EBootstrap::mergeClassString($this->pagerCssClass, array('pagination-centered'));
break;
case 'right':
EBootstrap::mergeClassString($this->pagerCssClass, array('pagination-right'));
break;
}
if ($this->cssFile === false) {
$cssFile = dirname(__FILE__).'/css/bootstrap.css';
$this->cssFile = Yii::app()->getAssetManager()->publish($cssFile);
Yii::app()->clientScript->registerCssFile($this->cssFile);
}
}
}
?>