Phang  2.1
 All Classes Files Functions Variables Pages
Public Member Functions | Public Attributes | Protected Attributes
Sql_Filter Class Reference

Filter and sort SQL queries. More...

Inheritance diagram for Sql_Filter:
Base

List of all members.

Public Member Functions

 __construct ($sql_string, $options=array())
 Class constructor.
 set_order_by ($item='')
 Set the order by clause.
 get_where ()
 Get the WHERE data.
 set_where ($item)
 Set the WHERE data.
 set_limit ($item)
 Set the limit clause.
 set_offset ($item)
 Set the offset clause.
 set_page_number ($value)
 Set the page number.
 get_page_number ()
 Get the page number.
 set_num_records_per_page ($value)
 Set the number of records per page.
 get_num_records_per_page ()
 Get the number of records per page.
 set_sql ($sql)
 Set the SQL.
 calculate ()
 Perform all the calculations.
 get_range ($max_links=20)
 Get the range.
 get_sort_columns ()
 Return a list of sortable columns to populate a drop-down menu in the pagination controls.
 get_sql ()
 Get the SQL string.
- Public Member Functions inherited from Base
 __call ($function, $params)
 The 'magic' call method will get/set for us invoked when the interpreter can not find a method the user is asking for.
 set_parameters ($arguments)
 Set variables from an array to member fields requires $this->optional_arguments or $this->required_arguments to have been set by the subclass.

Public Attributes

 $h2o_safe = true
 the object can be used in h2o

Protected Attributes

 $sql_string = ''
 SQL string.
 $sql_object = ''
 SQL object.
 $num_records_per_page = -1
 Number of records to display on each page.
 $page_number = -1
 Current page number.
 $total_records = 0
 Total number of records.
 $total_pages = 1
 Total number of pages.
 $results_first = 0
 Number of first result displayed.
 $results_last = 0
 Number of last result displayed.
 $limit = 50
 SQL limit.
 $offset = 0
 SQL offset.
 $records_per_page_options = array(10, 20, 50, 100, 1000)
 Options for the number of records per page.
 $order_by = array()
 ORDER BY data.
 $where = array()
 WHERE data.
 $sort_name = ''
 column to sort
 $sort_dir = ''
 sort direction (asc/desc)
 $filter_values = array()
 array of filter values
 $columns = array()
 array of column names/labels
- Protected Attributes inherited from Base
 $optional_arguments = array()
 Array of options that can be set to variables.
 $required_arguments = array()
 Array of options that need to be set to variables.

Detailed Description

Filter and sort SQL queries.


Constructor & Destructor Documentation

Sql_Filter::__construct (   $sql_string,
  $options = array() 
)

Class constructor.

Parameters:
$sql_stringSQL string
$options(defaults to global settings):
  • page_number
  • num_records
  • order_by

Member Function Documentation

Sql_Filter::set_sql (   $sql)

Set the SQL.

Parameters:
$sqlcan be an object (of type Sql) or string

The documentation for this class was generated from the following file: