Base paginator class.
PHOCOA has its own pagination infrastructure. The UI layer of pagination is nicely separated from the data layer so that the PHOCOA pagination infrastructure can be easily used with any underlying data source (SQL, PHP arrays, etc).
The WFPaginator class is the core pagination functionality that coordiantes the PHOCOA Pagination UI widgets with the underlying data. The PHOCOA pagination infrastructure includes support for multi-key sorting as well.
It is extremely simple to paginate your data with PHOCOA.
To hook up the PHOCOA widgets with a data source, you must provide a Data Delegate to WFPaginator to provide the paged data to the pagination infrastructure. A Data delegate is any class that implements the WFPagedData interface.
PHOCOA ships with data delegates for PHP Arrays, Propel criteria-based queries, and Creole-based queries. There is also a data delegate for DieselPoint result sets.
Because of this architecture, the pagination widgets of PHOCOA can be easily "bound" to a pagination instance and make the display of paginated data easy.
USAGE First, figure out is which mode you need to use.
Adding Pagination to an exist list view.
NOTE: The first page is page 1 (as opposed to page 0).
Located in /framework/WFPagination.php (line 64)
WFObject | --WFPaginator
Add a sortKey to the current paginator. Call multiple times for a multi-key-sort.
Add a sort option to the existing sort options.
Get the alternativeParameterValue for a particular ID.
Is the current page the first page?
Is the current page the last page?
Remove all sort information for the paginator.
Get the array of items in the current page.
NOTE: uses a cached value.
Get the current page that the paginator is on.
Turn on MODE_URL.
Get the number of the last item in the current page.
Get the current total item count for the current data delgate.
NOTE: uses a cached value.
Get the item phrase for the passed count. Returns singular or plural name based on count.
Get the javascript code for the onClick of a link needed to effect the given pasinatorState. For MODE_FORM only.
Get the name of the js function which the various paginator widgets use when MODE_FORM is active to "go" to the correct paginator state.
Get the name of the js var which the various paginator widgets use when MODE_FORM is active to determine whether the "submit" button has been pressed by a user, or by the jsPaginatorStateModeFormGoToStateFunctionName() function.
Get the page number of the last page.
Load all data from the delegate.
NOTE: won't reload if alread cached. Use reloadData instead.
Is there a next page?
Get the number of pages of data.
Get the number of items in a single page.
Get the passed paginator state in a serialized format.
Get the id of the paginatorState widget.
Is there a previous page?
Read the paginator's state from the page's parameters.
Clear all caches and reload the data from the delegate.
Provide alternate values for the page's params that will be used with urlForPaginatorState().
The passed value will be urlencoded when used.
Set the current page for the paginator.
Set the data delegate.
The WFPaginator instance will call out to the data delegate to fetch the paged data.
Set the default sort keys that will be used if no other sort keys are added.
Set the names of the items being paged.
Turn on MODE_FORM.
Set the number of items per page.
Used to restore the paginator to the state specified.
Tell the paginator the name of the "parameterId" which is used for maintaining the parameter state.
For MODE_URL, your page should have a declared paramater with this id. For MODE_FORM, your page should have a WFPaginatorState widget with this id.
NOTE: if you are using a paginator outside of a WFModule context, you should set the paginatorStateParameterID to NULL.
Inform the paginator of all sort options that can be used via the UI.
The WFPaginatorSortLink widget will use this info to effect sorting.
Get the effective sortKeys for the paginator.
This function will use the default sortKeys if there are no sortKeys set.
Get the assigned sort options for the paginator.
Get the number of the first item in the current page.
Get the id of the submit button used for pagination in MODE_FORM.
Get an absolute URL that links to a different paginator state for the current setup.
This is a helper function used by the pagination widgets.
This function is used for MODE_URL, and degrade-no-javascript for MODE_FORM. Functionality won't be quite perfect for the latter, but it is only intended to let search engines be able to scan through MODE_FORM paginated content.
If any of the other parameters should be different than they were in the original params created for the page, set the new value(s) with setAlternativeParameterValue before displaying any of the pagination widgets.
Inherited From WFObject
WFObject::__construct()
WFObject::exposedProperties()
WFObject::getClass()
WFObject::keyPathToTargetAndKey()
WFObject::setValueForKey()
WFObject::setValueForKeyPath()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForUndefinedKey()
WFObject::__toString()
Documentation generated on Thu, 17 Apr 2008 13:52:00 -0400 by phpDocumentor 1.4.1