static function ListAddFilterFields($arPropUserTypeList, $arProps, $sFormName, &$arFilter, &$arFilterable,
&$arCustomFilter, &$arDateFilter)
{
$i = count($arFilter);
foreach ($arProps as $propID => $arProp)
{
if (!self::CanBeFiltered($arPropUserTypeList, $arProp) ||
!isset($arProp['FILTRABLE']) || $arProp['FILTRABLE'] !== 'Y')
{
continue;
}
if (!empty($arProp['USER_TYPE'])
&& is_array($arPropUserTypeList[$arProp['USER_TYPE']]))
{
if (array_key_exists('GetPublicFilterHTML', $arPropUserTypeList[$arProp['USER_TYPE']]))
{
$arFilter[$i] = array(
'id' => $propID,
'name' => $arProp['NAME'],
'type' => 'custom',
'enable_settings' => false,
'value' => call_user_func_array(
$arPropUserTypeList[$arProp['USER_TYPE']]['GetPublicFilterHTML'],
array(
$arProp,
array(
'VALUE'=>$propID,
'FORM_NAME'=>'filter_'.$sFormName,
'GRID_ID' => $sFormName,
),
)
),
);
$arFilterable[$propID] = ($arProp['PROPERTY_TYPE'] === 'S') ? '?' : '';
if (array_key_exists('AddFilterFields', $arPropUserTypeList[$arProp['USER_TYPE']]))
$arCustomFilter[$propID] = array(
'callback' => $arPropUserTypeList[$arProp['USER_TYPE']]['AddFilterFields'],
'filter' => &$arFilter[$i],
);
}
}
else if (empty($arProp['USER_TYPE']))
{
if ($arProp["PROPERTY_TYPE"] === "F")
{
}
else if ($arProp["PROPERTY_TYPE"] === "N")
{
$arFilter[$i] = array(
"id" => $propID,
"name" => $arProp["NAME"],
"type" => "number",
);
$arFilterable[$propID] = "";
}
else if ($arProp["PROPERTY_TYPE"] === "G")
{
$items = array();
$propSections = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $arProp["LINK_IBLOCK_ID"]));
while($arSection = $propSections->Fetch())
$items[$arSection["ID"]] = str_repeat(". ", $arSection["DEPTH_LEVEL"]-1).$arSection["NAME"];
unset($propSections, $arSection);
$arFilter[$i] = array(
"id" => $propID,
"name" => $arProp["NAME"],
"type" => "list",
"items" => $items,
"params" => array("size"=>5, "multiple"=>"multiple"),
"valign" => "top",
);
$arFilterable[$propID] = "";
}
else if ($arProp["PROPERTY_TYPE"] === "E")
{
//Should be handled in template
$arFilter[$i] = array(
"id" => $propID,
"name" => $arProp["NAME"],
"type" => "propertyE",
"value" => ""
);
$arFilterable[$propID] = "";
$arCustomFilter[$propID] = array(
'type' => 'propertyE',
'filter' => &$arFilter[$i],
);
}
else if ($arProp["PROPERTY_TYPE"] === "L")
{
$items = array();
$propEnums = CIBlockProperty::GetPropertyEnum($arProp["ID"]);
while($ar_enum = $propEnums->Fetch())
$items[$ar_enum["ID"]] = $ar_enum["VALUE"];
unset($propEnums);
$arFilter[$i] = array(
"id" => $propID,
"name" => $arProp["NAME"],
"type" => "list",
"items" => $items,
"params" => array("size"=>5, "multiple"=>"multiple"),
"valign" => "top",
);
$arFilterable[$propID] = "";
}
else if ($arProp["PROPERTY_TYPE"] === 'S')
{
$arFilter[$i] = array(
"id" => $propID,
"name" => $arProp["NAME"],
);
$arFilterable[$propID] = "?";
}
else
{
$arFilter[$i] = array(
"id" => $propID,
"name" => $arProp["NAME"],
);
$arFilterable[$propID] = "";
}
}
$i++;
}
}