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

Class: Pager_Common

Source Location: /Pager-2.2.6/Common.php

Class Overview


Pager_Common - Common base class for [Sliding|Jumping] Window Pager


Author(s):

Version:

  • $Id: Common.php,v 1.31 2005/02/01 20:23:23 quipo Exp $

Variables

Methods


Child classes:

Pager_Jumping
Pager_Jumping - Jumping Window Pager
Pager_Sliding
Pager_Sliding - Generic data paging class ("sliding window" style)

Inherited Variables

Inherited Methods


Class Details

[line 73]
Pager_Common - Common base class for [Sliding|Jumping] Window Pager

Usage examples can be found in the doc provided



[ Top ]


Class Variables

$links =  ''

[line 352]

  • Var: Complete set of links
  • Access: public

Type:   string


[ Top ]

$linkTags =  ''

[line 358]

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

Type:   string


[ Top ]

$range = array()

[line 366]

  • 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 1146]

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

integer getCurrentPageID( )

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

[ Top ]

getLinks   [line 472]

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

mixed getNextPageID( )

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

[ Top ]

getOffsetByPageId   [line 422]

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

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

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

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

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

mixed getPreviousPageID( )

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

[ Top ]

isFirstPage   [line 554]

bool isFirstPage( )

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

[ Top ]

isLastPage   [line 567]

bool isLastPage( )

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

[ Top ]

isLastPageComplete   [line 580]

bool isLastPageComplete( )

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

[ Top ]

numItems   [line 528]

int numItems( )

Returns number of items
  • Return: Number of items

[ Top ]

numPages   [line 541]

int numPages( )

Returns number of pages
  • Return: Number of pages

[ Top ]


Documentation generated on Fri, 4 Feb 2005 05:20:12 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.