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


PHP CIBlockProperty::Update方法代码示例

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


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

示例1: array

    $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')), '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')), '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' => ''), 'TAGS' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '')), "CODE" => $iblockCode, "XML_ID" => $iblockCode);
    $iblock->Update($iblockID, $arFields);
    $arProperties = array("USER", "USER_ACTIVE", "DEPARTMENT", "POST", "STATE");
    foreach ($arProperties as $propertyName) {
        ${$propertyName . "_PROPERTY_ID"} = 0;
        $properties = CIBlockProperty::GetList(array(), array("ACTIVE" => "Y", "IBLOCK_ID" => $iblockID, "CODE" => $propertyName));
        if ($arProperty = $properties->Fetch()) {
            ${$propertyName . "_PROPERTY_ID"} = $arProperty["ID"];
        }
    }
    $aFormOptions = array("tabs" => "edit1--#--" . GetMessage("STATE_FORM_1") . "--,--PROPERTY_" . $USER_PROPERTY_ID . "--#--" . GetMessage("STATE_FORM_2") . "--,--ACTIVE_FROM--#--" . GetMessage("STATE_FORM_3") . "--,--NAME--#--*" . GetMessage("STATE_FORM_4") . "--,--PROPERTY_" . $POST_PROPERTY_ID . "--#--" . GetMessage("STATE_FORM_5") . "--,--PROPERTY_" . $DEPARTMENT_PROPERTY_ID . "--#--" . GetMessage("STATE_FORM_6") . "--,--PROPERTY_" . $STATE_PROPERTY_ID . "--#--" . GetMessage("STATE_FORM_8") . "--,--PREVIEW_TEXT--#--" . GetMessage("STATE_FORM_7") . "--;--");
    WizardServices::SetIBlockFormSettings($iblockID, $aFormOptions);
    if ($DEPARTMENT_PROPERTY_ID > 0) {
        $rsIBlock = CIBlock::GetList(array(), array("CODE" => "departments", "TYPE" => "structure", "SITE_ID" => WIZARD_SITE_ID));
        if ($arIBlock = $rsIBlock->Fetch()) {
            $property = new CIBlockProperty();
            $property->Update($DEPARTMENT_PROPERTY_ID, array("LINK_IBLOCK_ID" => $arIBlock["ID"]));
        }
    }
} else {
    $arSites = array();
    $db_res = CIBlock::GetSite($iblockID);
    while ($res = $db_res->Fetch()) {
        $arSites[] = $res["LID"];
    }
    if (!in_array(WIZARD_SITE_ID, $arSites)) {
        $arSites[] = WIZARD_SITE_ID;
        $iblock = new CIBlock();
        $iblock->Update($iblockID, array("LID" => $arSites));
    }
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:state_history.php

示例2: array

				else
					$PROP_TYPE = "S";

				if($arPriceType[$IBLOCK_XML_ID]==$PROP_XML_ID)
					continue;

				$res = CIBlock::GetProperties($IBLOCK_ID, array(), Array("IBLOCK_ID"=>$IBLOCK_ID, "XML_ID"=>$PROP_XML_ID));
				$bNewRecord_tmp = False;
				if($res_arr = $res->Fetch())
				{
					$PROP_ID = $res_arr["ID"];
					$res = $ibp->Update($PROP_ID,
							Array(
								"NAME" => $PROP_NAME,
								"TYPE" => $PROP_TYPE,
								"MULTIPLE" => $PROP_MULTIPLE,
								"DEFAULT_VALUE" => $PROP_DEF,
								"TMP_ID"		=> $tmpid
							)
						);
				}
				else
				{
					$bNewRecord_tmp = True;
					$arFields = Array(
						"NAME" 			=> $PROP_NAME,
						"ACTIVE" 		=> "Y",
						"SORT" 			=> "500",
						"DEFAULT_VALUE" => $PROP_DEF,
						"XML_ID" 		=> $PROP_XML_ID,
						"TMP_ID"		=> $tmpid,
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:31,代码来源:commerceml_run.php

示例3: updatePropertyIfExists

 public function updatePropertyIfExists($iblockId, $propertyCode, $fields)
 {
     $propId = $this->getPropertyId($iblockId, $propertyCode);
     if (!$propId) {
         return false;
     }
     $ib = new \CIBlockProperty();
     if ($ib->Update($propId, $fields)) {
         return true;
     }
     $this->throwException(__METHOD__, $ib->LAST_ERROR);
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:12,代码来源:IblockHelper.php

示例4: array

							$arNewIBlocksList[$intIBlockID]['OFFERS_PROP'] = $mxPropID;
							$arNewIBlocksList[$intIBlockID]['NEED_IS_REQUIRED'] = 'N';
							$arNewIBlocksList[$intIBlockID]['NEED_UPDATE'] = 'N';
							$arNewIBlocksList[$intIBlockID]['NEED_LINK'] = 'N';
						}
					}
					elseif (0 < $arIBlockInfo['OFFERS_PROP'])
					{
						if ('Y' == $arIBlockInfo['NEED_UPDATE'])
						{
							$arPropFields = array(
								'USER_TYPE' => 'SKU',
								'XML_ID' => 'CML2_LINK',
							);
							$obProp = new CIBlockProperty();
							$mxPropID = $obProp->Update($arIBlockInfo['OFFERS_PROP'],$arPropFields);
							if (!$mxPropID)
							{
								$boolFlag = false;
								$strWarning .= Loc::getMessage(
									'CAT_IBLOCK_OFFERS_ERR_MODIFY_PROP_IS_REQ',
									array(
										'#OFFERS#' => $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO'],
										'#ERR#' => $obProp->LAST_ERROR
									)
								).'<br />';
								break;
							}
						}
					}
				}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:31,代码来源:options.php

示例5: array

}
$dbSite = CSite::GetByID(WIZARD_SITE_ID);
if ($arSite = $dbSite->Fetch()) {
    $lang = $arSite["LANGUAGE_ID"];
}
if (strlen($lang) <= 0) {
    $lang = "ru";
}
$iblockCodeTheme = "infoportal_theme_" . WIZARD_SITE_ID;
$iblockTypeTheme = "news";
$rsIBlockTheme = CIBlock::GetList(array(), array("XML_ID" => $iblockCodeTheme, "TYPE" => $iblockTypeTheme));
if ($arIBlockTheme = $rsIBlockTheme->Fetch()) {
    $iblockIDTheme = $arIBlockTheme["ID"];
    $arFields = array("LINK_IBLOCK_TYPE_ID" => $iblockTypeTheme, "LINK_IBLOCK_ID" => $iblockIDTheme, "USER_TYPE" => "EAutocomplete", "USER_TYPE_SETTINGS" => array("MAX_WIDTH" => 250, "SHOW_ADD" => "Y", "IBLOCK_MESS" => "Y"));
    $ibprop = new CIBlockProperty();
    $ibprop->Update($arProperty["THEME"], $arFields);
    if ($lang == 'ru') {
        $arThemeElement = array("277" => array("254", "253"), "256" => array("259", "258", "255"));
    } elseif ($lang == 'en') {
        $arThemeElement = array("161" => array("1", "8", "92"), "163" => array("169", "88", "89", "93"));
    } elseif ($lang == 'de') {
        $arThemeElement = array("161" => array("35", "88", "77"), "163" => array("38", "83", "82", "166"));
    }
    foreach ($arThemeElement as $ThemeID => $ThemeElements) {
        $rsElemetTheme = CIBlockElement::GetList(array("show_counter" => "desc"), array("XML_ID" => $ThemeID, "IBLOCK_ID" => $iblockIDTheme));
        if ($arElemetTheme = $rsElemetTheme->Fetch()) {
            $elementIDTheme = $arElemetTheme["ID"];
            foreach ($ThemeElements as $ElementID) {
                $rsElemet = CIBlockElement::GetList(array("show_counter" => "desc"), array("XML_ID" => $ElementID, "IBLOCK_ID" => $iblockID), false, false, array("ID"));
                if ($arElemet = $rsElemet->Fetch()) {
                    CIBlockElement::SetPropertyValuesEx($arElemet["ID"], $iblockID, array("THEME" => $elementIDTheme));
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:31,代码来源:news.php

示例6: CheckSKUProperty

function CheckSKUProperty($ID, $SKUID)
{
    $arResult = false;
    $ID = (int) $ID;
    $SKUID = (int) $SKUID;
    if ($ID > 0 && $SKUID > 0) {
        $intSKUPropID = 0;
        $ibp = new CIBlockProperty();
        $arProp = GetSKUProperty($ID, $SKUID);
        if (empty($arProp) || is_array($arProp) && $arProp['MULTIPLE'] != 'N') {
            $arOFProperty = array('NAME' => GetMessage('IB_E_OF_SKU_PROPERTY_NAME'), 'IBLOCK_ID' => $SKUID, 'PROPERTY_TYPE' => Iblock\PropertyTable::TYPE_ELEMENT, 'USER_TYPE' => CIBlockPropertyTools::USER_TYPE_SKU_LINK, 'LINK_IBLOCK_ID' => $ID, 'ACTIVE' => 'Y', 'SORT' => '5', 'MULTIPLE' => 'N', 'CODE' => CIBlockPropertyTools::CODE_SKU_LINK, 'XML_ID' => CIBlockPropertyTools::XML_SKU_LINK, 'FILTRABLE' => 'Y', 'SEARCHABLE' => 'N');
            $intSKUPropID = $ibp->Add($arOFProperty);
            if (!$intSKUPropID) {
                $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => $ibp->LAST_ERROR);
            }
        } elseif ($arProp['USER_TYPE'] != CIBlockPropertyTools::USER_TYPE_SKU_LINK || $arProp['XML_ID'] != CIBlockPropertyTools::XML_SKU_LINK) {
            $arFields = array('USER_TYPE' => CIBlockPropertyTools::USER_TYPE_SKU_LINK, 'XML_ID' => CIBlockPropertyTools::XML_SKU_LINK);
            $boolFlag = $ibp->Update($arProp['ID'], $arFields);
            if (false === $boolFlag) {
                $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => $ibp->LAST_ERROR);
            } else {
                $intSKUPropID = $arProp['ID'];
            }
        } else {
            $intSKUPropID = $arProp['ID'];
        }
        $intSKUPropID = (int) $intSKUPropID;
        if ($intSKUPropID > 0) {
            $arResult = array('RESULT' => 'OK', 'VALUE' => $intSKUPropID);
        }
    } else {
        $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => GetMessage('IB_E_OF_ERR_SKU_IBLOCKS_IS_ABSENT'));
    }
    return $arResult;
}
开发者ID:Satariall,项目名称:izurit,代码行数:35,代码来源:iblock_edit.php

示例7: updateProperties

	/**
	 * [updateProperties description]
	 * @param  object $obprop
	 * @param  integer $sortKey
	 * @return array
	 */
	protected function updateProperties($obprop, $prop, $sortKey){
		if (!CModule::IncludeModule("iblock")):
			return false; 
		endif;
		$arFields = array();
		$name = null; $id1c = null;
		$name = $obprop->Наименование;
		$id1c = $obprop->Ид;
		$arFields = $this->bildArrFields($obprop, $sortKey);
		$ibp = new CIBlockProperty;
		if(!$ibp->Update($prop['ID'], $arFields)):
			return false;
		endif;
		return true;
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:21,代码来源:addPropertyIblock.php

示例8: while

    $db_res = CIBlock::GetSite($iblockID);
    while ($res = $db_res->Fetch()) {
        $arSites[] = $res["LID"];
    }
    if (!in_array(WIZARD_SITE_ID, $arSites)) {
        $arSites[] = WIZARD_SITE_ID;
        $iblock = new CIBlock();
        $iblock->Update($iblockID, array("LID" => $arSites));
    }
}
for ($t = 1; $t <= 7; $t++) {
    $res = CIBlockProperty::GetByID("TAB_" . $t . "_TYPE", $iblockID, false);
    if ($ar_res = $res->GetNext()) {
        $arFields2 = array('USER_TYPE_SETTINGS' => array('size' => '1', 'width' => '0', 'group' => 'N', 'multiple' => 'N', 'TABLE_NAME' => 'tab'), 'USER_TYPE' => 'directory');
        $ibp = new CIBlockProperty();
        $ibp->Update($ar_res['ID'], $arFields2);
    }
}
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "about/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "about/obzor/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "ajax/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "auth/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "brands/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "catalog/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "include/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "personal/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "news/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "sales/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "search/", array("REVIEWS_IBLOCK_ID" => $iblockID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "_index.php", array("REVIEWS_IBLOCK_ID" => $iblockID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . ".actions.menu.php", array("REVIEWS_IBLOCK_ID" => $iblockID));
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:reviews.php

示例9: applySnapshot

 /**
  * @param $data
  * @param null $dbVersion
  * @throws \Exception
  * @return ApplyResult
  */
 public function applySnapshot($data, $dbVersion = null)
 {
     $data = $this->handleNullValues($data);
     $prop = new \CIBlockProperty();
     $res = new ApplyResult();
     $extId = $data['ID'];
     if ($dbVersion) {
         $data['IBLOCK_ID'] = $this->getReferenceController()->getCurrentIdByOtherVersion($data['IBLOCK_ID'], ReferenceController::GROUP_IBLOCK, $dbVersion);
         $id = $this->getCurrentVersionId($extId, $dbVersion);
     } else {
         $id = $extId;
     }
     if (!$dbVersion && !PropertyTable::getById($id)->fetch()) {
         unset($data['VERSION']);
         $addRes = PropertyTable::add(array('ID' => $id, 'NAME' => $data['NAME'], 'IBLOCK_ID' => $data['IBLOCK_ID']));
         if (!$addRes->isSuccess()) {
             throw new \Exception('Ќе удалось возобновить свойство текущей версии. ' . implode(', ', $addRes->getErrorMessages()) . "\n" . var_export($data, true));
         }
     }
     if ($id && PropertyTable::getById($id)->fetch()) {
         $res->setSuccess((bool) $prop->Update($id, $data));
     } else {
         $res->setSuccess((bool) ($id = $prop->Add($data)));
         $this->registerCurrentVersionId($id, $this->getReferenceValue($extId, $dbVersion));
     }
     $res->setId($id);
     if ($data['PROPERTY_TYPE'] == self::LIST_TYPE_SIGN && !empty($data['~property_list_values'])) {
         $this->_applyPropertyListTypeValues($id, $data['~property_list_values']);
     }
     return $res->setMessage($prop->LAST_ERROR);
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:37,代码来源:iblockpropertyhandler.php

示例10: CIBlock

     $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") === "N") {
     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 ($propID > 0) {
     $arFields['PROPERTY_TYPE'] = $arProp['PROPERTY_TYPE'];
     $arFields['USER_TYPE'] = $arProp['USER_TYPE'];
     $res = $ibp->Update($propID, $arFields, true);
 } else {
     $propID = intval($ibp->Add($arFields));
 }
 if ($propID <= 0) {
     $errMsg .= $ibp->LAST_ERROR;
     $bVarsFromForm = true;
     if ($e = $APPLICATION->GetException()) {
         $errMsg .= $e->GetString() . '<br>';
     }
 } else {
     if (isset($_POST['apply'])) {
         LocalRedirect(CComponentEngine::makePathFromTemplate($arParams['PATH_TO_PRODUCTPROPS_EDIT'], array('prop_id' => $propID)));
     } else {
         LocalRedirect(CComponentEngine::makePathFromTemplate($arParams['PATH_TO_PRODUCTPROPS_LIST']));
     }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例11: IblockPropertyUpdate

 /**
  * @var string $iblock
  * @var array $data
  * @var bool $deleteIfExists
  */
 protected function IblockPropertyUpdate($iblock, array $data)
 {
     $ibId = $this->IblockGetIdByCode($iblock);
     if (empty($data['CODE'])) {
         throw new \Exception('You must set property CODE');
     }
     if ($ibId) {
         $fire = false;
         $res = \CIBlockProperty::GetList([], ['CODE' => $data['CODE'], 'IBLOCK_ID' => $ibId, 'CHECK_PERMISSIONS' => 'N']);
         if ($ob = $res->Fetch()) {
             $ib = new \CIBlockProperty();
             $id = $ib->Update($ob['ID'], $data);
             if ($id) {
                 echo "Update {$data['CODE']} iblock property\r\n";
             } else {
                 throw new \Exception("Can't update {$data['CODE']} iblock property");
             }
         } else {
             throw new \Exception("Can't find {$data['CODE']} iblock property");
         }
     } else {
         throw new \Exception("Can't find iblock {$iblock}");
     }
 }
开发者ID:marvin255,项目名称:bxmigrate,代码行数:29,代码来源:Coded.php

示例12: updatePropertyById

 public function updatePropertyById($propertyId, $fields)
 {
     if (!empty($fields['VALUES']) && !isset($fields['PROPERTY_TYPE'])) {
         $fields['PROPERTY_TYPE'] = 'L';
     }
     if (!empty($fields['LINK_IBLOCK_ID']) && !isset($fields['PROPERTY_TYPE'])) {
         $fields['PROPERTY_TYPE'] = 'E';
     }
     if (false !== strpos($fields['PROPERTY_TYPE'], ':')) {
         list($ptype, $utype) = explode(':', $fields['PROPERTY_TYPE']);
         $fields['PROPERTY_TYPE'] = $ptype;
         $fields['USER_TYPE'] = $utype;
     }
     $ib = new \CIBlockProperty();
     if ($ib->Update($propertyId, $fields)) {
         return true;
     }
     $this->throwException(__METHOD__, $ib->LAST_ERROR);
 }
开发者ID:andreyryabin,项目名称:sprint.migration,代码行数:19,代码来源:IblockHelper.php

示例13: process

 /**
  *
  */
 public function process()
 {
     if ($this->processed) {
         return;
     }
     $this->processed = true;
     foreach ($this->generateData() as $k => $v) {
         $this->data[$k] = $v;
     }
     $this->update();
     $o = new \CIBlock();
     $mesages = $this->messages();
     $o->SetMessages($this->getId(), $mesages);
     $fields = $this->fields();
     $o->SetFields($this->getId(), $fields);
     $props = $this->loadProperties();
     $newProps = $this->properties();
     foreach ($this->urlsProps() as $key => $data) {
         $newProps[$key] = $data;
     }
     $o = new \CIBlockProperty();
     foreach ($props as $prop => $data) {
         if (!isset($newProps[$prop])) {
             $o->Delete($data['ID']);
         }
     }
     foreach ($newProps as $prop => $data) {
         $data['CODE'] = $prop;
         if ($data['PROPERTY_TYPE'] == 'E' || $data['PROPERTY_TYPE'] == 'G') {
             if (!isset($data['LINK_IBLOCK_ID'])) {
                 if (isset($data['LINK_IBLOCK_CODE'])) {
                     $data['LINK_IBLOCK_ID'] = self::codeToId($data['LINK_IBLOCK_CODE']);
                 }
             }
         }
         if (isset($props[$prop])) {
             $id = $props[$prop]['ID'];
             $o->Update($id, $data);
         } else {
             $data['IBLOCK_ID'] = $this->getId();
             $id = $o->Add($data);
         }
         if ($data['PROPERTY_TYPE'] == 'L' && isset($data['ITEMS']) && is_array($data['ITEMS'])) {
             $items = array();
             $newItems = $data['ITEMS'];
             $res = \CIBlockPropertyEnum::GetList(array(), array('PROPERTY_ID' => $id, 'CHECK_PERMISSIONS' => 'N'));
             while ($row = $res->Fetch()) {
                 $iid = $row['ID'];
                 $eid = $row['EXTERNAL_ID'];
                 if (!isset($newItems[$eid])) {
                     \CIBlockPropertyEnum::Delete($iid);
                 } else {
                     $items[$eid] = $row;
                 }
             }
             $eo = new \CIBlockPropertyEnum();
             foreach ($newItems as $eid => $edata) {
                 if (is_string($edata)) {
                     $edata = array('VALUE' => $edata);
                 }
                 $edata['PROPERTY_ID'] = $id;
                 $edata['EXTERNAL_ID'] = $eid;
                 $edata['XML_ID'] = $eid;
                 if (isset($items[$eid])) {
                     $eo->Update($items[$eid]['ID'], $edata);
                 } else {
                     $eo->Add($edata);
                 }
             }
         }
     }
 }
开发者ID:techart,项目名称:bitrix.tao,代码行数:75,代码来源:infoblock.php

示例14: array

     </form>
     <?
     break;
 case 2:
     $PROPERTY_ID = $_REQUEST['PROPERTY_ID'];
     $IBLOCK_ID = $_REQUEST['IBLOCK_ID'];
     $arFields = array("PROPERTY_TYPE" => "L");
     foreach($_SESSION['PROP_VALUES_UNIQUE'] as $value) {
         $arFields["VALUES"][] = array(
             "VALUE" => $value,
             "DEF" => "N",
             "SORT" => "100"
        );   
     } 
     $ibp = new CIBlockProperty;
     if(!$ibp->Update($PROPERTY_ID, $arFields)) { 
         ShowError($ibp->LAST_ERROR);
     } else {
         $db_enum_list = CIBlockProperty::GetPropertyEnum($PROPERTY_ID, Array(), Array("IBLOCK_ID" => $IBLOCK_ID));
         while($ar_enum_list = $db_enum_list->GetNext()) {
             $propNameToId[$ar_enum_list['VALUE']] = $ar_enum_list['ID'];
         }
         foreach($_SESSION['PROP_VALUES'] as $elementId => $value) {
             CIBlockElement::SetPropertyValuesEx($elementId, $IBLOCK_ID, array($PROPERTY_ID => $propNameToId[$value]));
         } 
     } 
     echo 'Готово'; 
     break;
 default: ?>
     <script>
         $(function () {
开发者ID:ASDAFF,项目名称:bitrix-modules-iblocktools,代码行数:31,代码来源:iblocktools_strptops_to_list.php

示例15: foreach

         }
         foreach ($arID as $id) {
             if (strlen($id) <= 0) {
                 continue;
             }
             switch ($action) {
                 case "delete":
                     if (!CIBlockProperty::Delete($id)) {
                         $errorMsg .= GetMessage("CRM_PRODUCT_PROP_PL_DELETE_ERROR", array("#ID#" => $id)) . '<br>';
                     }
                     break;
                 case "activate":
                 case "deactivate":
                     $ibp = new CIBlockProperty();
                     $arFields = array("ACTIVE" => $action == "activate" ? "Y" : "N");
                     if (!$ibp->Update($id, $arFields)) {
                         $errorMsg .= GetMessage("CRM_PRODUCT_PROP_PL_SAVE_ERROR", array("#ID#" => $id, "#ERROR_TEXT#" => $ibp->LAST_ERROR)) . '<br>';
                     }
                     break;
             }
         }
     }
 }
 if (!empty($errorMsg)) {
     ShowError($errorMsg);
 }
 unset($_GET['ID'], $_POST['ID'], $_REQUEST['ID']);
 // otherwise the filter will work
 /*if(!isset($_POST['AJAX_CALL']))
 	{
 		LocalRedirect($APPLICATION->GetCurPage());
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


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