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


PHP GetFilterSqlSearch函数代码示例

本文整理汇总了PHP中GetFilterSqlSearch函数的典型用法代码示例。如果您正苦于以下问题:PHP GetFilterSqlSearch函数的具体用法?PHP GetFilterSqlSearch怎么用?PHP GetFilterSqlSearch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: RecalculateSupportDeadline

 public static function RecalculateSupportDeadline($arFilter = array())
 {
     global $DB;
     $err_mess = CAllTicketReminder::err_mess() . "<br>Function: RecalculateSupportDeadline<br>Line: ";
     $arSqlSearch = array();
     if (!is_array($arFilter)) {
         $arFilter = array();
     }
     foreach ($arFilter as $key => $val) {
         if (is_array($val) && count($val) <= 0 || !is_array($val) && strlen($val) <= 0) {
             continue;
         }
         $key = strtoupper($key);
         if (is_array($val)) {
             $val = implode(" | ", $val);
         }
         switch ($key) {
             case "ID":
                 $arSqlSearch[] = GetFilterQuery("T.ID", $val, "N");
                 break;
             case "SLA_ID":
                 $arSqlSearch[] = GetFilterQuery("T.SLA_ID", $val, "N");
                 break;
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tT.ID ID,\n\t\t\t\tT.SLA_ID,\n\t\t\t\t" . $DB->DateToCharFunction("T.DEADLINE_SOURCE_DATE", "FULL") . " DEADLINE_SOURCE_DATE,\n\t\t\t\t" . $DB->DateToCharFunction("T.D_1_USER_M_AFTER_SUP_M", "FULL") . " D_1_USER_M_AFTER_SUP_M,\n\t\t\t\tT.IS_OVERDUE,\n\t\t\t\tSLA.RESPONSE_TIME_UNIT,\n\t\t\t\tSLA.RESPONSE_TIME,\n\t\t\t\tSLA.NOTICE_TIME_UNIT,\n\t\t\t\tSLA.NOTICE_TIME\n\t\t\tFROM\n\t\t\t\tb_ticket T\n\t\t\t\tINNER JOIN b_ticket_sla SLA\n\t\t\t\t\tON T.SLA_ID = SLA.ID\n\t\t\t\t\t\tAND T.LAST_MESSAGE_BY_SUPPORT_TEAM = 'N'\n\t\t\t\t\t\tAND (T.DATE_CLOSE IS NULL)\n\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t";
     $rsTicket = $DB->Query($strSql, false, $err_mess . __LINE__);
     while ($arTicket = $rsTicket->Fetch()) {
         self::RecalculateSupportDeadlineForOneTicket($arTicket);
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:32,代码来源:reminder.php

示例2: GetList

 function GetList(&$by, &$order, $arFilter = array(), &$is_filtered)
 {
     $err_mess = "File: " . __FILE__ . "<br>Line: ";
     $DB = CDatabase::GetModuleConnection('statistic');
     $arSqlSearch = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (is_array($val)) {
                 if (count($val) <= 0) {
                     continue;
                 }
             } else {
                 if (strlen($val) <= 0 || $val === "NOT_REF") {
                     continue;
                 }
             }
             $match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
             $key = strtoupper($key);
             switch ($key) {
                 case "LAST":
                     $arSqlSearch[] = $val == "Y" ? "S.DATE_STAT = curdate()" : "S.DATE_STAT<>curdate()";
                     break;
                 case "USER_AGENT":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("S.USER_AGENT", $val, $match);
                     break;
                 case "COUNTER1":
                     $arSqlSearch_h[] = "COUNTER>=" . intval($val);
                     break;
                 case "COUNTER2":
                     $arSqlSearch_h[] = "COUNTER<=" . intval($val);
                     break;
             }
         }
         for ($i = 0; $i < count($arSqlSearch_h); $i++) {
             $strSqlSearch_h .= " and (" . $arSqlSearch_h[$i] . ") ";
         }
     }
     if ($by == "s_user_agent") {
         $strSqlOrder = "ORDER BY S.USER_AGENT";
     } elseif ($by == "s_counter") {
         $strSqlOrder = "ORDER BY COUNTER";
     } else {
         $by = "s_counter";
         $strSqlOrder = "ORDER BY COUNTER";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "SET OPTION SQL_BIG_SELECTS=1";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tS.USER_AGENT,\n\t\t\t\tcount(S.ID) COUNTER\n\t\t\tFROM\n\t\t\t\tb_stat_session S\n\t\t\tLEFT JOIN b_stat_browser B ON (\n\t\t\t\tlength(B.USER_AGENT)>0\n\t\t\tand B.USER_AGENT is not null\n\t\t\tand\tupper(S.USER_AGENT) like upper(B.USER_AGENT)\n\t\t\t)\n\t\t\tLEFT JOIN b_stat_searcher R ON (\n\t\t\t\tlength(R.USER_AGENT)>0\n\t\t\tand\tR.USER_AGENT is not null\n\t\t\tand\tupper(S.USER_AGENT) like upper(concat('%',R.USER_AGENT,'%'))\n\t\t\t)\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\tand S.USER_AGENT is not null\n\t\t\tand S.USER_AGENT<>''\n\t\t\tand S.NEW_GUEST<>'N'\n\t\t\tand B.ID is null\n\t\t\tand R.ID is null\n\t\t\tGROUP BY S.USER_AGENT\n\t\t\tHAVING '1'='1' {$strSqlSearch_h}\n\t\t\t{$strSqlOrder}\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch) || strlen($strSqlSearch_h) > 0;
     return $res;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:59,代码来源:autodetect.php

示例3: makeSqlSearch

 private static function makeSqlSearch($arFilter)
 {
     $arSqlSearch = array();
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (strlen($val) <= 0) {
                 continue;
             }
             $key = strtoupper($key);
             switch ($key) {
                 case "PAYSYSTEM_ID":
                     $arSqlSearch[] = $key . "=" . intval($val);
                     break;
                 case "DELIVERY_ID":
                 case "DELIVERY_PROFILE_ID":
                     $arSqlSearch[] = GetFilterQuery($key, $val, "N");
                     break;
             }
         }
     }
     return GetFilterSqlSearch($arSqlSearch);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:22,代码来源:delivery_2_pay_system.php

示例4: GetList

 public static function GetList($Params = array())
 {
     global $DB;
     $arFilter = $Params['arFilter'];
     $arOrder = isset($Params['arOrder']) ? $Params['arOrder'] : array('ID' => 'asc');
     $arFields = array("ID" => array("FIELD_NAME" => "U.ID", "FIELD_TYPE" => "string"), "MODULE_ID" => array("FIELD_NAME" => "U.MODULE_ID", "FIELD_TYPE" => "string"), "UNDO_TYPE" => array("FIELD_NAME" => "U.UNDO_TYPE", "FIELD_TYPE" => "string"), "UNDO_HANDLER" => array("FIELD_NAME" => "U.UNDO_HANDLER", "FIELD_TYPE" => "string"), "CONTENT" => array("FIELD_NAME" => "U.CONTENT", "FIELD_TYPE" => "string"), "USER_ID" => array("FIELD_NAME" => "U.USER_ID", "FIELD_TYPE" => "int"), "TIMESTAMP_X" => array("FIELD_NAME" => "U.TIMESTAMP_X", "FIELD_TYPE" => "int"));
     $err_mess = "CUndo::GetList<br>Line: ";
     $arSqlSearch = array();
     if (is_array($arFilter)) {
         $filter_keys = array_keys($arFilter);
         for ($i = 0, $l = count($filter_keys); $i < $l; $i++) {
             $n = strtoupper($filter_keys[$i]);
             $val = $arFilter[$filter_keys[$i]];
             if ($n == 'ID' || $n == 'USER_ID') {
                 $arSqlSearch[] = GetFilterQuery("U." . $n, $val, 'N');
             } elseif (isset($arFields[$n])) {
                 $arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val);
             }
         }
     }
     $strOrderBy = '';
     foreach ($arOrder as $by => $order) {
         if (isset($arFields[strtoupper($by)])) {
             $strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"] . ' ' . (strtolower($order) == 'desc' ? 'desc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS LAST" : "") : 'asc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS FIRST" : "")) . ',';
         }
     }
     if (strlen($strOrderBy) > 0) {
         $strOrderBy = "ORDER BY " . rtrim($strOrderBy, ",");
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tU.*\n\t\t\tFROM\n\t\t\t\tb_undo U\n\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t{$strOrderBy}";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $arResult = array();
     while ($arRes = $res->Fetch()) {
         $arResult[] = $arRes;
     }
     return $arResult;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:38,代码来源:undo.php

示例5: GetAccessibilityForUsers

 public static function GetAccessibilityForUsers($Params = array())
 {
     global $DB;
     CTimeZone::Disable();
     $curEventId = intVal($Params['curEventId']);
     if (!is_array($Params['users']) || count($Params['users']) == 0) {
         return array();
     }
     $users = array();
     $Accessibility = array();
     foreach ($Params['users'] as $userId) {
         $userId = intVal($userId);
         if ($userId) {
             $users[] = $userId;
             $Accessibility[$userId] = array();
         }
     }
     if (count($users) == 0) {
         return array();
     }
     $strUsers = join(',', $users);
     // We fetch all events for user where it was attented
     $strSql = "SELECT EVENT_ID,USER_ID,STATUS,ACCESSIBILITY FROM b_calendar_attendees WHERE USER_KEY in (" . $strUsers . ") AND STATUS<>'N'";
     $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $arInvIds = array();
     $Attendees = array();
     while ($ev = $res->Fetch()) {
         $ev["STATUS"] = trim($ev["STATUS"]);
         $ev["ACCESSIBILITY"] = trim($ev["ACCESSIBILITY"]);
         if (!is_array($Attendees[$ev['EVENT_ID']])) {
             $Attendees[$ev['EVENT_ID']] = array();
         }
         $Attendees[$ev['EVENT_ID']][] = $ev;
         if (!in_array(intVal($ev['EVENT_ID']), $arInvIds)) {
             $arInvIds[] = intVal($ev['EVENT_ID']);
         }
     }
     $strInvIds = join(',', $arInvIds);
     $from_ts = false;
     $to_ts = false;
     $arSqlSearch = array();
     if ($Params['from']) {
         $val = $Params['from'];
         $from_ts = CCalendar::Timestamp($val);
         if (strtoupper($DB->type) == "MYSQL") {
             $arSqlSearch[] = "CE.DT_TO>=FROM_UNIXTIME('" . MkDateTime(FmtDate($val, "D.M.Y"), "d.m.Y") . "')";
         } elseif (strtoupper($DB->type) == "MSSQL") {
             $arSqlSearch[] = "CE.DT_TO>=" . $DB->CharToDateFunction($val, "SHORT");
         } elseif (strtoupper($DB->type) == "ORACLE") {
             $arSqlSearch[] = "CE.DT_TO>=TO_DATE('" . FmtDate($val, "D.M.Y") . " 00:00:00','dd.mm.yyyy hh24:mi:ss')";
         }
     }
     if ($Params['to']) {
         $val = $Params['to'];
         $to_ts = CCalendar::Timestamp($val);
         if (date('H:i', $to_ts) == '00:00') {
             $to_ts += CCalendar::DAY_LENGTH;
         }
         if (strtoupper($DB->type) == "MYSQL") {
             $arSqlSearch[] = "CE.DT_FROM<=FROM_UNIXTIME('" . MkDateTime(FmtDate($val, "D.M.Y") . " 23:59:59", "d.m.Y H:i:s") . "')";
         } elseif (strtoupper($DB->type) == "MSSQL") {
             $arSqlSearch[] = "CE.DT_FROM<dateadd(day, 1, " . $DB->CharToDateFunction($val, "SHORT") . ")";
         } elseif (strtoupper($DB->type) == "ORACLE") {
             $arSqlSearch[] = "CE.DT_FROM<=TO_DATE('" . FmtDate($val, "D.M.Y") . " 23:59:59','dd.mm.yyyy hh24:mi:ss')";
         }
     }
     $arSqlSearch[] = GetFilterQuery("DELETED", "N");
     $q = "CE.CAL_TYPE='user' AND CE.OWNER_ID in (" . $strUsers . ")";
     if (count($arInvIds) > 0) {
         $q = '(' . $q . ') OR CE.ID in (' . $strInvIds . ')';
     }
     $arSqlSearch[] = $q;
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT CE.ID, CE.CAL_TYPE,CE.OWNER_ID, CE.NAME, " . $DB->DateToCharFunction("CE.DT_FROM") . " as DT_FROM, " . $DB->DateToCharFunction("CE.DT_TO") . " as DT_TO, CE.DT_LENGTH, CE.PRIVATE_EVENT, CE.ACCESSIBILITY, CE.IMPORTANCE,CE.IS_MEETING, CE.MEETING_HOST, CE.MEETING, CE.LOCATION, CE.RRULE, CE.EXRULE, CE.RDATE, CE.EXDATE, CES.SECT_ID, CES.REL\n\t\t\tFROM\n\t\t\t\tb_calendar_event CE\n\t\t\tINNER JOIN b_calendar_event_sect CES ON (CE.ID=CES.EVENT_ID)\n\t\t\tWHERE CE.DELETED='N' AND {$strSqlSearch}";
     $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $arResult = array();
     while ($event = $res->Fetch()) {
         $event = self::PreHandleEvent($event);
         if ($curEventId && $curEventId == $event['ID']) {
             continue;
         }
         if (self::CheckRecurcion($event)) {
             self::ParseRecursion($arResult, $event, array('fromLimit' => $Params["from"], 'toLimit' => $Params["to"]));
         } else {
             self::HandleEvent($arResult, $event);
         }
     }
     foreach ($arResult as $event) {
         $ev_to_ts = $event['DT_TO_TS'];
         if ($event['DT_SKIP_TIME'] == 'Y') {
             $ev_to_ts += CCalendar::DAY_LENGTH;
         }
         if ($from_ts && $ev_to_ts < $from_ts || $to_ts && $event['DT_FROM_TS'] > $to_ts) {
             continue;
         }
         if (!in_array($event["ACCESSIBILITY"], array('busy', 'quest', 'free', 'absent'))) {
             $event["ACCESSIBILITY"] = 'busy';
         }
         if (!in_array($event['IMPORTANCE'], array('high', 'normal', 'low'))) {
             $event['IMPORTANCE'] = 'normal';
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:calendar_event.php

示例6: GetDomainList

 function GetDomainList(&$by, &$order, $arFilter = array(), &$is_filtered)
 {
     $err_mess = "File: " . __FILE__ . "<br>Line: ";
     $DB = CDatabase::GetModuleConnection('statistic');
     $arSqlSearch = array("P.SEARCHER_ID <> 1");
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (is_array($val)) {
                 if (count($val) <= 0) {
                     continue;
                 }
             } else {
                 if (strlen($val) <= 0 || $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;
             }
         }
     }
     $strSqlOrder = "";
     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 {
         $by = "s_id";
         $strSqlOrder = "ORDER BY P.ID";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tP.ID,\n\t\t\t\tP.DOMAIN,\n\t\t\t\tP.VARIABLE,\n\t\t\t\tP.CHAR_SET\n\t\t\tFROM\n\t\t\t\tb_stat_searcher_params P\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\t{$strSqlOrder}\n\t\t\t";
     $rs = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $rs;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:54,代码来源:searcher.php

示例7: GetList


//.........这里部分代码省略.........
             switch ($key) {
                 case "ID":
                     $match = $match_value_set && $arFilter[$key . "_EXACT_MATCH"] == "N" ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("G.ID", $val, $match);
                     break;
                 case "TIMESTAMP_1":
                     $arSqlSearch[] = "G.TIMESTAMP_X >= FROM_UNIXTIME('" . MkDateTime(FmtDate($val, "D.M.Y"), "d.m.Y") . "')";
                     break;
                 case "TIMESTAMP_2":
                     $arSqlSearch[] = "G.TIMESTAMP_X <= FROM_UNIXTIME('" . MkDateTime(FmtDate($val, "D.M.Y") . " 23:59:59", "d.m.Y") . "')";
                     break;
                 case "ACTIVE":
                     $arSqlSearch[] = $val == "Y" ? "G.ACTIVE='Y'" : "G.ACTIVE='N'";
                     break;
                 case "ADMIN":
                     if (COption::GetOptionString("main", "controller_member", "N") == "Y" && COption::GetOptionString("main", "~controller_limited_admin", "N") == "Y") {
                         if ($val == "Y") {
                             $arSqlSearch[] = "G.ID=0";
                         }
                         break;
                     } else {
                         $arSqlSearch[] = $val == "Y" ? "G.ID=1" : "G.ID>1";
                     }
                     break;
                 case "NAME":
                     $match = $match_value_set && $arFilter[$key . "_EXACT_MATCH"] == "Y" ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("G.NAME", $val, $match);
                     break;
                 case "STRING_ID":
                     $match = $match_value_set && $arFilter[$key . "_EXACT_MATCH"] == "N" ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("G.STRING_ID", $val, $match);
                     break;
                 case "DESCRIPTION":
                     $match = $match_value_set && $arFilter[$key . "_EXACT_MATCH"] == "Y" ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("G.DESCRIPTION", $val, $match);
                     break;
                 case "USERS_1":
                     $SHOW_USERS_AMOUNT = "Y";
                     $arSqlSearch_h[] = "USERS>=" . intval($val);
                     break;
                 case "USERS_2":
                     $SHOW_USERS_AMOUNT = "Y";
                     $arSqlSearch_h[] = "USERS<=" . intval($val);
                     break;
                 case "ANONYMOUS":
                     if ($val == 'Y' || $val == 'N') {
                         $arSqlSearch[] = "G.ANONYMOUS='" . $val . "'";
                     }
                     break;
             }
         }
         foreach ($arSqlSearch_h as $condition) {
             $strSqlSearch_h .= " and (" . $condition . ") ";
         }
     }
     if (strtolower($by) == "id") {
         $strSqlOrder = " ORDER BY G.ID ";
     } elseif (strtolower($by) == "active") {
         $strSqlOrder = " ORDER BY G.ACTIVE ";
     } elseif (strtolower($by) == "timestamp_x") {
         $strSqlOrder = " ORDER BY G.TIMESTAMP_X ";
     } elseif (strtolower($by) == "c_sort") {
         $strSqlOrder = " ORDER BY G.C_SORT ";
     } elseif (strtolower($by) == "sort") {
         $strSqlOrder = " ORDER BY G.C_SORT, G.NAME, G.ID ";
     } elseif (strtolower($by) == "name") {
         $strSqlOrder = " ORDER BY G.NAME ";
     } elseif (strtolower($by) == "string_id") {
         $strSqlOrder = " ORDER BY G.STRING_ID ";
     } elseif (strtolower($by) == "description") {
         $strSqlOrder = " ORDER BY G.DESCRIPTION ";
     } elseif (strtolower($by) == "anonymous") {
         $strSqlOrder = " ORDER BY G.ANONYMOUS ";
     } elseif (strtolower($by) == "dropdown") {
         $strSqlOrder = " ORDER BY C_SORT, NAME ";
     } elseif (strtolower($by) == "users") {
         $strSqlOrder = " ORDER BY USERS ";
         $SHOW_USERS_AMOUNT = "Y";
     } else {
         $strSqlOrder = " ORDER BY G.C_SORT ";
         $by = "c_sort";
     }
     if (strtolower($order) == "desc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     } else {
         $strSqlOrder .= " asc ";
         $order = "asc";
     }
     $str_USERS = $str_TABLE = "";
     if ($SHOW_USERS_AMOUNT == "Y") {
         $str_USERS = "count(distinct U.USER_ID)\t\t\t\t\t\tUSERS,";
         $str_TABLE = "LEFT JOIN b_user_group U ON (U.GROUP_ID=G.ID AND ((U.DATE_ACTIVE_FROM IS NULL) OR (U.DATE_ACTIVE_FROM <= " . $DB->CurrentTimeFunction() . ")) AND ((U.DATE_ACTIVE_TO IS NULL) OR (U.DATE_ACTIVE_TO >= " . $DB->CurrentTimeFunction() . ")))";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tG.ID, G.ACTIVE, G.C_SORT, G.ANONYMOUS, G.NAME, G.DESCRIPTION, G.STRING_ID,\n\t\t\t\t" . $str_USERS . "\n\t\t\t\tG.ID\t\t\t\t\t\t\t\t\t\tREFERENCE_ID,\n\t\t\t\tconcat(G.NAME, ' [', G.ID, ']')\t\t\t\t\tREFERENCE,\n\t\t\t\t" . $DB->DateToCharFunction("G.TIMESTAMP_X") . "\tTIMESTAMP_X\n\t\t\tFROM\n\t\t\t\tb_group G\n\t\t\t" . $str_TABLE . "\n\t\t\tWHERE\n\t\t\t" . $strSqlSearch . "\n\t\t\tGROUP BY\n\t\t\t\tG.ID, G.ACTIVE, G.C_SORT, G.TIMESTAMP_X, G.ANONYMOUS, G.NAME, G.STRING_ID, G.DESCRIPTION\n\t\t\tHAVING\n\t\t\t\t1=1\n\t\t\t\t" . $strSqlSearch_h . "\n\t\t\t" . $strSqlOrder;
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $res->is_filtered = IsFiltered($strSqlSearch) || strlen($strSqlSearch_h) > 0;
     return $res;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:user.php

示例8: GetList


//.........这里部分代码省略.........
					case "NEW_GUEST":
					case "URL_LAST_404":
					case "URL_TO_404":
					case "USER_AUTH":
						$arSqlSearch[] = ($val=="Y") ? "S.".$key."='Y'" : "S.".$key."='N'";
						break;
					case "FAVORITES":
						$arSqlSearch[] = ($val=="Y") ? "G.".$key."='Y'" : "G.".$key."='N'";
						break;
					case "USER":
						$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
						$arSqlSearch[] = "ifnull(S.USER_ID,0)>0";
						$arSqlSearch[] = GetFilterQuery("S.USER_ID,A.LOGIN,A.LAST_NAME,A.NAME", $val, $match);
						$from1 = "LEFT JOIN b_user A ON (A.ID = S.USER_ID)";
						$select = " , A.LOGIN, concat(ifnull(A.NAME,''),' ',ifnull(A.LAST_NAME,'')) USER_NAME";
						break;
				}
			}
		}

		if (!is_array($arOrder))
			$arOrder = Array("s_id" => "desc");

		foreach($arOrder as $by=>$order)
		{
			$by = strtolower($by);
			$order = strtolower($order);
			if ($order!="asc")
				$order = "desc";
		}

		if ($by == "s_id") $strSqlOrder = "ORDER BY S.ID";
		elseif ($by == "s_session_time") $strSqlOrder = "ORDER BY SESSION_TIME";
		elseif ($by == "s_date_first") $strSqlOrder = "ORDER BY S.DATE_FIRST";
		elseif ($by == "s_date_last") $strSqlOrder = "ORDER BY S.DATE_LAST";
		elseif ($by == "s_user_id") $strSqlOrder = "ORDER BY S.USER_ID";
		elseif ($by == "s_guest_id") $strSqlOrder = "ORDER BY S.GUEST_ID";
		elseif ($by == "s_ip") $strSqlOrder = "ORDER BY S.IP_LAST";
		elseif ($by == "s_hits") $strSqlOrder = "ORDER BY S.HITS ";
		elseif ($by == "s_adv_id") $strSqlOrder = "ORDER BY S.ADV_ID ";
		elseif ($by == "s_country_id") $strSqlOrder = "ORDER BY S.COUNTRY_ID ";
		elseif ($by == "s_url_last") $strSqlOrder = "ORDER BY S.URL_LAST ";
		elseif ($by == "s_url_to") $strSqlOrder = "ORDER BY S.URL_TO ";
		else
		{
			$by = "s_id";
			$strSqlOrder = "ORDER BY S.ID";
		}
		if ($order!="asc")
		{
			$strSqlOrder .= " desc ";
			$order="desc";
		}

		$strSqlSearch = GetFilterSqlSearch($arSqlSearch);

		$strSql = "
			SELECT
				S.ID,
				S.ADV_ID, S.REFERER1, S.REFERER2, S.REFERER3, S.ADV_BACK,
				S.LAST_SITE_ID, S.URL_LAST, S.URL_LAST_404, S.IP_LAST, S.HITS, S.USER_AUTH,
				S.STOP_LIST_ID, S.GUEST_ID, G.FAVORITES, G.LAST_USER_ID,
				UNIX_TIMESTAMP(S.DATE_LAST) - UNIX_TIMESTAMP(S.DATE_FIRST) SESSION_TIME,
				".$DB->DateToCharFunction("S.DATE_LAST")." DATE_LAST,
				if(G.SESSIONS<=1,'Y','N') NEW_GUEST,
				G.FIRST_URL_FROM,
				G.FIRST_SITE_ID,
				S.URL_FROM,
				S.COUNTRY_ID,
				C.NAME COUNTRY_NAME,
				CITY.REGION REGION_NAME,
				S.CITY_ID,
				CITY.NAME CITY_NAME
			FROM
				b_stat_session S
				INNER JOIN b_stat_guest G ON (G.ID = S.GUEST_ID)
				INNER JOIN b_stat_country C ON (C.ID = S.COUNTRY_ID)
				".$from1."
				LEFT JOIN b_stat_city CITY ON (CITY.ID = S.CITY_ID)
			WHERE
				S.DATE_STAT >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)
				and S.DATE_LAST > DATE_ADD(now(), INTERVAL - ".$interval." SECOND)
				and ".$strSqlSearch."
			".$strSqlOrder."
		";

		$arr = array();
		$arrG = array();
		$rs = $DB->Query($strSql, false, $err_mess.__LINE__);
		while($ar = $rs->Fetch())
		{
			$arr[] = $ar;
			$arrG[$ar["GUEST_ID"]] = $ar["GUEST_ID"];
		}
		$guest_count = count($arrG);
		$session_count = count($arr);
		$rs = new CDBResult;
		$rs->InitFromArray($arr);
		return $rs;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:useronline.php

示例9: GetList


//.........这里部分代码省略.........
                 case "URL_404":
                 case "NEW_GUEST":
                     $arSqlSearch[] = $val == "Y" ? "H." . $key . "='Y'" : "H." . $key . "='N'";
                     break;
                 case "REGISTERED":
                     $arSqlSearch[] = $val == "Y" ? "H.USER_ID>0" : "(H.USER_ID<=0 or H.USER_ID is null)";
                     break;
                 case "DATE_1":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "H.DATE_HIT >= " . $DB->CharToDateFunction($val, "SHORT");
                     }
                     break;
                 case "DATE_2":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "H.DATE_HIT < " . CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
                     }
                     break;
                 case "IP":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H.IP", $val, $match, array("."));
                     break;
                 case "USER_AGENT":
                 case "COUNTRY_ID":
                 case "CITY_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H." . $key, $val, $match);
                     break;
                 case "COOKIE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H.COOKIES", $val, $match);
                     break;
                 case "USER":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = $DB->IsNull("H.USER_ID", "0") . ">0";
                     $arSqlSearch[] = GetFilterQuery("H.USER_ID,A.LOGIN,A.LAST_NAME,A.NAME", $val, $match);
                     $select = ", A.LOGIN, " . $DB->Concat($DB->IsNull("A.NAME", "''"), "' '", $DB->IsNull("A.LAST_NAME", "''")) . " USER_NAME";
                     $from1 = "LEFT JOIN b_user A ON (A.ID = H.USER_ID)";
                     break;
                 case "COUNTRY":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("C.NAME", $val, $match);
                     $from2 = "INNER JOIN b_stat_country C ON (C.ID = H.COUNTRY_ID)";
                     break;
                 case "REGION":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("CITY.REGION", $val, $match);
                     break;
                 case "CITY":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("CITY.NAME", $val, $match);
                     break;
                 case "STOP":
                     $arSqlSearch[] = $val == "Y" ? "H.STOP_LIST_ID>0" : "(H.STOP_LIST_ID<=0 or H.STOP_LIST_ID is null)";
                     break;
                 case "SITE_ID":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("H.SITE_ID", $val, $match);
                     break;
             }
         }
     }
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY H.ID";
     } elseif ($by == "s_site_id") {
         $strSqlOrder = "ORDER BY H.SITE_ID";
     } elseif ($by == "s_session_id") {
         $strSqlOrder = "ORDER BY H.SESSION_ID";
     } elseif ($by == "s_date_hit") {
         $strSqlOrder = "ORDER BY H.DATE_HIT";
     } elseif ($by == "s_user_id") {
         $strSqlOrder = "ORDER BY H.USER_ID";
     } elseif ($by == "s_guest_id") {
         $strSqlOrder = "ORDER BY H.GUEST_ID";
     } elseif ($by == "s_ip") {
         $strSqlOrder = "ORDER BY H.IP";
     } elseif ($by == "s_url") {
         $strSqlOrder = "ORDER BY H.URL ";
     } elseif ($by == "s_country_id") {
         $strSqlOrder = "ORDER BY H.COUNTRY_ID ";
     } elseif ($by == "s_region_name") {
         $strSqlOrder = "ORDER BY CITY.REGION ";
     } elseif ($by == "s_city_id") {
         $strSqlOrder = "ORDER BY H.CITY_ID ";
     } else {
         $by = "s_id";
         $strSqlOrder = "ORDER BY H.ID";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT /*TOP*/\n\t\t\t\tH.ID,\n\t\t\t\tH.SESSION_ID,\n\t\t\t\tH.GUEST_ID,\n\t\t\t\tH.NEW_GUEST,\n\t\t\t\tH.USER_ID,\n\t\t\t\tH.USER_AUTH,\n\t\t\t\tH.URL,\n\t\t\t\tH.URL_404,\n\t\t\t\tH.URL_FROM,\n\t\t\t\tH.IP,\n\t\t\t\tH.METHOD,\n\t\t\t\tH.COOKIES,\n\t\t\t\tH.USER_AGENT,\n\t\t\t\tH.STOP_LIST_ID,\n\t\t\t\tH.COUNTRY_ID,\n\t\t\t\tH.CITY_ID,\n\t\t\t\tCITY.REGION REGION_NAME,\n\t\t\t\tCITY.NAME CITY_NAME,\n\t\t\t\tH.SITE_ID,\n\t\t\t\t" . $DB->DateToCharFunction("H.DATE_HIT") . " DATE_HIT\n\t\t\t\t" . $select . "\n\t\t\tFROM\n\t\t\t\tb_stat_hit H\n\t\t\t\tLEFT JOIN b_stat_city CITY ON (CITY.ID = H.CITY_ID)\n\t\t\t" . $from1 . "\n\t\t\t" . $from2 . "\n\t\t\tWHERE\n\t\t\t" . $strSqlSearch . "\n\t\t\t" . $strSqlOrder . "\n\t\t";
     $res = $DB->Query(CStatistics::DBTopSql($strSql), false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:hit.php

示例10: GetList


//.........这里部分代码省略.........
						break;
					case "USER":
						if(COption::GetOptionString("statistic", "dbnode_id") <= 0)
						{
							$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
							$arSqlSearch[] = $DB->IsNull("G.LAST_USER_ID","0").">0";
							$arSqlSearch[] = GetFilterQuery("G.LAST_USER_ID,A.LOGIN,A.LAST_NAME,A.NAME", $val, $match);
							$select1 .= ", ".$DB->Concat($DB->IsNull("A.NAME","''"), "' '", $DB->IsNull("A.LAST_NAME","''"))." USER_NAME, A.LOGIN";
							$from1 = "LEFT JOIN  b_user A ON (A.ID = G.LAST_USER_ID) ";
							$arrGroup["A.NAME"] = true;
							$arrGroup["A.LAST_NAME"] = true;
							$arrGroup["A.LOGIN"] = true;
							$bGroup = true;
						}
						break;
					case "USER_ID":
						if(COption::GetOptionString("statistic", "dbnode_id") <= 0)
						{
							$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
							$arSqlSearch[] = $DB->IsNull("G.LAST_USER_ID","0").">0";
							$arSqlSearch[] = GetFilterQuery("G.LAST_USER_ID", $val, $match);
							$select1 .= ", ".$DB->Concat($DB->IsNull("A.NAME","''"), "' '", $DB->IsNull("A.LAST_NAME","''"))." USER_NAME, A.LOGIN";
							$from1 = "LEFT JOIN  b_user A ON (A.ID = G.LAST_USER_ID) ";
							$arrGroup["A.NAME"] = true;
							$arrGroup["A.LAST_NAME"] = true;
							$arrGroup["A.LOGIN"] = true;
							$bGroup = true;
						}
						break;
				}
			}
		}
		if ($by == "s_id")					$strSqlOrder = "ORDER BY G.ID";
		elseif ($by == "s_first_site_id")	$strSqlOrder = "ORDER BY G.FIRST_SITE_ID";
		elseif ($by == "s_last_site_id")	$strSqlOrder = "ORDER BY G.LAST_SITE_ID";
		elseif ($by == "s_events")			$strSqlOrder = "ORDER BY G.C_EVENTS";
		elseif ($by == "s_sessions")		$strSqlOrder = "ORDER BY G.SESSIONS";
		elseif ($by == "s_hits")			$strSqlOrder = "ORDER BY G.HITS";
		elseif ($by == "s_first_date")		$strSqlOrder = "ORDER BY G.FIRST_DATE";
		elseif ($by == "s_first_url_from")	$strSqlOrder = "ORDER BY G.FIRST_URL_FROM";
		elseif ($by == "s_first_url_to")	$strSqlOrder = "ORDER BY G.FIRST_URL_TO";
		elseif ($by == "s_first_adv_id")	$strSqlOrder = "ORDER BY G.FIRST_ADV_ID";
		elseif ($by == "s_last_date")		$strSqlOrder = "ORDER BY ".CStatistics::DBFirstDate("G.LAST_DATE");
		elseif ($by == "s_last_user_id")	$strSqlOrder = "ORDER BY G.LAST_USER_ID";
		elseif ($by == "s_last_url_last")	$strSqlOrder = "ORDER BY G.LAST_URL_LAST";
		elseif ($by == "s_last_user_agent")	$strSqlOrder = "ORDER BY G.LAST_USER_AGENT";
		elseif ($by == "s_last_ip")			$strSqlOrder = "ORDER BY G.LAST_IP";
		elseif ($by == "s_last_adv_id")		$strSqlOrder = "ORDER BY G.LAST_ADV_ID";
		elseif ($by == "s_last_country_id")	$strSqlOrder = "ORDER BY G.LAST_COUNTRY_ID";
		elseif ($by == "s_last_region_name")	$strSqlOrder = "ORDER BY CITY.REGION";
		elseif ($by == "s_last_city_id")	$strSqlOrder = "ORDER BY G.LAST_CITY_ID";
		else
		{
			$by = "s_last_date";
			$strSqlOrder = "ORDER BY ".CStatistics::DBFirstDate("G.LAST_DATE");
		}
		if ($order!="asc")
		{
			$strSqlOrder .= " desc ";
			$order="desc";
		}

		if($bGroup)
		{
			$strSqlGroup = "GROUP BY ".implode(", ", array_keys($arrGroup));
		}

		$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
		$strSql = "
			SELECT /*TOP*/
				".$select0."
				G.ID, G.FIRST_SITE_ID, G.FIRST_SESSION_ID,
				G.LAST_SESSION_ID, G.LAST_SITE_ID,
				G.C_EVENTS, G.SESSIONS, G.HITS,  G.FAVORITES,
				G.FIRST_URL_FROM, G.FIRST_URL_TO, G.FIRST_URL_TO_404,
				G.FIRST_ADV_ID, G.FIRST_REFERER1, G.FIRST_REFERER2, G.FIRST_REFERER3,
				G.LAST_ADV_ID, G.LAST_ADV_BACK, G.LAST_REFERER1, G.LAST_REFERER2, G.LAST_REFERER3,
				G.LAST_USER_ID, G.LAST_USER_AUTH, G.LAST_URL_LAST, G.LAST_URL_LAST_404,
				G.LAST_USER_AGENT, G.LAST_IP, G.LAST_LANGUAGE, G.LAST_COUNTRY_ID,
				CITY.REGION as LAST_REGION_NAME,
				G.LAST_CITY_ID, CITY.NAME as LAST_CITY_NAME,
				".$DB->DateToCharFunction("G.FIRST_DATE")." FIRST_DATE,
				".$DB->DateToCharFunction("G.LAST_DATE")." LAST_DATE
				".$select1."
			FROM
				b_stat_guest G
			".$from0."
			".$from1."
			".$from2."
				LEFT JOIN b_stat_city CITY ON (CITY.ID = G.LAST_CITY_ID)
			WHERE
			".$strSqlSearch."
			".$strSqlGroup."
			".$strSqlOrder."
		";

		$res = $DB->Query(CStatistics::DBTopSql($strSql), false, $err_mess.__LINE__);
		$is_filtered = (IsFiltered($strSqlSearch));
		return $res;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:guest.php

