当前位置: 首页>>代码示例>>PHP>>正文


PHP CBPHelper::GetFilterOperation方法代码示例

本文整理汇总了PHP中CBPHelper::GetFilterOperation方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::GetFilterOperation方法的具体用法?PHP CBPHelper::GetFilterOperation怎么用?PHP CBPHelper::GetFilterOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBPHelper的用法示例。


在下文中一共展示了CBPHelper::GetFilterOperation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PrepareSql


//.........这里部分代码省略.........
                     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)) {
         $filter_keys = array();
     } else {
         $filter_keys = array_keys($arFilter);
     }
     for ($i = 0, $cnt = count($filter_keys); $i < $cnt; $i++) {
         $vals = $arFilter[$filter_keys[$i]];
         if (!is_array($vals)) {
             $vals = array($vals);
         }
         $key = $filter_keys[$i];
         $key_res = CBPHelper::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();
             for ($j = 0, $cntj = count($vals); $j < $cntj; $j++) {
                 $val = $vals[$j];
                 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 && strpos($strOperation, "=") !== False) {
                             $arSqlSearch_tmp[] = "(" . $arFields[$key]["FIELD"] . " IS " . ($strNegative == "Y" ? "NOT " : "") . "NULL) " . ($strNegative == "Y" ? "AND" : "OR") . " " . ($strNegative == "Y" ? "NOT " : "") . "(" . $arFields[$key]["FIELD"] . " " . $strOperation . " 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 && strpos($strOperation, "=") !== False) {
                             $arSqlSearch_tmp[] = "(" . $arFields[$key]["FIELD"] . " IS " . ($strNegative == "Y" ? "NOT " : "") . "NULL) " . ($strNegative == "Y" ? "AND" : "OR") . " " . ($strNegative == "Y" ? "NOT " : "") . "(" . $arFields[$key]["FIELD"] . " " . $strOperation . " 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 && strpos($strOperation, "=") !== False) {
开发者ID:rasuldev,项目名称:torino,代码行数:67,代码来源:helper.php


注:本文中的CBPHelper::GetFilterOperation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。