From 2975d49bb77729aee82c7563adcf996a9f0e0b2f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 6 Dec 2006 02:35:30 +0000 Subject: [PATCH] Updating pagination.php to be in line with the new formatting --- pagination.php | 146 +++++++++++++++---------------------------------- 1 file changed, 44 insertions(+), 102 deletions(-) diff --git a/pagination.php b/pagination.php index a20d215..7a32957 100644 --- a/pagination.php +++ b/pagination.php @@ -20,8 +20,7 @@ \*=====================================================================*/ /** -* Pagination System -* pagination.php +* Pagination System (Pagination.php) * * @package ISSO */ @@ -34,139 +33,102 @@ * and then the input variables for page number and perpage. This will * then create a page navigator and manage the SQL LIMIT statements. * -* Templates required: -* pagenav_bit - The individual page numbers in the page navigator -* pagenav - The entirity of the page navigtaor -* * @author Blue Static * @copyright Copyright ©2002 - [#]year[#], Blue Static * @version $Revision$ * @package ISSO * */ -class Pagination +class BSPagination { /** * Current page number * @var integer - * @access private */ - var $page; + private $page; /** * Per-page value * @var integer - * @access private */ - var $perpage; + private $perpage; /** * Number of page links * @var integer - * @access private */ - var $pagelinks; + private $pagelinks; /** * Total number of results * @var integer - * @access private */ - var $total; + private $total; /** * Total number of pages * @var integer - * @access private */ - var $pagecount; + private $pagecount; /** * Name of page variable * @var array - * @access private */ - var $pagevar; + private $pagevar = 'p'; /** * Name of per-page variable * @var integer - * @access private */ - var $perpagevar; + private $perpagevar = 'pp'; /** * Maximum number of per-page results * @var integer - * @access private */ - var $maxperpage = 100; + private $maxperpage = 100; /** * Default number of per-page results * @var integer - * @access private */ - var $defaultperpage = 20; + private $defaultperpage = 20; /** - * The processing callback function for individual pagenav bits + * The processing callback public function for individual pagenav bits * @var string - * @access private */ - var $bitprocessor = ':undefined:'; + private $bitprocessor = ':undefined:'; /** - * The processing callback function for the entire pagenav system + * The processing callback public function for the entire pagenav system * @var string - * @access private - */ - var $pagenavprocessor = ':undefined:'; - - // ################################################################### - /** - * Constructor - */ - function __construct(&$registry) - { - $this->registry =& $registry; - } - - // ################################################################### - /** - * (PHP 4) Constructor */ - function Pagination(&$registry) - { - $this->__construct($registry); - } + private $pagenavprocessor = ':undefined:'; // ################################################################### /** - * Callback function for the processing of an indivdual page. Needs + * Callback public function for the processing of an indivdual page. Needs * the signature: * public string callback(string $baseLink, boolean $noLink, integer $pageNumber, Pagination $this) * - * @access public - * * @param string Callback function */ - function setBitProcessor($callback) + public function setBitProcessor($callback) { $this->bitprocessor = $callback; } // ################################################################### /** - * Callback function for the processing the entire page navigator. Needs + * Callback public function for the processing the entire page navigator. Needs * the signature: * public string callback(string $baseLink, integer $nextPage, integer $prevPage array $show['first'=>first page, 'last'=>last page, 'prev'=>previous page, 'next'=>next page], string $bits, Pagination $this) * - * @access public - * * @param string Callback function */ - function setNavigatorProcessor($callback) + public function setNavigatorProcessor($callback) { $this->pagenavprocessor = $callback; } @@ -175,11 +137,9 @@ class Pagination /** * Returns the current page number * - * @access public - * * @return integer Current page */ - function getPage() + public function getPage() { return $this->page; } @@ -188,11 +148,9 @@ class Pagination /** * Returns the current perpage value * - * @access public - * * @return integer Current perpage */ - function getPerPage() + public function getPerPage() { return $this->perpage; } @@ -201,11 +159,9 @@ class Pagination /** * Sets total * - * @access public - * * @param integer Total number */ - function setTotal($total) + public function setTotal($total) { $this->total = $total; } @@ -214,11 +170,9 @@ class Pagination /** * Returns the number of pages to be in the navigator * - * @access public - * * @param integer Number of pages */ - function getPageCount() + public function getPageCount() { return $this->pagecount; } @@ -227,11 +181,9 @@ class Pagination /** * Sets pagelinks * - * @access public - * * @param integer Number of page links */ - function setPageLinks($pagelinks) + public function setPageLinks($pagelinks) { $this->pagelinks = $pagelinks; } @@ -240,11 +192,9 @@ class Pagination /** * Sets pagevar * - * @access public - * * @param string Page variable */ - function setPageVar($pagevar) + public function setPageVar($pagevar) { $this->pagevar = $pagevar; } @@ -253,11 +203,9 @@ class Pagination /** * Sets perpagevar * - * @access public - * * @param string Per-page variable */ - function setPerPageVar($perpagevar) + public function setPerPageVar($perpagevar) { $this->perpagevar = $perpagevar; } @@ -266,11 +214,9 @@ class Pagination /** * Sets maxperpage * - * @access public - * * @param integer Maximum number per page */ - function setMaxPerPage($maxperpage) + public function setMaxPerPage($maxperpage) { $this->maxperpage = $maxperpage; } @@ -279,28 +225,30 @@ class Pagination /** * Sets defaultperpage * - * @access public - * * @param integer Total number */ - function setDefaultPerPage($defaultperpage) + public function setDefaultPerPage($defaultperpage) { $this->defaultperpage = $defaultperpage; } - // ################################################################### /** * Takes all of the information from the set() functions and then * prepares all of the data through verification - * - * @access public */ - function processIncomingData() + public function processIncomingData() { - $this->page = $this->registry->input_clean($this->pagevar, TYPE_INT); - $this->perpage = $this->registry->input_clean($this->perpagevar, TYPE_INT); - $this->pagelinks = $this->registry->clean($this->pagelinks, TYPE_INT); + $input = BSRegister::GetType('BSInput'); + if ($input == null) + { + BSRegister::Debug('ISSO/Input not loaded, so manually doing so'); + $input = BSRegister::LoadModule('Input'); + } + + $this->page = $input->input_clean($this->pagevar, TYPE_INT); + $this->perpage = $input->input_clean($this->perpagevar, TYPE_INT); + $this->pagelinks = $input->clean($this->pagelinks, TYPE_INT); if ($this->page <= 0) { @@ -315,17 +263,15 @@ class Pagination { $this->perpage = $this->maxperpage; } - - $this->perpage = $this->registry->clean($this->perpage, TYPE_INT); + + $this->perpage = $input->clean($this->perpage, TYPE_INT); } // ################################################################### /** * Takes the variables and splits up the pages - * - * @access public */ - function splitPages() + public function splitPages() { $this->pagecount = ceil($this->total / $this->perpage); if ($this->pagelinks == 0) @@ -338,13 +284,11 @@ class Pagination /** * Returns the lower limit of the pages * - * @access public - * * @param integer Page number * * @return integer Lower result limit */ - function fetchLimit($page = null) + public function fetchLimit($page = null) { if ($page === null) { @@ -382,13 +326,11 @@ class Pagination /** * Constructs the page navigator * - * @access public - * * @param string Base link path * * @return string Generated HTML page navigator */ - function constructPageNav($baselink) + public function constructPageNav($baselink) { global $bugsys; -- 2.22.5