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


PHP CIBlockPropertyEnum::Add方法代码示例

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


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

示例1: _applyPropertyListTypeValues

 private function _applyPropertyListTypeValues($id, $values)
 {
     $addValues = array();
     $updateValues = array();
     $useValuesIds = array();
     foreach ($values as $value) {
         $value['PROPERTY_ID'] = $id;
         try {
             $value['ID'] = $this->getReferenceController()->getItemCurrentVersionByReference($value['~reference'])->id;
             $useValuesIds[] = $value['ID'];
             $updateValues[] = $value;
         } catch (\Exception $e) {
             $addValues[] = $value;
         }
     }
     $currentValues = PropertyEnumerationTable::getList(array('filter' => array('=PROPERTY_ID' => $id)))->fetchAll();
     foreach ($currentValues as $value) {
         !in_array($value['ID'], $useValuesIds) && PropertyEnumerationTable::delete(array('ID' => $value['ID'], 'PROPERTY_ID' => $value['PROPERTY_ID']));
     }
     foreach ($addValues as $value) {
         unset($value['ID']);
         unset($value['~reference']);
         $enum = new \CIBlockPropertyEnum();
         $enumElementId = $enum->Add($value);
         if (!$enumElementId) {
             throw new \Exception('Add property list value. Property not save. ' . var_export($value, true));
         }
         $result = PropertyEnumerationTable::update(array('ID' => $enumElementId, 'PROPERTY_ID' => $value['PROPERTY_ID']), $value);
         if (!$result->isSuccess()) {
             throw new \Exception('Add property list value in table. Property not save. ' . var_export($result->getErrorMessages(), true));
         }
         $referenceItem = new ReferenceItem();
         $referenceItem->id = $enumElementId;
         $referenceItem->group = ReferenceController::GROUP_IBLOCK_PROPERTY_LIST_VALUES;
         $referenceItem->reference = $value['~reference'];
         $this->getReferenceController()->registerItem($referenceItem);
     }
     foreach ($updateValues as $value) {
         $vId = $value['ID'];
         unset($value['ID']);
         unset($value['~reference']);
         $result = PropertyEnumerationTable::update(array('ID' => $vId, 'PROPERTY_ID' => $value['PROPERTY_ID']), $value);
         if (!$result->isSuccess()) {
             throw new \Exception('Update property list value. Property not save. ' . var_export($result->getErrorMessages(), true));
         }
     }
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:47,代码来源:iblockpropertyhandler.php

示例2: getPropertyEnumValueId

/**
 * Тип свойства - список
 * По коду и значению свойства получить id этого значения
 * В случае отсутствия, значение будет создано и будет возвращен его id
 *
 * <code>
 * $propertyCountryValue = getPropertyEnumValueId($IBLOCK_ID, 'COUNTRIES', 'Япония');
 * $be = new CIBlockElement;
 * $be->Add(array(
 *    "ACTIVE" => 'Y',
 *    "IBLOCK_ID" => $IBLOCK_ID,
 *    "NAME" => $name,
 *    "PROPERTY_VALUES" => array(
 *       'COUNTRIES' => $propertyCountryValue,
 *    )
 *  );
 * </code>
 * @param $IBLOCK_ID int id инфоблока, в котором находится данное свойство
 * @param $prop string код свойства
 * @param $value string значение свойства
 * @return bool|int ID значения свойства или false, если не удалось найти свойство с таким кодом или не удалось создать запись с данным значением
 */
function getPropertyEnumValueId($IBLOCK_ID, $prop, $value)
{
    $property = CIBlockProperty::GetByID($prop, $IBLOCK_ID)->Fetch();
    if (!$property) {
        return false;
    }
    $ar_enum_list = CIBlockProperty::GetPropertyEnum($prop, array("SORT" => "asc"), array("IBLOCK_ID" => $IBLOCK_ID, 'VALUE' => $value))->Fetch();
    if (!$ar_enum_list) {
        $ibpenum = new CIBlockPropertyEnum();
        if ($PropID = $ibpenum->Add(array('PROPERTY_ID' => $property['ID'], 'VALUE' => $value))) {
            $ar_enum_list['ID'] = $PropID;
        } else {
            return false;
        }
    }
    return $ar_enum_list['ID'];
}
开发者ID:ASDAFF,项目名称:Bitrix,代码行数:39,代码来源:iblockElementProperties.php

示例3: isset

         }
         $arRes[$i] = isset($arProductCache[$arRes[$i]]) ? $arProductCache[$arRes[$i]] : '';
     }
 } elseif ($arIBlockProperty[$cur_prop_id]["PROPERTY_TYPE"] == "L") {
     $arRes[$i] = trim($arRes[$i]);
     if ('' !== $arRes[$i]) {
         $propValueHash = md5($arRes[$i]);
         if (!isset($arPropertyListCache[$cur_prop_id])) {
             $arPropertyListCache[$cur_prop_id] = array();
             $propEnumRes = CIBlockPropertyEnum::GetList(array('SORT' => 'ASC', 'VALUE' => 'ASC'), array('IBLOCK_ID' => $IBLOCK_ID, 'PROPERTY_ID' => $arIBlockProperty[$cur_prop_id]['ID']));
             while ($propEnumValue = $propEnumRes->Fetch()) {
                 $arPropertyListCache[$cur_prop_id][md5($propEnumValue['VALUE'])] = $propEnumValue['ID'];
             }
         }
         if (!isset($arPropertyListCache[$cur_prop_id][$propValueHash])) {
             $arPropertyListCache[$cur_prop_id][$propValueHash] = CIBlockPropertyEnum::Add(array("PROPERTY_ID" => $arIBlockProperty[$cur_prop_id]['ID'], "VALUE" => $arRes[$i], "TMP_ID" => $tmpid));
         }
         if (isset($arPropertyListCache[$cur_prop_id][$propValueHash])) {
             $arRes[$i] = $arPropertyListCache[$cur_prop_id][$propValueHash];
         } else {
             $arRes[$i] = '';
         }
     }
 } elseif ($arIBlockProperty[$cur_prop_id]["PROPERTY_TYPE"] == "F") {
     if (preg_match("/^(http|https):\\/\\//", $arRes[$i])) {
         $arRes[$i] = CFile::MakeFileArray($arRes[$i]);
     } else {
         $arRes[$i] = CFile::MakeFileArray($io->GetPhysicalName($_SERVER["DOCUMENT_ROOT"] . $PATH2IMAGE_FILES . '/' . $arRes[$i]));
     }
     if (!is_array($arRes[$i]) || !array_key_exists("tmp_name", $arRes[$i])) {
         $arRes[$i] = '';
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:csv_new_run.php

示例4: CheckManufacturer

 function CheckManufacturer($xml)
 {
     $propertyId = $this->PROPERTY_MAP["CML2_MANUFACTURER"];
     $enumXmlId = $xml[$this->mess["IBLOCK_XML2_ID"]];
     $enumName = $xml[$this->mess["IBLOCK_XML2_NAME"]];
     $enumValue = CIBlockPropertyEnum::GetList(array(), array("PROPERTY_ID" => $propertyId, "XML_ID" => $enumXmlId));
     $enum = $enumValue->Fetch();
     if ($enum) {
         if ($enum["VALUE"] !== $enumName) {
             CIBlockPropertyEnum::Update($enum["ID"], array("VALUE" => $enumName));
         }
         return $enum["ID"];
     } else {
         return CIBlockPropertyEnum::Add(array("VALUE" => $enumName, "PROPERTY_ID" => $propertyId, "DEF" => "N", "XML_ID" => $enumXmlId));
     }
 }
开发者ID:nycmic,项目名称:bittest,代码行数:16,代码来源:cml2.php

示例5: intval

 $cur_prop_id = intval(substr(${"field_" . $i}, 7));
 if (!is_set($arIBlockProperty, $cur_prop_id)) {
     $res1 = CIBlockProperty::GetByID($cur_prop_id, $IBLOCK_ID);
     if ($arRes1 = $res1->Fetch()) {
         $arIBlockProperty[$cur_prop_id] = $arRes1;
     } else {
         $arIBlockProperty[$cur_prop_id] = array();
     }
 }
 if (is_array($arIBlockProperty[$cur_prop_id]) && count($arIBlockProperty[$cur_prop_id]) > 0) {
     if ($arIBlockProperty[$cur_prop_id]["PROPERTY_TYPE"] == "L") {
         $res2 = CIBlockProperty::GetPropertyEnum($cur_prop_id, array(), array("IBLOCK_ID" => $IBLOCK_ID, "VALUE" => Trim($arRes[$i])));
         if ($arRes2 = $res2->Fetch()) {
             $arRes[$i] = $arRes2["ID"];
         } else {
             $arRes[$i] = CIBlockPropertyEnum::Add(array("PROPERTY_ID" => $cur_prop_id, "VALUE" => Trim($arRes[$i]), "TMP_ID" => $tmpid));
         }
     } elseif ($arIBlockProperty[$cur_prop_id]["PROPERTY_TYPE"] == "F") {
         if (preg_match("/^(http|https):\\/\\//", $arRes[$i])) {
             $arRes[$i] = CFile::MakeFileArray($arRes[$i]);
         } else {
             $arRes[$i] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . $PATH2IMAGE_FILES . $arRes[$i]);
         }
         if (!is_array($arRes[$i]) || !isset($arRes[$i]["tmp_name"])) {
             $arRes[$i] = '';
         }
     }
     if ($arIBlockProperty[$cur_prop_id]["MULTIPLE"] == "Y") {
         if (!isset($arIBlockPropertyValue[$PRODUCT_ID][$cur_prop_id]) || !is_array($arIBlockPropertyValue[$PRODUCT_ID][$cur_prop_id]) || !in_array(Trim($arRes[$i]), $arIBlockPropertyValue[$PRODUCT_ID][$cur_prop_id])) {
             $arIBlockPropertyValue[$PRODUCT_ID][$cur_prop_id][] = is_array($arRes[$i]) ? $arRes[$i] : Trim($arRes[$i]);
         }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:csv_new_run.php

示例6: CheckManufacturer

	function CheckManufacturer($xml)
	{
		$propertyId = $this->PROPERTY_MAP["CML2_MANUFACTURER"];
		$enumXmlId = $xml[GetMessage("IBLOCK_XML2_ID")];
		$enumValue = CIBlockPropertyEnum::GetList(array(), array(
			"PROPERTY_ID" => $propertyId,
			"XML_ID" => $enumXmlId,
		));
		$enum = $enumValue->Fetch();

		if ($enum)
		{
			return $enum["ID"];
		}
		else
		{
			return CIBlockPropertyEnum::Add(array(
				"VALUE" => $xml[GetMessage("IBLOCK_XML2_NAME")],
				"PROPERTY_ID" => $propertyId,
				"DEF" => "N",
				"XML_ID" => $enumXmlId,
			));
		}
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:24,代码来源:cml2.php

示例7: MapEnum

 function MapEnum($prop_id, $value)
 {
     static $arEnumCache = array();
     if (is_array($value)) {
         foreach ($value as $k => $v) {
             $value[$k] = $this->MapEnum($prop_id, $v);
         }
     } else {
         if (!isset($arEnumCache[$prop_id])) {
             $arEnumCache[$prop_id] = array();
         }
         if (array_key_exists($value, $arEnumCache[$prop_id])) {
             $value = $arEnumCache[$prop_id][$value];
         } else {
             $res2 = CIBlockProperty::GetPropertyEnum($prop_id, array(), array("IBLOCK_ID" => $this->IBLOCK_ID, "VALUE" => $value));
             if ($arRes2 = $res2->Fetch()) {
                 $value = $arEnumCache[$prop_id][$value] = $arRes2["ID"];
             } else {
                 $value = $arEnumCache[$prop_id][$value] = CIBlockPropertyEnum::Add(array("PROPERTY_ID" => $prop_id, "VALUE" => $value, "TMP_ID" => $this->tmpid));
             }
         }
     }
     return $value;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:24,代码来源:data_import.php

示例8: addPropEnum

 private function addPropEnum($iblock_id, $prop_id, $value)
 {
     $obPropEnum = new CIBlockPropertyEnum();
     $prop_id = $obPropEnum->Add(array('PROPERTY_ID' => $prop_id, 'VALUE' => $value));
     if ($prop_id) {
         return $prop_id;
     } else {
         $this->redError("Не удалось добавить значение: {$value} свойства №{$prop_id} для инфоблока {$iblock_id}");
     }
     return false;
 }
开发者ID:HannibalLecktor,项目名称:alfa74,代码行数:11,代码来源:parser.php

示例9: Array

						$arFields = Array(
							"DEF"=>$PROP_ENUM_DEF,
							"TMP_ID"=>$tmpid,
							"VALUE"=>$PROP_ENUM_NAME,
							"PROPERTY_ID"=>$PROP_ID,
							"XML_ID"=>$PROP_ENUM_XML_ID
						);
						$res = CIBlockPropertyEnum::GetList(array(), Array("PROPERTY_ID"=>$PROP_ID, "XML_ID"=>$PROP_ENUM_XML_ID));
						if($arr = $res->Fetch())
						{
							$PROP_ENUM_ID = $arr["ID"];
							$pren->Update($PROP_ENUM_ID, $arFields);
						}
						else
						{
							$PROP_ENUM_ID = $pren->Add($arFields);
						}
						$arPropertiesEnum[$PROP_XML_ID][$PROP_ENUM_XML_ID] = $PROP_ENUM_ID;
					}
				}
			}

			if (function_exists("catalog_property_mutator_1c"))
				catalog_property_mutator_1c();

			$arGrTmp = array();
			$groups = $xCatNode->select_nodes("/".$nameUTF['Category']);
			for ($j = 0, $intGroupCount = count($groups); $j < $intGroupCount; $j++)
			{
				$xGroupNode = $groups[$j];
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:30,代码来源:commerceml_run.php

示例10: array_filter

         $variants[] = $property['VALUE'];
     }
 }
 $variants = array_filter(array_unique($variants));
 asort($variants);
 $prop = new CIBlockProperty();
 $prop->Update($idProperty, array('PROPERTY_TYPE' => $type));
 $propertyData = CIBlockProperty::GetByID($idProperty, $idIBlock)->Fetch();
 $list = array();
 switch ($type) {
     case "L":
         // list
         /** @var CDatabase $DB */
         global $DB;
         foreach ($variants as $variant) {
             $lastId = $list[$variant] = CIBlockPropertyEnum::Add(array('PROPERTY_ID' => $idProperty, 'VALUE' => $variant));
             if (!$lastId) {
                 throw new Exception($DB->db_Error);
             }
         }
         break;
     case "E":
         // Привязка к элементу
         $arSourceIblockData = CIBlock::GetArrayByID($idIBlock);
         $sites = array();
         $rsSites = \Bitrix\Main\SiteTable::getList();
         while ($arSite = $rsSites->fetch()) {
             $sites[] = $arSite['LID'];
         }
         $iblock = new CIBlock();
         $handbookIblockId = $iblock->Add(array("ACTIVE" => 'Y', "NAME" => $propertyData['NAME'], "SITE_ID" => $sites, "IBLOCK_TYPE_ID" => $arSourceIblockData['IBLOCK_TYPE_ID']));
开发者ID:Under5,项目名称:bitrix-module-tools,代码行数:31,代码来源:conversion.php

示例11: ImportPropsFromXML

 public static function ImportPropsFromXML($BID, $xmlPath, &$arOldNewID)
 {
     if (file_exists($xmlPath) && $BID && CModule::IncludeModule('iblock')) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/classes/general/xml.php';
         $arExistProps = array();
         $rsProp = CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $BID));
         while ($arProp = $rsProp->Fetch()) {
             $arExistProps[$arProp['CODE']] = $arProp;
         }
         $arExistEnums = array();
         $rsEnum = CIBlockPropertyEnum::GetList(array(), array('IBLOCK_ID' => $BID));
         while ($arEnum = $rsEnum->Fetch()) {
             $arExistEnums[$arEnum['PROPERTY_ID'] . '_' . $arEnum['XML_ID']] = $arEnum;
         }
         $arOldNewID = array();
         $xml = new CDataXML();
         $ep = new CIBlockProperty();
         $en = new CIBlockPropertyEnum();
         if ($xml->Load($xmlPath)) {
             if ($node = $xml->SelectNodes('/asd_iblock_props/props/')) {
                 foreach ($node->children() as $child) {
                     $arProp = array_pop($child->__toArray());
                     $arFields = array('IBLOCK_ID' => $BID);
                     foreach ($arProp as $code => $v) {
                         $arFields[strtoupper($code)] = is_array($v[0]['#']['cdata-section']) ? $v[0]['#']['cdata-section'][0]['#'] : $v[0]['#'];
                     }
                     if (isset($arExistProps[$arFields['CODE']])) {
                         $arOldNewID[$arFields['OLD_ID']] = $arExistProps[$arFields['CODE']]['ID'];
                         $ep->Update($arExistProps[$arFields['CODE']]['ID'], $arFields);
                     } else {
                         $arOldNewID[$arFields['OLD_ID']] = $arFields['ID'] = $ep->Add($arFields);
                         $arExistProps[$arFields['CODE']] = $arFields;
                     }
                 }
             }
             if ($node = $xml->SelectNodes('/asd_iblock_props/enums/')) {
                 foreach ($node->children() as $child) {
                     $arProp = array_pop($child->__toArray());
                     $arFields = array('IBLOCK_ID' => $BID);
                     foreach ($arProp as $code => $v) {
                         $arFields[strtoupper($code)] = is_array($v[0]['#']['cdata-section']) ? $v[0]['#']['cdata-section'][0]['#'] : $v[0]['#'];
                     }
                     $arFields['PROPERTY_ID'] = $arExistProps[$arFields['PROPERTY_CODE']]['ID'];
                     if (isset($arExistEnums[$arFields['PROPERTY_ID'] . '_' . $arFields['XML_ID']])) {
                         $en->Update($arExistEnums[$arFields['PROPERTY_ID'] . '_' . $arFields['XML_ID']]['ID'], $arFields);
                     } else {
                         $en->Add($arFields);
                     }
                 }
             }
         }
     }
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:53,代码来源:iblock_tools.php

