Public Method Details |
pxdb_search |
public void pxdb_search([ mixed $dt ])
|
|
|
Parameter |
|
mixed |
$dt |
= >>null<< |
|
The datatype(s) that this filter affects. (important for knowing how to look up field names to correponsing typesfields rows) |
|
Returns |
void |
|
&search |
public Object &search([ mixed $dt ])
|
|
Currently identical to constructor.
|
Parameter |
|
mixed |
$dt |
= >>null<< |
|
The datatype(s) that this filter affects. (important for knowing how to look up field names to correponsing typesfields rows) |
|
Returns |
Object Instance of this class in search mode. |
|
&filter |
public object Reference &filter([ mixed $dt ])
|
|
|
Parameter |
|
mixed |
$dt |
= >>null<< |
|
The datatype(s) that this filter affects. (important for knowing how to look up field names to correponsing typesfields rows) |
|
Returns |
object Reference to an instance of this class in filter mode. |
|
set_value_conj |
public void set_value_conj(string $conj)
|
|
|
Parameter |
|
string |
$conj |
|
|
The conjunction / logical operator to use. (e.g. 'AND' or 'OR') |
|
Returns |
void |
Since |
0.0.2 |
|
set_conj |
public string set_conj(string $conj)
|
|
Currently there is no difference between this function and set_type(). You can also pass 'filter' or 'search' to set_type() which is what happens when this class is instantiated using the pxdb_search::filter() or pxdb_search::search() methods.
|
Parameter |
|
string |
$conj |
|
|
The conjunction to set. |
|
Returns |
string The operator set. |
Since |
0.0.2 |
|
set_type |
public boolean set_type(string $type)
|
|
This method sets the logical operator (or conjunction) that is used in the WHERE SQL.
|
Parameter |
|
string |
$type |
|
|
The type of filter this is. |
|
Returns |
boolean On success of setting filter. |
|
get_where_sql |
public string get_where_sql([ object [unknown] $obj, string $records_alias ])
|
|
Uses current field values and field values of any records related to the current record.
|
Parameter |
|
object [unknown] |
$obj |
= >>null<< |
|
The current pxdb_filter object -- used for recursion. |
|
|
string |
$records_alias |
= >>null<< |
|
The alias of the current records table -- used for recursion. |
|
Returns |
string The text that should be inserted in the WHERE clause of SQL statement to activate these filters. |
|
get_join_sql |
public array get_join_sql([ object [unknown] $obj, string $records_alias ])
|
|
This includes pickrel values (JOINing to pickrel table) and also any related recors also need to be INNER JOINed to current records table.
|
Parameter |
|
object [unknown] |
$obj |
= >>null<< |
|
The current pxdb_filter object -- used for recursion. |
|
|
string |
$records_alias |
= >>null<< |
|
The alias of the current records table -- used for recursion. |
|
Returns |
array The text that should be inserted in the FROM clause of SQL statement to activate these filters as well as the related order by fields. |
|
merge |
public void merge(object [unknown] &$filter)
|
|
Fields, related records, pickrel items, datatypes are all merged, with values of current 'name ASC' for $orderby, then new value will be 'date 1 DESC, name ASC'
|
Parameter |
|
object [unknown] |
&$filter |
|
|
The other pxdb_filter object to merge. |
|
Returns |
void |
|
add_related |
public boolean add_related(object [unknown] &$filter, [ mixed $relid ])
|
|
|
Parameter |
|
object [unknown] |
&$filter |
|
|
The pxdb_filter object to be related. |
|
|
mixed |
$relid |
= >>null<< |
|
The relid(s) by which this object can be related. |
|
Returns |
boolean Returns true on success |
|
add_secondaryrel_related |
public void add_secondaryrel_related(object [unknown] &$filter)
|
|
|
Parameter |
|
object [unknown] |
&$filter |
|
|
The pxdb_filter object to related. |
|
Returns |
void |
|
add_parent |
public void add_parent(object [unknown] $filter, [ int $noderel_id, resource $weight_sort ])
|
|
OAM: extended add_parent, the first parameter can now be a filter, or a section object, section id, or a section idnum.
|
Parameter |
|
object [unknown] |
$filter |
|
|
The pxdb_filter to related. |
|
|
int |
$noderel_id |
= >>null<< |
|
The noderel ID to be related. |
|
|
resource |
$weight_sort |
= >>NULL<< |
|
String to indicate if the subsequent collection will be sorted by this noderel.weight, if empty no sorting, otherwise specify ASC or DESC. |
|
Returns |
void |
|
add_child |
public void add_child(object [unknown] &$filter, [ int $noderel_id ])
|
|
|
Parameter |
|
object [unknown] |
&$filter |
|
|
The pxdb_filter to related. |
|
|
int |
$noderel_id |
= >>null<< |
|
The noderel ID to be related. |
|
Returns |
void |
|
add_value |
public boolean add_value(string $fname, string $value, [ string $relop, string $fieldopt, boolean $quote ])
|
|
Note: filter values are *not* able to be passed on. Also, if you add a filter value using this method, is_filtered() will still report FALSE if no vars are defined.
|
Parameter |
|
string |
$fname |
|
|
The field name to filter on. (May also be a typesfields displayname) |
|
|
string |
$value |
|
|
The value that the given field should match. |
|
|
string |
$relop |
= >>'='<< |
|
The way that the field and value are related. (i.e. field='value' or field LIKE '%value%', etc.) |
|
|
string |
$fieldopt |
= >>null<< |
|
An option field name to lookup up on if getting a pickid value. |
|
|
boolean |
$quote |
= >>true<< |
|
whether or not to quote value |
|
Returns |
boolean (documented in _add_field) |
|
add_var |
public boolean add_var(string $fname, string $varname, [ string $relop, string $fieldopt, boolean $quote ])
|
|
This is generally the preferred method for adding filters. Why? Because when you add a filter based on a varname (instead of a value) you can use the pass() method to pass the filters (the variables) to another page. Also, the is_filtered() will check to see if any of the filter vars are set. (is_filtered() will return false when only value filters are set.)
|
Parameter |
|
string |
$fname |
|
|
The field name to filter on. (May also be a typesfields displayname) |
|
|
string |
$varname |
|
|
The variable name that holds the value for the given field. |
|
|
string |
$relop |
= >>'='<< |
|
The way that the field and value are related. (i.e. field='value' or field LIKE '%value%', etc.) |
|
|
string |
$fieldopt |
= >>null<< |
|
An option field name to lookup up on if getting a pickid value. |
|
|
boolean |
$quote |
= >>true<< |
|
whether or not to quote value |
|
Returns |
boolean (documented in _add_field) |
|
get_vars |
public array get_vars([ Object $obj ])
|
|
|
Parameter |
|
Object |
$obj |
= >>null<< |
|
The object we are working with (used by recursion; will be set to $this on first invocation). |
|
Returns |
array Array of all variables used by this filter. |
|
pass |
public void pass([ string $method ])
|
|
|
Parameter |
|
string |
$method |
= >>'form'<< |
|
The way to pass vars -- e.g. 'form' or 'url'. |
|
Returns |
void |
|
is_filtered |
public boolean is_filtered()
|
|
|
Returns |
boolean |
|
clean_querystring |
public string clean_querystring()
|
|
|
Returns |
string the current query string ($QUERY_STRING) without any filter information in it. |
|
get_values_array |
public array get_values_array()
|
|
|
Returns |
array Values for currently defined filters. |
|
get_values_list |
public string get_values_list([ string $delim, string $smart_end ])
|
|
This method is for convenience only -- but it has a serious limitation: if you are using multi-select filters (i.e. arrays) you won't be able to use this method -- and will have to build your own display using get_values_array() method.
|
Parameter |
|
string |
$delim |
= >>', '<< |
|
The separator for the items of the array |
|
|
string |
$smart_end |
= >>''<< |
|
The text to add to last element -- e.g. if $smart_element = "and": Boston, Bermuda, and Baltimore. |
|
Returns |
string Formatted text list of the values for currently specified filters. |
|
filter_sql |
public string filter_sql(string $sql)
|
|
This method provides additional flexibility in working with filters and SQL statements. You could probably build your entire SQL statement simply using combinations of filter & searches, but it may be easier to just build a basic SQL statement and then add the filters. NOTE: This will *not* filter on priv table.
|
Parameter |
|
string |
$sql |
|
|
The SQL statement to filter. |
|
Returns |
string The filtered SQL. |
|