Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

get_filters()

Description

Get all defined filters (currently only used for search)

Parameters

ColumnTypeDefaultDescription
$order string "ref" column to order by
$sort string "ASC" sort order ("ASC" or "DESC")
$find string "" text to search for in filter

Return

array

Location

include/search_functions.php lines 2441 to 2466

Definition

 
function get_filters($order "ref"$sort "ASC"$find "")
    {
    
$validorder = array("ref","name");
    if(!
in_array($order,$validorder))
        {
        
$order "ref";
        }
        
    if(
$sort != "ASC")
        {
        
$sort "DESC";
        }
        
    
$condition "";
    
$join "";
    
    if(
trim($find) != "")
        {
        
$join " LEFT JOIN filter_rule_node fn ON fn.filter=f.ref LEFT JOIN node n ON n.ref = fn.node LEFT JOIN resource_type_field rtf ON rtf.ref=n.resource_type_field";
        
$condition " WHERE f.name LIKE '%" escape_check($find) . "%' OR n.name LIKE '%" escape_check($find) . "%' OR rtf.name LIKE '" escape_check($find) . "' OR rtf.title LIKE '" escape_check($find) . "'";
        }
        
    
$sql "SELECT f.ref, f.name FROM filter f {$join}{$condition} GROUP BY f.ref ORDER BY f.{$order} {$sort}";
    
$filters sql_query($sql);
    return 
$filters;
    }

This article was last updated 3rd December 2020 13:05 Europe/London time based on the source file dated 26th November 2020 14:30 Europe/London time.