File size: 1.13Kb
<?php
class CPager extends CBasePager {
public $htmlOptions = array('class' => 'blue_block center-aligned');
public $separator = ' | ';
/**
* Runs widget
*/
public function run() {
if ($this->pageCount == 0)
return;
$currentPage=$this->getCurrentPage();
$links = array();
if ($currentPage > 0) {
$links[] = $this->generatePageLink(Yii::t('yii','<< First'), 0);
$links[] = $this->generatePageLink(Yii::t('yii','< Previous'), $currentPage - 1);
}
$links[] = CHtml::tag('strong', array(), Yii::t('yii', '{currentPage} page of {pageCount}', array('{currentPage}' => $currentPage + 1, '{pageCount}' => $this->pageCount)));
if (($currentPage + 1) < $this->pageCount) {
$links[] = $this->generatePageLink(Yii::t('yii','Next >'), $currentPage + 1);
$links[] = $this->generatePageLink(Yii::t('yii','Last >>'), $this->pageCount - 1);
}
echo CHtml::tag('div', $this->htmlOptions, implode($this->separator, $links));
}
/**
* Generates link to page
*/
private function generatePageLink($label, $page) {
return CHtml::link(CHtml::tag('strong', array(), $label), $this->createPageUrl($page));
}
}