Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function render()
 {
     $this->ul->clear();
     $this->ul->add($this->getLi(max(1, $this->current - 1), '«')->addClass('prev'));
     $min = 1;
     $max = $this->page;
     if ($this->page > $this->maxItem) {
         $min = max(1, $this->current - $this->maxItem / 2);
         $max = min($this->page, $this->current + $this->maxItem / 2);
     }
     if ($min - 1 >= 1) {
         $this->ul->add($this->getLi($min + 1, '...'));
     }
     for ($i = $min; $i <= $max; $i++) {
         $this->ul->add($this->getLi($i));
     }
     if ($max + 1 < $this->page) {
         $this->ul->add($this->getLi($max + 1, '...'));
     }
     $this->ul->add($this->getLi(min($this->page, $this->current + 1), '&raquo;')->addClass('next'));
     $this->setContent($this->ul->render());
     return parent::render();
 }