\Pluf_Paginator_Builder

Model pagination builder

Model paginator is used to select and perform an action on part of models in the model collection.

Here is an example showes how to use the class:

$builder = new Pluf_Paginator_Builder(new Pluf_Model())
->setRequest($request)

->setDisplayFields($displayList) ->setSearchFields($searchFields) ->setSortFields($sortFields)

->setWhereClause($sql) ->setView($viewName);

$paginator = $bulder->build();

Summary

Methods
Properties
Constants
__construct()
setRequest()
setDisplayList()
setSortFields()
setSearchFields()
setWhereClause()
setView()
setSortOrders()
build()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
loadDisplayFields()
loadSearchFileds()
loadSortFields()
getVisibleFieldsName()
loadModelView()
$model
$displayFields
$searchFields
$sortFields
$whereClause
$modelView
$request
$sortOrders
N/A

Properties

$model

$model : 

Type

$displayFields

$displayFields : array

Display list

Type

array

$searchFields

$searchFields : array

The fields being searched.

Type

array

$sortFields

$sortFields : array

Sort fields

Type

array

$whereClause

$whereClause : \Pluf_SQL

The where clause from the search.

Type

\Pluf_SQL

$modelView

$modelView : string

Model view to use with query

Type

string

$request

$request : \Pluf_HTTP_Request

User request

Type

\Pluf_HTTP_Request

$sortOrders

$sortOrders : array

Sort orders

Type

array

Methods

__construct()

__construct(\Pluf_Model  $model = null) 

Creates new instance of builder

Parameters

\Pluf_Model $model

setRequest()

setRequest(\Pluf_HTTP_Request  $request) : \Pluf_Paginator_Builder

Load setting from request

Parameters

\Pluf_HTTP_Request $request

Returns

\Pluf_Paginator_Builder

setDisplayList()

setDisplayList(array  $displayFields) 

The fields being shown.

If no fields are given, all readable fields of the model of the item will be used to show the item.

If an item in the list_display is an array the format is the following:

array('field', 'Custom_Function_ToApply', 'custom header name')

Parameters

array $displayFields

setSortFields()

setSortFields(array  $sortFields) : \Pluf_Paginator_Builder

Which fields of the model can be used to sort the dataset.

To be useable these fields must be in the $list_display so that the sort links can be shown for the user to click on them and sort the list.

Parameters

array $sortFields

Returns

\Pluf_Paginator_Builder

setSearchFields()

setSearchFields(array  $searchFields) : \Pluf_Paginator_Builder

Which fields used to search

Parameters

array $searchFields

Returns

\Pluf_Paginator_Builder

setView()

setView(string  $viewName) : \Pluf_Paginator_Builder

Main model view

Parameters

string $viewName

Returns

\Pluf_Paginator_Builder

setSortOrders()

setSortOrders(array  $sortOrders) 

Sets list of sort orders

$builder
->setSortOrder(array(
'id',
'DESC'
))
->build();

Parameters

array $sortOrders

list of default sort orders

build()

build() : \Pluf_Paginator

Build a paginator

Returns

\Pluf_Paginator

loadDisplayFields()

loadDisplayFields() : array

Load display fileds

Returns

array

loadSearchFileds()

loadSearchFileds() : array

Loads search fileds

Returns

array

loadSortFields()

loadSortFields() : array

Loads sort fields

Returns

array

getVisibleFieldsName()

getVisibleFieldsName() : array

Gets all readable fields names

Returns

array

loadModelView()

loadModelView() : string

Load model view

Returns

string