示例12: UpdatePropertyList

 public static function UpdatePropertyList($prop_id, $list)
 {
     foreach ($list as $id => $arEnum) {
         $value = trim($arEnum["VALUE"], " \t\n\r");
         if (strlen($value)) {
             $dbEnum = CIBlockPropertyEnum::GetByID($id);
             if (is_array($dbEnum)) {
                 $def = isset($arEnum["DEF"]) ? $arEnum["DEF"] : $dbEnum["DEF"];
                 $sort = intval($arEnum["SORT"]);
                 if ($dbEnum["VALUE"] != $value || $dbEnum["SORT"] != $sort || $dbEnum["DEF"] != $def) {
                     $dbEnum["VALUE"] = $value;
                     $dbEnum["SORT"] = $sort;
                     $dbEnum["DEF"] = $def;
                     unset($dbEnum["ID"]);
                     CIBlockPropertyEnum::Update($id, $dbEnum);
                 }
             } else {
                 $arEnum["PROPERTY_ID"] = $prop_id;
                 CIBlockPropertyEnum::Add($arEnum);
             }
         } else {
             CIBlockPropertyEnum::Delete($id);
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:25,代码来源:list.php

示例13: ImportSyncTimeCard

 private function ImportSyncTimeCard($xml)
 {
     $absenceTypePropertyId = 0;
     $rsProperty = CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $this->ABSENCE_IBLOCK_ID, 'CODE' => 'ABSENCE_TYPE'));
     if ($arProperty = $rsProperty->Fetch()) {
         $absenceTypePropertyId = $arProperty['ID'];
     }
     if ($absenceTypePropertyId > 0) {
         $db_enum_list = CIBlockProperty::GetPropertyEnum($absenceTypePropertyId, array(), array('IBLOCK_ID' => $this->ABSENCE_IBLOCK_ID));
         $arStates = array();
         while ($ar_enum_list = $db_enum_list->GetNext()) {
             $arStates[$ar_enum_list['XML_ID']] = array('ID' => $ar_enum_list['ID'], 'NAME' => $ar_enum_list['VALUE']);
         }
     }
     $obElement =& $this->__element;
     foreach ($xml->TimeCard as $timeCard) {
         if (isset($timeCard->ReportedResource)) {
             $personID = $this->GetPersonGUID($timeCard->ReportedResource->SpecifiedPerson->PersonID);
             $arUserFields = array('XML_ID' => $this->FindUserByPersonID($personID), 'ACTIVE' => 'Y');
             if (empty($arUserFields['XML_ID'])) {
                 $this->warnings[] = str_replace('#ID#', $personID, GetMessage('IBLOCK_HR_USER_NOT_FOUND'));
                 continue;
             }
             $arTimePROP = array();
             $rsUser = CUser::GetList($by = "ID", $order = "desc", $arUserFields, array('FIELDS' => array('ID')));
             if ($arUser = $rsUser->fetch()) {
                 $arTimePROP['USER'] = $arUser['ID'];
             } else {
                 continue;
             }
             foreach ($timeCard->TimeCardReportedItem as $timeItem) {
                 if ($absenceTypePropertyId > 0 && isset($timeItem->TimeInterval->TimeIntervalTypeCode)) {
                     $timeIntervalTypeCode = (string) $timeItem->TimeInterval->TimeIntervalTypeCode;
                     if (array_key_exists($timeIntervalTypeCode, $arStates)) {
                         $arTimePROP['ABSENCE_TYPE'] = $arStates[$timeIntervalTypeCode]['ID'];
                     } else {
                         $ibpenum = new CIBlockPropertyEnum();
                         $attr = $timeItem->TimeInterval->TimeIntervalTypeCode->attributes();
                         $attr = (array) $attr;
                         $attr = array_shift($attr);
                         $arFields = array('PROPERTY_ID' => $absenceTypePropertyId, 'VALUE' => $attr['name'], 'XML_ID' => $timeIntervalTypeCode);
                         $arFields = $this->ConvertCharset($arFields);
                         if ($PropID = $ibpenum->Add($arFields)) {
                             $arTimePROP['ABSENCE_TYPE'] = $PropID;
                             $arStates[$timeIntervalTypeCode] = array('ID' => $PropID, 'NAME' => $arFields['VALUE']);
                         }
                     }
                 }
                 $arTimeRecord = array('ACTIVE' => 'Y', 'IBLOCK_ID' => $this->ABSENCE_IBLOCK_ID, 'PROPERTY_VALUES' => $arTimePROP, 'ACTIVE_FROM' => explode('-', (string) $timeItem->TimeInterval->FreeFormEffectivePeriod->StartDate->FormattedDateTime), 'ACTIVE_TO' => explode('-', (string) $timeItem->TimeInterval->FreeFormEffectivePeriod->EndDate->FormattedDateTime));
                 $arTimeRecord['ACTIVE_FROM'] = $arTimeRecord['ACTIVE_FROM'][2] . '.' . $arTimeRecord['ACTIVE_FROM'][1] . '.' . $arTimeRecord['ACTIVE_FROM'][0];
                 $arTimeRecord['ACTIVE_TO'] = $arTimeRecord['ACTIVE_TO'][2] . '.' . $arTimeRecord['ACTIVE_TO'][1] . '.' . $arTimeRecord['ACTIVE_TO'][0];
                 $arTimeRecord = $this->ConvertCharset($arTimeRecord);
                 $arTimeRecord['NAME'] = $arStates[$timeIntervalTypeCode]['NAME'];
                 $result = $obElement->Add($arTimeRecord);
             }
         }
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:hrxml.php

示例14: 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


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