Prints pagination links for fRecordSet or other paginated records
1.0.0b2 | Improved the determination of what pages to show with with_first_last templates 9/16/12 |
---|---|
1.0.0b | Added the prev_disabled and next_disabled pieces 9/6/11 |
Defines a new template to use with the paginator
The $pieces array must contain the following array keys:
There are various pre-defined variables available for use in the template pieces. These variables are printed by using the syntax {{ variable }}.
The info, start and end pieces may use the following variables:
The prev and next pieces may use the following variables:
The page piece may use the following variables:
The separator piece does not have access to any pre-defined variables.
In addition to the pre-defined variables, it is possible to add any other variables to be used in any of the pieces by calling the instance method set().
It is possible to use variable filters on a variable to modify it. The most common variable to filter would be name. To filter a variable, add a | and the filter name after the variable name, in the form {{ variable|filter }}. The following filters are available:
Filters can be combined, in which case they are list one after the other in the form {{ variable|filter_1|filter_2 }}.
void defineTemplate( string $name, string $type, integer $size, array $pieces )
string | $name | The name of the template |
string | $type | The type of pagination: without_first_last or with_first_last - with_first_last always includes links to the first and last pages |
integer | $size | The number of pages to show on either side of the current page |
array | $pieces | The chunks of HTML to create the paginator from - see method description for details |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Handles the printInfo() method for fRecordSet
void printRecordSetInfo( fRecordSet $object, string|array $class, array &$records, string $method_name, array $parameters )
fRecordSet | $object | The record set |
string|array | $class | The class(es) contained in the record set |
array | &$records | The records |
string | $method_name | The method that was called |
array | $parameters | The parameters passed to the method |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Resets the configuration of the class
void reset( )
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Handles the showLinks() method for fRecordSet
boolean showRecordSetLinks( fRecordSet $object, string|array $class, array &$records, string $method_name, array $parameters )
fRecordSet | $object | The record set |
string|array | $class | The class(es) contained in the record set |
array | &$records | The records |
string | $method_name | The method that was called |
array | $parameters | The parameters passed to the method |
If the links were shown
Accepts the record information necessary for printing pagination
fPaginator __construct( integer $records, integer $per_page, integer $page )
fPaginator __construct( fRecordSet $records )
integer | $records | The total number of records |
integer | $per_page | The number of records per page |
integer | $page | The page number |
Prints which records are showing on the current page
void printInfo( string $template='default' )
string | $template | The template to use |
Sets data to be available to the templates
void set( string $key, mixed $value )
void set( array $data )
string | $key | The key to set |
mixed | $value | The value to set |
array | $data | An associative array of keys and values |
Shows links to other pages when more than one page of records exists
boolean showLinks( string $template='default' )
string | $template | The template to use |
If link were printed