當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CIBlockProperty::_Add方法代碼示例

本文整理匯總了PHP中CIBlockProperty::_Add方法的典型用法代碼示例。如果您正苦於以下問題:PHP CIBlockProperty::_Add方法的具體用法?PHP CIBlockProperty::_Add怎麽用?PHP CIBlockProperty::_Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CIBlockProperty的用法示例。


在下文中一共展示了CIBlockProperty::_Add方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: FirstStep12

function FirstStep12($arIBlock)
{
    global $DB, $_SESSION, $arErrors, $arMessages, $INTERVAL;
    $obIBlock = new CIBlock();
    $LAST_CONV_ELEMENT = intval($arIBlock["LAST_CONV_ELEMENT"]);
    if ($LAST_CONV_ELEMENT == 0) {
        $strSql = "\n\t\t\tSELECT\n\t\t\t\tCOUNT(*) CNT\n\t\t\tFROM\n\t\t\t\tb_iblock_property\n\t\t\tWHERE\n\t\t\t\tIBLOCK_ID = " . $arIBlock["ID"] . "\n\t\t";
        $rs = $DB->Query($strSql);
        if ($ar = $rs->Fetch()) {
            if ($ar["CNT"] > 50) {
                $arErrors[] = GetMessage("IBCONV_TOO_MANY_PROPERTIES", array("#NUM#" => 50));
                return 3;
            }
        }
        $bOK = $obIBlock->_Add($arIBlock["ID"]);
        $DB->Query("UPDATE b_iblock SET LAST_CONV_ELEMENT = -1 WHERE ID = " . $arIBlock["ID"]);
    } else {
        $bOK = true;
    }
    if ($bOK) {
        $obIBlockProperty = new CIBlockProperty();
        $arMultiple = array();
        $arSingle = array();
        $arNumber = array();
        $strSql = "\n\t\t\tSELECT\n\t\t\t\tID\n\t\t\t\t,MULTIPLE\n\t\t\t\t,PROPERTY_TYPE\n\t\t\t\t,IBLOCK_ID\n\t\t\t\t,WITH_DESCRIPTION\n\t\t\tFROM\n\t\t\t\tb_iblock_property\n\t\t\tWHERE\n\t\t\t\tIBLOCK_ID=" . $arIBlock["ID"] . "\n\t\t";
        $rs = $DB->Query($strSql);
        while ($ar = $rs->Fetch()) {
            $id = intval($ar["ID"]);
            if ($ar["MULTIPLE"] == "Y") {
                $arMultiple[$id] = $id;
            } else {
                $arSingle[$id] = $id;
            }
            if ($ar["PROPERTY_TYPE"] == "N") {
                $arNumber[$id] = $id;
            }
            if ($LAST_CONV_ELEMENT == 0) {
                $obIBlockProperty->_Add($id, $ar);
            }
        }
        $strSql = "\n\t\t\tSELECT\n\t\t\t\tCOUNT('x') AS CNT\n\t\t\tFROM\n\t\t\t\tb_iblock_element\n\t\t\tWHERE\n\t\t\t\tIBLOCK_ID=" . $arIBlock["ID"] . "\n\t\t\t\tAND ID > " . $LAST_CONV_ELEMENT . "\n\t\t";
        $rs = $DB->Query($strSql);
        $ar = $rs->Fetch();
        if ($ar && $ar["CNT"] > 0) {
            $_SESSION["BX_IBLOCK_CONV"] = array("DONE" => 0, "TODO" => $ar["CNT"], "arMultiple" => $arMultiple, "arSingle" => $arSingle, "arNumber" => $arNumber);
        } else {
            return 4;
            //nothing todo
        }
    } else {
        $arErrors[] = GetMessage("IBCONV_TABLE_CREATION_ERROR");
    }
    return 3;
}
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:54,代碼來源:iblock_convert.php


注:本文中的CIBlockProperty::_Add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。