63 if ($this->nextPageLabel === null) {
64 $this->nextPageLabel =
'»';
67 if ($this->prevPageLabel === null) {
68 $this->prevPageLabel =
'«';
71 $classes = array(
'pagination');
77 $validAlignments = array(self::ALIGNMENT_CENTER, self::ALIGNMENT_RIGHT);
79 if (in_array($this->alignment, $validAlignments)) {
80 if($this->alignment == self::ALIGNMENT_RIGHT)
81 $classes[] =
'pull-right';
83 if($this->alignment == self::ALIGNMENT_CENTER) {
85 $containerStyle =
'text-align: center;';
89 if (!empty($classes)) {
90 $classes = implode(
' ', $classes);
91 if (isset($this->htmlOptions[
'class'])) {
92 $this->htmlOptions[
'class'] =
' ' . $classes;
94 $this->htmlOptions[
'class'] = $classes;
99 if(isset($this->htmlOptions[
'style']) && !empty($this->htmlOptions[
'style']))
100 $this->htmlOptions[
'style'] .=
' '.$style;
102 $this->htmlOptions[
'style'] = $style;
105 if(!empty($containerStyle)) {
106 if(isset($this->containerHtmlOptions[
'style']) && !empty($this->containerHtmlOptions[
'style']))
107 $this->containerHtmlOptions[
'style'] .=
' '.$containerStyle;
109 $this->containerHtmlOptions[
'style'] = $containerStyle;
121 $this->registerClientScript();
125 echo CHtml::openTag($this->containerTag, $this->containerHtmlOptions);
127 echo CHtml::tag(
'ul',$this->htmlOptions,implode(
"\n",$buttons));
128 echo
'<div style="clear: both;"></div>';
130 echo CHtml::closeTag($this->containerTag);
141 if (($pageCount = $this->getPageCount()) <= 1) {
145 list ($beginPage, $endPage) = $this->getPageRange();
147 $currentPage = $this->getCurrentPage(
false);
152 if ($this->displayFirstAndLast) {
153 $buttons[] = $this->
createPageButton($this->firstPageLabel, 0,
'first', $currentPage <= 0,
false);
157 if (($page = $currentPage - 1) < 0) {
161 $buttons[] = $this->
createPageButton($this->prevPageLabel, $page,
'previous', $currentPage <= 0,
false);
164 for (
$i = $beginPage;
$i <= $endPage; ++
$i) {
169 if (($page = $currentPage + 1) >= $pageCount - 1) {
170 $page = $pageCount - 1;
174 $this->nextPageLabel,
177 $currentPage >= ($pageCount - 1),
182 if ($this->displayFirstAndLast) {
184 $this->lastPageLabel,
187 $currentPage >= ($pageCount - 1),
211 if ($hidden || $selected) {
212 $class .=
' ' . ($hidden ?
'disabled' :
'active');
215 return CHtml::tag(
'li', array(
'class' =>
$class), CHtml::link(
$label, $this->createPageUrl($page)));