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

Class: Pager_Common

Source Location: /Pager-2.3.5/Common.php

Class Overview


Pager_Common - Common base class for [Sliding|Jumping] Window Pager Extend this class to write a custom paging class


Author(s):

Copyright:

  • 2003-2005 Lorenzo Alberton, Richard Heyes

Variables

Methods


Child classes:

Pager_Jumping
Pager_Jumping - Generic data paging class ("jumping window" style) Handles paging a set of data. For usage see the example.php provided.
Pager_Sliding
Pager_Sliding - Generic data paging class ("sliding window" style) Usage examples can be found in the PEAR manual

Inherited Variables

Inherited Methods


Class Details

[line 73]
Pager_Common - Common base class for [Sliding|Jumping] Window Pager Extend this class to write a custom paging class


[ Top ]


Class Variables

$links =  ''

[line 387]

  • Var: Complete set of links
  • Access: public

Type:   string


[ Top ]

$linkTags =  ''

[line 393]

  • Var: Complete set of link tags
  • Access: public

Type:   string


[ Top ]

$range = array()

[line 401]

  • 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

errorMessage   [line 1412]

string errorMessage( int $code)

Return a textual error message for a PAGER error code
  • Return: error message
  • Access: public

Parameters:

int   $code     error code

[ Top ]

getCurrentPageID   [line 520]

integer getCurrentPageID( )

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

[ Top ]

getLinks   [line 505]

array getLinks( [integer $pageID = null], [string $next_html = ''])

Returns back/next/first/last and page links, both as ordered and associative array.

NB: in original PEAR::Pager this method accepted two parameters, $back_html and $next_html. Now the only parameter accepted is an integer ($pageID), since the html text for prev/next links can be set in the factory. If a second parameter is provided, then the method act as it previously did. This hack was done to mantain backward compatibility only.

  • Return: back/next/first/last and page links

Overridden in child classes as:

Pager_Jumping::getLinks()
Returns back/next/first/last and page links, both as ordered and associative array.
Pager_Sliding::getLinks()
Returns back/next/first/last and page links, both as ordered and associative array.

Parameters:

integer   $pageID     Optional pageID. If specified, links for that page are provided instead of current one. [ADDED IN NEW PAGER VERSION]
string   $next_html     HTML to put inside the next link [deprecated: use the factory instead]

[ Top ]

getNextPageID   [line 534]

mixed getNextPageID( )

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

[ Top ]

getOffsetByPageId   [line 455]

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 (1, 10). PageID of 2 would give you (11, 20).
  • Return: First and last offsets
  • Access: public

Parameters:

integer   $pageid     PageID to get offsets for

[ Top ]

getPageData   [line 413]

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 435]

int getPageIdByOffset( $index $index)

Returns pageID for given offset
  • Return: PageID for given offset

Overridden in child classes as:

Pager_Jumping::getPageIdByOffset()
Returns pageID for given offset
Pager_Sliding::getPageIdByOffset()
"Overload" PEAR::Pager method. VOID. Not needed here...

Parameters:

$index   $index     Offset to get pageID for

[ Top ]

getPageRangeByPageId   [line 479]

array getPageRangeByPageId( integer $pageID)

  • Return: First and last offsets

Overridden in child classes as:

Pager_Jumping::getPageRangeByPageId()
Given a PageId, it returns the limits of the range of pages displayed.
Pager_Sliding::getPageRangeByPageId()
Given a PageId, it returns the limits of the range of pages displayed.

Parameters:

integer   $pageID     PageID to get offsets for

[ Top ]

getPerPageSelectBox   [line 1054]

string getPerPageSelectBox( [integer $start = 5], [integer $end = 30], [integer $step = 5], [boolean $showAllData = false], [array $extraParams = array()])

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     
boolean   $showAllData     If true, perPage is set equal to totalItems.
array   $extraParams     (or string $optionText for BC reasons)
  • 'optionText': text to show in each option. Use '%d' where you want to see the number of pages selected.
  • 'attributes': (html attributes) Tag attributes or HTML attributes id="foo" pairs, will be inserted in the <select> tag

[ Top ]

getPreviousPageID   [line 548]

mixed getPreviousPageID( )

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

[ Top ]

isFirstPage   [line 587]

bool isFirstPage( )

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

[ Top ]

isLastPage   [line 600]

bool isLastPage( )

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

[ Top ]

isLastPageComplete   [line 613]

bool isLastPageComplete( )

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

[ Top ]

numItems   [line 561]

int numItems( )

Returns number of items
  • Return: Number of items

[ Top ]

numPages   [line 574]

int numPages( )

Returns number of pages
  • Return: Number of pages

[ Top ]


Documentation generated on Fri, 20 Jan 2006 09:03:21 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.