/*=====================================================================*\
|| ###################################################################
|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2008 Blue Static
+|| # Copyright (c)2005-2009 Blue Static
|| #
|| # This program is free software; you can redistribute it and/or modify
|| # it under the terms of the GNU General Public License as published by
\*=====================================================================*/
/**
-* Pagination System (Pagination.php)
-*
-* @package ISSO
-*/
+ * Pagination System (Pagination.php)
+ *
+ * @package ISSO
+ */
/**
-* Pagination System
-*
-* On many pages, it is necessary to limit the amount of records to display.
-* Using this class, you can set the maximum and minimum values to display,
-* and then the input variables for page number and perpage. This will
-* then create a page navigator and manage the SQL LIMIT statements.
-*
-* @author Blue Static
-* @copyright Copyright (c)2005 - 2008, Blue Static
-* @package ISSO
-*
-*/
+ * Pagination System
+ *
+ * On many pages, it is necessary to limit the amount of records to display.
+ * Using this class, you can set the maximum and minimum values to display,
+ * and then the input variables for page number and perpage. This will
+ * then create a page navigator and manage the SQL LIMIT statements.
+ *
+ * @author Blue Static
+ * @copyright Copyright (c)2005 - 2009, Blue Static
+ * @package ISSO
+ *
+ */
abstract class BSPagination
{
/**
- * Current page number
- * @var integer
- */
- protected $page;
+ * Current page number
+ * @var integer
+ */
+ public $page;
/**
- * Per-page value
- * @var integer
- */
- protected $perpage;
+ * Per-page value
+ * @var integer
+ */
+ public $perpage;
/**
- * Number of page links
- * @var integer
- */
+ * Number of page links
+ * @var integer
+ */
protected $pagelinks;
/**
- * Total number of results
- * @var integer
- */
+ * Total number of results
+ * @var integer
+ */
protected $total;
/**
- * Total number of pages
- * @var integer
- */
+ * Total number of pages
+ * @var integer
+ */
protected $pagecount;
/**
- * Maximum number of per-page results
- * @var integer
- */
+ * Maximum number of per-page results
+ * @var integer
+ */
protected $maxperpage = 100;
/**
- * Default number of per-page results
- * @var integer
- */
+ * Default number of per-page results
+ * @var integer
+ */
protected $defaultperpage = 20;
- // ###################################################################
/**
* Callback public function for the processing of an indivdual page link
*
*/
protected abstract function _bitProcessor($baselink, $isCurrent, $pagenumber);
- // ###################################################################
/**
* Callback public function for the processing the entire page navigator
*
}
}
- // ###################################################################
/**
- * Returns the current page number
- *
- * @return integer Current page
- */
+ * Returns the current page number
+ *
+ * @return integer Current page
+ */
public function getPage()
{
return $this->page;
}
- // ###################################################################
/**
- * Returns the current perpage value
- *
- * @return integer Current perpage
- */
+ * Returns the current perpage value
+ *
+ * @return integer Current perpage
+ */
public function getPerPage()
{
return $this->perpage;
}
- // ###################################################################
/**
- * Sets total
- *
- * @param integer Total number
- */
+ * Sets total
+ *
+ * @param integer Total number
+ */
public function setTotal($total)
{
$this->total = $total;
}
- // ###################################################################
/**
- * Returns the number of pages to be in the navigator
- *
- * @param integer Number of pages
- */
+ * Returns the number of pages to be in the navigator
+ *
+ * @param integer Number of pages
+ */
public function getPageCount()
{
return $this->pagecount;
}
- // ###################################################################
/**
- * Takes all of the information from the set() functions and then
- * prepares all of the data through verification
- */
+ * Takes all of the information from the set() functions and then
+ * prepares all of the data through verification
+ */
public function processIncomingData()
{
$this->_setVariables();
$this->perpage = BSApp::$input->clean($this->perpage, TYPE_INT);
}
- // ###################################################################
/**
- * Takes the variables and splits up the pages
- */
+ * Takes the variables and splits up the pages
+ */
public function splitPages()
{
$this->pagecount = ceil($this->total / $this->perpage);
}
}
- // ###################################################################
/**
- * Returns the lower limit of the pages
- *
- * @param integer Page number
- *
- * @return integer Lower result limit
- */
+ * Returns the lower limit of the pages
+ *
+ * @param integer Page number
+ *
+ * @return integer Lower result limit
+ */
public function fetchLimit($page = null)
{
if ($page === null)
}
}
- // ###################################################################
/**
- * Constructs the page navigator
- *
- * @param string Base link path
- * @param bool Add a ? or a & to the path so it's link-friendly
- *
- * @return string Generated HTML page navigator
- */
+ * Constructs the page navigator
+ *
+ * @param string Base link path
+ * @param bool Add a ? or a & to the path so it's link-friendly
+ *
+ * @return string Generated HTML page navigator
+ */
public function constructPageNav($baselink, $addParam = true)
{
// handle base link