本文整理汇总了PHP中CBlog::GetFilterOperation方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlog::GetFilterOperation方法的具体用法?PHP CBlog::GetFilterOperation怎么用?PHP CBlog::GetFilterOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlog
的用法示例。
在下文中一共展示了CBlog::GetFilterOperation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetList
//.........这里部分代码省略.........
"AUTHOR_LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (P.AUTHOR_ID = U.ID)"),
"AUTHOR_NAME" => array("FIELD" => "U.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (P.AUTHOR_ID = U.ID)"),
"AUTHOR_LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (P.AUTHOR_ID = U.ID)"),
"AUTHOR_SECOND_NAME" => array("FIELD" => "U.SECOND_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (P.AUTHOR_ID = U.ID)"),
"AUTHOR_EMAIL" => array("FIELD" => "U.EMAIL", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (P.AUTHOR_ID = U.ID)"),
"AUTHOR" => array("FIELD" => "U.LOGIN, U.NAME, U.LAST_NAME, U.EMAIL, U.ID", "WHERE_ONLY" => "Y", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (P.AUTHOR_ID = U.ID)"),
"CATEGORY_NAME" => array("FIELD" => "PCN.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_blog_category PCN ON (P.CATEGORY_ID = PCN.ID)"),
"CATEGORY_ID_F" => array("FIELD" => "PC.CATEGORY_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_blog_post_category PC ON (PC.POST_ID = P.ID)"),
"BLOG_USER_ALIAS" => array("FIELD" => "BU.ALIAS", "TYPE" => "string", "FROM" => "LEFT JOIN b_blog_user BU ON (P.AUTHOR_ID = BU.USER_ID)"),
"BLOG_USER_AVATAR" => array("FIELD" => "BU.AVATAR", "TYPE" => "int", "FROM" => "LEFT JOIN b_blog_user BU ON (P.AUTHOR_ID = BU.USER_ID)"),
"BLOG_URL" => array("FIELD" => "B.URL", "TYPE" => "string", "FROM" => "INNER JOIN b_blog B ON (P.BLOG_ID = B.ID)"),
"BLOG_OWNER_ID" => array("FIELD" => "B.OWNER_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_blog B ON (P.BLOG_ID = B.ID)"),
"BLOG_ACTIVE" => array("FIELD" => "B.ACTIVE", "TYPE" => "string", "FROM" => "INNER JOIN b_blog B ON (P.BLOG_ID = B.ID)"),
"BLOG_GROUP_ID" => array("FIELD" => "B.GROUP_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_blog B ON (P.BLOG_ID = B.ID)"),
"BLOG_ENABLE_RSS" => array("FIELD" => "B.ENABLE_RSS", "TYPE" => "string", "FROM" => "INNER JOIN b_blog B ON (P.BLOG_ID = B.ID)"),
"BLOG_USE_SOCNET" => array("FIELD" => "B.USE_SOCNET", "TYPE" => "string", "FROM" => "INNER JOIN b_blog B ON (P.BLOG_ID = B.ID)"),
"BLOG_NAME" => array("FIELD" => "B.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_blog B ON (P.BLOG_ID = B.ID)"),
"BLOG_GROUP_SITE_ID" => array("FIELD" => "BG.SITE_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_blog_group BG ON (B.GROUP_ID = BG.ID)"),
"SOCNET_BLOG_READ" => array("FIELD" => "BSR.BLOG_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_blog_socnet BSR ON (P.BLOG_ID = BSR.BLOG_ID)"),
"BLOG_SOCNET_GROUP_ID" => array("FIELD" => "B.SOCNET_GROUP_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_blog B ON (P.BLOG_ID = B.ID)"),
"SOCNET_GROUP_ID" => array("FIELD" => "SR1.ENTITY_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_blog_socnet_rights SR1 ON (P.ID = SR1.POST_ID AND SR1.ENTITY_TYPE = 'SG')"),
"SOCNET_SITE_ID" => array("FIELD" => "SLS.SITE_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_log BSL ON (BSL.EVENT_ID in ('blog_post', 'blog_post_micro', 'blog_post_important') AND BSL.SOURCE_ID = P.ID) ".
"LEFT JOIN b_sonet_log_site SLS ON BSL.ID = SLS.LOG_ID"),
"COMMENT_ID" => array("FIELD" => "PC.ID", "TYPE" => "string", "FROM" => "INNER JOIN b_blog_comment PC ON (P.ID = PC.POST_ID)"),
);
foreach ($arFilter as $key => $val)
{
$key_res = CBlog::GetFilterOperation($key);
$k = $key_res["FIELD"];
if (strpos($k, "POST_PARAM_") === 0)
{
$user_id = 0; $ii++; $pref = "BPP".$ii;
if (is_array($val))
{
$user_id = (isset($val["USER_ID"]) ? intval($val["USER_ID"]) : 0);
$arFilter[$key] = $val["VALUE"];
}
$arSelectFields[] = $k;
$arFields[$k] = array("FIELD" => $pref.".VALUE", "TYPE" => "string",
"FROM" => "LEFT JOIN b_blog_post_param ".$pref." ON (P.ID = ".$pref.".POST_ID AND ".$pref.".USER_ID".
($user_id <= 0 ? " IS NULL" : "=".$user_id)." AND ".$pref.".NAME='".$GLOBALS["DB"]->ForSql(substr($k, 11), 50)."')");
}
}
if(isset($arFilter["GROUP_CHECK_PERMS"]))
{
if(is_array($arFilter["GROUP_CHECK_PERMS"]))
{
foreach($arFilter["GROUP_CHECK_PERMS"] as $val)
{
if(IntVal($val)>0)
{
$arFields["POST_PERM_".$val] = Array(
"FIELD" => "BUGP".$val.".PERMS",
"TYPE" => "string",
"FROM" => "LEFT JOIN b_blog_user_group_perms BUGP".$val."
ON (P.BLOG_ID = BUGP".$val.".BLOG_ID
AND P.ID = BUGP".$val.".POST_ID
AND BUGP".$val.".USER_GROUP_ID = ".$val."
AND BUGP".$val.".PERMS_TYPE = '".BLOG_PERMS_POST."')"
);
示例2: PrepareSql
//.........这里部分代码省略.........
if (isset($arFields[$val]["FROM"]) && strlen($arFields[$val]["FROM"]) > 0 && !in_array($arFields[$val]["FROM"], $arAlreadyJoined)) {
if (strlen($strSqlFrom) > 0) {
$strSqlFrom .= " ";
}
$strSqlFrom .= $arFields[$val]["FROM"];
$arAlreadyJoined[] = $arFields[$val]["FROM"];
}
}
}
}
if (strlen($strSqlGroupBy) > 0) {
if (strlen($strSqlSelect) > 0) {
$strSqlSelect .= ", ";
}
$strSqlSelect .= "COUNT(%%_DISTINCT_%% " . $arFields[$arFieldsKeys[0]]["FIELD"] . ") as CNT";
} else {
$strSqlSelect = "%%_DISTINCT_%% " . $strSqlSelect;
}
}
// <-- SELECT
// WHERE -->
$arSqlSearch = array();
if (!is_array($arFilter)) {
$filter_keys = array();
} else {
$filter_keys = array_keys($arFilter);
}
for ($i = 0; $i < count($filter_keys); $i++) {
$vals = $arFilter[$filter_keys[$i]];
if (!is_array($vals)) {
$vals = array($vals);
}
$key = $filter_keys[$i];
$key_res = CBlog::GetFilterOperation($key);
$key = $key_res["FIELD"];
$strNegative = $key_res["NEGATIVE"];
$strOperation = $key_res["OPERATION"];
$strOrNull = $key_res["OR_NULL"];
$arSqlSearch_tmp = array();
if (array_key_exists($key, $arFields)) {
if (count($vals) > 0) {
if ($strOperation == "IN") {
if (isset($arFields[$key]["WHERE"])) {
$arSqlSearch_tmp1 = call_user_func_array($arFields[$key]["WHERE"], array($vals, $key, $strOperation, $strNegative, $arFields[$key]["FIELD"], $arFields, $arFilter));
if ($arSqlSearch_tmp1 !== false) {
$arSqlSearch_tmp[] = $arSqlSearch_tmp1;
}
} else {
if ($arFields[$key]["TYPE"] == "int") {
array_walk($vals, create_function("&\$item", "\$item=IntVal(\$item);"));
$vals = array_unique($vals);
$val = implode(",", $vals);
if (count($vals) <= 0) {
$arSqlSearch_tmp[] = "(1 = 2)";
} else {
$arSqlSearch_tmp[] = ($strNegative == "Y" ? " NOT " : "") . "(" . $arFields[$key]["FIELD"] . " IN (" . $val . "))";
}
} elseif ($arFields[$key]["TYPE"] == "double") {
array_walk($vals, create_function("&\$item", "\$item=DoubleVal(\$item);"));
$vals = array_unique($vals);
$val = implode(",", $vals);
if (count($vals) <= 0) {
$arSqlSearch_tmp[] = "(1 = 2)";
} else {
$arSqlSearch_tmp[] = ($strNegative == "Y" ? " NOT " : "") . "(" . $arFields[$key]["FIELD"] . " " . $strOperation . " (" . $val . "))";
}