Public Member Functions | |
getCurrentPage () | |
getLimit () | |
setCollection ($collection) | |
getCollection () | |
setPageVarName ($varName) | |
getPageVarName () | |
setShowPerPage ($varName) | |
getShowPerPage () | |
setLimitVarName ($varName) | |
getLimitVarName () | |
setAvailableLimit (array $limits) | |
getAvailableLimit () | |
getFirstNum () | |
getLastNum () | |
getTotalNum () | |
isFirstPage () | |
getLastPageNum () | |
isLastPage () | |
isLimitCurrent ($limit) | |
isPageCurrent ($page) | |
getPages () | |
getFirstPageUrl () | |
getPreviousPageUrl () | |
getNextPageUrl () | |
getLastPageUrl () | |
getPageUrl ($page) | |
getLimitUrl ($limit) | |
getPagerUrl ($params=array()) | |
Protected Member Functions | |
_construct () | |
Protected Attributes | |
$_collection = null | |
$_pageVarName = 'p' | |
$_limitVarName = 'limit' | |
$_availableLimit = array(10=>10,20=>20,50=>50) | |
$_dispersion = 3 | |
$_displayPages = 5 | |
$_showPerPage = true |
Definition at line 36 of file Pager.php.
_construct | ( | ) | [protected] |
Internal constructor, that is called from real constructor
Please override this one instead of overriding real __construct constructor
Please override this one instead of overriding real __construct constructor
Reimplemented from Mage_Core_Block_Abstract.
Reimplemented in Mage_Catalog_Block_Product_List_Toolbar.
Definition at line 46 of file Pager.php.
00047 { 00048 parent::_construct(); 00049 $this->setTemplate('page/html/pager.phtml'); 00050 }
getAvailableLimit | ( | ) |
getCollection | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 87 of file Pager.php.
getCurrentPage | ( | ) |
Definition at line 52 of file Pager.php.
00053 { 00054 if ($page = (int) $this->getRequest()->getParam($this->getPageVarName())) { 00055 return $page; 00056 } 00057 return 1; 00058 }
getFirstNum | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 137 of file Pager.php.
00138 { 00139 $collection = $this->getCollection(); 00140 return $collection->getPageSize()*($collection->getCurPage()-1)+1; 00141 }
getFirstPageUrl | ( | ) |
getLastNum | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 143 of file Pager.php.
00144 { 00145 $collection = $this->getCollection(); 00146 return $collection->getPageSize()*($collection->getCurPage()-1)+$collection->count(); 00147 }
getLastPageNum | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 159 of file Pager.php.
00160 { 00161 return $this->getCollection()->getLastPageNumber(); 00162 }
getLastPageUrl | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 231 of file Pager.php.
00232 { 00233 return $this->getPageUrl($this->getCollection()->getLastPageNumber()); 00234 }
getLimit | ( | ) |
Reimplemented in Mage_Catalog_Block_Product_List_Toolbar, and Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 60 of file Pager.php.
00061 { 00062 $limits = $this->getAvailableLimit(); 00063 if ($limit = $this->getRequest()->getParam($this->getLimitVarName())) { 00064 if (isset($limits[$limit])) { 00065 return $limit; 00066 } 00067 } 00068 $limits = array_keys($limits); 00069 return $limits[0]; 00070 }
getLimitUrl | ( | $ | limit | ) |
Reimplemented in Mage_Catalog_Block_Product_List_Toolbar.
Definition at line 241 of file Pager.php.
00242 { 00243 return $this->getPagerUrl(array($this->getLimitVarName()=>$limit)); 00244 }
getLimitVarName | ( | ) |
getNextPageUrl | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 226 of file Pager.php.
00227 { 00228 return $this->getPageUrl($this->getCollection()->getCurPage(+1)); 00229 }
getPagerUrl | ( | $ | params = array() |
) |
getPages | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 179 of file Pager.php.
00180 { 00181 $collection = $this->getCollection(); 00182 00183 $pages = array(); 00184 if ($collection->getLastPageNumber() <= $this->_displayPages) { 00185 $pages = range(1, $collection->getLastPageNumber()); 00186 } 00187 else { 00188 $half = ceil($this->_displayPages / 2); 00189 if ($collection->getCurPage() >= $half && $collection->getCurPage() <= $collection->getLastPageNumber() - $half) { 00190 $start = ($collection->getCurPage() - $half) + 1; 00191 $finish = ($start + $this->_displayPages) - 1; 00192 } 00193 elseif ($collection->getCurPage() < $half) { 00194 $start = 1; 00195 $finish = $this->_displayPages; 00196 } 00197 elseif ($collection->getCurPage() > ($collection->getLastPageNumber() - $half)) { 00198 $finish = $collection->getLastPageNumber(); 00199 $start = $finish - $this->_displayPages + 1; 00200 } 00201 00202 $pages = range($start, $finish); 00203 } 00204 return $pages; 00205 00206 // $pages = array(); 00207 // for ($i=$this->getCollection()->getCurPage(-$this->_dispersion); $i <= $this->getCollection()->getCurPage(+($this->_dispersion-1)); $i++) 00208 // { 00209 // 00210 // $pages[] = $i; 00211 // } 00212 // 00213 // return $pages; 00214 }
getPageUrl | ( | $ | page | ) |
Definition at line 236 of file Pager.php.
00237 { 00238 return $this->getPagerUrl(array($this->getPageVarName()=>$page)); 00239 }
getPageVarName | ( | ) |
getPreviousPageUrl | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 221 of file Pager.php.
00222 { 00223 return $this->getPageUrl($this->getCollection()->getCurPage(-1)); 00224 }
getShowPerPage | ( | ) |
Definition at line 108 of file Pager.php.
00109 { 00110 if(sizeof($this->getAvailableLimit())<=1) { 00111 return false; 00112 } 00113 return $this->_showPerPage; 00114 }
getTotalNum | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 149 of file Pager.php.
00150 { 00151 return $this->getCollection()->getSize(); 00152 }
isFirstPage | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 154 of file Pager.php.
00155 { 00156 return $this->getCollection()->getCurPage() == 1; 00157 }
isLastPage | ( | ) |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 164 of file Pager.php.
00165 { 00166 return $this->getCollection()->getCurPage() >= $this->getLastPageNum(); 00167 }
isLimitCurrent | ( | $ | limit | ) |
isPageCurrent | ( | $ | page | ) |
Definition at line 174 of file Pager.php.
00175 { 00176 return $page == $this->getCurrentPage(); 00177 }
setAvailableLimit | ( | array $ | limits | ) |
setCollection | ( | $ | collection | ) |
Reimplemented in Mage_Catalog_Block_Product_List_Toolbar, and Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.
Definition at line 72 of file Pager.php.
00073 { 00074 $this->_collection = $collection 00075 ->setCurPage($this->getCurrentPage()); 00076 // If not int - then not limit 00077 if ((int) $this->getLimit()) { 00078 $this->_collection->setPageSize($this->getLimit()); 00079 } 00080 00081 return $this; 00082 }
setLimitVarName | ( | $ | varName | ) |
setPageVarName | ( | $ | varName | ) |
setShowPerPage | ( | $ | varName | ) |
$_showPerPage = true [protected] |
Reimplemented in Mage_Catalog_Block_Seo_Sitemap_Tree_Pager.