本文整理汇总了PHP中CIBlock::_Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::_Add方法的具体用法?PHP CIBlock::_Add怎么用?PHP CIBlock::_Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::_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;
}