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

Class: Pager_Common

Source Location: /Pager-2.4.3/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_Sliding
Pager_Sliding - Generic data paging class ("sliding window" style) Usage examples can be found in the PEAR manual
Pager_Jumping
Pager_Jumping - Generic data paging class ("jumping window" style) Handles paging a set of data. For usage see the example.php provided.

Inherited Variables

Inherited Methods


Class Details

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


[ Top ]


Class Variables

$links =  ''

[line 406]

  • Var: Complete set of links
  • Access: public

Type:   string


[ Top ]

$linkTags =  ''

[line 412]

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

Type:   string


[ Top ]

$range = array()

[line 420]

  • 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

build   [line 485]

void build( )

Generate or refresh the links and paged data after a call to setOptions()
  • Access: public

Overridden in child classes as:

Pager_Sliding::build()
Generate or refresh the links and paged data after a call to setOptions()
Pager_Jumping::build()
Generate or refresh the links and paged data after a call to setOptions()

[ Top ]

errorMessage   [line 1487]

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

integer getCurrentPageID( )

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

[ Top ]

getLinks   [line 594]

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_Sliding::getLinks()
Returns back/next/first/last and page links, both as ordered and associative array.
Pager_Jumping::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 623]

mixed getNextPageID( )

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

[ Top ]

getOffsetByPageId   [line 544]

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 ]

getOption   [line 1450]

mixed getOption( string $name)

Return the current value of a given option
  • Return: option value

Parameters:

string   $name   —  option name

[ Top ]

getOptions   [line 1468]

array getOptions( )

Return an array with all the current pager options
  • Return: list of all the pager options

[ Top ]

getPageData   [line 502]

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

int getPageIdByOffset( $index $index)

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

Overridden in child classes as:

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

Parameters:

$index   $index   —  Offset to get pageID for

[ Top ]

getPageRangeByPageId   [line 568]

array getPageRangeByPageId( integer $pageID)

  • Return: First and last offsets

Overridden in child classes as:

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

Parameters:

integer   $pageID   —  PageID to get offsets for

[ Top ]

getPageSelectBox   [line 1172]

string getPageSelectBox( [array $params = array()], [string $extraAttributes = ''])

Returns a string with a XHTML SELECT menu with the page numbers, useful as an alternative to the links
  • Return: xhtml select box
  • Access: public

Parameters:

string   $extraAttributes   —  (html attributes) Tag attributes or HTML attributes (id="foo" pairs), will be inserted in the <select> tag
array   $params   —  - 'optionText': text to show in each option. Use '%d' where you want to see the number of pages selected.
  • 'autoSubmit': if TRUE, add some js code to submit the form on the onChange event

[ Top ]

getPerPageSelectBox   [line 1148]

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

mixed getPreviousPageID( )

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

[ Top ]

isFirstPage   [line 676]

bool isFirstPage( )

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

[ Top ]

isLastPage   [line 689]

bool isLastPage( )

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

[ Top ]

isLastPageComplete   [line 702]

bool isLastPageComplete( )

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

[ Top ]

numItems   [line 650]

int numItems( )

Returns number of items
  • Return: Number of items

[ Top ]

numPages   [line 663]

int numPages( )

Returns number of pages
  • Return: Number of pages

[ Top ]

setOptions   [line 1363]

integer setOptions( mixed $options)

Set and sanitize options
  • Return: error code (PAGER_OK on success)
  • Access: public

Parameters:

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

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:49:08 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.