pclib  2.3.2
Lightweight PHP framework
Public Member Functions | Data Fields | Protected Member Functions
GridPager Class Reference

Provides paginator calculations and rendering of the grid pager. More...

Inheritance diagram for GridPager:
BaseObject

Public Member Functions

 __construct ($length, $baseUrl)
 Create pager. More...
 
 setPage ($page)
 Set active (selected) page. More...
 
 setLength ($length)
 Set total number of rows. More...
 
 setPageLen ($pageLen)
 Set number of rows of the page. More...
 
 getValue ($id)
 Return value of the pager item. More...
 
 getUrl ($page)
 Return pager url for the $page. More...
 
 getHtml ($id, $cssClass= 'page-item')
 Return HTML for the pager link or other item. More...
 
 html ()
 Return pager html. More...
 
- Public Member Functions inherited from BaseObject
 loadDefaults ($className=null)
 Load default parameters of class $className into object instance.
 
 setProperties (array $defaults)
 Set public properties of object from the array. More...
 
 addEvent ($name, $callback)
 Add event handler to $object->$name property. More...
 
 toArray ()
 Convert object to array. More...
 

Data Fields

 $linkNumber = 10
 Number of page-links shown in pager. More...
 
 $baseUrl = '/?'
 Base url for pager links. More...
 
 $pattern = '%s | %s | %s'
 Pattern for rendering. More...
 
 $patternItem = '<span class="%s">%s</span>'
 Pattern for rendering of the pager item. More...
 
 $translator
 var Translator
 
- Data Fields inherited from BaseObject
 $onNewInstance
 Occurs when new instance of the class is created. More...
 
 $onMissingMethod
 Occurs when called method does not exist. More...
 
 $serviceLocator
 var function() Return service object when requested with service(). More...
 

Protected Member Functions

 clamp ($num, $min, $max)
 Shift $num value into interval <$min, $max>. More...
 
 getPagesHtml ()
 Return links to all pages. More...
 
 pagerRange ($page, $size)
 Return array of page numbers arround active page. More...
 
- Protected Member Functions inherited from BaseObject
 fireEvent ($name, array $args=array())
 Run all event handlers in $object->$name property. More...
 
 service ($service, $default=null)
 Try acquire $service and load it into property $this->$service. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseObject
static defaults ()
 Set or retireve default parameters of the object. More...
 

Detailed Description

Provides paginator calculations and rendering of the grid pager.

Constructor & Destructor Documentation

__construct (   $length,
  $baseUrl 
)

Create pager.

Parameters
int$lengthTotal number of rows.
string$baseUrl

Member Function Documentation

clamp (   $num,
  $min,
  $max 
)
protected

Shift $num value into interval <$min, $max>.

Returns
int $num Value in specified interval.
getHtml (   $id,
  $cssClass = 'page-item' 
)

Return HTML for the pager link or other item.

Parameters
string$idId of pager item
string$cssClass
Returns
string $html
getPagesHtml ( )
protected

Return links to all pages.

Returns
string $html
getUrl (   $page)

Return pager url for the $page.

Parameters
int$page
Returns
string $url
getValue (   $id)

Return value of the pager item.

Parameters
string$idId of pager item
html ( )

Return pager html.

Returns
string $html
pagerRange (   $page,
  $size 
)
protected

Return array of page numbers arround active page.

Parameters
int$pageActive page
int$sizeSize of returned array
Returns
array Page numbers
setLength (   $length)

Set total number of rows.

Parameters
int$length
setPage (   $page)

Set active (selected) page.

Parameters
int$page
setPageLen (   $pageLen)

Set number of rows of the page.

Parameters
int$pageLen

Field Documentation

$baseUrl = '/?'

Base url for pager links.

$linkNumber = 10

Number of page-links shown in pager.

$pattern = '%s | %s | %s'

Pattern for rendering.

"first | last | pages" by default.

$patternItem = '<span class="%s">%s</span>'

Pattern for rendering of the pager item.


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