Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

get_filter_rules()

Description

Get filter rules for use in search

Parameters

ColumnTypeDefaultDescription
$filterid int ID of filter (from usergroup search_filter_id or user search_filter_oid)

Return

array

Location

include/search_functions.php lines 3022 to 3048

Definition

 
function get_filter_rules($filterid)
    {
    
$filter_rule_nodes  ps_query("SELECT fr.ref as rule, frn.node_condition, frn.node FROM filter_rule fr LEFT JOIN filter_rule_node frn ON frn.filter_rule=fr.ref WHERE fr.filter=?", array("i",$filterid));

    
// Convert results into useful array
    
$rules = array();
    foreach(
$filter_rule_nodes as $filter_rule_node)
        {
        
$rule $filter_rule_node["rule"];
        if(!isset(
$rules[$filter_rule_node["rule"]]))
            {
            
$rules[$rule] = array();
            
$rules[$rule]["nodes_on"] = array();
            
$rules[$rule]["nodes_off"] = array();
            }
        if(
$filter_rule_node["node_condition"] == 1)
            {
            
$rules[$rule]["nodes_on"][] = $filter_rule_node["node"];
            }
        else
            {
            
$rules[$rule]["nodes_off"][] = $filter_rule_node["node"];
            }
        }

    return 
$rules;
    }

This article was last updated 4th December 2024 08:35 Europe/London time based on the source file dated 27th November 2024 09:40 Europe/London time.