Пример #1
0
 protected function addLinksForCollection(ORMPager $pager)
 {
     $pager->set_url_pattern($this->prefix . $this->underscorifyName($this->modelName) . '?page=#page#');
     $this->meta['page'] = $pager->page instanceof VulnerableField ? $pager->page->getFilteredValue() : $pager->page;
     $this->meta['page_url'] = $pager->url($pager->page);
     $this->response->addLinkUrl($pager->url($pager->page), 'current');
     $this->meta['first_page'] = 1;
     $this->meta['first_page_url'] = $pager->url(1);
     $this->response->addLinkUrl($pager->url(1), 'first');
     $this->meta['last_page'] = 1;
     $this->meta['last_page_url'] = $pager->url(1);
     $this->response->addLinkUrl($pager->url($pager->num_pages), 'last');
     if ($pager->page > 1) {
         $this->meta['prev_page'] = $pager->page - 1;
         $this->meta['prev_page_url'] = $pager->url($pager->page - 1);
         $this->response->addLinkUrl($pager->url($pager->page - 1), 'prev');
     }
     if ($pager->page < $pager->num_pages) {
         $this->meta['next_page'] = $pager->page + 1;
         $this->meta['next_page_url'] = $pager->url($pager->page + 1);
         $this->response->addLinkUrl($pager->url($pager->page + 1), 'next');
     }
     $this->meta['total_items'] = (int) $pager->num_items;
     $this->meta['pages'] = (int) $pager->num_pages;
     $this->meta['per_page'] = (int) $pager->page_size;
 }
Пример #2
0
 protected function addLinksForCollection(ORMPager $pager)
 {
     $pager->set_url_pattern($this->prefix . $this->underscorifyName($this->modelName) . '?page=#page#');
     $this->response->addLinkUrl($pager->url($pager->page), 'current');
     $this->response->addLinkUrl($pager->url(1), 'first');
     $this->response->addLinkUrl($pager->url($pager->num_pages), 'last');
     if ($pager->page > 1) {
         $this->response->addLinkUrl($pager->url($pager->page - 1), 'prev');
     }
     if ($pager->page < $pager->num_pages) {
         $this->response->addLinkUrl($pager->url($pager->page + 1), 'next');
     }
 }