- Модуль: statistic
- Путь к файлу: ~/bitrix/modules/statistic/classes/general/searcher.php
- Класс: CAllSearcher
- Вызов: CAllSearcher::GetDomainList
static function GetDomainList($by = 's_id', $order = 'desc', $arFilter = [])
{
$err_mess = "File: ".__FILE__."
Line: ";
$DB = CDatabase::GetModuleConnection('statistic');
$arSqlSearch = Array("P.SEARCHER_ID <> 1");
if (is_array($arFilter))
{
foreach ($arFilter as $key => $val)
{
if(is_array($val))
{
if(count($val) <= 0)
continue;
}
else
{
if( ((string)$val == '') || ($val === "NOT_REF") )
continue;
}
$match_value_set = array_key_exists($key."_EXACT_MATCH", $arFilter);
$key = strtoupper($key);
switch($key)
{
case "ID":
case "SEARCHER_ID":
$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("P.".$key,$val,$match);
break;
case "DOMAIN":
case "VARIABLE":
$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
$arSqlSearch[] = GetFilterQuery("P.".$key, $val, $match);
break;
}
}
}
if ($by == "s_id") $strSqlOrder = "ORDER BY P.ID";
elseif ($by == "s_domain") $strSqlOrder = "ORDER BY P.DOMAIN";
elseif ($by == "s_variable") $strSqlOrder = "ORDER BY P.VARIABLE";
else
{
$strSqlOrder = "ORDER BY P.ID";
}
if ($order != "asc")
{
$strSqlOrder .= " desc ";
}
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
$strSql = "
SELECT
P.ID,
P.DOMAIN,
P.VARIABLE,
P.CHAR_SET
FROM
b_stat_searcher_params P
WHERE
$strSqlSearch
$strSqlOrder
";
$rs = $DB->Query($strSql, false, $err_mess.__LINE__);
return $rs;
}