Example #1
0
 function set($entries, $page, $limit)
 {
     self::$entries = $entries;
     self::$limit = $limit;
     self::$pages = $entries > 0 ? ceil($entries / $limit) : 0;
     self::$page = self::sanitize($page, self::$pages);
 }
Example #2
0
File: pager.php Project: rigidus/ea
 function init($pages, $cur_page, $uri)
 {
     self::$pager = true;
     self::$pages = $pages;
     self::$cur_page = $cur_page;
     self::$pager_uri = $uri;
 }
 public function test_twelth_of_twelve_pages()
 {
     $first = new pager(100, 1200, 12);
     $actual = $first->pages();
     $expected = array(1, 'skip', 6, 7, 8, 9, 10, 11, 12);
     $this->assertEquals($expected, $actual);
 }
 protected function render_paging_bar(paging_bar $pagingbar)
 {
     $pagingbar = clone $pagingbar;
     $pagingbar->prepare($this, $this->page, $this->target);
     $show_pagingbar = $pagingbar->perpage > 0 && $pagingbar->totalcount > $pagingbar->perpage;
     if (!$show_pagingbar) {
         return '';
     }
     $current_page = $pagingbar->page + 1;
     // Counting from one, not zero.
     $pager = new pager($pagingbar->perpage, $pagingbar->totalcount, $current_page);
     $pages = $pager->pages();
     $pagination = new bootstrap_pager(html_entity_decode($pagingbar->baseurl), $current_page, $pager->last_page);
     return bootstrap::pagination($pagination->for_pages($pages));
 }