当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlock::Update方法代码示例

本文整理汇总了PHP中CIBlock::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::Update方法的具体用法?PHP CIBlock::Update怎么用?PHP CIBlock::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIBlock的用法示例。


在下文中一共展示了CIBlock::Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateIBlock

 /**
  * @param int $id
  * @param array $arFields
  *
  * @return bool
  *
  * @throws MigrationException
  */
 protected function updateIBlock($id, array $arFields)
 {
     if ($this->iBlockGateway->Update($id, $arFields)) {
         $this->iblockId = $id;
         return true;
     }
     throw new MigrationException($this->iBlockGateway->LAST_ERROR);
 }
开发者ID:rocko61rus,项目名称:QuetzalTools,代码行数:16,代码来源:AbstractIBlockMigration.php

示例2: applySnapshot

 public function applySnapshot($data, $dbVersion = null)
 {
     $iblockData = $this->handleNullValues($data['iblock']);
     $typeData = $this->handleNullValues($data['type']);
     $res = new ApplyResult();
     $type = new \CIBlockType();
     if (!\CIBlockType::GetByID($typeData['ID'])->Fetch()) {
         $res->setSuccess($type->Add($typeData));
     } else {
         $res->setSuccess($type->Update($typeData['ID'], $typeData));
     }
     if (!$res->isSuccess()) {
         return $res->setMessage($type->LAST_ERROR);
     }
     $extId = $iblockData['ID'];
     if ($dbVersion) {
         $id = $this->getCurrentVersionId($extId, $dbVersion);
     } else {
         $id = $extId;
     }
     if (!$dbVersion && !IblockTable::getById($id)->fetch()) {
         $addRes = IblockTable::add(array('ID' => $id, 'IBLOCK_TYPE_ID' => $typeData['ID'], 'NAME' => 'add'));
         if (!$addRes->isSuccess()) {
             throw new \Exception('add iblock error ' . implode(', ', $addRes->getErrorMessages()));
         }
     }
     $iblock = new \CIBlock();
     if ($id && ($currentData = IblockTable::getById($id)->fetch())) {
         $iblockData['PICTURE'] = $currentData['PICTURE'];
         $res->setSuccess((bool) $iblock->Update($id, $iblockData));
     } else {
         unset($iblockData['PICTURE']);
         $res->setSuccess((bool) ($id = $iblock->Add($iblockData)));
         $this->registerCurrentVersionId($id, $this->getReferenceValue($extId, $dbVersion));
     }
     $res->setId($id);
     return $res->setMessage($iblock->LAST_ERROR);
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:38,代码来源:iblockhandler.php

示例3: array

		$ib->Update($arIBlock["ID"], array("XML_ID" => "clothes_colors_".WIZARD_SITE_ID));
	}
}*/
if ($IBLOCK_OFFERS_ID) {
    $iblockCodeOffers = "clothes_offers_" . WIZARD_SITE_ID;
    //IBlock fields
    $iblock = new CIBlock();
    $arFields = array("ACTIVE" => "Y", "FIELDS" => array('IBLOCK_SECTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y'), 'ACTIVE_FROM' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE_TO' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SORT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'PREVIEW_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'PREVIEW_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'PREVIEW_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'DETAIL_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'DETAIL_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y')), 'TAGS' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_NAME' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'SECTION_DESCRIPTION_TYPE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => 'text'), 'SECTION_DESCRIPTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'SECTION_XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y'))), "CODE" => "clothes_offers", "XML_ID" => $iblockCodeOffers);
    $iblock->Update($IBLOCK_OFFERS_ID, $arFields);
}
if ($IBLOCK_CATALOG_ID) {
    $iblockCode = "clothes_" . WIZARD_SITE_ID;
    //IBlock fields
    $iblock = new CIBlock();
    $arFields = array("ACTIVE" => "Y", "FIELDS" => array('IBLOCK_SECTION' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'ACTIVE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y'), 'ACTIVE_FROM' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE_TO' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SORT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'PREVIEW_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'PREVIEW_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'PREVIEW_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'DETAIL_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'DETAIL_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'CODE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y')), 'TAGS' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'SECTION_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'SECTION_DESCRIPTION_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'SECTION_DESCRIPTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'SECTION_XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_CODE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y'))), "CODE" => "clothes", "XML_ID" => $iblockCode);
    $iblock->Update($IBLOCK_CATALOG_ID, $arFields);
    if ($IBLOCK_OFFERS_ID) {
        $ID_SKU = CCatalog::LinkSKUIBlock($IBLOCK_CATALOG_ID, $IBLOCK_OFFERS_ID);
        $rsCatalogs = CCatalog::GetList(array(), array('IBLOCK_ID' => $IBLOCK_OFFERS_ID), false, false, array('IBLOCK_ID'));
        if ($arCatalog = $rsCatalogs->Fetch()) {
            CCatalog::Update($IBLOCK_OFFERS_ID, array('PRODUCT_IBLOCK_ID' => $IBLOCK_CATALOG_ID, 'SKU_PROPERTY_ID' => $ID_SKU));
        } else {
            CCatalog::Add(array('IBLOCK_ID' => $IBLOCK_OFFERS_ID, 'PRODUCT_IBLOCK_ID' => $IBLOCK_CATALOG_ID, 'SKU_PROPERTY_ID' => $ID_SKU));
        }
        //create facet index
        $index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($IBLOCK_CATALOG_ID);
        $index->startIndex();
        $index->continueIndex(0);
        $index->endIndex();
        $index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($IBLOCK_OFFERS_ID);
        $index->startIndex();
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:catalog3.php

示例4: list

         list($arFields["PROPERTY_TYPE"], $arFields["USER_TYPE"]) = explode(':', $_POST["PROPERTY_PROPERTY_TYPE"], 2);
     } else {
         $arFields["PROPERTY_TYPE"] = $_POST["PROPERTY_PROPERTY_TYPE"];
         $arFields["USER_TYPE"] = "";
     }
 }
 if (!empty($arListValues)) {
     $arFields["VALUES"] = $arListValues;
 }
 if (COption::GetOptionString("iblock", "show_xml_id", "N") == "Y") {
     $arFields["XML_ID"] = $_POST["PROPERTY_XML_ID"];
 }
 if (CIBlock::GetArrayByID($arFields["IBLOCK_ID"], "SECTION_PROPERTY") != "Y") {
     if ($arFields["SECTION_PROPERTY"] === "N" || $arFields["SMART_FILTER"] === "Y") {
         $ib = new CIBlock();
         $ib->Update($arFields["IBLOCK_ID"], array("SECTION_PROPERTY" => "Y"));
     }
 }
 $ibp = new CIBlockProperty();
 if ($str_PROPERTY_ID > 0) {
     $res = $ibp->Update($str_PROPERTY_ID, $arFields, true);
 } else {
     $str_PROPERTY_ID = $ibp->Add($arFields);
     $res = $str_PROPERTY_ID > 0;
     if (!$res) {
         $str_PROPERTY_ID = 'n0';
     }
 }
 if (!$res) {
     $strWarning .= $ibp->LAST_ERROR;
     $bVarsFromForm = true;
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:iblock_edit_property.php

示例5: foreach

             foreach ($_REQUEST["FIELDS"] as $strLogField => $arOneLogField) {
                 if (!preg_match("/^LOG_/", $strLogField)) {
                     continue;
                 }
                 $arLogFields[$strLogField] = $arOneLogField;
             }
         }
         if (!empty($arLogFields)) {
             $arOffersOldFields = CIBlock::GetFields($OF_IBLOCK_ID);
             $arOffersFields["FIELDS"] = $arOffersOldFields;
             foreach ($arLogFields as $keyLogField => $valueLogField) {
                 $arOffersFields["FIELDS"][$keyLogField] = $valueLogField;
             }
         }
         $obIBlock = new CIBlock();
         $mxOffersID = $obIBlock->Update($OF_IBLOCK_ID, $arOffersFields);
         if (false == $mxOffersID) {
             $strWarning .= $obIBlock->LAST_ERROR . "<br>";
             $bVarsFromForm = true;
         } else {
             $res_log = array();
             $res_log['NAME'] = CIBlock::GetArrayByID($OF_IBLOCK_ID, 'NAME');
             if (COption::GetOptionString("iblock", "event_log_iblock", "N") === "Y") {
                 CEventLog::Log("IBLOCK", "IBLOCK_EDIT", "iblock", $OF_IBLOCK_ID, serialize($res_log));
             }
         }
     } else {
         $strWarning .= str_replace(array('#ID#'), array($OF_IBLOCK_ID), GetMessage('IB_E_RIGHTS_IBLOCK_ACCESS_DENIED')) . '<br>';
         $bVarsFromForm = true;
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:iblock_edit.php

示例6: CIBlock

                 $arResult["Step"] = 2;
             }
         }
     }
 }
 if ($arResult["Step"] > 2) {
     $ib = new CIBlock();
     $v1 = "v2:" . serialize(array("DESCRIPTION" => $arResult["Data"]["Description"], "FILTERABLE_FIELDS" => $arResult["Data"]["FilterableFields"], "VISIBLE_FIELDS" => $arResult["Data"]["VisibleFields"], "COMPONENT_TEMPLATES" => $arResult["Data"]["ComponentTemplates"]));
     $arFields = array("IBLOCK_TYPE_ID" => $arParams["IBLOCK_TYPE"], "LID" => SITE_ID, "NAME" => $arResult["Data"]["Name"], "ACTIVE" => 'Y', "SORT" => $arResult["Data"]["Sort"], "PICTURE" => intval($arResult["Data"]["Image"]) > 0 ? CFile::MakeFileArray($arResult["Data"]["Image"]) : false, "DESCRIPTION" => $v1, "DESCRIPTION_TYPE" => 'text', "WORKFLOW" => 'N', "BIZPROC" => 'Y', "VERSION" => 1, "ELEMENT_ADD" => $arResult["Data"]["ElementAdd"]);
     foreach ($arResult["Data"]["UserGroups"] as $v) {
         $arFields["GROUP_ID"][$v] = "R";
     }
     if ($arParams["BLOCK_ID"] <= 0) {
         $opRes = $iblockId = $ib->Add($arFields);
     } else {
         $opRes = $ib->Update($arParams["BLOCK_ID"], $arFields);
         $iblockId = $arParams["BLOCK_ID"];
     }
     if ($opRes) {
         global $CACHE_MANAGER;
         $CACHE_MANAGER->Clean("component_bizproc_wizards_templates");
         if (intval($arResult["Data"]["Image"]) > 0) {
             CFile::Delete($arResult["Data"]["Image"]);
         }
         if ($arParams["BLOCK_ID"] <= 0 && strlen($arResult["Data"]["Template"]) > 0) {
             $arVariables = false;
             if (method_exists($bpTemplateObject, "GetVariables")) {
                 $arVariables = $bpTemplateObject->GetVariables();
                 $ks = array_keys($arVariables);
                 foreach ($ks as $k) {
                     $arVariables[$k]["Default"] = $arResult["Data"]["TemplateVariables"][$k];
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例7: implode

        $tabNumber = $arAllOptions[$i][5];
        $name = $arAllOptions[$i][0];
        if (isset($arAllOptions[$i][4]) && $arAllOptions[$i][4] === "hidden") {
            $val = $arAllOptions[$i][2];
        } else {
            $val = $_REQUEST[$tabNumber . '_' . $name];
        }
        if ($arAllOptions[$i][3][0] == "checkbox" && $val != "Y") {
            $val = "N";
        }
        if ($arAllOptions[$i][3][0] == "mlist") {
            $val = implode(",", $val);
        }
        if ($name === '1C_CRM_CAT_XML_ID') {
            $ib = new CIBlock();
            $ib->Update($iblockId, array('XML_ID' => $val));
            unset($ib);
        } else {
            if ($name === 'selected_catalog_group_id') {
                COption::SetOptionInt("crm", $name, intval($val), $arAllOptions[$i][1]);
            } else {
                COption::SetOptionString("catalog", $name, $val, $arAllOptions[$i][1]);
            }
        }
    }
    LocalRedirect(CComponentEngine::MakePathFromTemplate($arResult['PATH_TO_EXCH1C_INDEX'], array()));
}
$tabNames = array(1 => "tab_catalog_import", 2 => "tab_catalog_export");
foreach ($arAllOptions as $Option) {
    $tabNumber = $Option[5];
    if (isset($Option[4]) && $Option[4] === 'hidden') {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例8: OnBeforePrologHandler

    public static function OnBeforePrologHandler()
    {
        global $USER_FIELD_MANAGER;
        if (isset($_REQUEST['action_button']) && !isset($_REQUEST['action'])) {
            $_REQUEST['action'] = $_REQUEST['action_button'];
        }
        if (!isset($_REQUEST['action'])) {
            return;
        }
        $BID = isset($_REQUEST['ID']) ? (int) $_REQUEST['ID'] : 0;
        if ($_REQUEST['action'] == 'asd_prop_export' && $BID > 0 && check_bitrix_sessid() && CModule::IncludeModule('iblock') && CASDIblockRights::IsIBlockEdit($BID)) {
            $strPath = $_SERVER['DOCUMENT_ROOT'] . '/bitrix/tmp/asd.iblock/';
            $strName = 'asd_props_export_' . $BID . '_' . md5(LICENSE_KEY) . '.xml';
            CheckDirPath($strPath);
            if ($hdlOutput = fopen($strPath . $strName, 'wb')) {
                fwrite($hdlOutput, '<?xml version="1.0" encoding="' . SITE_CHARSET . '"?>' . "\n");
                fwrite($hdlOutput, '<asd_iblock_props>' . "\n");
                fwrite($hdlOutput, CASDiblockTools::ExportPropsToXML($BID, $_REQUEST['p']));
                if ($_REQUEST['forms'] == 'Y') {
                    fwrite($hdlOutput, CASDiblockTools::ExportSettingsToXML($BID, array('forms')));
                }
                fwrite($hdlOutput, '</asd_iblock_props>' . "\n");
                fclose($hdlOutput);
            }
            ?>
<script type="text/javascript">
				top.BX.closeWait(); top.BX.WindowManager.Get().AllowClose(); top.BX.WindowManager.Get().Close();
				window.location.href = '/bitrix/tools/asd.iblock/props_export.php?ID=<?php 
            echo $BID;
            ?>
';
			</script><?php 
            die;
        }
        if ($_REQUEST['action'] == 'asd_prop_import' && $BID > 0 && !$_FILES['xml_file']['error'] && check_bitrix_sessid() && CModule::IncludeModule('iblock') && CASDIblockRights::IsIBlockEdit($BID)) {
            CASDiblockTools::ImportPropsFromXML($BID, $_FILES['xml_file']['tmp_name'], $arOldNewID);
            CASDiblockTools::ImportFormsFromXML($BID, $_FILES['xml_file']['tmp_name'], $arOldNewID);
            LocalRedirect('/bitrix/admin/iblock_edit.php?type=' . $_REQUEST['type'] . '&tabControl_active_tab=edit2&lang=' . LANGUAGE_ID . '&ID=' . $BID . '&admin=Y');
        }
        $IBLOCK_ID = 0;
        if (isset($_REQUEST['IBLOCK_ID'])) {
            $IBLOCK_ID = (int) $_REQUEST['IBLOCK_ID'];
            if ($IBLOCK_ID < 0) {
                $IBLOCK_ID = 0;
            }
        }
        if ($_REQUEST['action'] == 'asd_reverse' && $IBLOCK_ID > 0 && check_bitrix_sessid() && CModule::IncludeModule('iblock') && CASDIblockRights::IsIBlockEdit($IBLOCK_ID)) {
            $LIST_MODE = CIBlock::GetArrayByID($IBLOCK_ID, 'LIST_MODE');
            if (!strlen($LIST_MODE)) {
                $LIST_MODE = COption::GetOptionString('iblock', 'combined_list_mode', 'N') == 'Y' ? 'C' : 'S';
            }
            $LIST_MODE = $LIST_MODE == 'C' ? 'S' : 'C';
            $ib = new CIBlock();
            $ib->Update($IBLOCK_ID, array('LIST_MODE' => $LIST_MODE));
            LocalRedirect('/bitrix/admin/' . ($LIST_MODE == 'S' ? 'iblock_element_admin' : 'iblock_list_admin') . '.php?IBLOCK_ID=' . $IBLOCK_ID . '&type=' . htmlspecialcharsbx($_REQUEST['type']) . '&find_section_section=' . intval($_REQUEST['find_section_section']) . '&lang=' . LANGUAGE_ID);
        }
        $strCurPage = $GLOBALS['APPLICATION']->GetCurPage();
        $bElemPage = $strCurPage == '/bitrix/admin/iblock_element_admin.php' || $strCurPage == '/bitrix/admin/cat_product_admin.php';
        $bSectPage = $strCurPage == '/bitrix/admin/iblock_section_admin.php' || $strCurPage == '/bitrix/admin/cat_section_admin.php';
        $bMixPage = $strCurPage == '/bitrix/admin/iblock_list_admin.php';
        $bRightPage = $bElemPage || $bSectPage || $bMixPage;
        $successRedirect = false;
        if ($bRightPage && $_REQUEST['action'] == 'asd_copy_in_list' && strlen($_REQUEST['ID']) > 0) {
            $bDoAction = true;
            $_REQUEST['action'] = 'asd_copy';
            $_REQUEST['asd_ib_dest'] = $IBLOCK_ID;
            $_REQUEST['ID'] = array($_REQUEST['ID']);
        } else {
            $bDoAction = false;
        }
        if ($bRightPage && check_bitrix_sessid() && !empty($_REQUEST['ID']) && ($_SERVER['REQUEST_METHOD'] == 'POST' || $bDoAction) && CModule::IncludeModule('iblock') && ($_REQUEST['action'] == 'asd_copy' || $_REQUEST['action'] == 'asd_move') && isset($_REQUEST['asd_ib_dest']) && (int) $_REQUEST['asd_ib_dest'] > 0 && CASDIblockRights::IsIBlockDisplay($_REQUEST['asd_ib_dest'])) {
            $intSrcIBlockID = $IBLOCK_ID;
            $intDestIBlockID = (int) $_REQUEST['asd_ib_dest'];
            $intSetSectID = 0;
            if (isset($_REQUEST['asd_sect_dest'])) {
                $intSetSectID = (int) $_REQUEST['asd_sect_dest'];
                if ($intSetSectID < 0) {
                    $intSetSectID = 0;
                }
            }
            $boolCreateElement = false;
            $boolCreateSection = false;
            if ($bElemPage || $bMixPage) {
                $boolCreateElement = CASDIblockRights::IsSectionElementCreate($intDestIBlockID, $intSetSectID);
            }
            if ($bSectPage || $bMixPage) {
                $boolCreateSection = CASDIblockRights::IsSectionSectionCreate($intDestIBlockID, $intSetSectID);
            }
            if ($boolCreateElement || $boolCreateSection) {
                $arPropListCache = array();
                $arOldPropListCache = array();
                $arNamePropListCache = array();
                $arOldNamePropListCache = array();
                $boolUFListCache = false;
                $arUFListCache = array();
                $arOldUFListCache = array();
                $arUFEnumCache = array();
                $arOldUFEnumCache = array();
                $arUFNameEnumCache = array();
                $arOldUFNameEnumCache = array();
//.........这里部分代码省略.........
开发者ID:Hawkart,项目名称:megatv,代码行数:101,代码来源:iblock_action.php

示例9: addBP

 /**
  *
  * 1) шаг первый - создание Инфоблока
  * 2) шаг второй - создание шаблона Бизнес-Процесса
  * @param array $arResult - массив с данными
  * @param array $arParams - 
  */
 public static function addBP($arResult, $arParams)
 {
     if (!CModule::IncludeModule("iblock")) {
         ShowError('Нет модуля iblock');
     }
     if (!CModule::IncludeModule("bizproc")) {
         ShowError('Нет модуля bizproc');
     }
     $ib = new CIBlock();
     $description = 'описание';
     /*
      ШАГ 1
     */
     $arFields = array("IBLOCK_TYPE_ID" => $arParams["IBLOCK_TYPE"], "LID" => "s1", "NAME" => $arResult["Data"]["Name"], "CODE" => "select_color", "ACTIVE" => 'Y', "SORT" => $arResult["Data"]["Sort"], "PICTURE" => intval($arResult["Data"]["Image"]) > 0 ? CFile::MakeFileArray($arResult["Data"]["Image"]) : false, "DESCRIPTION" => $description, "DESCRIPTION_TYPE" => 'text', "WORKFLOW" => 'N', "BIZPROC" => 'Y', "VERSION" => 1, "ELEMENT_ADD" => $arResult["Data"]["ElementAdd"]);
     foreach ($arResult["Data"]["UserGroups"] as $v) {
         $arFields["GROUP_ID"][$v] = "R";
     }
     if ($arParams["BLOCK_ID"] <= 0) {
         $opRes = $iblockId = $ib->Add($arFields);
     } else {
         $opRes = $ib->Update($arParams["BLOCK_ID"], $arFields);
         $iblockId = $arParams["BLOCK_ID"];
     }
     /*
      ШАГ 2
     */
     if ($opRes) {
         global $CACHE_MANAGER;
         $CACHE_MANAGER->Clean("component_bizproc_wizards_templates");
         if (intval($arResult["Data"]["Image"]) > 0) {
             CFile::Delete($arResult["Data"]["Image"]);
         }
         if ($arParams["BLOCK_ID"] <= 0 && strlen($arResult["Data"]["Template"]) > 0) {
             $arVariables = false;
             if (method_exists($bpTemplateObject, "GetVariables")) {
                 $arVariables = $bpTemplateObject->GetVariables();
                 $ks = array_keys($arVariables);
                 foreach ($ks as $k) {
                     $arVariables[$k]["Default"] = $arResult["Data"]["TemplateVariables"][$k];
                 }
             }
             $arFieldsT = array("DOCUMENT_TYPE" => array("bizproc", "CBPVirtualDocument", "type_" . $iblockId), "AUTO_EXECUTE" => CBPDocumentEventType::Create, "NAME" => $arResult["Data"]["Name"], "DESCRIPTION" => $arResult["Data"]["Description"], "TEMPLATE" => $bpTemplateObject->GetTemplate(), "PARAMETERS" => $bpTemplateObject->GetParameters(), "VARIABLES" => $arVariables, "USER_ID" => $GLOBALS["USER"]->GetID(), "ACTIVE" => 'Y', "MODIFIER_USER" => new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
             CBPWorkflowTemplateLoader::Add($arFieldsT);
             if (method_exists($bpTemplateObject, "GetDocumentFields")) {
                 $runtime = CBPRuntime::GetRuntime();
                 $runtime->StartRuntime();
                 $arResult["DocumentService"] = $runtime->GetService("DocumentService");
                 $arDocumentFields = $bpTemplateObject->GetDocumentFields();
                 if ($arDocumentFields && is_array($arDocumentFields) && count($arDocumentFields) > 0) {
                     foreach ($arDocumentFields as $f) {
                         $arResult["DocumentService"]->AddDocumentField(array("bizproc", "CBPVirtualDocument", "type_" . $iblockId), $f);
                     }
                 }
             }
         }
         /*
          * разворачиваем шаблон БП из файла
          */
         $templateFileNameBP = $_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/adeveloper.bp/data/bp-sc.bpt';
         $f = fopen($templateFileNameBP, "rb");
         $datum = fread($f, filesize($templateFileNameBP));
         fclose($f);
         try {
             $BLOCK_ID = $opRes;
             $r = CBPWorkflowTemplateLoader::ImportTemplate($ID, array("bizproc", "CBPVirtualDocument", "type_" . $BLOCK_ID), 1, "Шаблон БП", "Описание шаблона", $datum);
         } catch (Exception $e) {
             $errTmp = preg_replace("#[\r\n]+#", " ", $e->getMessage());
         }
     } else {
         ShowError("Инфоблока нет");
     }
     return $opRes;
 }
开发者ID:st7art22,项目名称:bitrix,代码行数:80,代码来源:cbpvisitor.php

示例10: serialize

                } else {
                    if (COption::GetOptionString("iblock", "event_log_iblock", "N") === "Y") {
                        $res_log["NAME"] = $arIBlock["NAME"];
                        CEventLog::Log("IBLOCK", "IBLOCK_DELETE", "iblock", $ID, serialize($res_log));
                    }
                }
                $DB->Commit();
                break;
            case "activate":
            case "deactivate":
                if (!CIBlockRights::UserHasRightTo($ID, $ID, "iblock_delete")) {
                    break;
                }
                $ob = new CIBlock();
                $arFields = array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N");
                if (!$ob->Update($ID, $arFields)) {
                    $lAdmin->AddGroupError(GetMessage("IBLOCK_ADM_UPD_ERROR") . $ob->LAST_ERROR, $ID);
                }
                break;
        }
    }
}
$arHeader = array(array("id" => "NAME", "content" => GetMessage("IBLOCK_ADM_NAME"), "sort" => "name", "default" => true), array("id" => "SORT", "content" => GetMessage("IBLOCK_ADM_SORT"), "sort" => "sort", "default" => true, "align" => "right"), array("id" => "ACTIVE", "content" => GetMessage("IBLOCK_ADM_ACTIVE"), "sort" => "active", "default" => true, "align" => "center"), array("id" => "CODE", "content" => GetMessage("IBLOCK_FIELD_CODE"), "sort" => "code"), array("id" => "LIST_PAGE_URL", "content" => GetMessage("IBLOCK_ADM_HEADER_LIST_URL")), array("id" => "DETAIL_PAGE_URL", "content" => GetMessage("IBLOCK_ADM_HEADER_DETAIL_URL")), array("id" => "ELEMENT_CNT", "content" => GetMessage("IBLOCK_ADM_HEADER_EL"), "default" => true, "align" => "right"));
if ($arIBTYPE["SECTIONS"] == "Y") {
    $arHeader[] = array("id" => "SECTION_CNT", "content" => GetMessage("IBLOCK_ADM_HEADER_SECT"), "default" => true, "align" => "right");
}
$arHeader[] = array("id" => "LID", "content" => GetMessage("IBLOCK_ADM_LANG"), "sort" => "lid", "default" => true, "align" => "left");
$arHeader[] = array("id" => "INDEX_ELEMENT", "content" => GetMessage("IBLOCK_ADM_HEADER_TOINDEX"));
if ($bWorkflow) {
    $arHeader[] = array("id" => "WORKFLOW", "content" => GetMessage("IBLOCK_ADM_HEADER_WORKFLOW"));
}
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:iblock_admin.php

示例11: CIBlock

}
// sync iblock url fields with params
if (IsModuleInstalled('iblock') && CModule::IncludeModule('iblock')) {
    $iblock = new CIBlock();
    if (isset($arResult['PATH_TO_PRODUCT_LIST'])) {
        // list page
        $listPageUrl = CComponentEngine::makePathFromTemplate($arResult['PATH_TO_PRODUCT_LIST'], array('section_id' => ''));
        if ($arParams['SEF_MODE'] === 'Y') {
            $listPageUrl = str_replace('//', '/', $listPageUrl);
        } else {
            $listPageUrl = str_replace('?' . $arVariableAliases['section_id'] . '=', '/', $listPageUrl);
        }
        //$listPageUrl = '#SITE_ID#'.$listPageUrl;
        $curListPageUrl = COption::GetOptionString('crm', 'product_list_page_url', '');
        if ($listPageUrl !== $curListPageUrl) {
            $iblock->Update($catalogID, array('LIST_PAGE_URL' => $listPageUrl));
            COption::SetOptionString('crm', 'product_list_page_url', $listPageUrl);
        }
        // section page
        $sectionPageUrl = CComponentEngine::makePathFromTemplate($arResult['PATH_TO_PRODUCT_LIST'], array('section_id' => '#SECTION_ID#'));
        //$sectionPageUrl = '#SITE_ID#'.$sectionPageUrl;
        $curSectionPageUrl = COption::GetOptionString('crm', 'product_section_page_url', '');
        if ($sectionPageUrl !== $curSectionPageUrl) {
            $iblock->Update($catalogID, array('SECTION_PAGE_URL' => $sectionPageUrl));
            COption::SetOptionString('crm', 'product_section_page_url', $sectionPageUrl);
        }
    }
    if (isset($arResult['PATH_TO_PRODUCT_SHOW'])) {
        // detail page
        $detailPageUrl = CComponentEngine::makePathFromTemplate($arResult['PATH_TO_PRODUCT_SHOW'], array('product_id' => '#ID#'));
        //$detailPageUrl = '#SITE_ID#'.$detailPageUrl;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例12: migrateList

 public static function migrateList($id)
 {
     $id = intval($id);
     if ($id <= 0) {
         throw new Main\ArgumentNullException("id");
     }
     $db = \CIBlock::GetList(array(), array("ID" => $id, "IBLOCK_TYPE_ID" => "lists", "CHECK_PERMISSIONS" => "N"));
     $iblock = $db->Fetch();
     if (!$iblock) {
         throw new Main\ArgumentOutOfRangeException("id");
     }
     $iblockType = static::getIBlockType();
     $ob = new \CIBlock();
     $res = $ob->Update($id, array("IBLOCK_TYPE_ID" => $iblockType));
     if ($res) {
         \CLists::setLiveFeed(1, $id);
     }
     \CBPDocument::MigrateDocumentType(array("lists", 'Bitrix\\Lists\\BizprocDocumentLists', "iblock_" . $id), array("lists", "BizprocDocument", "iblock_" . $id));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:importer.php

示例13: importXMLData

 public function importXMLData()
 {
     if (!$this->_bIBlockSelected) {
         return false;
     }
     $bTypeSuccess = $this->createIBlockType();
     if (!$bTypeSuccess) {
         return false;
     }
     if (!$this->deleteOldIBlockData()) {
         return false;
     }
     // Это если мы реинсталлируем данные инфоблоков
     if ($this->_iblockID == 0) {
         $arFields = Tools::arrayMergeRecursiveDistinct(self::$_arDefaultIBlockFields, $this->_arConfig['IBLOCK'][$this->_iblockCode]);
         $arPermissions = $arFields['PERMISSIONS'];
         $dbGroup = \CGroup::GetList($by = "", $order = "", array("STRING_ID" => "content_editor"));
         if ($arGroup = $dbGroup->Fetch()) {
             $arPermissions[$arGroup["ID"]] = 'W';
         }
         unset($arFields['IBLOCK_TYPE_ID']);
         unset($arFields['XML_FILE']);
         unset($arFields['FORM_SETTINGS']);
         unset($arFields['PERMISSIONS']);
         $arFields['CODE'] = $this->_iblockCode;
         $arFields['LID'] = WIZARD_SITE_ID;
         $this->_iblockID = \WizardServices::ImportIBlockFromXML($this->_iblockXMLFile, $this->_iblockCode, $this->_iblockType, WIZARD_SITE_ID, $arPermissions);
         if ($this->_iblockID < 1) {
             die('Error importing xml-data:' . "<br /> \n" . 'xml file: "' . htmlspecialchars($this->_iblockXMLFile) . '"' . ",<br /> \n" . 'iblock code: "' . htmlspecialchars($this->_iblockCode) . '"' . ",<br /> \n" . 'iblock type: "' . htmlspecialchars($this->_iblockType) . '"');
         }
         $iblock = new \CIBlock();
         $iblock->Update($this->_iblockID, $arFields);
     } else {
         $arSites = self::getIBlockSites($this->_iblockID);
         if (!in_array(WIZARD_SITE_ID, $arSites)) {
             $arSites[] = WIZARD_SITE_ID;
             $iblock = new \CIBlock();
             $iblock->Update($this->_iblockID, array("LID" => $arSites));
         }
     }
 }
开发者ID:OpenBX,项目名称:obx.core,代码行数:41,代码来源:importiblock.php

示例14: CIBlock

********************************************************************/
//$GLOBALS["APPLICATION"]->SetFileAccessPermission($_REQUEST["library_FOLDER"], $_REQUEST["library_FOLDER_PERMISSION"]);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    CUtil::JSPostUnescape();
    $ib = new CIBlock();
    if (!check_bitrix_sessid()) {
        $strWarning = GetMessage("WD_ERROR_BAD_SESSID");
    } else {
        $bSetERights = isset($_REQUEST['IB_E_RIGHTS']) && $_REQUEST['IB_E_RIGHTS'] == 'Y';
        if ($arIBlock['RIGHTS_MODE'] !== ($bSetERights ? 'E' : 'S')) {
            $arFields = array();
            $arFields['RIGHTS_MODE'] = $bSetERights ? 'E' : 'S';
            if ($bSetERights) {
                $arFields['GROUP_ID'] = CIBlock::GetGroupPermissions($iblock_id);
            }
            $res = $ib->Update($iblock_id, $arFields);
            $ob->e_rights = $bSetERights;
        } else {
            $arFields = array();
            if (isset($_REQUEST['WF_TYPE'])) {
                $arFields = array("WORKFLOW" => $_REQUEST["WF_TYPE"] == "WF" ? "Y" : "N", "BIZPROC" => $_REQUEST["WF_TYPE"] == "BP" ? "Y" : "N");
            } else {
                if (isset($_REQUEST['WF_TYPE_WF']) && $_REQUEST['WF_TYPE_WF'] == 'Y') {
                    $arFields["WORKFLOW"] = "Y";
                    $arFields["BIZPROC"] = "N";
                } elseif (isset($_REQUEST['WF_TYPE_BP']) && $_REQUEST['WF_TYPE_BP'] == "Y") {
                    $arFields["BIZPROC"] = "Y";
                    $arFields["WORKFLOW"] = "N";
                } else {
                    $arFields["BIZPROC"] = "N";
                    $arFields["WORKFLOW"] = "N";
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:iblock_settings.php

示例15: IblockUpdate

 /**
  * @var array $data
  * @var array $fields
  * @var bool $deleteIfExists
  */
 protected function IblockUpdate(array $data, array $fields = null)
 {
     global $DB;
     if (empty(trim($data['CODE']))) {
         throw new \Exception('You must set iblock CODE');
     }
     $name = trim($data['CODE']);
     $fire = false;
     $res = \CIBlock::GetList([], ['CODE' => $name, 'CHECK_PERMISSIONS' => 'N']);
     if ($ob = $res->Fetch()) {
         $ib = new \CIBlock();
         $id = $ib->Update($ob['ID'], $data);
         if ($id) {
             echo "Update {$name} iblock\r\n";
             if ($id && $fields) {
                 $this->IblockSetFields($name, $fields);
             }
         } else {
             throw new \Exception("Can't create {$name} iblock type");
         }
     } else {
         throw new \Exception("Iblock don't exists");
     }
     return $id;
 }
开发者ID:marvin255,项目名称:bxmigrate,代码行数:30,代码来源:Coded.php


注:本文中的CIBlock::Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。