本文整理汇总了PHP中CTicket::CheckFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP CTicket::CheckFilter方法的具体用法?PHP CTicket::CheckFilter怎么用?PHP CTicket::CheckFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTicket
的用法示例。
在下文中一共展示了CTicket::CheckFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetList
function GetList(&$arSort, $arFilter = array(), &$isFiltered)
{
$err_mess = CTicketSLA::err_mess() . "<br>Function: GetList<br>Line: ";
global $DB, $USER, $APPLICATION;
$isFiltered = false;
// filter params correct
if (CTicket::CheckFilter($arFilter)) {
$arSqlSearch = array();
if (is_array($arFilter) && count($arFilter) > 0) {
$filterKeys = array_keys($arFilter);
$filterKeysCount = count($filterKeys);
for ($i = 0; $i < $filterKeysCount; $i++) {
$key = $filterKeys[$i];
$val = $arFilter[$filterKeys[$i]];
if (is_array($val) && count($val) <= 0 || !is_array($val) && (strlen($val) <= 0 || $val === 'NOT_REF')) {
continue;
}
$matchValueSet = in_array($key . "_EXACT_MATCH", $filterKeys) ? true : false;
$key = strtoupper($key);
if (is_array($val)) {
$val = implode(" | ", $val);
}
switch ($key) {
case "ID":
case "SLA_ID":
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $matchValueSet ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("S." . $key, $val, $match);
break;
case "NAME":
case "DESCRIPTION":
case "DEADLINE_SOURCE":
$match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $matchValueSet ? "N" : "Y";
$arSqlSearch[] = GetFilterQuery("S." . $key, $val, $match);
break;
case "SITE":
$val .= " | ALL";
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $matchValueSet ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("SS.SITE_ID", $val, $match);
$left_join_site = "LEFT JOIN b_ticket_sla_2_site SS ON (S.ID = SS.SLA_ID)";
break;
}
}
}
}
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
$arSort = is_array($arSort) ? $arSort : array();
if (count($arSort) > 0) {
$ar1 = array_merge($DB->GetTableFieldsList("b_ticket_sla"), array());
$ar2 = array_keys($arSort);
$arDiff = array_diff($ar2, $ar1);
if (is_array($arDiff) && count($arDiff) > 0) {
foreach ($arDiff as $value) {
unset($arSort[$value]);
}
}
}
if (count($arSort) <= 0) {
$arSort = array("PRIORITY" => "DESC");
}
while (list($by, $order) = each($arSort)) {
if (strtoupper($order) != "DESC") {
$order = "ASC";
}
if ($by == "RESPONSE_TIME") {
$arSqlOrder[] = "case RESPONSE_TIME_UNIT when 'day' then 3 when 'hour' then 2 when 'minute' then 1 end {$order}";
$arSqlOrder[] = $by . " " . $order;
} else {
$arSqlOrder[] = $by . " " . $order;
}
}
if (is_array($arSqlOrder) && count($arSqlOrder) > 0) {
$strSqlOrder = " ORDER BY " . implode(",", $arSqlOrder);
}
$strSql = "\n\t\t\tSELECT DISTINCT\n\t\t\t\tS.*,\n\t\t\t\tcase S.RESPONSE_TIME_UNIT\n\t\t\t\t\twhen 'day' then S.RESPONSE_TIME*1440\n\t\t\t\t\twhen 'hour' then S.RESPONSE_TIME*60\n\t\t\t\t\twhen 'minute' then S.RESPONSE_TIME\n\t\t\t\t\tend\t\t\t\t\t\t\t\t\t\t\tM_RESPONSE_TIME,\n\t\t\t\tcase S.NOTICE_TIME_UNIT\n\t\t\t\t\twhen 'day' then S.NOTICE_TIME*1440\n\t\t\t\t\twhen 'hour' then S.NOTICE_TIME*60\n\t\t\t\t\twhen 'minute' then S.NOTICE_TIME\n\t\t\t\t\tend\t\t\t\t\t\t\t\t\t\t\tM_NOTICE_TIME,\n\t\t\t\tS.ID\t\t\t\t\t\t\t\t\t\t\tREFERENCE_ID,\n\t\t\t\tS.NAME\t\t\t\t\t\t\t\t\t\t\tREFERENCE,\n\t\t\t\t" . $DB->DateToCharFunction("S.DATE_MODIFY") . "\tDATE_MODIFY_F,\n\t\t\t\t" . $DB->DateToCharFunction("S.DATE_CREATE") . "\tDATE_CREATE_F\n\t\t\tFROM\n\t\t\t\tb_ticket_sla S\n\t\t\t{$left_join_site}\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__);
$isFiltered = IsFiltered($strSqlSearch);
return $rs;
}