UNA
BxDolPaginate Class Reference
Inheritance diagram for BxDolPaginate:
BxDol BxBasePaginate BxTemplPaginate

Public Member Functions

 __construct ($aParams, $oTemplate=null)
 
 getNum ()
 
 setNumFromDataArray (&$a, $isAutoPopLastElement=true)
 
 setNum ($i)
 
 getStart ()
 
 setStart ($i)
 
 getPerPage ()
 
 setPerPage ($i)
 
 setOnChangePage ($s)
 
 isPrevAvail ()
 
 isNextAvail ()
 
 getPaginate ($iStart=-1, $iNum=-1, $iPerPage=-1)
 
 getSimplePaginate ($sViewAllUrl='', $iStart=-1, $iNum=-1, $iPerPage=-1)
 

Detailed Description

Paginage for any content. It is used to create paginate, configuring it via input parameters. Paginate don't support total number of pages, moreover it is not recommended to count all records - it slows down the site. To correctly determine last page we need to pass number of available records on the current page plus one - so we always know if next page is available.

Two types of paginate presentation is supported:

  • getPaginate() - to get default paginate, it is better to use it on the whole page.
  • getSimplePaginate() - to get limited paginate, it is better to use in some boxes, where availabel space is limited or for ajax paginate.

The list of available input parameters:

Parameters:

  • start - position of the first item.
  • num - number of available items on the page, it should be number of items per page + 1 (+1 is needed to correctly determine last page). It is possible to set this value automatically
    See also
    setNumFromDataArray.
  • per_page - number of items displayed on the page.
  • page_url - page URL to go through pages, special markers are automatically replaced.
  • on_change_page - JavaScript code to be called on change page.
  • info - display info.
  • view_all_url - URL for 'view all' page. This url is not showed by default. It is convinient to use with
    See also
    getSimplePaginate.
  • view_all_caption - optional caption for 'view all' link.

Available markers to replace in 'page_url' and 'on_change_page' parameters:

  • {per_page} - current number of items to display per page.
  • {start} - the number to display items starting from.

Example of usage:

$oPaginate = new BxDolPaginate(array(
'start' => 0,
'num' => 11,
'per_page' => 10,
'on_change_page' => 'changePage({start}, {per_page})'
));
$oPaginate->getPaginate();

Memberships/ACL: Doesn't depend on user's membership.

Alerts: no alerts available

Constructor & Destructor Documentation

◆ __construct()

BxDolPaginate::__construct (   $aParams,
  $oTemplate = null 
)

Constructor

Member Function Documentation

◆ getNum()

BxDolPaginate::getNum ( )

Get number of available results per page. If it is not last page, then this number is number of result per page plus one.

Returns
integer

◆ getPaginate()

BxDolPaginate::getPaginate (   $iStart = -1,
  $iNum = -1,
  $iPerPage = -1 
)

Get default paginate, it is better to use it on the whole page.

Parameters
$iStart-
See also
setStart.
Parameters
$iNum-
See also
setNum and
setNumFromDataArray.
Parameters
$iPerPage-
See also
setPerPage.
Returns
HTML string.

◆ getPerPage()

BxDolPaginate::getPerPage ( )

Get number of records per page.

Returns
integer.

◆ getSimplePaginate()

BxDolPaginate::getSimplePaginate (   $sViewAllUrl = '',
  $iStart = -1,
  $iNum = -1,
  $iPerPage = -1 
)

Get limited paginate, it is better to use in some boxes, where availabel space is limited or for ajax paginate.

Parameters
$sViewAllUrl- url to page for 'view all' link.
$iStart-
See also
setStart.
Parameters
$iNum-
See also
setNum and
setNumFromDataArray.
Parameters
$iPerPage-
See also
setPerPage.
Returns
HTML string.

◆ getStart()

BxDolPaginate::getStart ( )

Position, the data is showing from.

Returns
integer.

◆ isNextAvail()

BxDolPaginate::isNextAvail ( )
Returns
true if next page is available, or false if not

◆ isPrevAvail()

BxDolPaginate::isPrevAvail ( )
Returns
true if previous page is available, or false if not

◆ setNum()

BxDolPaginate::setNum (   $i)

Set number of available items on the page, it should be number of items per page + 1 (+1 is needed to correctly determine last page). It is possible to set this value automatically

See also
setNumFromDataArray.
Parameters
$ipositive integer.
Returns
true on success or false if $i param isn't correct.

◆ setNumFromDataArray()

BxDolPaginate::setNumFromDataArray ( $a,
  $isAutoPopLastElement = true 
)

Set number of available items on the page directly from data array. Since data array should contain additional record - we will pop last item from array automatically.

Returns
nothing.

◆ setOnChangePage()

BxDolPaginate::setOnChangePage (   $s)

Set string to pass to 'onclick' for change page button. The following markers are replaced automatically:

  • {per_page}
  • {start}
Parameters
$ipositive integer.
Returns
integer.

◆ setPerPage()

BxDolPaginate::setPerPage (   $i)

Set number of records per page.

Parameters
$ipositive integer.
Returns
integer.

◆ setStart()

BxDolPaginate::setStart (   $i)

Set the starting position, the data is showing from.

Parameters
$ipositive integer.
Returns
true on siccess or false on error.

The documentation for this class was generated from the following file: