本文整理汇总了PHP中CIBlock::_MergeIBArrays方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::_MergeIBArrays方法的具体用法?PHP CIBlock::_MergeIBArrays怎么用?PHP CIBlock::_MergeIBArrays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::_MergeIBArrays方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PrepareGetList
//.........这里部分代码省略.........
$arSqlOrder[$by] = CIBlock::_Order("BE.CREATED_BY", $order, "desc");
} elseif ($by == "ACTIVE") {
$arSqlOrder[$by] = CIBlock::_Order("BE.ACTIVE", $order, "desc");
} elseif ($by == "ACTIVE_FROM") {
$arSqlOrder[$by] = CIBlock::_Order("BE.ACTIVE_FROM", $order, "desc");
} elseif ($by == "ACTIVE_TO") {
$arSqlOrder[$by] = CIBlock::_Order("BE.ACTIVE_TO", $order, "desc");
} elseif ($by == "SORT") {
$arSqlOrder[$by] = CIBlock::_Order("BE.SORT", $order, "desc");
} elseif ($by == "IBLOCK_SECTION_ID") {
$arSqlOrder[$by] = CIBlock::_Order("BE.IBLOCK_SECTION_ID", $order, "desc");
} elseif ($by == "SHOW_COUNTER") {
$arSqlOrder[$by] = CIBlock::_Order("BE.SHOW_COUNTER", $order, "desc");
} elseif ($by == "SHOW_COUNTER_START") {
$arSqlOrder[$by] = CIBlock::_Order("BE.SHOW_COUNTER_START", $order, "desc");
} elseif ($by == "RAND") {
$arSqlOrder[$by] = CIBlockElement::GetRandFunction(true);
} elseif ($by == "SHOWS") {
$arSqlOrder[$by] = CIBlock::_Order(CIBlockElement::GetShowedFunction(), $order, "desc", false);
} elseif ($by == "HAS_PREVIEW_PICTURE") {
$arSqlOrder[$by] = CIBlock::_Order(CIBlock::_NotEmpty("BE.PREVIEW_PICTURE"), $order, "desc", false);
} elseif ($by == "HAS_DETAIL_PICTURE") {
$arSqlOrder[$by] = CIBlock::_Order(CIBlock::_NotEmpty("BE.DETAIL_PICTURE"), $order, "desc", false);
} elseif ($by == "RATING_TOTAL_VALUE") {
$arSqlOrder[$by] = CIBlock::_Order("RV.TOTAL_VALUE", $order, "desc");
$arJoinProps["RV"] = true;
} elseif ($by == "CNT") {
if (is_array($arGroupBy) && count($arGroupBy) > 0) {
$arSqlOrder[$by] = " CNT " . $order . " ";
}
} elseif (substr($by, 0, 9) == "PROPERTY_") {
$propID = strtoupper(substr($by_orig, 9));
if (preg_match("/^([^.]+)\\.([^.]+)\$/", $propID, $arMatch)) {
$db_prop = CIBlockProperty::GetPropertyArray($arMatch[1], CIBlock::_MergeIBArrays($arFilter["IBLOCK_ID"], $arFilter["IBLOCK_CODE"]));
if (is_array($db_prop) && $db_prop["PROPERTY_TYPE"] == "E") {
CIBlockElement::MkPropertyOrder($arMatch, $order, false, $db_prop, $arJoinProps, $arSqlOrder);
}
} else {
if ($db_prop = CIBlockProperty::GetPropertyArray($propID, CIBlock::_MergeIBArrays($arFilter["IBLOCK_ID"], $arFilter["IBLOCK_CODE"]))) {
CIBlockElement::MkPropertyOrder($by, $order, false, $db_prop, $arJoinProps, $arSqlOrder);
}
}
} elseif (substr($by, 0, 13) == "PROPERTYSORT_") {
$propID = strtoupper(substr($by_orig, 13));
if (preg_match("/^([^.]+)\\.([^.]+)\$/", $propID, $arMatch)) {
$db_prop = CIBlockProperty::GetPropertyArray($arMatch[1], CIBlock::_MergeIBArrays($arFilter["IBLOCK_ID"], $arFilter["IBLOCK_CODE"]));
if (is_array($db_prop) && $db_prop["PROPERTY_TYPE"] == "E") {
CIBlockElement::MkPropertyOrder($arMatch, $order, true, $db_prop, $arJoinProps, $arSqlOrder);
}
} else {
if ($db_prop = CIBlockProperty::GetPropertyArray($propID, CIBlock::_MergeIBArrays($arFilter["IBLOCK_ID"], $arFilter["IBLOCK_CODE"]))) {
CIBlockElement::MkPropertyOrder($by, $order, true, $db_prop, $arJoinProps, $arSqlOrder);
}
}
} else {
$by = "ID";
if (!array_key_exists($by, $arSqlOrder)) {
$arSqlOrder[$by] = CIBLock::_Order("BE.ID", $order, "desc");
}
}
//Check if have to add select field in order to correctly sort
if (is_array($arSqlOrder[$by])) {
if (is_array($arGroupBy) && count($arGroupBy) > 0) {
$arGroupBy[] = $arSqlOrder[$by][1];
} else {
$arSelectFields[] = $arSqlOrder[$by][1];
示例2: UpdateList
protected function UpdateList($arFields, $arFilter = array())
{
global $DB, $USER, $USER_FIELD_MANAGER;
$strUpdate = $DB->PrepareUpdate("b_iblock_section", $arFields, "iblock", false, "BS");
if ($strUpdate == "") {
return false;
}
if (isset($arFilter["IBLOCK_ID"]) && $arFilter["IBLOCK_ID"] > 0) {
$obUserFieldsSql = new CUserTypeSQL();
$obUserFieldsSql->SetEntity("IBLOCK_" . $arFilter["IBLOCK_ID"] . "_SECTION", "BS.ID");
$obUserFieldsSql->SetFilter($arFilter);
} else {
foreach ($arFilter as $key => $val) {
$res = CIBlock::MkOperationFilter($key);
if (preg_match("/^UF_/", $res["FIELD"])) {
trigger_error("arFilter parameter of the CIBlockSection::GetList contains user fields, but has no IBLOCK_ID field.", E_USER_WARNING);
break;
}
}
}
$arJoinProps = array();
$bJoinFlatProp = false;
$arSqlSearch = CIBlockSection::GetFilter($arFilter);
$bCheckPermissions = !array_key_exists("CHECK_PERMISSIONS", $arFilter) || $arFilter["CHECK_PERMISSIONS"] !== "N";
$bIsAdmin = is_object($USER) && $USER->IsAdmin();
if ($bCheckPermissions && !$bIsAdmin) {
$arSqlSearch[] = CIBlockSection::_check_rights_sql($arFilter["MIN_PERMISSION"]);
}
if (array_key_exists("PROPERTY", $arFilter)) {
$val = $arFilter["PROPERTY"];
foreach ($val as $propID => $propVAL) {
$res = CIBlock::MkOperationFilter($propID);
$propID = $res["FIELD"];
$cOperationType = $res["OPERATION"];
if ($db_prop = CIBlockProperty::GetPropertyArray($propID, CIBlock::_MergeIBArrays($arFilter["IBLOCK_ID"], $arFilter["IBLOCK_CODE"]))) {
$bSave = false;
if (array_key_exists($db_prop["ID"], $arJoinProps)) {
$iPropCnt = $arJoinProps[$db_prop["ID"]];
} elseif ($db_prop["VERSION"] != 2 || $db_prop["MULTIPLE"] == "Y") {
$bSave = true;
$iPropCnt = count($arJoinProps);
}
if (!is_array($propVAL)) {
$propVAL = array($propVAL);
}
if ($db_prop["PROPERTY_TYPE"] == "N" || $db_prop["PROPERTY_TYPE"] == "G" || $db_prop["PROPERTY_TYPE"] == "E") {
if ($db_prop["VERSION"] == 2 && $db_prop["MULTIPLE"] == "N") {
$r = CIBlock::FilterCreate("FPS.PROPERTY_" . $db_prop["ORIG_ID"], $propVAL, "number", $cOperationType);
$bJoinFlatProp = $db_prop["IBLOCK_ID"];
} else {
$r = CIBlock::FilterCreate("FPV" . $iPropCnt . ".VALUE_NUM", $propVAL, "number", $cOperationType);
}
} else {
if ($db_prop["VERSION"] == 2 && $db_prop["MULTIPLE"] == "N") {
$r = CIBlock::FilterCreate("FPS.PROPERTY_" . $db_prop["ORIG_ID"], $propVAL, "string", $cOperationType);
$bJoinFlatProp = $db_prop["IBLOCK_ID"];
} else {
$r = CIBlock::FilterCreate("FPV" . $iPropCnt . ".VALUE", $propVAL, "string", $cOperationType);
}
}
if (strlen($r) > 0) {
if ($bSave) {
$db_prop["iPropCnt"] = $iPropCnt;
$arJoinProps[$db_prop["ID"]] = $db_prop;
}
$arSqlSearch[] = $r;
}
}
}
}
$strSqlSearch = "";
foreach ($arSqlSearch as $r) {
if (strlen($r) > 0) {
$strSqlSearch .= "\n\t\t\t\tAND (" . $r . ") ";
}
}
if (isset($obUserFieldsSql)) {
$r = $obUserFieldsSql->GetFilter();
if (strlen($r) > 0) {
$strSqlSearch .= "\n\t\t\t\tAND (" . $r . ") ";
}
}
$strProp1 = "";
foreach ($arJoinProps as $propID => $db_prop) {
if ($db_prop["VERSION"] == 2) {
$strTable = "b_iblock_element_prop_m" . $db_prop["IBLOCK_ID"];
} else {
$strTable = "b_iblock_element_property";
}
$i = $db_prop["iPropCnt"];
$strProp1 .= "\n\t\t\t\tLEFT JOIN b_iblock_property FP" . $i . " ON FP" . $i . ".IBLOCK_ID=B.ID AND\n\t\t\t\t" . (IntVal($propID) > 0 ? " FP" . $i . ".ID=" . IntVal($propID) . " " : " FP" . $i . ".CODE='" . $DB->ForSQL($propID, 200) . "' ") . "\n\t\t\t\tLEFT JOIN " . $strTable . " FPV" . $i . " ON FP" . $i . ".ID=FPV" . $i . ".IBLOCK_PROPERTY_ID AND FPV" . $i . ".IBLOCK_ELEMENT_ID=BE.ID ";
}
if ($bJoinFlatProp) {
$strProp1 .= "\n\t\t\t\tLEFT JOIN b_iblock_element_prop_s" . $bJoinFlatProp . " FPS ON FPS.IBLOCK_ELEMENT_ID = BE.ID\n\t\t\t";
}
$strSql = "\n\t\t\tUPDATE\n\t\t\tb_iblock_section BS\n\t\t\t\tINNER JOIN b_iblock B ON BS.IBLOCK_ID = B.ID\n\t\t\t\t" . (isset($obUserFieldsSql) ? $obUserFieldsSql->GetJoin("BS.ID") : "") . "\n\t\t\t" . (strlen($strProp1) > 0 ? "\tINNER JOIN b_iblock_section BSTEMP ON BSTEMP.IBLOCK_ID = BS.IBLOCK_ID\n\t\t\t\t\tLEFT JOIN b_iblock_section_element BSE ON BSE.IBLOCK_SECTION_ID=BSTEMP.ID\n\t\t\t\t\tLEFT JOIN b_iblock_element BE ON (BSE.IBLOCK_ELEMENT_ID=BE.ID\n\t\t\t\t\t\tAND ((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL )\n\t\t\t\t\t\tAND BE.IBLOCK_ID = BS.IBLOCK_ID\n\t\t\t\t" . ($arFilter["CNT_ALL"] == "Y" ? " OR BE.WF_NEW='Y' " : "") . ")\n\t\t\t\t" . ($arFilter["CNT_ACTIVE"] == "Y" ? " AND BE.ACTIVE='Y'\n\t\t\t\t\tAND (BE.ACTIVE_TO >= " . $DB->CurrentTimeFunction() . " OR BE.ACTIVE_TO IS NULL)\n\t\t\t\t\tAND (BE.ACTIVE_FROM <= " . $DB->CurrentTimeFunction() . " OR BE.ACTIVE_FROM IS NULL)" : "") . ")\n\t\t\t\t\t" . $strProp1 . " " : "") . "\n\t\t\tSET " . $strUpdate . "\n\t\t\tWHERE 1=1\n\t\t\t" . (strlen($strProp1) > 0 ? "\tAND BSTEMP.LEFT_MARGIN >= BS.LEFT_MARGIN\n\t\t\t\t\tAND BSTEMP.RIGHT_MARGIN <= BS.RIGHT_MARGIN " : "") . "\n\t\t\t" . $strSqlSearch . "\n\t\t";
return $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
}