SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatPagination
public class SwatPagination
extends SwatControl
| Field Summary | |
|---|---|
| final mixed | Display part constant for the displaying 'next' link. |
| final mixed | Display part constant for displaying a list of pages close to the current page. |
| final mixed | Display part constant for displaying a textual description of the current position. |
| final mixed | Display part constant for displaying the 'previous' link. |
| protected integer | The current page number. |
| integer | The index of the first record being displayed on the current page. |
| integer | Displayed pagination parts. |
| string | The URI linked by this pagination widget. |
| string | The text label displayed in the Next link. |
| protected integer | The next page to display. |
| integer | The number of records displayed on a page. |
| protected integer | The previous page to display. |
| string | The text label displayed in the Previous link. |
| protected integer | The total number of pages in the record set. |
| integer | The total number of records that are available for display. |
| Constructor Summary | |
|---|---|
SwatPagination(string id) Creates a new pagination widget. |
|
| Method Summary | |
|---|---|
| private void | Calculates page totals. |
| void | display() Displays this pagination widget. |
| protected void | Displays the next page link. |
| protected void | Displays a smart list of pages. |
| protected void | Displays the current page position. |
| protected void | Displays the previous page link. |
| protected array | Gets the array of CSS classes that are applied to this pagination widget. |
| integer | Get the current page that is displayed. |
| protected string | getLink() Gets the base link for all page links. |
| string | getResultsMessage(mixed unit, mixed unit_plural, $unit_plural string) Gets a human readable summary of the current state of this pagination widget. |
| void | setCurrentPage(integer page) Set the current page that is displayed. |
| Methods inherited from Swat.SwatControl | |
|---|---|
| addMessage, getNote, printWidgetTree | |
| Methods inherited from Swat.SwatWidget | |
|---|---|
| addCompositeWidget, addMessage, confirmCompositeWidgets, copy, createCompositeWidgets, display, displayHtmlHeadEntries, getCSSClassNames, getCompositeWidget, getCompositeWidgets, getFocusableHtmlId, getHtmlHeadEntrySet, getMessages, hasMessage, init, isDisplayed, isInitialized, isProcessed, isSensitive, printWidgetTree, process, replaceWithContainer | |
| Methods inherited from Swat.SwatUIObject | |
|---|---|
| addComment, addJavaScript, addStyleSheet, addTangoAttribution, copy, getCSSClassNames, getCSSClassString, getFirstAncestor, getHtmlHeadEntrySet, getInlineJavaScript, getUniqueId, isVisible | |
public final mixed NEXT = 1
Display part constant for the displaying 'next' link
public final mixed PAGES = 8
Display part constant for displaying a list of pages close to the current page
public final mixed POSITION = 4
Display part constant for displaying a textual description of the current position
public final mixed PREV = 2
Display part constant for displaying the 'previous' link
protected integer $current_page = 1
The current page number
public integer $current_record
The index of the first record being displayed on the current page
public integer $display_parts
Displayed pagination parts
The display parts property is a bitwise combination of the
SwatPagination::PREV, SwatPagination::NEXT,
SwatPagination::PAGES and SwatPagination::POSITION
constants.
For example, to show a pagination widget with just next and previous links use the following:
<?php
$pagination->display_parts = SwatPagination::PREV |
SwatPagination::NEXT;
?>
Defaults to SwatPagination::POSITION | SwatPagination::NEXT |
SwatPagination::PREV | SwatPagination::PAGES.
public string $link = null
The URI linked by this pagination widget
The first sprintf placeholder (%s) in the URI will be replaced with the current page number. For example: "mydir/page%s".
public string $next_label
The text label displayed in the Next link
Defaults to "Next »".
protected integer $next_page
The next page to display
public integer $page_size = 20
The number of records displayed on a page
protected integer $prev_page
The previous page to display
public string $previous_label
The text label displayed in the Previous link
Defaults to "« Previous".
protected integer $total_pages
The total number of pages in the record set
This is not the number of records in the record set.
public integer $total_records
The total number of records that are available for display
public SwatPagination(string id)
Creates a new pagination widget
id - a non-visible unique id for this widget.private void calculatePages()
Calculates page totals
Sets the internal total_pages, next_page and prev_page properties.
public void display()
Displays this pagination widget
protected void displayNext()
Displays the next page link
protected void displayPages()
Displays a smart list of pages
protected void displayPosition()
Displays the current page position
i.e. "1 of 3"
protected void displayPrev()
Displays the previous page link
protected array getCSSClassNames()
Gets the array of CSS classes that are applied to this pagination widget
public integer getCurrentPage()
Get the current page that is displayed
protected string getLink()
Gets the base link for all page links
public string getResultsMessage(mixed unit, mixed unit_plural, $unit_plural string)
Gets a human readable summary of the current state of this pagination widget
string - optional. The type of unit being returned. By default this is 'record'.string - optional. The plural version of the $unit parameter. By default this is 'records'.public void setCurrentPage(integer page)
Set the current page that is displayed
Calculates the current_record properties.
page - The current page being displayed.
A widget to allow navigation between paged data
SwatPagination pages start at page 1, not page 0.