Pager_Sliding
[ class tree: Pager_Sliding ] [ index: Pager_Sliding ] [ all elements ]

Class: Pager_Sliding

Source Location: /Pager_Sliding-1.6/Sliding.php

Class Overview


Pager_Sliding - Generic data paging class ("sliding window" style)


Author(s):

Version:

  • $Id: Sliding.php,v 1.19 2003/12/16 20:48:49 quipo Exp $

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 45]
Pager_Sliding - Generic data paging class ("sliding window" style)

Usage examples can be found in the doc provided

  • Version: $Id: Sliding.php,v 1.19 2003/12/16 20:48:49 quipo Exp $
  • Author: Lorenzo Alberton <at quipo.it>


[ Top ]


Class Variables

$links =  ''

[line 280]

  • Var: Complete set of links
  • Access: public

Type:   string


[ Top ]

$range = array()

[line 288]

  • Var: Array with a key => value pair representing page# => bool value (true if key==currentPageNumber). can be used for extreme customization.
  • Access: public

Type:   array


[ Top ]



Method Detail

Pager_Sliding (Constructor)   [line 359]

Pager_Sliding Pager_Sliding( [mixed $options = array()])

Constructor

------------------------------------------------------------------------- VALID options are (default values are set some lines before):

  • totalItems (int): # of items to page.
  • perPage (int): # of items per page.
  • delta (int): # of page #s to show before and after the current one
  • expanded (bool): if true, window size is always 2*delta+1
  • linkClass (string): name of CSS class used for link styling.
  • append (bool): if true pageID is appended as GET value to the URL - if false it is embedded in the URL according to "fileName" specs
  • path (string): complete path to the page (without the page name)
  • fileName (string): name of the page, with a %d if append=true
  • urlVar (string): name of pageNumber URL var, for example "pageID"
  • altPrev (string): alt text to display for prev page, on prev link.
  • altNext (string): alt text to display for next page, on next link.
  • altPage (string): alt text to display before the page number.
  • prevImg (string): sth (it can be text such as " PREV" or an <img/> as well...) to display instead of "".
  • nextImg (string): same as prevImg, used for NEXT link, instead of the default value, which is ">>".
  • separator (string): what to use to separate numbers (can be an <img/>, a comma, an hyphen, or whatever.
  • spacesBeforeSeparator (int): number of spaces before the separator.
  • firstPagePre (string): string used before first page number (can be an <img/>, a "{", an empty string, or whatever.
  • firstPageText (string): string used in place of first page number
  • firstPagePost (string): string used after first page number (can be an <img/>, a "}", an empty string, or whatever.
  • lastPagePre (string): similar to firstPagePre.
  • lastPageText (string): similar to firstPageText.
  • lastPagePost (string): similar to firstPagePost.
  • spacesAfterSeparator (int): number of spaces after the separator.
  • curPageLinkClassName (string): name of CSS class used for current page link.
  • clearIfVoid(bool): if there's only one page, don't display pager.
  • itemData (array): array of items to page.
  • useSessions (bool): if true, number of items to display per page is stored in the $_SESSION[$_sessionVar] var.
  • closeSession (bool): if true, the session is closed just after R/W.
  • sessionVar (string): name of the session var for perPage value. A value != from default can be useful when using more than one Pager istance in the page.
------------------------------------------------------------------------- REQUIRED options are:
  • fileName IF append==false (default is true)
-------------------------------------------------------------------------

  • Access: public

Parameters:

mixed   $options     An associative array of option names and their values.

[ Top ]

getCurrentPageID   [line 492]

integer getCurrentPageID( )

Returns ID of current page
  • Return: ID of current page
  • Access: public

[ Top ]

getLinks   [line 610]

array getLinks( [integer $pageID = null])

Returns back/next/first/last and page links, both as ordered and associative array.
  • Return: back/pages/next/first/last/all links
  • Access: public

Parameters:

integer   $pageID     Optional pageID. If specified, links for that page are provided instead of current one.

[ Top ]

getNextPageID   [line 507]

mixed getNextPageID( )

Returns next page ID. If current page is last page this function returns FALSE
  • Return: Next pages' ID
  • Access: public

[ Top ]

getOffsetByPageId   [line 429]

array getOffsetByPageId( [integer $pageid = null])

Returns offsets for given pageID. Eg, if you pass it pageID one and your perPage limit is 10 it will return you 1 and 10. PageID of 2 would give you 11 and 20.
  • Return: First and last offsets
  • Access: public

Parameters:

integer   $pageid     PageID to get offsets for

[ Top ]

getPageData   [line 388]

array getPageData( [$pageID $pageID = null])

Returns an array of current pages data
  • Return: Page data
  • Access: public

Parameters:

$pageID   $pageID     Desired page ID (optional)

[ Top ]

getPageIdByOffset   [line 414]

void getPageIdByOffset( [integer $index = null])

"Overload" PEAR::Pager method. VOID. Not needed here...
  • Access: public
  • Deprecated:

Parameters:

integer   $index     Offset to get pageID for

[ Top ]

getPageRangeByPageId   [line 461]

array getPageRangeByPageId( [integer $pageid = null])

Given a PageId, it returns the limits of the range of pages displayed.

While getOffsetByPageId() returns the offset of the data within the current page, this method returns the offsets of the page numbers interval. E.g., if you have pageId=5 and delta=2, it will return (3, 7). PageID of 9 would give you (4, 8). If the method is called without parameter, pageID is set to currentPage#.

  • Return: First and last offsets
  • Access: public

Parameters:

integer   $pageid     PageID to get offsets for

[ Top ]

getPerPageSelectBox   [line 671]

string getPerPageSelectBox( [integer $start = 5], [integer $end = 30], [integer $step = 5])

Returns a string with a XHTML SELECT menu,

useful for letting the user choose how many items per page should be displayed. If parameter useSessions is TRUE, this value is stored in a session var. The string isn't echoed right now so you can use it with template engines.

  • Return: xhtml select box
  • Access: public

Parameters:

integer   $start     
integer   $end     
integer   $step     

[ Top ]

getPreviousPageID   [line 523]

mixed getPreviousPageID( )

Returns previous page ID. If current page is first page this function returns FALSE
  • Return: Previous pages' ID
  • Access: public

[ Top ]

isFirstPage   [line 565]

bool isFirstPage( )

Returns whether current page is first page
  • Return: First page or not
  • Access: public

[ Top ]

isLastPage   [line 579]

bool isLastPage( )

Returns whether current page is last page
  • Return: Last page or not
  • Access: public

[ Top ]

isLastPageComplete   [line 593]

bool isLastPageComplete( )

Returns whether last page is complete
  • Return: Last page complete or not
  • Access: public

[ Top ]

numItems   [line 537]

int numItems( )

Returns number of items
  • Return: Number of items
  • Access: public

[ Top ]

numPages   [line 551]

int numPages( )

Returns number of pages
  • Return: Number of pages
  • Access: public

[ Top ]


Documentation generated on Sat, 1 May 2004 01:26:31 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.