Paginate_DB_Data __construct(
integer
$page_size, string
$sql_select, string
$sql_count, [boolean
$forgiving = true]
)
|
|
Constructor
Parameters:
|
integer |
$page_size: |
Page size. How many rows will each page have |
|
string |
$sql_select: |
SQL statement that will be used to set actual data |
|
string |
$sql_count: |
SQL statement that will be used to count rows matching the "where" clause. Note that returned value have to be aliased with "as total_rows", otherwise you will get an exception |
|
boolean |
$forgiving: |
If set to false some methods will throw exception if you try to fetch non existing page. If true - fetch* methods will guess some safe value. Default is false |
void ask_for_forgivenes(
unknown_type
$exception
)
|
|
Check the forgivenes mode and throws exception if mode is false
Parameters:
API Tags:
integer calculate_start(
)
|
|
Calculates start of current page
API Tags:
| Internal: | |
| Access: | protected |
unknown calculate_total_pages(
)
|
|
Calculates total pages
API Tags:
| Internal: | |
| Access: | protected |
Gathers current page rows
Parameters:
API Tags:
| Return: | Returned rows |
| Access: | public |
Fetches first page
Parameters:
API Tags:
Fetches last page
Parameters:
API Tags:
Fetches next page
Parameters:
API Tags:
Fetches page specified by $page
Parameters:
API Tags:
Fetches previous page
Parameters:
API Tags:
integer get_current_page(
)
|
|
Returns current page
API Tags:
Gets forgiving mode
API Tags:
| See: | Paginate_DB_Data::set_forgiving |
| Access: | public |
Returns page size
API Tags:
Gets SQL statement that will be used to count rows matching the "where" clause
API Tags:
Gets SQL statement used to get actual data
API Tags:
integer get_total_pages(
)
|
|
Returns total pages
API Tags:
integer get_total_rows(
)
|
|
Returns total rows (current sql_count)
API Tags:
boolean is_valid_page(
integer
$page
)
|
|
checks if $page is valid page index, i.e. there is such page
Parameters:
API Tags:
| Internal: | |
| Access: | private |
Executes $sql_count and recalculates total rows and total pages
Parameters:
API Tags:
void set_current_page(
integer
$current_page
)
|
|
Sets current page
Parameters:
API Tags:
| Internal: | |
| Access: | protected |
void set_forgiving(
boolean
$forgiving
)
|
|
Sets forgiving mode. If set to false some methods will throw exception if you try to fetch non existing page. If true - fetch* methods will guess some safe value. Default is false
Parameters:
API Tags:
void set_page_size(
integer
$page_size
)
|
|
Sets page size
Parameters:
API Tags:
void set_sql_count(
string
$sql_count
)
|
|
Sets SQL statement that will be used to count rows matching the "where" clause. Note that returned value have to be aliased with "as total_rows", otherwise you will get an exception
Parameters:
API Tags:
void set_sql_select(
unknown_type
$sql_select
)
|
|
Sets SQL statement used to get actual data
Parameters:
|
unknown_type |
$sql_select: |
|
API Tags:
void set_total_pages(
integer
$total_pages
)
|
|
Sets total pages for current sql count
Parameters:
API Tags:
void set_total_rows(
unknown_type
$total_rows
)
|
|
Sets total rows.
Parameters:
|
unknown_type |
$total_rows: |
|
API Tags:
Gathers current page rows
Parameters:
API Tags:
| Return: | Returned rows |
| Internal: | |
| Access: | protected |