ZenMagick 0.9.10


org.zenmagick.mvc.resultlist\ZMResultList
mvc\resultlist\ZMResultList.php at line 37

Class ZMResultList

ZMObject
└─ZMResultList

public class ZMResultList
extends ZMObject

A (result) list that handles lists spanning multiple pages.

A result list operates on any given set of results. Results do not have to have any specific properties, type specific code is delegated to filters and sorters.

Results are obtained via the ZMResultSource object. This defers the actual query to the latest possible moment. Methods may trigger the query if they depend on results; a good example for that is, for example, getNumberOfResults().

Author:
DerManoMann

Field Summary
protected mixed

$allResults_

protected mixed

$filters_

protected mixed

$page_

protected mixed

$pagination_

protected mixed

$resultSource_

protected mixed

$results_

protected mixed

$sorters_

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
void

__construct()

Create new result list.

void

addFilter(ZMResultListFilter filter)

Add a filter to this result list.

void

addSorter(ZMResultListSorter sorter)

Add a sorter to this result list.

protected array

buildResults()

Actual method to generate the viewable results.

array

getAllResults()

Get all available results.

array

getFilters(boolean active)

Get all filter.

int

getNextPageNumber()

Get the next page number.

int

getNumberOfPages()

Get the calculated number of pages.

int

getNumberOfResults()

Count all results.

int

getPageNumber()

Get the page number (1-based).

int

getPagination()

Get the configured pagination.

int

getPreviousPageNumber()

Get the previous page number.

array

getResults()

Get the results for the current page.

array

getSorters(boolean active)

Get all configured sorter.

boolean

hasFilters()

Check if any filter are active.

boolean

hasNextPage()

Check if a next page is available.

boolean

hasPreviousPage()

Check if a previous page is available.

boolean

hasResults()

Checks if there are results available.

boolean

hasSorters()

Check if any sorter are configured.

void

setPageNumber(int page)

Set the page number (1-based).

void

setPagination(int pagination)

Set the configured pagination.

void

setResultSource(ZMResultSource resultSource)

Set a source for results.

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Field Detail

mvc\resultlist\ZMResultList.php at line 43

allResults_

protected mixed $allResults_

mvc\resultlist\ZMResultList.php at line 39

filters_

protected mixed $filters_

mvc\resultlist\ZMResultList.php at line 41

page_

protected mixed $page_

mvc\resultlist\ZMResultList.php at line 42

pagination_

protected mixed $pagination_

mvc\resultlist\ZMResultList.php at line 38

resultSource_

protected mixed $resultSource_

mvc\resultlist\ZMResultList.php at line 44

results_

protected mixed $results_

mvc\resultlist\ZMResultList.php at line 40

sorters_

protected mixed $sorters_

Method Detail

mvc\resultlist\ZMResultList.php at line 50

__construct

public void __construct()

Create new result list.


mvc\resultlist\ZMResultList.php at line 89

addFilter

public void addFilter(ZMResultListFilter filter)

Add a filter to this result list.

Parameters:
filter - The new filter.

mvc\resultlist\ZMResultList.php at line 102

addSorter

public void addSorter(ZMResultListSorter sorter)

Add a sorter to this result list.

Parameters:
sorter - The new sorter.

mvc\resultlist\ZMResultList.php at line 329

buildResults

protected array buildResults()

Actual method to generate the viewable results.

Returns:
List of result objects.

mvc\resultlist\ZMResultList.php at line 317

getAllResults

public array getAllResults()

Get all available results.

Please note that depending on the actual implementation this might return the same as getResults().

Returns:
List of all available results.

mvc\resultlist\ZMResultList.php at line 153

getFilters

public array getFilters(boolean active)

Get all filter.

Parameters:
active - Optional flag to get only active sorters; default is false
Returns:
A list of ZMResultListFilter.

mvc\resultlist\ZMResultList.php at line 264

getNextPageNumber

public int getNextPageNumber()

Get the next page number.

Returns:
The next page number.

mvc\resultlist\ZMResultList.php at line 228

getNumberOfPages

public int getNumberOfPages()

Get the calculated number of pages.

Returns:
The number of pages; will return 0 if no results available.

mvc\resultlist\ZMResultList.php at line 181

getNumberOfResults

public int getNumberOfResults()

Count all results.

Returns:
The total number if results.

mvc\resultlist\ZMResultList.php at line 190

getPageNumber

public int getPageNumber()

Get the page number (1-based).

Returns:
The page number.

mvc\resultlist\ZMResultList.php at line 209

getPagination

public int getPagination()

Get the configured pagination.

Returns:
The number of results per page.

mvc\resultlist\ZMResultList.php at line 255

getPreviousPageNumber

public int getPreviousPageNumber()

Get the previous page number.

Returns:
The previous page number; (default: 1)

mvc\resultlist\ZMResultList.php at line 273

getResults

public array getResults()

Get the results for the current page.

Returns:
List of results for the current page.

mvc\resultlist\ZMResultList.php at line 124

getSorters

public array getSorters(boolean active)

Get all configured sorter.

Parameters:
active - Optional flag to get only active sorters; default is false
Returns:
A list of ZMResultListSorter.

mvc\resultlist\ZMResultList.php at line 143

hasFilters

public boolean hasFilters()

Check if any filter are active.

Returns:
true if filters are configured, false if not.

mvc\resultlist\ZMResultList.php at line 246

hasNextPage

public boolean hasNextPage()

Check if a next page is available.

Returns:
true if a next page is available, false if not.

mvc\resultlist\ZMResultList.php at line 237

hasPreviousPage

public boolean hasPreviousPage()

Check if a previous page is available.

Returns:
true if a previous page is available, false if not.

mvc\resultlist\ZMResultList.php at line 172

hasResults

public boolean hasResults()

Checks if there are results available.

Returns:
true if results are available, false if not.

mvc\resultlist\ZMResultList.php at line 114

hasSorters

public boolean hasSorters()

Check if any sorter are configured.

Returns:
true if sorter are configured, false if not.

mvc\resultlist\ZMResultList.php at line 199

setPageNumber

public void setPageNumber(int page)

Set the page number (1-based).

Parameters:
page - The page number.

mvc\resultlist\ZMResultList.php at line 218

setPagination

public void setPagination(int pagination)

Set the configured pagination.

Parameters:
pagination - The number of results per page.

mvc\resultlist\ZMResultList.php at line 78

setResultSource

public void setResultSource(ZMResultSource resultSource)

Set a source for results.

The advantage of using a result source is that alternative implementations are free to ignore these, modify them or replace them as needed. Providing results via the constructor means that the resources used to build that list might be wasted.

Parameters:
resultSource - A result source.

ZenMagick 0.9.10