示例11: GetList


//.........这里部分代码省略.........
         foreach ($arFilter as $key => $val) {
             if (is_array($val)) {
                 if (count($val) <= 0) {
                     continue;
                 }
             } else {
                 if (strlen($val) <= 0 || "{$val}" == "NOT_REF") {
                     continue;
                 }
             }
             $match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
             $key = strtoupper($key);
             $predicate = "";
             switch ($key) {
                 case "ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $predicate = GetFilterQuery("S.ID", $val, $match);
                     break;
                 case "ACTIVE":
                     $predicate = $val == "Y" ? "S.ACTIVE='Y'" : "S.ACTIVE='N'";
                     break;
                 case "!=ACTIVE":
                     if ($val === "Y" || $val === "N") {
                         $arSqlSearch[] = "S.ACTIVE <> '" . $val . "'";
                     }
                     break;
                 case "TITLE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $predicate = GetFilterQuery("S.TITLE", $val, $match);
                     break;
                 case "DESCRIPTION":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $predicate = GetFilterQuery("S.DESCRIPTION", $val, $match);
                     break;
                 case "DOCUMENTS_1":
                     $arSqlSearch_h[] = "count(D.ID) >= " . intval($val);
                     $bGroup = true;
                     break;
                 case "DOCUMENTS_2":
                     $arSqlSearch_h[] = "count(D.ID) <= " . intval($val);
                     $bGroup = true;
                     break;
                 case "GROUP_ID":
                     if (!is_array($val)) {
                         $val = array($val);
                     }
                     $groups = array();
                     foreach ($val as $i => $v) {
                         $v = intval($v);
                         if ($v > 0) {
                             $groups[$v] = $v;
                         }
                     }
                     if (count($groups) > 0) {
                         $arSqlSearch_g[] = "G.GROUP_ID in (" . implode(", ", $groups) . ")";
                         $bGroup = true;
                     }
                     break;
                 case "PERMISSION_TYPE_1":
                     $val = intval($val);
                     if ($val > 0) {
                         $arSqlSearch_g[] = "G.PERMISSION_TYPE >= " . $val;
                         $bGroup = true;
                     }
                     break;
                 case "PERMISSION_TYPE_2":
                     $val = intval($val);
                     if ($val > 0) {
                         $arSqlSearch_g[] = "G.PERMISSION_TYPE <= " . $val;
                         $bGroup = true;
                     }
                     break;
             }
             if (strlen($predicate) > 0 && $predicate != "0") {
                 $arSqlSearch[] = $predicate;
             }
         }
     }
     if (count($arSqlSearch) > 0) {
         $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     } else {
         $strSqlSearch = "";
     }
     if (count($arSqlSearch_h) > 0) {
         $strSqlSearch_h = "(" . implode(") and (", $arSqlSearch_h) . ") ";
     } else {
         $strSqlSearch_h = "";
     }
     if (count($arSqlSearch_g) > 0) {
         if (strlen($strSqlSearch)) {
             $strSqlSearch .= " AND ";
         }
         $strSqlSearch .= "(" . implode(") and (", $arSqlSearch_g) . ") ";
     }
     $strSql = "\n\t\t\tSELECT\n\t\t\t\t" . implode(", ", $arSqlSelect) . "\n\t\t\tFROM\n\t\t\t\tb_workflow_status S\n\t\t\t" . (strlen($strSqlSearch_h) > 0 || array_key_exists("DOCUMENTS", $arSqlSelect) ? "LEFT JOIN b_workflow_document D ON (D.STATUS_ID = S.ID)" : "") . "\n\t\t\t" . (count($arSqlSearch_g) > 0 ? "LEFT JOIN b_workflow_status2group G ON (G.STATUS_ID = S.ID)" : "") . "\n\t\t\t" . (strlen($strSqlSearch) > 0 ? "WHERE " . $strSqlSearch : "") . "\n\t\t\t" . ($bGroup ? "GROUP BY " . implode(", ", $arSqlGroup) : "") . "\n\t\t\t" . (strlen($strSqlSearch_h) > 0 ? "HAVING " . $strSqlSearch_h : "") . "\n\t\t\t{$strSqlOrder}\n\t\t\t";
     //echo "<pre>".htmlspecialcharsbx($strSql)."</pre>";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = strlen($strSqlSearch) > 0;
     return $res;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:status.php

