Bitrix Site Manager

InitFilterEx

InitFilterEx(
 array vars,
 string id, 
 string action = "set", 
 bool session = true
)

The function InitFilterEx initialises or stores the filter variables in the session.

Note
The function handles variables of the global scope. Take it into account when creating the main component files.

Parameters

ParameterDescription
vars Array of filter variables names.
id The filter ID identifying this filter in the session array: $_SESSION["SESS_ADMIN"][id].
action Action to be performed: store or obtain filter values.

If action is "set", the values of variables whose names were passed in the parameter vars will be copied to the session array $_SESSION["SESS_ADMIN"][id]. 
Otherwise, these variables will be initialised by the values stored in the session array $_SESSION["SESS_ADMIN"][id].

Optional. "set" by default.
session Specifies to use the session. If set to true, the filter values will be stored in the session array $_SESSION["SESS_ADMIN"][id].

See Also

Example



<?
$FilterArr = Array(
    "find_id",
    "find_id_exact_match",
    );

// if "Set filter" is clicked...
if (strlen($set_filter)>0) 
{
    // remember the filter values in the session
    InitFilterEx($FilterArr,"ADV_BANNER_LIST","set"); 
}
else 
{
    // initialize the filter values from the session
    InitFilterEx($FilterArr,"ADV_BANNER_LIST","get");
}

// if "Reset filter" is clicked
if (strlen($del_filter)>0) DelFilterEx($FilterArr,"ADV_BANNER_LIST");

$arFilter = Array(
    "ID"                    => $find_id,
    "ID_EXACT_MATCH"        => $find_id_exact_match,
    );
$rsBanners = CAdvBanner::GetList($by, $order, $arFilter, $is_filtered);
?>