ELinkPager.php 892 Bytes
Newer Older
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
<?php
/**
 * The following variables are available in this template:
 * - $this: the CrudCode object
 */
?>
<?php echo "<?php\n"; ?>
class ELinkPager extends CLinkPager
{
	public function run()
	{
		$this->registerClientScript();
		$buttons = $this->createPageButtons();
		if (empty($buttons))
		{
			return;
		}
		$this->htmlOptions['class'] = trim($this->htmlOptions['class'] . ' pagination');
		echo CHtml::tag('div', $this->htmlOptions, implode("\n", $buttons));
	}

	protected function createPageButton($label, $page, $class, $hidden, $selected)
	{
		if ($hidden)
		{
			return false;
		}
		$class = str_replace(self::CSS_INTERNAL_PAGE, '', $class);
		$class .= ' ' . ($selected ? 'current active' : '');
		$class = trim($class);
		return $selected ? CHtml::tag('span', array('class' => $class), $label) : CHtml::link($label, $this->createPageUrl($page), array('class' => $class));
	}
}