paginator/0000775000076400007640000000000011222560536013550 5ustar ahsanchezahsanchezpaginator/__MACOSX/0000775000076400007640000000000010652767316015053 5ustar ahsanchezahsanchezpaginator/src/0000755000076400007640000000000010631053430014326 5ustar ahsanchezahsanchezpaginator/__MACOSX/src/0000775000076400007640000000000010652767316015642 5ustar ahsanchezahsanchezpaginator/src/TrailingLayout.php0000644000076400007640000000064610652762343020031 0ustar ahsanchezahsanchezgetPageNumber(); $totalPages = $parent->fetchNumberPages(); $str = ""; if($totalPages >= 1) { for($i = 1; $i <= $totalPages; $i++) { $str .= " Page $i"; $str .= $i != $totalPages ? " | " : ""; } } return $str; } } ?>paginator/src/Paginated.php0000644000076400007640000000642610652762212016753 0ustar ahsanchezahsanchezsetRs($obj); $this->setPageSize($displayRows); $this->assignPageNumber($pageNum); $this->setRowNumber(0); $this->setOffSet(($this->getPageNumber() - 1) * ($this->getPageSize())); } //implement getters and setters public function setOffSet($offSet) { $this->offSet = $offSet; } public function getOffSet() { return $this->offSet; } public function getRs() { return $this->rs; } public function setRs($obj) { $this->rs = $obj; } public function getPageSize() { return $this->pageSize; } public function setPageSize($pages) { $this->pageSize = $pages; } //accessor and mutator for page numbers public function getPageNumber() { return $this->pageNumber; } public function setPageNumber($number) { $this->pageNumber = $number; } //fetches the row number public function getRowNumber() { return $this->rowNumber; } public function setRowNumber($number) { $this->rowNumber = $number; } public function fetchNumberPages() { if (!$this->getRs()) { return false; } $pages = ceil(count($this->getRs()) / (float)$this->getPageSize()); return $pages; } //sets the current page being viewed to the value of the parameter public function assignPageNumber($page) { if(($page <= 0) || ($page > $this->fetchNumberPages()) || ($page == "")) { $this->setPageNumber(1); } else { $this->setPageNumber($page); } //upon assigning the current page, move the cursor in the result set to (page number minus one) multiply by the page size //example (2 - 1) * 10 } public function fetchPagedRow() { if((!$this->getRs()) || ($this->getRowNumber() >= $this->getPageSize())) { return false; } $this->setRowNumber($this->getRowNumber() + 1); $index = $this->getOffSet(); $this->setOffSet($this->getOffSet() + 1); return $this->rs[$index]; } public function isFirstPage() { return ($this->getPageNumber() <= 1); } public function isLastPage() { return ($this->getPageNumber() >= $this->fetchNumberPages()); } /** * * @return PageLayout */ public function getLayout() { return $this->layout; } /** * * @param PageLayout */ public function setLayout(PageLayout $layout) { $this->layout = $layout; } //returns a string with the base navigation for the page //if queryVars are to be added then the first parameter should be preceeded by a ampersand public function fetchPagedNavigation($queryVars = "") { return $this->getLayout()->fetchPagedLinks($this, $queryVars); }//end writeNavigation }//end Paginated ?>paginator/src/PageLayout.php0000644000076400007640000000040710652756750017134 0ustar ahsanchezahsanchez paginator/src/index.php0000644000076400007640000000237610652767223016175 0ustar ahsanchezahsanchez Pagination "; while($row = $pagedResults->fetchPagedRow()) { //when $row is false loop terminates echo "
  • {$row}
  • "; } echo ""; //important to set the strategy to be used before a call to fetchPagedNavigation $pagedResults->setLayout(new DoubleBarLayout()); echo $pagedResults->fetchPagedNavigation(); ?> paginator/src/DoubleBarLayout.php0000644000076400007640000000314410652760300020102 0ustar ahsanchezahsanchezgetPageNumber(); $str = ""; if(!$parent->isFirstPage()) { if($currentPage != 1 && $currentPage != 2 && $currentPage != 3) { $str .= "First < "; } } //write statement that handles the previous and next phases //if it is not the first page then write previous to the screen if(!$parent->isFirstPage()) { $previousPage = $currentPage - 1; $str .= "< previous "; } for($i = $currentPage - 2; $i <= $currentPage + 2; $i++) { //if i is less than one then continue to next iteration if($i < 1) { continue; } if($i > $parent->fetchNumberPages()) { break; } if($i == $currentPage) { $str .= "Page $i"; } else { $str .= "$i"; } ($i == $currentPage + 2 || $i == $parent->fetchNumberPages()) ? $str .= " " : $str .= " | "; //determine if to print bars or not }//end for if (!$parent->isLastPage()) { if($currentPage != $parent->fetchNumberPages() && $currentPage != $parent->fetchNumberPages() -1 && $currentPage != $parent->fetchNumberPages() - 2) { $str .= " > fetchNumberPages()."$queryVars\" title=\"Last\">Last(".$parent->fetchNumberPages().") "; } } if(!$parent->isLastPage()) { $nextPage = $currentPage + 1; $str .= "next >"; } return $str; } } ?>paginator/src/.DS_Store0000644000076400007640000001400410652767264016034 0ustar ahsanchezahsanchezBud1 Storein .DS_Storeinfoblob0ÂÑŸ/ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿDoubleBarLayout.phpinfoblob0ÂÑ‘@ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ index.phpinfoblob0ÂÑŸÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿPageLayout.phpinfoblob0ÂÑŽhÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ Paginated.phpinfoblob0ÂÑ• ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿTrailingLayout.phpinfoblob0ÂÑ•cÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  @€ @€ @€ @ E DSDB `€ @€ @€ @paginator/__MACOSX/src/._TrailingLayout.php0000644000076400007640000000012210652762343021523 0ustar ahsanchezahsanchez 2 RTEXTpaginator/__MACOSX/src/._Paginated.php0000644000076400007640000000012210652762212020443 0ustar ahsanchezahsanchez 2 RTEXTpaginator/__MACOSX/src/._PageLayout.php0000644000076400007640000000012210652756750020633 0ustar ahsanchezahsanchez 2 RTEXTpaginator/__MACOSX/src/._index.php0000644000076400007640000000012210652767223017665 0ustar ahsanchezahsanchez 2 RTEXTpaginator/__MACOSX/src/._DoubleBarLayout.php0000644000076400007640000000012210652760300021600 0ustar ahsanchezahsanchez 2 RTEXTpaginator/__MACOSX/src/._.DS_Store0000644000076400007640000000012210652767264017535 0ustar ahsanchezahsanchez 2 R@