本文整理汇总了PHP中CGroup::GetFilterOperation方法的典型用法代码示例。如果您正苦于以下问题:PHP CGroup::GetFilterOperation方法的具体用法?PHP CGroup::GetFilterOperation怎么用?PHP CGroup::GetFilterOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGroup
的用法示例。
在下文中一共展示了CGroup::GetFilterOperation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PrepareSql
//.........这里部分代码省略.........
} elseif ($arFields[$val]["TYPE"] == "date") {
$strSqlSelect .= $DB->DateToCharFunction($arFields[$val]["FIELD"], "SHORT") . " as " . $val;
} else {
$strSqlSelect .= $arFields[$val]["FIELD"] . " as " . $val;
}
}
if (isset($arFields[$val]["FROM"]) && strlen($arFields[$val]["FROM"]) > 0 && !in_array($arFields[$val]["FROM"], $arAlreadyJoined)) {
if (strlen($strSqlFrom) > 0) {
$strSqlFrom .= " ";
}
$strSqlFrom .= $arFields[$val]["FROM"];
$arAlreadyJoined[] = $arFields[$val]["FROM"];
}
}
}
}
if (strlen($strSqlGroupBy) > 0) {
if (strlen($strSqlSelect) > 0) {
$strSqlSelect .= ", ";
}
$strSqlSelect .= "COUNT(%%_DISTINCT_%% " . $arFields[$arFieldsKeys[0]]["FIELD"] . ") as CNT";
} else {
$strSqlSelect = "%%_DISTINCT_%% " . $strSqlSelect;
}
}
// <-- SELECT
// WHERE -->
$arSqlSearch = array();
if (is_array($arFilter)) {
foreach ($arFilter as $key => $vals) {
if (!is_array($vals)) {
$vals = array($vals);
}
$key_res = CGroup::GetFilterOperation($key);
$key = $key_res["FIELD"];
$strNegative = $key_res["NEGATIVE"];
$strOperation = $key_res["OPERATION"];
$strOrNull = $key_res["OR_NULL"];
if (array_key_exists($key, $arFields)) {
$arSqlSearch_tmp = array();
foreach ($vals as $val) {
if (isset($arFields[$key]["WHERE"])) {
$arSqlSearch_tmp1 = call_user_func_array($arFields[$key]["WHERE"], array($val, $key, $strOperation, $strNegative, $arFields[$key]["FIELD"], $arFields, $arFilter));
if ($arSqlSearch_tmp1 !== false) {
$arSqlSearch_tmp[] = $arSqlSearch_tmp1;
}
} else {
if ($arFields[$key]["TYPE"] == "int") {
if (intval($val) <= 0) {
$arSqlSearch_tmp[] = ($strNegative == "Y" ? "NOT" : "") . "(" . $arFields[$key]["FIELD"] . " IS NULL OR " . $arFields[$key]["FIELD"] . " <= 0)";
} else {
$arSqlSearch_tmp[] = ($strNegative == "Y" ? " " . $arFields[$key]["FIELD"] . " IS NULL OR NOT " : "") . "(" . $arFields[$key]["FIELD"] . " " . $strOperation . " " . intval($val) . " )";
}
} elseif ($arFields[$key]["TYPE"] == "double") {
$val = str_replace(",", ".", $val);
if (DoubleVal($val) <= 0) {
$arSqlSearch_tmp[] = ($strNegative == "Y" ? "NOT" : "") . "(" . $arFields[$key]["FIELD"] . " IS NULL OR " . $arFields[$key]["FIELD"] . " <= 0)";
} else {
$arSqlSearch_tmp[] = ($strNegative == "Y" ? " " . $arFields[$key]["FIELD"] . " IS NULL OR NOT " : "") . "(" . $arFields[$key]["FIELD"] . " " . $strOperation . " " . DoubleVal($val) . " )";
}
} elseif ($arFields[$key]["TYPE"] == "string" || $arFields[$key]["TYPE"] == "char") {
if ($strOperation == "QUERY") {
$arSqlSearch_tmp[] = GetFilterQuery($arFields[$key]["FIELD"], $val, "Y");
} else {
if (strlen($val) <= 0) {
$arSqlSearch_tmp[] = ($strNegative == "Y" ? "NOT" : "") . "(" . $arFields[$key]["FIELD"] . " IS NULL OR LENGTH(" . $arFields[$key]["FIELD"] . ")<=0)";
示例2: GetFilterOperation
public static function GetFilterOperation($key)
{
return CGroup::GetFilterOperation($key);
}