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


PHP GetFilterQuery函数代码示例

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


在下文中一共展示了GetFilterQuery函数的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: initExternalValues

 protected function initExternalValues($filterName)
 {
     if (!empty($_REQUEST['del_filter_' . $filterName])) {
         return;
     }
     $this->externalValues = array('UF_DEPARTMENT' => $_REQUEST[$filterName . '_UF_DEPARTMENT'], 'POST' => isset($_REQUEST[$filterName . '_POST']) ? $_REQUEST[$filterName . '_POST'] : null, 'COMPANY' => isset($_REQUEST[$filterName . '_COMPANY']) ? $_REQUEST[$filterName . '_COMPANY'] : null, 'EMAIL' => isset($_REQUEST[$filterName . '_EMAIL']) ? $_REQUEST[$filterName . '_EMAIL'] : null, 'FIO' => isset($_REQUEST[$filterName . '_FIO']) && GetFilterQuery("TEST", $_REQUEST[$filterName . '_FIO']) ? $_REQUEST[$filterName . '_FIO'] : null, 'PHONE' => isset($_REQUEST[$filterName . '_PHONE']) ? $_REQUEST[$filterName . '_PHONE'] : null, 'UF_PHONE_INNER' => isset($_REQUEST[$filterName . '_UF_PHONE_INNER']) ? $_REQUEST[$filterName . '_UF_PHONE_INNER'] : null, 'KEYWORDS' => isset($_REQUEST[$filterName . '_KEYWORDS']) ? $_REQUEST[$filterName . '_KEYWORDS'] : null, 'IS_ONLINE' => isset($_REQUEST[$filterName . '_IS_ONLINE']) ? $_REQUEST[$filterName . '_IS_ONLINE'] : null, 'LAST_NAME' => isset($_REQUEST[$filterName . '_LAST_NAME']) ? $_REQUEST[$filterName . '_LAST_NAME'] : null, 'LAST_NAME_RANGE' => isset($_REQUEST[$filterName . '_LAST_NAME_RANGE']) ? $_REQUEST[$filterName . '_LAST_NAME_RANGE'] : null);
     if ($this->externalValues['UF_DEPARTMENT'] !== null) {
         if (!is_array($this->externalValues['UF_DEPARTMENT'])) {
             $this->externalValues['UF_DEPARTMENT'] = array($this->externalValues['UF_DEPARTMENT']);
         }
         $this->externalValues['UF_DEPARTMENT'] = array_filter(array_map('intval', $this->externalValues['UF_DEPARTMENT']));
     } else {
         $this->externalValues['UF_DEPARTMENT'] = array();
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:15,代码来源:class.php

示例4: GetList

 public static function GetList($arOrder = array("ID" => "ASC"), $arFilter = array())
 {
     global $DB;
     $arSqlSearch = array();
     foreach ($arFilter as $key => $val) {
         $key = strtoupper($key);
         switch ($key) {
             case "ID":
             case "POST_ID":
             case "USER_ID":
                 $val = intval($val);
                 $arSqlSearch[] = $val > 0 ? "BPP." . $key . " IS NULL" : "BPP." . $key . "=" . $val;
                 break;
             case "NAME":
                 $arSqlSearch[] = "BPP.NAME = '" . $DB->ForSql($val, 50) . "'";
                 break;
             case "NAME_MASK":
                 $arSqlSearch[] = GetFilterQuery("BPP.NAME", $val);
                 break;
         }
     }
     $strSql = "\n\t\t\tSELECT BPP.ID, BPP.USER_ID, BPP.POST_ID, BPP.NAME, BPP.VALUE\n\t\t\tFROM b_blog_post_param BPP\n\t\t\tWHERE 1 = 1\n\t\t\t" . (empty($arSqlSearch) ? "" : " AND (" . implode($arSqlSearch, ") AND (") . ")") . "\n\t\t";
     $arSqlOrder = array();
     if (is_array($arOrder)) {
         foreach ($arOrder as $by => $order) {
             $by = strtoupper($by);
             $order = strtoupper($order);
             if ($order != "ASC") {
                 $order = "DESC";
             }
             if ($by == "ID") {
                 $arSqlOrder[$by] = " BP.ID " . $order . " ";
             } elseif ($by == "USER_ID") {
                 $arSqlOrder[$by] = " BP.USER_ID " . $order . " ";
             } elseif ($by == "POST_ID") {
                 $arSqlOrder[$by] = " BP.POST_ID " . $order . " ";
             } elseif ($by == "NAME") {
                 $arSqlOrder[$by] = " BP.NAME " . $order . " ";
             }
         }
     }
     $strSqlOrder = !empty($arSqlOrder) ? "ORDER BY " . implode(", ", $arSqlOrder) : "";
     return $DB->Query($strSql . $strSqlOrder, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
 }
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:44,代码来源:blog_post_param.php

示例5: 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

示例6: 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

示例7: GetList


//.........这里部分代码省略.........
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/statistic/classes/creferer/getlist.php
  * @author Bitrix
  */
 public static function GetList(&$by, &$order, $arFilter = array(), &$is_filtered, &$total, &$grby, &$max)
 {
     $err_mess = "File: " . __FILE__ . "<br>Line: ";
     global $grby, $total;
     $DB = CDatabase::GetModuleConnection('statistic');
     $group = false;
     $strSqlGroup = "GROUP BY L.PROTOCOL, L.SITE_NAME, L.URL_FROM, R.HITS, R.SESSIONS";
     $url_from = $DB->Concat("L.PROTOCOL", "L.SITE_NAME", "L.URL_FROM");
     $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 "ID":
                 case "SESSION_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("L." . $key, $val, $match);
                     break;
                 case "DATE1":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "L.DATE_HIT >= " . $DB->CharToDateFunction($val, "SHORT");
                     }
                     break;
                 case "DATE2":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "L.DATE_HIT < " . CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
                     }
                     break;
                 case "FROM_PROTOCOL":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("L.PROTOCOL", $val, $match, array("/", "\\", ":"));
                     break;
                 case "FROM_DOMAIN":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("L.SITE_NAME", $val, $match, array("."));
                     break;
                 case "FROM_PAGE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("L.URL_FROM", $val, $match, array("/", "\\", ".", "?", "#", ":", ":"));
                     break;
                 case "FROM":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery($url_from, $val, $match, array("/", "\\", ".", "?", "#", ":"), "N", "N");
                     break;
                 case "TO":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("L.URL_TO", $val, $match, array("/", "\\", ".", "?", "#", ":"));
                     break;
                 case "TO_404":
开发者ID:rasuldev,项目名称:torino,代码行数:67,代码来源:referer.php

示例8: GetList

	public function GetList($aSort=array(), $arFilter=Array(), $getCommon=true)
	{
		global $DB;

		$err_mess = (CAdminFilter::err_mess())."<br>Function: GetList<br>Line: ";
		$arSqlSearch = Array();
		if (is_array($arFilter))
		{
			foreach ($arFilter as $key => $val)
			{
				if (strlen($val)<=0 || $val=="NOT_REF")
					continue;

				switch(strtoupper($key))
				{
				case "ID":
					$arSqlSearch[] = GetFilterQuery("F.ID",$val,"N");
					break;
				case "USER_ID":
					if($getCommon)
						$arSqlSearch[] = "F.USER_ID=".intval($val)." OR F.COMMON='Y'";
					else
						$arSqlSearch[] = "F.USER_ID = ".intval($val);
					break;
				case "FILTER_ID":
					$arSqlSearch[] = GetFilterQuery("F.FILTER_ID", $val);
					break;
				case "NAME":
					$arSqlSearch[] = GetFilterQuery("F.NAME", $val);
					break;
				case "FIELDS":
					$arSqlSearch[] = GetFilterQuery("F.FIELDS", $val);
					break;
				case "COMMON":
					$arSqlSearch[] = "F.COMMON = '".$DB->ForSql($val,1)."'";
					break;
				case "PRESET":
					$arSqlSearch[] = "F.PRESET = '".$DB->ForSql($val,1)."'";
					break;
				case "LANGUAGE_ID":
					$arSqlSearch[] = "F.LANGUAGE_ID = '".$DB->ForSql($val,2)."'";
					break;
				case "PRESET_ID":
					$arSqlSearch[] = GetFilterQuery("F.PRESET_ID", $val);
					break;
				case "SORT":
					$arSqlSearch[] = GetFilterQuery("F.SORT", $val);
					break;
				case "SORT_FIELD":
					$arSqlSearch[] = GetFilterQuery("F.SORT_FIELD", $val);
					break;
				}
			}
		}

		$sOrder = "";
		foreach($aSort as $key=>$val)
		{
			$ord = (strtoupper($val) <> "ASC"? "DESC":"ASC");
			switch (strtoupper($key))
			{
				case "ID":		$sOrder .= ", F.ID ".$ord; break;
				case "USER_ID":	$sOrder .= ", F.USER_ID ".$ord; break;
				case "FILTER_ID":	$sOrder .= ", F.FILTER_ID ".$ord; break;
				case "NAME":	$sOrder .= ", F.NAME ".$ord; break;
				case "FIELDS":	$sOrder .= ", F.FIELDS ".$ord; break;
				case "COMMON":	$sOrder .= ", F.COMMON ".$ord; break;
				case "PRESET":	$sOrder .= ", F.PRESET ".$ord; break;
				case "LANGUAGE_ID":	$sOrder .= ", F.LANGUAGE_ID ".$ord; break;
				case "PRESET_ID":	$sOrder .= ", F.PRESET_ID ".$ord; break;
				case "SORT":	$sOrder .= ", F.SORT ".$ord; break;
				case "SORT_FIELD":	$sOrder .= ", F.SORT_FIELD ".$ord; break;
			}
		}
		if (strlen($sOrder)<=0)
			$sOrder = "F.ID ASC";
		$strSqlOrder = " ORDER BY ".TrimEx($sOrder,",");

		$strSqlSearch = GetFilterSqlSearch($arSqlSearch,"noFilterLogic");
		$strSql = "
			SELECT
				F.ID, F.USER_ID, F.NAME, F.FILTER_ID, F.FIELDS, F.COMMON, F.PRESET, F.LANGUAGE_ID, F.PRESET_ID, F.SORT, F.SORT_FIELD
			FROM
				b_filters F
			WHERE
			".$strSqlSearch."
			".$strSqlOrder;

		$res = $DB->Query($strSql, false, $err_mess.__LINE__);
		return $res;
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:91,代码来源:admin_lib.php

示例9: GetList

 /**
  * <p>Метод производит выборку уведомлений с сортировкой и фильтрацией. Статичный метод.</p>
  *
  *
  * @param array $arSort = array() Сортировка осуществляется по: <ul> <li> <b>ID</b> - идентификатору
  * сообщения;</li> <li> <b>MODULE_ID</b> - идентификатору модуля, к которому
  * относится сообщение.</li> </ul>
  *
  * @param array $arFilter = array() Фильтрация осуществляется по: <ul> <li> <b>ID</b> - идентификатору
  * сообщения;</li> <li> <b>MODULE_ID</b> - идентификатору модуля, к которому
  * относится сообщение;</li> <li> <b>TAG</b> - тегу;</li> <li> <b>ENABLE_CLOSE</b>-
  * разрешению на ручное закрытие.</li> </ul>
  *
  * @return mixed <p>Возвращается экземляр класса <a
  * href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/index.php">CDBResult</a> для дальней
  * обработки.</p>
  *
  * <h4>Example</h4> 
  * <pre>
  * CAdminNotify::GetList(array('ID' =&gt; 'DESC'), array('MODULE_ID'=&gt;'main'));
  * </pre>
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/index.php">CDBResult</a> </li> </ul><a
  * name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/main/reference/cadminnotify/getlist.php
  * @author Bitrix
  */
 public static function GetList($arSort = array(), $arFilter = array())
 {
     global $DB;
     $arSqlSearch = array();
     $strSqlSearch = '';
     $err_mess = self::err_mess() . '<br />Function: GetList<br />Line: ';
     if (!is_array($arFilter)) {
         $arFilter = array();
     }
     if (!isset($arFilter['LID'])) {
         $arFilter['LID'] = LANGUAGE_ID;
     }
     if (!isset($arFilter['PUBLIC_SECTION'])) {
         $arFilter['PUBLIC_SECTION'] = 'N';
     }
     $strFrom = '';
     $strSelect = "AN.ID, AN.MODULE_ID, AN.TAG, AN.MESSAGE, AN.ENABLE_CLOSE, AN.PUBLIC_SECTION";
     if (is_array($arFilter)) {
         $filter_keys = array_keys($arFilter);
         for ($i = 0, $ic = count($filter_keys); $i < $ic; $i++) {
             $val = $arFilter[$filter_keys[$i]];
             if (strlen($val) <= 0 || $val == 'NOT_REF') {
                 continue;
             }
             switch (strtoupper($filter_keys[$i])) {
                 case 'ID':
                     $arSqlSearch[] = GetFilterQuery('AN.ID', $val, 'N');
                     break;
                 case 'MODULE_ID':
                     $arSqlSearch[] = GetFilterQuery('AN.MODULE_ID', $val);
                     break;
                 case 'TAG':
                     $arSqlSearch[] = GetFilterQuery('AN.TAG', $val);
                     break;
                 case 'MESSAGE':
                     $arSqlSearch[] = GetFilterQuery('AN.MESSAGE', $val);
                     break;
                 case 'ENABLE_CLOSE':
                     $arSqlSearch[] = $val == 'Y' ? "AN.ENABLE_CLOSE='Y'" : "AN.ENABLE_CLOSE='N'";
                     break;
                 case 'LID':
                     $strSelect .= ", ANL.MESSAGE as MESSAGE_LANG";
                     $strFrom = 'LEFT JOIN b_admin_notify_lang ANL ON (AN.ID = ANL.NOTIFY_ID AND ANL.LID = \'' . $DB->ForSQL($val) . '\')';
                     break;
                 case 'PUBLIC_SECTION':
                     $arSqlSearch[] = $val == 'Y' ? "AN.PUBLIC_SECTION='Y'" : "AN.PUBLIC_SECTION='N'";
             }
         }
     }
     $sOrder = '';
     foreach ($arSort as $key => $val) {
         $ord = strtoupper($val) != 'ASC' ? 'DESC' : 'ASC';
         switch (strtoupper($key)) {
             case 'ID':
                 $sOrder .= ', AN.ID ' . $ord;
                 break;
             case 'MODULE_ID':
                 $sOrder .= ', AN.MODULE_ID ' . $ord;
                 break;
             case 'ENABLE_CLOSE':
                 $sOrder .= ', AN.ENABLE_CLOSE ' . $ord;
                 break;
         }
     }
     if (strlen($sOrder) <= 0) {
         $sOrder = 'AN.ID DESC';
     }
     $strSqlOrder = ' ORDER BY ' . TrimEx($sOrder, ',');
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:admin_notify.php

示例10: GetList

 public static function GetList($aSort = array(), $arFilter = array(), $arNavStartParams = false)
 {
     global $DB;
     $arSqlSearch = array();
     $from1 = "";
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (!is_array($val)) {
                 if (strlen($val) <= 0 || $val === "NOT_REF") {
                     continue;
                 }
             }
             switch (strtoupper($key)) {
                 case "ID":
                     $arSqlSearch[] = GetFilterQuery("S.ID", $val, "N");
                     break;
                 case "EMAIL":
                     $arSqlSearch[] = GetFilterQuery("S.EMAIL", $val, "Y", array("@", ".", "_"));
                     break;
                 case "UPDATE_1":
                     $arSqlSearch[] = "S.DATE_UPDATE>=" . $DB->CharToDateFunction($val);
                     break;
                 case "UPDATE_2":
                     $arSqlSearch[] = "S.DATE_UPDATE<=" . $DB->CharToDateFunction($val . " 23:59:59");
                     break;
                 case "INSERT_1":
                     $arSqlSearch[] = "S.DATE_INSERT>=" . $DB->CharToDateFunction($val);
                     break;
                 case "INSERT_2":
                     $arSqlSearch[] = "S.DATE_INSERT<=" . $DB->CharToDateFunction($val . " 23:59:59");
                     break;
                 case "USER":
                     $arSqlSearch[] = GetFilterQuery("U.ID, U.LOGIN, U.NAME, U.LAST_NAME", $val);
                     break;
                 case "USER_ID":
                     $arSqlSearch[] = GetFilterQuery("S.USER_ID", $val, "N");
                     break;
                 case "ANONYMOUS":
                     $arSqlSearch[] = $val == "Y" ? "(S.USER_ID = 0 or S.USER_ID is null)" : "(S.USER_ID > 0 and S.USER_ID is not null)";
                     break;
                 case "CONFIRMED":
                     $arSqlSearch[] = $val == "Y" ? "S.CONFIRMED='Y'" : "S.CONFIRMED='N'";
                     break;
                 case "ACTIVE":
                     $arSqlSearch[] = $val == "Y" ? "S.ACTIVE='Y'" : "S.ACTIVE='N'";
                     break;
                 case "FORMAT":
                     $arSqlSearch[] = $val == "text" ? "S.FORMAT='text'" : "S.FORMAT='html'";
                     break;
                 case "RUBRIC":
                 case "RUBRIC_MULTI":
                 case "DISTRIBUTION":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     if (strlen($val) > 0) {
                         $from1 = " INNER JOIN b_subscription_rubric SR ON (SR.SUBSCRIPTION_ID=S.ID) ";
                         $arSqlSearch[] = GetFilterQuery("SR.LIST_RUBRIC_ID", $val, "N");
                     } else {
                         $arSqlSearch[] = " 1=0 ";
                     }
                     break;
             }
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $arOrder = array();
     foreach ($aSort as $by => $ord) {
         $by = strtoupper($by);
         $ord = strtoupper($ord) != "ASC" ? "DESC" : "ASC";
         switch ($by) {
             case "ID":
                 $arOrder[$by] = "S.ID " . $ord;
                 break;
             case "DATE_INSERT":
                 $arOrder[$by] = "S.DATE_INSERT " . $ord;
                 break;
             case "DATE_UPDATE":
                 $arOrder[$by] = "S.DATE_UPDATE " . $ord;
                 break;
             case "DATE_CONFIRM":
                 $arOrder[$by] = "S.DATE_CONFIRM " . $ord;
                 break;
             case "ACT":
                 $arOrder[$by] = "S.ACTIVE " . $ord;
                 break;
             case "CONF":
                 $arOrder[$by] = "S.CONFIRMED " . $ord;
                 break;
             case "EMAIL":
                 $arOrder[$by] = "S.EMAIL " . $ord;
                 break;
             case "FMT":
                 $arOrder[$by] = "S.FORMAT " . $ord;
                 break;
             case "USER":
                 $arOrder[$by] = "S.USER_ID " . $ord;
                 break;
             case "CONFIRM_CODE":
                 $arOrder[$by] = "S.CONFIRM_CODE " . $ord;
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:subscription.php

示例11: GetList

	/**
	 * <p>Возвращает список <a href="http://dev.1c-bitrix.ru/api_help/statistic/terms.php#session">сессий</a> <a href="http://dev.1c-bitrix.ru/api_help/statistic/terms.php#guest">посетителей</a>, проявивших активность (совершивших <a href="http://dev.1c-bitrix.ru/api_help/statistic/terms.php#hit">хит</a>) на сайте за определённый интервал времени.</p>
	 *
	 *
	 *
	 *
	 * @param function $GetList  Ссылка на переменную, которая после выполнения функции будет
	 * содержать количество <a
	 * href="http://dev.1c-bitrix.ru/api_help/statistic/terms.php#online">посетителей в online</a>.
	 *
	 *
	 *
	 * @param (&$guest_coun $t  Ссылка на переменную, которая после выполнения функции будет
	 * содержать количество сессий посетителей в online.
	 *
	 *
	 *
	 * @param &$session_coun $t  
	 *
	 *
	 *
	 * @param $arOrde $r = Array() 
	 *
	 *
	 *
	 * @param $arFilte $r = Array()) 
	 *
	 *
	 *
	 * @return CDBResult 
	 *
	 *
	 * <h4>Example</h4> 
	 * <pre>
	 * &lt;?
	 * // получим список записей
	 * $rs = <b>CUserOnline::GetList</b>($guest_counter, $session_counter);
	 * 
	 * echo "Количество посетителей в онлайн: ".$guest_counter;
	 * echo "Количество сессий в онлайн: ".$session_counter;
	 * 
	 * // выведем все записи
	 * while ($ar = $rs-&gt;Fetch())
	 * {
	 *     echo "&lt;pre&gt;"; print_r($ar); echo "&lt;/pre&gt;";    
	 * }
	 * ?&gt;
	 * </pre>
	 *
	 *
	 *
	 * <h4>See Also</h4> 
	 * <ul> <li> <a href="http://www.1c-bitrix.ru/user_help/statistic/users_online.php">Отчет "Кто на сайте"</a>
	 * </li> </ul><a name="examples"></a>
	 *
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/statistic/classes/cuseronline/getlist.php
	 * @author Bitrix
	 */
	public static function GetList(&$guest_count, &$session_count, $arOrder=Array(), $arFilter=Array())
	{
		$DB = CDatabase::GetModuleConnection('statistic');
		$err_mess = "File: ".__FILE__."<br>Line: ";
		$interval = intval(COption::GetOptionString("statistic", "ONLINE_INTERVAL"));

		$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 "INTERVAL":
						$interval = intval($val);
						break;
					case "ID":
					case "GUEST_ID":
					case "ADV_ID":
					case "STOP_LIST_ID":
					case "USER_ID":
						$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
						$arSqlSearch[] = GetFilterQuery("S.".$key,$val,$match);
						break;
					case "COUNTRY_ID":
						$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
						$arSqlSearch[] = GetFilterQuery("S.COUNTRY_ID",$val,$match);
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:useronline.php

示例12: GetList


//.........这里部分代码省略.........
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/statistic/terms.php#hit">Термин "Хит"</a> </li> </ul> <a
  * name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/statistic/classes/chit/getlist.php
  * @author Bitrix
  */
 public static 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 "ID":
                 case "GUEST_ID":
                 case "SESSION_ID":
                 case "STOP_LIST_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("H." . $key, $val, $match);
                     break;
                 case "URL":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H.URL", $val, $match, array("/", "\\", ".", "?", "#", ":"));
                     break;
                 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;
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:67,代码来源:hit.php

示例13: GetGraphArray

 public static function GetGraphArray($arFilter, &$arLegend, $sort = false, $top = 0)
 {
     $err_mess = "File: " . __FILE__ . "<br>Line: ";
     global $arCityColor;
     $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 "COUNTRY_ID":
                     if ($val != "NOT_REF") {
                         $arSqlSearch[] = GetFilterQuery("C.COUNTRY_ID", $val, "N");
                     }
                     break;
                 case "DATE1":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "D.DATE_STAT>=" . $DB->CharToDateFunction($val, "SHORT");
                     }
                     break;
                 case "DATE2":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "D.DATE_STAT<=" . $DB->CharToDateFunction($val . " 23:59:59", "FULL");
                     }
                     break;
             }
         }
     }
     $arrDays = array();
     $arLegend = array();
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\t" . $DB->DateToCharFunction("D.DATE_STAT", "SHORT") . " DATE_STAT,\n\t\t\t\t" . $DB->DateFormatToDB("DD", "D.DATE_STAT") . " DAY,\n\t\t\t\t" . $DB->DateFormatToDB("MM", "D.DATE_STAT") . " MONTH,\n\t\t\t\t" . $DB->DateFormatToDB("YYYY", "D.DATE_STAT") . " YEAR,\n\t\t\t\tD.CITY_ID,\n\t\t\t\tD.SESSIONS,\n\t\t\t\tD.NEW_GUESTS,\n\t\t\t\tD.HITS,\n\t\t\t\tD.C_EVENTS,\n\t\t\t\tC.NAME,\n\t\t\t\tC.SESSIONS TOTAL_SESSIONS,\n\t\t\t\tC.NEW_GUESTS TOTAL_NEW_GUESTS,\n\t\t\t\tC.HITS TOTAL_HITS,\n\t\t\t\tC.C_EVENTS TOTAL_C_EVENTS\n\t\t\tFROM\n\t\t\t\tb_stat_city_day D\n\t\t\t\tINNER JOIN b_stat_city C ON (C.ID = D.CITY_ID)\n\t\t\tWHERE\n\t\t\t\t" . $strSqlSearch . "\n\t\t\tORDER BY\n\t\t\t\tD.DATE_STAT, D.CITY_ID\n\t\t";
     $rsD = $DB->Query($strSql, false, $err_mess . __LINE__);
     while ($arD = $rsD->Fetch()) {
         $arrDays[$arD["DATE_STAT"]]["D"] = $arD["DAY"];
         $arrDays[$arD["DATE_STAT"]]["M"] = $arD["MONTH"];
         $arrDays[$arD["DATE_STAT"]]["Y"] = $arD["YEAR"];
         $arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["SESSIONS"] = $arD["SESSIONS"];
         $arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["NEW_GUESTS"] = $arD["NEW_GUESTS"];
         $arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["HITS"] = $arD["HITS"];
         $arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["C_EVENTS"] = $arD["C_EVENTS"];
         $arLegend[$arD["CITY_ID"]]["CITY_ID"] = intval($arD["CITY_ID"]);
         $arLegend[$arD["CITY_ID"]]["NAME"] = $arD["NAME"];
         $arLegend[$arD["CITY_ID"]]["SESSIONS"] += $arD["SESSIONS"];
         $arLegend[$arD["CITY_ID"]]["NEW_GUESTS"] += $arD["NEW_GUESTS"];
         $arLegend[$arD["CITY_ID"]]["HITS"] += $arD["HITS"];
         $arLegend[$arD["CITY_ID"]]["C_EVENTS"] += $arD["C_EVENTS"];
         $arLegend[$arD["CITY_ID"]]["TOTAL_SESSIONS"] = $arD["TOTAL_SESSIONS"];
         $arLegend[$arD["CITY_ID"]]["TOTAL_NEW_GUESTS"] = $arD["TOTAL_NEW_GUESTS"];
         $arLegend[$arD["CITY_ID"]]["TOTAL_HITS"] = $arD["TOTAL_HITS"];
         $arLegend[$arD["CITY_ID"]]["TOTAL_C_EVENTS"] = $arD["TOTAL_C_EVENTS"];
     }
     if ($sort) {
         CStatisticSort::Sort($arLegend, $sort);
     }
     if ($top) {
         $totals = array("CITY_ID" => 0, "NAME" => GetMessage("STAT_CITY_OTHER"), "SESSIONS" => 0, "NEW_GUESTS" => 0, "HITS" => 0, "C_EVENTS" => 0, "TOTAL_SESSIONS" => 0, "TOTAL_NEW_GUESTS" => 0, "TOTAL_HITS" => 0, "TOTAL_C_EVENTS" => 0);
         $i = 0;
         while (count($arLegend) > $top) {
             $i++;
             $tail = array_pop($arLegend);
             $totals["SESSIONS"] += $tail["SESSIONS"];
             $totals["NEW_GUESTS"] += $tail["NEW_GUESTS"];
             $totals["HITS"] += $tail["HITS"];
             $totals["C_EVENTS"] += $tail["C_EVENTS"];
             $totals["TOTAL_SESSIONS"] += $tail["TOTAL_SESSIONS"];
             $totals["TOTAL_NEW_GUESTS"] += $tail["TOTAL_NEW_GUESTS"];
             $totals["TOTAL_HITS"] += $tail["TOTAL_HITS"];
             $totals["TOTAL_C_EVENTS"] += $tail["TOTAL_C_EVENTS"];
         }
         if ($i) {
             $arLegend[0] = $totals;
         }
         foreach ($arrDays as $DATE_STAT => $arDate) {
             foreach ($arDate as $CITY_ID => $arCity) {
                 if (intval($CITY_ID) > 0) {
                     if (!array_key_exists($CITY_ID, $arLegend)) {
                         $arrDays[$DATE_STAT][0]["CITY_ID"] = 0;
                         $arrDays[$DATE_STAT][0]["NAME"] = GetMessage("STAT_CITY_OTHER");
                         $arrDays[$DATE_STAT][0]["SESSIONS"] += $arCity["SESSIONS"];
                         $arrDays[$DATE_STAT][0]["NEW_GUESTS"] += $arCity["NEW_GUESTS"];
                         $arrDays[$DATE_STAT][0]["HITS"] += $arCity["HITS"];
                         $arrDays[$DATE_STAT][0]["C_EVENTS"] += $arCity["C_EVENTS"];
                         unset($arrDays[$DATE_STAT][$CITY_ID]);
                     }
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:city.php

示例14: GetList

 function GetList($aSort = array(), $arFilter = array())
 {
     global $DB;
     $this->LAST_ERROR = "";
     $arSqlSearch = array();
     $arSqlSearch_h = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (!is_array($val) && (strlen($val) <= 0 || $val == "NOT_REF")) {
                 continue;
             }
             switch (strtoupper($key)) {
                 case "MSG_CHARSET":
                     $arSqlSearch[] = "P.MSG_CHARSET = '" . $DB->ForSql($val) . "'";
                     break;
                 case "ID":
                     $arSqlSearch[] = GetFilterQuery("P.ID", $val, "N");
                     break;
                 case "TIMESTAMP_1":
                     if ($DB->IsDate($val)) {
                         $arSqlSearch[] = "P.TIMESTAMP_X>=" . $DB->CharToDateFunction($val, "SHORT");
                     } else {
                         $this->LAST_ERROR .= GetMessage("POST_WRONG_TIMESTAMP_FROM") . "<br>";
                     }
                     break;
                 case "TIMESTAMP_2":
                     if ($DB->IsDate($val)) {
                         $arSqlSearch[] = "P.TIMESTAMP_X<DATE_ADD(" . $DB->CharToDateFunction($val, "SHORT") . ",INTERVAL 1 DAY)";
                     } else {
                         $this->LAST_ERROR .= GetMessage("POST_WRONG_TIMESTAMP_TILL") . "<br>";
                     }
                     break;
                 case "DATE_SENT_1":
                     if ($DB->IsDate($val)) {
                         $arSqlSearch[] = "P.DATE_SENT>=" . $DB->CharToDateFunction($val, "SHORT");
                     } else {
                         $this->LAST_ERROR .= GetMessage("POST_WRONG_DATE_SENT_FROM") . "<br>";
                     }
                     break;
                 case "DATE_SENT_2":
                     if ($DB->IsDate($val)) {
                         $arSqlSearch[] = "P.DATE_SENT<DATE_ADD(" . $DB->CharToDateFunction($val, "SHORT") . ",INTERVAL 1 DAY)";
                     } else {
                         $this->LAST_ERROR .= GetMessage("POST_WRONG_DATE_SENT_TILL") . "<br>";
                     }
                     break;
                 case "STATUS":
                     $arSqlSearch_h[] = GetFilterQuery("STATUS_TITLE, P.STATUS", $val);
                     break;
                 case "STATUS_ID":
                     $arSqlSearch[] = GetFilterQuery("P.STATUS", $val, "N");
                     break;
                 case "SUBJECT":
                     $arSqlSearch[] = GetFilterQuery("P.SUBJECT", $val);
                     break;
                 case "FROM":
                     $arSqlSearch[] = GetFilterQuery("P.FROM_FIELD", $val, "Y", array("@", "_", "."));
                     break;
                 case "TO":
                     $r = GetFilterQuery("PE.EMAIL", $val, "Y", array("@", "_", "."));
                     if (strlen($r) > 0) {
                         $arSqlSearch[] = "EXISTS (SELECT * FROM b_posting_email PE WHERE PE.POSTING_ID=P.ID AND PE.STATUS='N' AND " . $r . ")";
                     }
                     break;
                 case "BODY_TYPE":
                     $arSqlSearch[] = $val == "html" ? "P.BODY_TYPE='html'" : "P.BODY_TYPE='text'";
                     break;
                 case "RUB_ID":
                     if (is_array($val) && count($val) > 0) {
                         $rub_id = array();
                         foreach ($val as $i => $v) {
                             $v = intval($v);
                             if ($v > 0) {
                                 $rub_id[$v] = $v;
                             }
                         }
                         if (count($rub_id)) {
                             $arSqlSearch[] = "EXISTS (SELECT * from b_posting_rubric PR WHERE PR.POSTING_ID = P.ID AND PR.LIST_RUBRIC_ID in (" . implode(", ", $rub_id) . "))";
                         }
                     }
                     break;
                 case "BODY":
                     $arSqlSearch[] = GetFilterQuery("P.BODY", $val);
                     break;
                 case "AUTO_SEND_TIME_1":
                     if ($DB->IsDate($val, false, false, "FULL")) {
                         $arSqlSearch[] = "(P.AUTO_SEND_TIME is not null and P.AUTO_SEND_TIME>=" . $DB->CharToDateFunction($val, "FULL") . " )";
                     } elseif ($DB->IsDate($val, false, false, "SHORT")) {
                         $arSqlSearch[] = "(P.AUTO_SEND_TIME is not null and P.AUTO_SEND_TIME>=" . $DB->CharToDateFunction($val, "SHORT") . " )";
                     } else {
                         $this->LAST_ERROR .= GetMessage("POST_WRONG_AUTO_FROM") . "<br>";
                     }
                     break;
                 case "AUTO_SEND_TIME_2":
                     if ($DB->IsDate($val, false, false, "FULL")) {
                         $arSqlSearch[] = "(P.AUTO_SEND_TIME is not null and P.AUTO_SEND_TIME<=" . $DB->CharToDateFunction($val, "FULL") . " )";
                     } elseif ($DB->IsDate($val, false, false, "SHORT")) {
                         $arSqlSearch[] = "(P.AUTO_SEND_TIME is not null and P.AUTO_SEND_TIME<=" . $DB->CharToDateFunction($val, "SHORT") . " )";
                     } else {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:posting.php

示例15: GetFileList

 function GetFileList(&$by, &$order, $arFilter = array(), $checkRights = 'N')
 {
     $err_mess = CAllTicket::err_mess() . "<br>Function: GetFileList<br>Line: ";
     global $DB, $USER;
     $arSqlSearch = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         $filter_keys = array_keys($arFilter);
         $filterKeysCount = count($filter_keys);
         for ($i = 0; $i < $filterKeysCount; $i++) {
             $key = $filter_keys[$i];
             $val = $arFilter[$filter_keys[$i]];
             if (is_array($val) && count($val) <= 0 || !is_array($val) && (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 "LINK_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("MF.ID", $val, $match);
                     break;
                 case "MESSAGE":
                 case "TICKET_ID":
                 case "FILE_ID":
                 case "HASH":
                 case "MESSAGE_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("MF." . $key, $val, $match);
                     break;
             }
         }
     }
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY MF.ID";
     } elseif ($by == "s_file_id") {
         $strSqlOrder = "ORDER BY F.ID";
     } elseif ($by == "s_message_id") {
         $strSqlOrder = "ORDER BY MF.MESSAGE_ID";
     } else {
         $by = "s_id";
         $strSqlOrder = "ORDER BY MF.ID";
     }
     if ($order == "desc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     } else {
         $strSqlOrder .= " asc ";
         $order = "asc";
     }
     $messageJoin = '';
     $ticketJoin = '';
     if ($checkRights == 'Y') {
         $bAdmin = CTicket::IsAdmin() ? 'Y' : 'N';
         $bSupportTeam = CTicket::IsSupportTeam() ? 'Y' : 'N';
         $bSupportClient = CTicket::IsSupportClient() ? 'Y' : 'N';
         $bDemo = CTicket::IsDemo() ? 'Y' : 'N';
         $uid = intval($USER->GetID());
         if ($bAdmin != 'Y' && $bSupportTeam != 'Y' && $bSupportClient != 'Y' && $bDemo != 'Y') {
             return false;
         }
         if (!($bAdmin == 'Y' || $bDemo == 'Y')) {
             // a list of users who own or are responsible for tickets, which we can show to our current user
             $ticketUsers = array($uid);
             // check if user has groups
             $result = $DB->Query('SELECT GROUP_ID FROM b_ticket_user_ugroup WHERE USER_ID = ' . $uid . ' AND CAN_VIEW_GROUP_MESSAGES = \'Y\'');
             if ($result) {
                 // collect members of these groups
                 $uGroups = array();
                 while ($row = $result->Fetch()) {
                     $uGroups[] = $row['GROUP_ID'];
                 }
                 if (!empty($uGroups)) {
                     $result = $DB->Query('SELECT USER_ID FROM b_ticket_user_ugroup WHERE GROUP_ID IN (' . join(',', $uGroups) . ')');
                     if ($result) {
                         while ($row = $result->Fetch()) {
                             $ticketUsers[] = $row['USER_ID'];
                         }
                     }
                 }
             }
             // build sql
             $strSqlSearchUser = "";
             if ($bSupportTeam == 'Y') {
                 $strSqlSearchUser = 'T.RESPONSIBLE_USER_ID IN (' . join(',', $ticketUsers) . ')';
             } elseif ($bSupportClient == 'Y') {
                 $strSqlSearchUser = 'T.OWNER_USER_ID IN (' . join(',', $ticketUsers) . ')';
             }
             if ($strSqlSearchUser) {
                 $ticketJoin = 'INNER JOIN b_ticket T ON (T.ID = MF.TICKET_ID)';
                 $arSqlSearch[] = $strSqlSearchUser;
             }
         }
         if ($bSupportTeam != "Y" && $bAdmin != "Y") {
             $messageJoin = 'INNER JOIN b_ticket_message M ON (M.ID = MF.MESSAGE_ID)';
             $arSqlSearch[] = "M.IS_HIDDEN='N'";
             $arSqlSearch[] = "M.IS_LOG='N'";
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:support.php


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