phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlPaginationMenu.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Ajax\JsUtils;
6 
8 
10  private $_page;
11  private $_pages;
12  private $_max;
13  public function __construct( $identifier, $items=array() ){
14  parent::__construct( $identifier,$items);
15  $this->_pages=$items;
16  }
21  public function compile(JsUtils $js=NULL,&$view=NULL){
22  $max=$this->_max;
23  if(!$this->_compiled){
24  foreach ($this->content as $item){
25  $item->addClass("pageNum");
26  }
27  $this->insertItem(new HtmlIcon("", "left chevron"))->setProperty("data-page", \max([1,$this->_page-1]))->addToProperty("class","_firstPage no-active");
28  $this->addItem(new HtmlIcon("", "right chevron"))->setProperty("data-page", \min([$max,$this->_page+1]))->setProperty("data-max", $max)->addToProperty("class","_lastPage no-active");
29  $this->asPagination();
30  }
31  return parent::compile($js,$view);
32  }
33 
34  public function setActivePage($page){
35  $index=$page-$this->_pages[0];
36  $this->setActiveItem($index);
37  $this->_page=$page;
38  return $this;
39  }
40 
41  public function getPage() {
42  return $this->_page;
43  }
47  public function setMax($_max) {
48  $this->_max = $_max;
49  }
50 
51 
52 }
Semantic Icon component.
Definition: HtmlIcon.php:14
JQuery PHP library.
Definition: JsUtils.php:23