示例12: GetHistoryList

 function GetHistoryList(&$by, &$order, $arFilter = array(), &$is_filtered)
 {
     $err_mess = CWorkflow::err_mess() . "<br>Function: GetHistoryList<br>Line: ";
     global $DB;
     $arSqlSearch = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (strlen($val) <= 0 || "{$val}" == "NOT_REF") {
                 continue;
             }
             if (is_array($val) && count($val) <= 0) {
                 continue;
             }
             $match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter) ? true : false;
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("L.ID", $val, $match);
                     break;
                 case "DOCUMENT_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("L.DOCUMENT_ID", $val, $match);
                     break;
                 case "DATE_MODIFY_1":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "L.TIMESTAMP_X >= " . $DB->CharToDateFunction($val, "SHORT");
                     }
                     break;
                 case "DATE_MODIFY_2":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "L.TIMESTAMP_X < " . $DB->CharToDateFunction($val, "SHORT") . " + INTERVAL 1 DAY";
                     }
                     break;
                 case "MODIFIED_BY":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("L.MODIFIED_BY", $val, $match);
                     break;
                 case "MODIFIED_USER":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("L.MODIFIED_BY, U.LOGIN, U.NAME, U.LAST_NAME", $val, $match);
                     break;
                 case "TITLE":
                 case "SITE_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("L." . $key, $val, $match);
                     break;
                 case "FILENAME":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("L.FILENAME", $val, $match, array("/", "\\", ".", "_"));
                     break;
                 case "BODY":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("L.BODY", $val, $match, array(), "Y");
                     break;
                 case "STATUS":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("L.STATUS_ID, S.TITLE", $val, $match);
                     break;
                 case "STATUS_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("L.STATUS_ID", $val, $match);
                     break;
             }
         }
     }
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY L.ID";
     } elseif ($by == "s_document_id") {
         $strSqlOrder = "ORDER BY L.DOCUMENT_ID";
     } elseif ($by == "s_date_modify") {
         $strSqlOrder = "ORDER BY L.TIMESTAMP_X";
     } elseif ($by == "s_modified_by") {
         $strSqlOrder = "ORDER BY L.MODIFIED_BY";
     } elseif ($by == "s_filename") {
         $strSqlOrder = "ORDER BY L.FILENAME";
     } elseif ($by == "s_site_id") {
         $strSqlOrder = "ORDER BY L.SITE_ID";
     } elseif ($by == "s_title") {
         $strSqlOrder = "ORDER BY L.TITLE";
     } elseif ($by == "s_status") {
         $strSqlOrder = "ORDER BY L.STATUS_ID";
     } else {
         $by = "s_id";
         $strSqlOrder = "ORDER BY L.ID";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT DISTINCT\n\t\t\t\tL.*,\n\t\t\t\t" . $DB->DateToCharFunction("L.TIMESTAMP_X") . " TIMESTAMP_X,\n\t\t\t\tconcat('(',U.LOGIN,') ',ifnull(U.NAME,''),' ',ifnull(U.LAST_NAME,'')) USER_NAME,\n\t\t\t\tS.TITLE STATUS_TITLE\n\t\t\tFROM\n\t\t\t\tb_workflow_log L\n\t\t\t\tLEFT JOIN b_workflow_status S ON (S.ID = L.STATUS_ID)\n\t\t\t\tLEFT JOIN b_user U ON (U.ID = L.MODIFIED_BY)\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\t{$strSqlOrder}\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:97,代码来源:workflow.php

示例13: GetList

 public static function GetList($Params = array())
 {
     global $DB, $USER;
     $arFilter = $Params['arFilter'];
     $arOrder = isset($Params['arOrder']) ? $Params['arOrder'] : array('ID' => 'asc');
     static $arFields = array("ID" => array("FIELD_NAME" => "MLC.ID", "FIELD_TYPE" => "int"), "NAME" => array("FIELD_NAME" => "MLC.NAME", "FIELD_TYPE" => "string"), "ACTIVE" => array("FIELD_NAME" => "MLC.ACTIVE", "FIELD_TYPE" => "string"), "DATE_UPDATE" => array("FIELD_NAME" => "MLC.DATE_UPDATE", "FIELD_TYPE" => "date"), "KEYWORDS" => array("FIELD_NAME" => "MLC.KEYWORDS", "FIELD_TYPE" => "string"), "DESCRIPTION" => array("FIELD_NAME" => "MLC.DESCRIPTION", "FIELD_TYPE" => "string"), "OWNER_ID" => array("FIELD_NAME" => "MLC.OWNER_ID", "FIELD_TYPE" => "int"), "PARENT_ID" => array("FIELD_NAME" => "MLC.PARENT_ID", "FIELD_TYPE" => "int"), "ML_TYPE" => array("FIELD_NAME" => "MLC.ML_TYPE", "FIELD_TYPE" => "string"));
     $err_mess = CMedialibCollection::GetErrorMess() . "<br>Function: GetList<br>Line: ";
     $arSqlSearch = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         $filter_keys = array_keys($arFilter);
         for ($i = 0, $l = count($filter_keys); $i < $l; $i++) {
             $n = strtoupper($filter_keys[$i]);
             $val = $arFilter[$filter_keys[$i]];
             if (is_string($val) && strlen($val) <= 0 || strval($val) == "NOT_REF") {
                 continue;
             }
             if ($n == 'ID' || $n == 'PARENT_ID' || $n == 'OWNER_ID') {
                 $arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val, 'N');
             } elseif (isset($arFields[$n])) {
                 $arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val);
             }
         }
     }
     $strOrderBy = '';
     foreach ($arOrder as $by => $order) {
         if (isset($arFields[strtoupper($by)])) {
             $strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"] . ' ' . (strtolower($order) == 'desc' ? 'desc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS LAST" : "") : 'asc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS FIRST" : "")) . ',';
         }
     }
     if (strlen($strOrderBy) > 0) {
         $strOrderBy = "ORDER BY " . rtrim($strOrderBy, ",");
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     if (isset($arFilter['TYPES']) && is_array($arFilter['TYPES'])) {
         $strTypes = "";
         for ($i = 0, $l = count($arFilter['TYPES']); $i < $l; $i++) {
             $strTypes .= "," . IntVal($arFilter['TYPES'][$i]);
         }
         $strSqlSearch .= "\n AND ML_TYPE in (" . trim($strTypes, ", ") . ")";
     }
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tMLC.*\n\t\t\tFROM\n\t\t\t\tb_medialib_collection MLC\n\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t{$strOrderBy}";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $arResult = array();
     while ($arRes = $res->Fetch()) {
         $arResult[] = $arRes;
     }
     return $arResult;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:49,代码来源:medialib.php

示例14: GetMenuList

 function GetMenuList($arFilter = array(), $check_rights = "Y")
 {
     $err_mess = CAllForm::err_mess() . "<br>Function: GetMenuList<br>Line: ";
     global $DB, $USER, $strError;
     $arSqlSearch = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         $filter_keys = array_keys($arFilter);
         for ($i = 0; $i < count($filter_keys); $i++) {
             $key = $filter_keys[$i];
             $val = $arFilter[$filter_keys[$i]];
             if (is_array($val)) {
                 if (count($val) <= 0) {
                     continue;
                 }
             } else {
                 if (strlen($val) <= 0 || $val === "NOT_REF") {
                     continue;
                 }
             }
             $match_value_set = in_array($key . "_EXACT_MATCH", $filter_keys) ? true : false;
             $key = strtoupper($key);
             switch ($key) {
                 case "FORM_ID":
                 case "LID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("L." . $key, $val, $match);
                     break;
                 case "MENU":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("L.MENU", $val, $match);
                     break;
             }
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     if ($check_rights == "N" || CForm::IsAdmin()) {
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tF.ID,\n\t\t\t\t\tF.NAME,\n\t\t\t\t\tL.LID,\n\t\t\t\t\tL.MENU\n\t\t\t\tFROM\n\t\t\t\t\tb_form_menu L,\n\t\t\t\t\tb_form F\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\tand L.FORM_ID = F.ID\n\t\t\t\tORDER BY F.C_SORT\n\t\t\t\t";
     } else {
         $arGroups = $USER->GetUserGroupArray();
         if (!is_array($arGroups)) {
             $arGroups[] = 2;
         }
         $groups = implode(",", $arGroups);
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tF.ID,\n\t\t\t\t\tF.NAME,\n\t\t\t\t\tL.LID,\n\t\t\t\t\tL.MENU\n\t\t\t\tFROM\n\t\t\t\t\tb_form_menu L,\n\t\t\t\t\tb_form F,\n\t\t\t\t\tb_form_2_group G\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\tand L.FORM_ID = F.ID\n\t\t\t\tand G.FORM_ID = F.ID\n\t\t\t\tand G.GROUP_ID in ({$groups})\n\t\t\t\tGROUP BY\n\t\t\t\t\tL.ID, L.LID, L.MENU, F.NAME, F.ID, F.C_SORT\n\t\t\t\tHAVING\n\t\t\t\t\tmax(G.PERMISSION)>=15\n\t\t\t\tORDER BY F.C_SORT\n\t\t\t\t";
     }
     //echo "<pre>".$strSql."</pre>";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     return $res;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:50,代码来源:form_callform.php

示例15: GetList


//.........这里部分代码省略.........
					$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
					$arSqlSearch[] = GetFilterQuery("M.ID", $val, $match);
					break;
				case "TYPE":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.EVENT_NAME, T.NAME", $val, $match);
					break;
				case "EVENT_NAME":
				case "TYPE_ID":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
					$arSqlSearch[] = GetFilterQuery("M.EVENT_NAME", $val, $match);
					break;
				case "TIMESTAMP_1":
					$arSqlSearch[] = "M.TIMESTAMP_X >= FROM_UNIXTIME('".MkDateTime(FmtDate($val,"D.M.Y"),"d.m.Y")."')";
					break;
				case "TIMESTAMP_2":
					$arSqlSearch[] = "M.TIMESTAMP_X <= FROM_UNIXTIME('".MkDateTime(FmtDate($val,"D.M.Y")." 23:59:59","d.m.Y")."')";
					break;
				case "LID":
				case "LANG":
				case "SITE_ID":
					if (is_array($val)) $val = implode(" | ",$val);
					$arSqlSearch[] = GetFilterQuery("MS.SITE_ID",$val,"N");
					$bIsLang = true;
					break;
				case "ACTIVE":
					$arSqlSearch[] = ($val=="Y") ? "M.ACTIVE = 'Y'" : "M.ACTIVE = 'N'";
					break;
				case "FROM":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.EMAIL_FROM", $val, $match);
					break;
				case "TO":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.EMAIL_TO", $val, $match);
					break;
				case "BCC":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.BCC", $val, $match);
					break;
				case "SUBJECT":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.SUBJECT", $val, $match);
					break;
				case "BODY_TYPE":
					$arSqlSearch[] = ($val=="text") ? "M.BODY_TYPE = 'text'" : "M.BODY_TYPE = 'html'";
					break;
				case "BODY":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.MESSAGE", $val, $match);
					break;
				}
			}
		}

		if ($by == "id") $strSqlOrder = " ORDER BY M.ID ";
		elseif ($by == "active") $strSqlOrder = " ORDER BY M.ACTIVE ";
		elseif ($by == "event_name") $strSqlOrder = " ORDER BY M.EVENT_NAME ";
		elseif ($by == "from") $strSqlOrder = " ORDER BY M.EMAIL_FROM ";
		elseif ($by == "to") $strSqlOrder = " ORDER BY M.EMAIL_TO ";
		elseif ($by == "bcc") $strSqlOrder = " ORDER BY M.BCC ";
		elseif ($by == "body_type") $strSqlOrder = " ORDER BY M.BODY_TYPE ";
		elseif ($by == "subject") $strSqlOrder = " ORDER BY M.SUBJECT ";
		else
		{
			$strSqlOrder = " ORDER BY M.ID ";
			$by = "id";
		}

		if ($order!="asc")
		{
			$strSqlOrder .= " desc ";
			$order = "desc";
		}

		$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
		$strSql =
			"SELECT M.ID, M.EVENT_NAME, M.ACTIVE, M.LID, ".($bIsLang? "MS.SITE_ID":"M.LID AS SITE_ID").", M.EMAIL_FROM, M.EMAIL_TO, M.SUBJECT, M.MESSAGE, M.BODY_TYPE, M.BCC,
				M.REPLY_TO,
				M.CC,
				M.IN_REPLY_TO,
				M.PRIORITY,
				M.FIELD1_NAME,
				M.FIELD1_VALUE,
				M.FIELD2_NAME,
				M.FIELD2_VALUE,
			".
				$DB->DateToCharFunction("M.TIMESTAMP_X").
			" TIMESTAMP_X,	if(T.ID is null, M.EVENT_NAME, concat('[ ',T.EVENT_NAME,' ] ',ifnull(T.NAME,'')))	EVENT_TYPE ".
			"FROM b_event_message M ".
			($bIsLang?" LEFT JOIN b_event_message_site MS ON (M.ID = MS.EVENT_MESSAGE_ID)":"")." ".
			"	LEFT JOIN b_event_type T ON (T.EVENT_NAME = M.EVENT_NAME and T.LID = '".LANGUAGE_ID."') ".
			"WHERE ".
			$strSqlSearch.
			$strSqlOrder;

		$res = $DB->Query($strSql, false, $err_mess.__LINE__);
		$res->is_filtered = (IsFiltered($strSqlSearch));
		return $res;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:event.php


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