當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CGroup::GetFilterOperation方法代碼示例

本文整理匯總了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)";
開發者ID:rasuldev,項目名稱:torino,代碼行數:67,代碼來源:user.php

示例2: GetFilterOperation

 public static function GetFilterOperation($key)
 {
     return CGroup::GetFilterOperation($key);
 }
開發者ID:andy-profi,項目名稱:bxApiDocs,代碼行數:4,代碼來源:vote.php


注:本文中的CGroup::GetFilterOperation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。