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

Class: Pager_Common

Source Location: /Pager-2.4.9/Pager/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-2007 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 431]

  • Var: Complete set of links
  • Access: public

Type:   string


[ Top ]

$linkTags =  ''

[line 437]

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

Type:   string


[ Top ]

$linkTagsRaw = array()

[line 443]

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

Type:   array


[ Top ]

$range = array()

[line 451]

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

void build( )

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

[ Top ]

errorMessage   [line 1682]

string errorMessage( integer $code)

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

Parameters:

integer   $code     error code

[ Top ]

getCurrentPageID   [line 680]

integer getCurrentPageID( )

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

[ Top ]

getLinks   [line 665]

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
  • Access: public

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

mixed getNextPageID( )

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

[ Top ]

getOffsetByPageId   [line 609]

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

mixed getOption( string $name)

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

Parameters:

string   $name     option name

[ Top ]

getOptions   [line 1662]

array getOptions( )

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

[ Top ]

getPageData   [line 565]

array getPageData( [integer $pageID = null])

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

Parameters:

integer   $pageID     Desired page ID (optional)

[ Top ]

getPageIdByOffset   [line 589]

integer getPageIdByOffset( integer $index)

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

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:

integer   $index     Offset to get pageID for

[ Top ]

getPageRangeByPageId   [line 636]

array getPageRangeByPageId( [integer $pageID = null])

Given a PageId, it returns the limits of the range of pages displayed.
  • Return: First and last offsets
  • Access: public

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

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:

array   $params     
    • 'autoSubmit': if TRUE, add some js code to submit the form on the onChange event
    string   $extraAttributes     (html attributes) Tag attributes or HTML attributes (id="foo" pairs), will be inserted in the <select> tag

    [ Top ]

    getPerPageSelectBox   [line 1324]

    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     starting value for the select menu
    integer   $end     ending value for the select menu
    integer   $step     step between values in the select menu
    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 710]

    mixed getPreviousPageID( )

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

    [ Top ]

    isFirstPage   [line 752]

    bool isFirstPage( )

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

    [ Top ]

    isLastPage   [line 766]

    bool isLastPage( )

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

    [ Top ]

    isLastPageComplete   [line 780]

    bool isLastPageComplete( )

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

    [ Top ]

    numItems   [line 724]

    integer numItems( )

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

    [ Top ]

    numPages   [line 738]

    integer numPages( )

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

    [ Top ]

    setOptions   [line 1547]

    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 Wed, 14 May 2014 10:00:04 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.