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


PHP CIBlockProperty::GetPropertyEnum方法代码示例

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


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

示例1: getOptions

 public function getOptions()
 {
     if (!isset($this->options)) {
         $res = \CIBlockProperty::GetPropertyEnum($this->data['ID'], array("SORT" => "asc"), array());
         while ($row = $res->Fetch()) {
             $this->options[] = $row;
         }
     }
     return $this->options;
 }
开发者ID:ASDAFF,项目名称:bitrix_lib,代码行数:10,代码来源:Property.class.php

示例2: getIblockPropertyEnumId

 /**
  * Получить ID значения свойства типа "список" у инфоблока
  *
  * @param string $iblockCode
  * @param string $propertyCode
  * @param string $enumCode
  * @return int|bool
  */
 public static function getIblockPropertyEnumId($iblockCode, $propertyCode, $enumCode)
 {
     if (!empty(self::$iblockPropertyEnumId[$iblockCode][$propertyCode][$enumCode])) {
         return self::$iblockPropertyEnumId[$iblockCode][$propertyCode][$enumCode];
     }
     if (!($iblockId = self::getIblockId($iblockCode))) {
         return false;
     }
     if ($enum = \CIBlockProperty::GetPropertyEnum($propertyCode, [], ['IBLOCK_ID' => $iblockId, 'EXTERNAL_ID' => $enumCode])->fetch()) {
         self::$iblockPropertyEnumId[$iblockCode][$propertyCode][$enumCode] = $enum['ID'];
         return $enum['ID'];
     }
     return false;
 }
开发者ID:notagency,项目名称:notagency.base,代码行数:22,代码来源:iblocktools.php

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

示例4: getPropertyEnum

	/**
	 * Получает значиния свойства типа Список
	 *
	 * @param $code
	 * @param string $iblockID
	 * @param string $valueID
	 * @return array
	 */
	public static function getPropertyEnum($code, $iblockID = '', $valueID = '')
	{
		if (intval($iblockID) > 0) {
			$arFilter = array('IBLOCK_ID' => $iblockID);
		}

		if (intval($iblockID) > 0) {
			$arFilter['ID'] = $valueID;
		}

		$result = array();

		$rsPropertyEnum = CIBlockProperty::GetPropertyEnum(
			$code,
			array('sort' => 'asc'),
			$arFilter
		);
		while($arPropertyEnum = $rsPropertyEnum->GetNext()) {
			$result[] = $arPropertyEnum;
		}

		return $result;
	}
开发者ID:rocko61rus,项目名称:magazzz,代码行数:31,代码来源:IBlockHelper.php

示例5: ExportProperties

	function ExportProperties(&$PROPERTY_MAP)
	{
		$PROPERTY_MAP = array();

		fwrite($this->fp, "\t\t<".GetMessage("IBLOCK_XML2_PROPERTIES").">\n");

		if($this->bExtended)
		{
			$arElementFields = array(
				"CML2_ACTIVE" => GetMessage("IBLOCK_XML2_BX_ACTIVE"),
				"CML2_CODE" => GetMessage("IBLOCK_XML2_SYMBOL_CODE"),
				"CML2_SORT" => GetMessage("IBLOCK_XML2_SORT"),
				"CML2_ACTIVE_FROM" => GetMessage("IBLOCK_XML2_START_TIME"),
				"CML2_ACTIVE_TO" => GetMessage("IBLOCK_XML2_END_TIME"),
				"CML2_PREVIEW_TEXT" => GetMessage("IBLOCK_XML2_ANONS"),
				"CML2_DETAIL_TEXT" => GetMessage("IBLOCK_XML2_DETAIL"),
				"CML2_PREVIEW_PICTURE" => GetMessage("IBLOCK_XML2_PREVIEW_PICTURE"),
			);

			foreach($arElementFields as $key => $value)
				fwrite($this->fp, $this->formatXMLNode(3, GetMessage("IBLOCK_XML2_PROPERTY"), array(
					GetMessage("IBLOCK_XML2_ID") => $key,
					GetMessage("IBLOCK_XML2_NAME") => $value,
					GetMessage("IBLOCK_XML2_MULTIPLE") => "false",
				)));
		}

		$arFilter = array(
			"IBLOCK_ID" => $this->arIBlock["ID"],
			"ACTIVE" => "Y",
		);
		$arSort = array(
			"sort" => "asc",
		);

		$obProp = new CIBlockProperty();
		$rsProp = $obProp->GetList($arSort, $arFilter);
		while($arProp = $rsProp->Fetch())
		{
			fwrite($this->fp, "\t\t\t<".GetMessage("IBLOCK_XML2_PROPERTY").">\n");

			$xml_id = $this->GetPropertyXML_ID($this->arIBlock["ID"], $arProp["NAME"], $arProp["ID"], $arProp["XML_ID"]);
			$PROPERTY_MAP[$arProp["ID"]] = $xml_id;
			fwrite($this->fp, $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_ID"), $xml_id));

			fwrite($this->fp, $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_NAME"), $arProp["NAME"]));
			fwrite($this->fp, $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_MULTIPLE"), ($arProp["MULTIPLE"]=="Y"? "true": "false")));
			if($arProp["PROPERTY_TYPE"]=="L")
			{
				fwrite($this->fp, "\t\t\t\t<".GetMessage("IBLOCK_XML2_CHOICE_VALUES").">\n");
				$rsEnum = CIBlockProperty::GetPropertyEnum($arProp["ID"]);
				while($arEnum = $rsEnum->Fetch())
				{
					fwrite($this->fp, $this->formatXMLNode(5, GetMessage("IBLOCK_XML2_VALUE"), $arEnum["VALUE"]));
					if($this->bExtended)
					{
						fwrite($this->fp,
							"\t\t\t\t\t<".GetMessage("IBLOCK_XML2_CHOICE").">\n"
							.$this->formatXMLNode(6, GetMessage("IBLOCK_XML2_ID"), $arEnum["XML_ID"])
							.$this->formatXMLNode(6, GetMessage("IBLOCK_XML2_VALUE"), $arEnum["VALUE"])
							.$this->formatXMLNode(6, GetMessage("IBLOCK_XML2_BY_DEFAULT"), ($arEnum["DEF"]=="Y"? "true": "false"))
							.$this->formatXMLNode(6, GetMessage("IBLOCK_XML2_SORT"), intval($arEnum["SORT"]))
							."\t\t\t\t\t</".GetMessage("IBLOCK_XML2_CHOICE").">\n"
						);
					}
				}
				fwrite($this->fp, "\t\t\t\t</".GetMessage("IBLOCK_XML2_CHOICE_VALUES").">\n");
			}

			if($this->bExtended)
			{
				fwrite($this->fp,
					$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_SORT"), intval($arProp["SORT"]))
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_CODE"), $arProp["CODE"])
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_PROPERTY_TYPE"), $arProp["PROPERTY_TYPE"])
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_ROWS"), $arProp["ROW_COUNT"])
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_COLUMNS"), $arProp["COL_COUNT"])
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_LIST_TYPE"), $arProp["LIST_TYPE"])
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_FILE_EXT"), $arProp["FILE_TYPE"])
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_FIELDS_COUNT"), $arProp["MULTIPLE_CNT"])
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_LINKED_IBLOCK"), $this->GetIBlockXML_ID($arProp["LINK_IBLOCK_ID"]))
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_WITH_DESCRIPTION"), ($arProp["WITH_DESCRIPTION"]=="Y"? "true": "false"))
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_SEARCH"), ($arProp["SEARCHABLE"]=="Y"? "true": "false"))
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_FILTER"), ($arProp["FILTRABLE"]=="Y"? "true": "false"))
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_USER_TYPE"), $arProp["USER_TYPE"])
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_IS_REQUIRED"), ($arProp["IS_REQUIRED"]=="Y"? "true": "false"))
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_DEFAULT_VALUE"), serialize($arProp["DEFAULT_VALUE"]))
					.$this->formatXMLNode(4, GetMessage("IBLOCK_XML2_SERIALIZED"), 1)
				);
			}
			fwrite($this->fp, "\t\t\t</".GetMessage("IBLOCK_XML2_PROPERTY").">\n");
		}
		fwrite($this->fp, "\t\t</".GetMessage("IBLOCK_XML2_PROPERTIES").">\n");

		if($this->bExtended)
		{
			$arPropLink = CIBlockSectionPropertyLink::GetArray($this->arIBlock["ID"], 0);
			foreach($arPropLink as $PID => $arLink)
				if($arLink["INHERITED"] != "N" || !array_key_exists($PID, $PROPERTY_MAP))
					unset($arPropLink[$PID]);
//.........这里部分代码省略.........
开发者ID:nProfessor,项目名称:Mytb,代码行数:101,代码来源:cml2.php

示例6: array

            }
            $arResult["arrProp"][$arProp["ID"]] = $arTemp;
        }
    }
    // offer properties
    if ($arResultModules['catalog']) {
        $arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($arParams["IBLOCK_ID"]);
        if (is_array($arOffersIBlock)) {
            $rsProp = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", "IBLOCK_ID" => $arOffersIBlock["OFFERS_IBLOCK_ID"]));
            while ($arProp = $rsProp->Fetch()) {
                if (in_array($arProp["CODE"], $arParams["OFFERS_PROPERTY_CODE"]) && $arProp["PROPERTY_TYPE"] != "F") {
                    $arTemp = array("CODE" => $arProp["CODE"], "NAME" => $arProp["NAME"], "PROPERTY_TYPE" => $arProp["PROPERTY_TYPE"], "MULTIPLE" => $arProp["MULTIPLE"]);
                    if ($arProp["PROPERTY_TYPE"] == "L") {
                        $arTemp['LIST_TYPE'] = $arProp['LIST_TYPE'];
                        $arrEnum = array();
                        $rsEnum = CIBlockProperty::GetPropertyEnum($arProp["ID"]);
                        while ($arEnum = $rsEnum->Fetch()) {
                            $arrEnum[$arEnum["ID"]] = $arEnum["VALUE"];
                        }
                        $arTemp["VALUE_LIST"] = $arrEnum;
                    }
                    $arResult["arrOfferProp"][$arProp["ID"]] = $arTemp;
                }
            }
        }
    }
    $arResult['MODULES'] = $arResultModules;
    $this->EndResultCache();
}
$arResult["FORM_ACTION"] = isset($_SERVER['REQUEST_URI']) ? htmlspecialcharsbx($_SERVER['REQUEST_URI']) : "";
$arResult["FILTER_NAME"] = $FILTER_NAME;
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:component.php

示例7: array

 $arFilter = array("IBLOCK_ID" => $arParams["BLOCK_ID"], "CHECK_BP_VIRTUAL_PERMISSIONS" => "read");
 $gridFilter = $gridOptions->GetFilter($arResult["FILTER"]);
 foreach ($gridFilter as $key => $value) {
     if (substr($key, -5) == "_from") {
         $op = ">=";
         $newKey = substr($key, 0, -5);
     } elseif (substr($key, -3) == "_to") {
         $op = "<=";
         $newKey = substr($key, 0, -3);
     } else {
         $op = "";
         $newKey = $key;
     }
     if (array_key_exists($newKey, $arDocumentFields) && $arDocumentFields[$newKey]["Filterable"]) {
         if ($arDocumentFields[$newKey]["BaseType"] == "select") {
             $db = CIBlockProperty::GetPropertyEnum(substr($newKey, strlen("PROPERTY_")), array(), array("XML_ID" => $value, "IBLOCK_ID" => $arParams["BLOCK_ID"]));
             while ($ar = $db->Fetch()) {
                 $value = $ar["ID"];
             }
         } elseif ($arDocumentFields[$newKey]["BaseType"] == "string" || $arDocumentFields[$newKey]["BaseType"] == "text") {
             if ($op == "") {
                 $op = "?";
             }
         } elseif ($arDocumentFields[$newKey]["BaseType"] == "user") {
             $value = CBPHelper::UsersStringToArray($value, $documentType, $arErrors);
             if (is_array($value) && count($value) > 0) {
                 $value = $value[0];
             }
             if (substr($value, 0, strlen("user_")) == "user_") {
                 $value = substr($value, strlen("user_"));
             }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例8: array

     $arProperty = array("ID" => $str_PROPERTY_ID, "ACTIVE" => $_POST["PROPERTY_ACTIVE"], "IBLOCK_ID" => $_POST["IBLOCK_ID"], "NAME" => $_POST["PROPERTY_NAME"], "SORT" => $_POST["PROPERTY_SORT"], "CODE" => $_POST["PROPERTY_CODE"], "MULTIPLE" => $_POST["PROPERTY_MULTIPLE"], "IS_REQUIRED" => $_POST["PROPERTY_IS_REQUIRED"], "SEARCHABLE" => $_POST["PROPERTY_SEARCHABLE"], "FILTRABLE" => $_POST["PROPERTY_FILTRABLE"], "WITH_DESCRIPTION" => $_POST["PROPERTY_WITH_DESCRIPTION"], "MULTIPLE_CNT" => $_POST["PROPERTY_MULTIPLE_CNT"], "HINT" => $_POST["PROPERTY_HINT"], "SECTION_PROPERTY" => $_POST["PROPERTY_SECTION_PROPERTY"], "SMART_FILTER" => $_POST["PROPERTY_SMART_FILTER"], "DISPLAY_TYPE" => $_POST["PROPERTY_DISPLAY_TYPE"], "DISPLAY_EXPANDED" => $_POST["PROPERTY_DISPLAY_EXPANDED"], "FILTER_HINT" => $_POST["PROPERTY_FILTER_HINT"], "ROW_COUNT" => $_POST["PROPERTY_ROW_COUNT"], "COL_COUNT" => $_POST["PROPERTY_COL_COUNT"], "DEFAULT_VALUE" => $_POST["PROPERTY_DEFAULT_VALUE"], "FILE_TYPE" => $_POST["PROPERTY_FILE_TYPE"]);
     if (isset($_POST["PROPERTY_PROPERTY_TYPE"])) {
         if (strpos($_POST["PROPERTY_PROPERTY_TYPE"], ":")) {
             list($arProperty["PROPERTY_TYPE"], $arProperty["USER_TYPE"]) = explode(':', $_POST["PROPERTY_PROPERTY_TYPE"], 2);
         } else {
             $arProperty["PROPERTY_TYPE"] = $_POST["PROPERTY_PROPERTY_TYPE"];
         }
     }
     if (!empty($arListValues)) {
         $arProperty["VALUES"] = $arListValues;
     }
 } elseif (is_array($arPropCheck)) {
     $arProperty = $arPropCheck;
     if ($arProperty['PROPERTY_TYPE'] == "L") {
         $arProperty['VALUES'] = array();
         $rsLists = CIBlockProperty::GetPropertyEnum($arProperty['ID'], array('SORT' => 'ASC', 'ID' => 'ASC'));
         while ($res = $rsLists->Fetch()) {
             $arProperty['VALUES'][$res["ID"]] = array('ID' => $res["ID"], 'VALUE' => $res["VALUE"], 'SORT' => $res['SORT'], 'XML_ID' => $res["XML_ID"], 'DEF' => $res['DEF']);
         }
     }
     $arPropLink = CIBlockSectionPropertyLink::GetArray($intIBlockID, 0);
     if (isset($arPropLink[$arProperty["ID"]])) {
         $arProperty["SECTION_PROPERTY"] = "Y";
         $arProperty["SMART_FILTER"] = $arPropLink[$arProperty["ID"]]["SMART_FILTER"] == 'Y' ? 'Y' : 'N';
         $arProperty["DISPLAY_TYPE"] = $arPropLink[$arProperty["ID"]]["DISPLAY_TYPE"];
         $arProperty["DISPLAY_EXPANDED"] = $arPropLink[$arProperty["ID"]]["DISPLAY_EXPANDED"] == 'Y' ? 'Y' : 'N';
         $arProperty["FILTER_HINT"] = $arPropLink[$arProperty["ID"]]["FILTER_HINT"];
     } else {
         $arProperty["SECTION_PROPERTY"] = "N";
         $arProperty["SMART_FILTER"] = "N";
         $arProperty["DISPLAY_TYPE"] = "";
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:iblock_edit_property.php

示例9: array

*/
$arTypesConfig = array('vendor.model' => array('vendor', 'vendorCode', 'model', 'manufacturer_warranty'), 'book' => array('author', 'publisher', 'series', 'year', 'ISBN', 'volume', 'part', 'language', 'binding', 'page_extent', 'table_of_contents'), 'audiobook' => array('author', 'publisher', 'series', 'year', 'ISBN', 'performed_by', 'performance_type', 'language', 'volume', 'part', 'format', 'storage', 'recording_length', 'table_of_contents'), 'artist.title' => array('title', 'artist', 'director', 'starring', 'originalName', 'country', 'year', 'media'));
$arTypesConfigKeys = array_keys($arTypesConfig);
$dbRes = CIBlockProperty::GetList(array('sort' => 'asc'), array('IBLOCK_ID' => $intIBlockID, 'ACTIVE' => 'Y'));
$arIBlock['PROPERTY'] = array();
$arIBlock['OFFERS_PROPERTY'] = array();
while ($arRes = $dbRes->Fetch()) {
    $arIBlock['PROPERTY'][$arRes['ID']] = $arRes;
}
if ($boolOffers) {
    $rsProps = CIBlockProperty::GetList(array('SORT' => 'ASC'), array('IBLOCK_ID' => $intOfferIBlockID, 'ACTIVE' => 'Y'));
    while ($arProp = $rsProps->Fetch()) {
        if ($arOffers['SKU_PROPERTY_ID'] != $arProp['ID']) {
            if ($arProp['PROPERTY_TYPE'] == 'L') {
                $arProp['VALUES'] = array();
                $rsPropEnums = CIBlockProperty::GetPropertyEnum($arProp['ID'], array('sort' => 'asc'), array('IBLOCK_ID' => $intOfferIBlockID));
                while ($arPropEnum = $rsPropEnums->Fetch()) {
                    $arProp['VALUES'][$arPropEnum['ID']] = $arPropEnum['VALUE'];
                }
            }
            $arIBlock['OFFERS_PROPERTY'][$arProp['ID']] = $arProp;
            if (in_array($arProp['PROPERTY_TYPE'], $arSelectedPropTypes)) {
                $arSelectOfferProps[] = $arProp['ID'];
            }
        }
    }
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (!empty($_REQUEST['save'])) {
        $arErrors = array();
        $arCurrency = array('RUB' => array('rate' => 1));
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:yandex_detail.php

示例10: CreateDocument

 /**
  * ћетод создает новый документ с указанными свойствами (пол¤ми).
  *
  * @param array $arFields - массив значений свойств документа в виде array(код_свойства => значение, ...).  оды свойств соответствуют кодам свойств, возвращаемым методом GetDocumentFields.
  * @return int - код созданного документа.
  */
 public function CreateDocument($parentDocumentId, $arFields)
 {
     if (!array_key_exists("IBLOCK_ID", $arFields) || intval($arFields["IBLOCK_ID"]) <= 0) {
         throw new Exception("IBlock ID is not found");
     }
     $arFieldsPropertyValues = array();
     $arDocumentFields = self::GetDocumentFields("iblock_" . $arFields["IBLOCK_ID"]);
     $arKeys = array_keys($arFields);
     foreach ($arKeys as $key) {
         if (!array_key_exists($key, $arDocumentFields)) {
             continue;
         }
         $arFields[$key] = is_array($arFields[$key]) && !CBPHelper::IsAssociativeArray($arFields[$key]) ? $arFields[$key] : array($arFields[$key]);
         if ($arDocumentFields[$key]["Type"] == "user") {
             $ar = array();
             foreach ($arFields[$key] as $v1) {
                 if (substr($v1, 0, strlen("user_")) == "user_") {
                     $ar[] = substr($v1, strlen("user_"));
                 } else {
                     $a1 = self::GetUsersFromUserGroup($v1, $documentId);
                     foreach ($a1 as $a11) {
                         $ar[] = $a11;
                     }
                 }
             }
             $arFields[$key] = $ar;
         } elseif ($arDocumentFields[$key]["Type"] == "select") {
             $realKey = substr($key, 0, strlen("PROPERTY_")) == "PROPERTY_" ? substr($key, strlen("PROPERTY_")) : $key;
             $arV = array();
             $db = CIBlockProperty::GetPropertyEnum($realKey, false, array("IBLOCK_ID" => $arFields["IBLOCK_ID"]));
             while ($ar = $db->GetNext()) {
                 $arV[$ar["XML_ID"]] = $ar["ID"];
             }
             foreach ($arFields[$key] as &$value) {
                 if (array_key_exists($value, $arV)) {
                     $value = $arV[$value];
                 }
             }
         } elseif ($arDocumentFields[$key]["Type"] == "file") {
             foreach ($arFields[$key] as &$value) {
                 $value = CFile::MakeFileArray($value);
             }
         } elseif ($arDocumentFields[$key]["Type"] == "S:HTML") {
             foreach ($arFields[$key] as &$value) {
                 $value = array("VALUE" => $value);
             }
         }
         if (!$arDocumentFields[$key]["Multiple"] && is_array($arFields[$key])) {
             if (count($arFields[$key]) > 0) {
                 $a = array_values($arFields[$key]);
                 $arFields[$key] = $a[0];
             } else {
                 $arFields[$key] = null;
             }
         }
         if (substr($key, 0, strlen("PROPERTY_")) == "PROPERTY_") {
             $realKey = substr($key, strlen("PROPERTY_"));
             $arFieldsPropertyValues[$realKey] = is_array($arFields[$key]) && !CBPHelper::IsAssociativeArray($arFields[$key]) ? $arFields[$key] : array($arFields[$key]);
             unset($arFields[$key]);
         }
     }
     if (count($arFieldsPropertyValues) > 0) {
         $arFields["PROPERTY_VALUES"] = $arFieldsPropertyValues;
     }
     $iblockElement = new CIBlockElement();
     $id = $iblockElement->Add($arFields, false, true, true);
     if (!$id || $id <= 0) {
         throw new Exception($iblockElement->LAST_ERROR);
     }
     return $id;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:77,代码来源:iblockdocument.php

示例11: while

 while ($price = $rsPrice->Fetch()) {
     $arPrices[] = $price;
     $arHeaders[] = array("id" => "PRICE" . $price["ID"], "content" => htmlspecialcharsex(!empty($price["NAME_LANG"]) ? $price["NAME_LANG"] : $price["NAME"]), "default" => $price["BASE"] == 'Y' ? true : false);
 }
 $arHeaders[] = array("id" => "ACT", "content" => GetMessage("SPS_FIELD_ACTION"), "default" => true);
 $lAdmin->AddHeaders($arHeaders);
 $arSelectedFields = $lAdmin->GetVisibleHeaderColumns();
 if (!in_array('ACT', $arSelectedFields)) {
     $arSelectedFields[] = 'ACT';
 }
 $arSelectedProps = array();
 foreach ($arProps as $prop) {
     if ($key = array_search("PROPERTY_" . $prop['ID'], $arSelectedFields)) {
         $arSelectedProps[] = $prop;
         $arSelect[$prop['ID']] = array();
         $props = CIBlockProperty::GetPropertyEnum($prop['ID']);
         while ($res = $props->Fetch()) {
             $arSelect[$prop['ID']][$res["ID"]] = $res["VALUE"];
         }
         unset($arSelectedFields[$key]);
     }
 }
 if (!in_array("ID", $arSelectedFields)) {
     $arSelectedFields[] = "ID";
 }
 $arSelectedFields[] = "LANG_DIR";
 $arSelectedFields[] = "LID";
 $arSelectedFields[] = "WF_PARENT_ELEMENT_ID";
 $arSelectedFields[] = "ACT";
 if (in_array("LOCKED_USER_NAME", $arSelectedFields)) {
     $arSelectedFields[] = "WF_LOCKED_BY";
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:cat_store_product_search.php

示例12: ExportProperties

 function ExportProperties(&$PROPERTY_MAP)
 {
     $PROPERTY_MAP = array();
     fwrite($this->fp, "\t\t<" . GetMessage("IBLOCK_XML2_PROPERTIES") . ">\n");
     if ($this->bExtended) {
         $arElementFields = array("CML2_ACTIVE" => GetMessage("IBLOCK_XML2_BX_ACTIVE"), "CML2_CODE" => GetMessage("IBLOCK_XML2_SYMBOL_CODE"), "CML2_SORT" => GetMessage("IBLOCK_XML2_SORT"), "CML2_ACTIVE_FROM" => GetMessage("IBLOCK_XML2_START_TIME"), "CML2_ACTIVE_TO" => GetMessage("IBLOCK_XML2_END_TIME"), "CML2_PREVIEW_TEXT" => GetMessage("IBLOCK_XML2_ANONS"), "CML2_DETAIL_TEXT" => GetMessage("IBLOCK_XML2_DETAIL"), "CML2_PREVIEW_PICTURE" => GetMessage("IBLOCK_XML2_PREVIEW_PICTURE"));
         foreach ($arElementFields as $key => $value) {
             fwrite($this->fp, $this->formatXMLNode(3, GetMessage("IBLOCK_XML2_PROPERTY"), array(GetMessage("IBLOCK_XML2_ID") => $key, GetMessage("IBLOCK_XML2_NAME") => $value, GetMessage("IBLOCK_XML2_MULTIPLE") => "false")));
         }
     }
     $arFilter = array("IBLOCK_ID" => $this->arIBlock["ID"], "ACTIVE" => "Y");
     $arSort = array("sort" => "asc");
     $obProp = new CIBlockProperty();
     $rsProp = $obProp->GetList($arSort, $arFilter);
     while ($arProp = $rsProp->Fetch()) {
         fwrite($this->fp, "\t\t\t<" . GetMessage("IBLOCK_XML2_PROPERTY") . ">\n");
         $xml_id = $this->GetPropertyXML_ID($this->arIBlock["ID"], $arProp["NAME"], $arProp["ID"], $arProp["XML_ID"]);
         $PROPERTY_MAP[$arProp["ID"]] = $xml_id;
         $PROPERTY_MAP["~" . $arProp["ID"]] = $arProp["NAME"];
         fwrite($this->fp, $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_ID"), $xml_id));
         fwrite($this->fp, $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_NAME"), $arProp["NAME"]));
         fwrite($this->fp, $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_MULTIPLE"), $arProp["MULTIPLE"] == "Y" ? "true" : "false"));
         if ($arProp["PROPERTY_TYPE"] == "L") {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_CHOICE_VALUES") . ">\n");
             $rsEnum = CIBlockProperty::GetPropertyEnum($arProp["ID"]);
             while ($arEnum = $rsEnum->Fetch()) {
                 fwrite($this->fp, $this->formatXMLNode(5, GetMessage("IBLOCK_XML2_VALUE"), $arEnum["VALUE"]));
                 if ($this->bExtended) {
                     fwrite($this->fp, "\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_CHOICE") . ">\n" . $this->formatXMLNode(6, GetMessage("IBLOCK_XML2_ID"), $arEnum["XML_ID"]) . $this->formatXMLNode(6, GetMessage("IBLOCK_XML2_VALUE"), $arEnum["VALUE"]) . $this->formatXMLNode(6, GetMessage("IBLOCK_XML2_BY_DEFAULT"), $arEnum["DEF"] == "Y" ? "true" : "false") . $this->formatXMLNode(6, GetMessage("IBLOCK_XML2_SORT"), intval($arEnum["SORT"])) . "\t\t\t\t\t</" . GetMessage("IBLOCK_XML2_CHOICE") . ">\n");
                 }
             }
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_CHOICE_VALUES") . ">\n");
         }
         if ($this->bExtended) {
             $strUserSettings = '';
             if ('' != $arProp["USER_TYPE"]) {
                 if (!empty($arProp['USER_TYPE_SETTINGS']) && is_array($arProp['USER_TYPE_SETTINGS'])) {
                     $strUserSettings = $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_USER_TYPE_SETTINGS"), serialize($arProp['USER_TYPE_SETTINGS']));
                 }
             }
             fwrite($this->fp, $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_SORT"), intval($arProp["SORT"])) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_CODE"), $arProp["CODE"]) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_PROPERTY_TYPE"), $arProp["PROPERTY_TYPE"]) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_ROWS"), $arProp["ROW_COUNT"]) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_COLUMNS"), $arProp["COL_COUNT"]) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_LIST_TYPE"), $arProp["LIST_TYPE"]) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_FILE_EXT"), $arProp["FILE_TYPE"]) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_FIELDS_COUNT"), $arProp["MULTIPLE_CNT"]) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_LINKED_IBLOCK"), $this->GetIBlockXML_ID($arProp["LINK_IBLOCK_ID"])) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_WITH_DESCRIPTION"), $arProp["WITH_DESCRIPTION"] == "Y" ? "true" : "false") . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_SEARCH"), $arProp["SEARCHABLE"] == "Y" ? "true" : "false") . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_FILTER"), $arProp["FILTRABLE"] == "Y" ? "true" : "false") . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_USER_TYPE"), $arProp["USER_TYPE"]) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_IS_REQUIRED"), $arProp["IS_REQUIRED"] == "Y" ? "true" : "false") . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_BX_DEFAULT_VALUE"), serialize($arProp["DEFAULT_VALUE"])) . $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_SERIALIZED"), 1) . $strUserSettings);
         }
         fwrite($this->fp, "\t\t\t</" . GetMessage("IBLOCK_XML2_PROPERTY") . ">\n");
     }
     fwrite($this->fp, "\t\t</" . GetMessage("IBLOCK_XML2_PROPERTIES") . ">\n");
     if ($this->bExtended) {
         $catalog = false;
         if (CModule::IncludeModule("catalog")) {
             $catalog = CCatalogSKU::getInfoByOfferIBlock($this->arIBlock["ID"]);
         }
         if (!empty($catalog) && is_array($catalog)) {
             $this->ExportSmartFilter(2, $this->arIBlock["ID"], false, $PROPERTY_MAP, $catalog["PRODUCT_IBLOCK_ID"]);
         } else {
             $this->ExportSmartFilter(2, $this->arIBlock["ID"], 0, $PROPERTY_MAP);
         }
     }
 }
开发者ID:nycmic,项目名称:bittest,代码行数:57,代码来源:cml2.php

示例13: _SyncGetValueByType

 protected function _SyncGetValueByType($FIELD, &$arQueue)
 {
     $fld = $FIELD['FIELD'];
     $bProperty = ($prop = self::__prop($fld['FIELD_ID'])) != null;
     $value = $FIELD['VALUE'];
     switch ($fld['SP_FIELD_TYPE']) {
         case 'DateTime':
             $ts = strtotime($value);
             if ($ts) {
                 $value = ConvertTimeStamp($ts, 'FULL');
             }
             break;
         case 'Counter':
         case 'Integer':
             $value = intval($value);
             break;
         case 'Number':
             $value = doubleval($value);
             break;
         case 'User':
             $bParseAsUser = false;
             if ($bProperty) {
                 $dbRes = CIBlockProperty::GetByID($prop, $IBLOCK_ID);
                 if ($arRes = $dbRes->Fetch()) {
                     if ($arRes['USER_TYPE'] == 'UserID' || $arRes['USER_TYPE'] == 'employee') {
                         $bParseAsUser = true;
                     }
                 }
             } elseif ($fld['FIELD_ID'] == 'MODIFIED_BY' || $fld['FIELD_ID'] == 'CREATED_BY') {
                 $bParseAsUser = true;
             }
             //var_dump($value);
             if ($bParseAsUser) {
                 $value = self::_SyncGetUser($value);
             }
             break;
         case 'Choice':
             if ($bProperty) {
                 $dbRes = CIBlockProperty::GetByID($prop, $IBLOCK_ID);
                 if ($arRes = $dbRes->Fetch()) {
                     if ($arRes['PROPERTY_TYPE'] == 'L') {
                         $dbRes = CIBlockProperty::GetPropertyEnum($prop, array(), array('VALUE' => $value));
                         if ($arRes = $dbRes->Fetch()) {
                             $value = $arRes['ID'];
                         }
                     }
                 }
             }
             break;
         case 'Attachments':
             $value = intval($value);
             if ($value > 0) {
                 $arQueue[] = array('SP_METHOD' => 'GetAttachmentCollection', 'SP_METHOD_PARAMS' => array('SP_ID' => $FIELD['ROW']['ID']), 'CALLBACK' => array('CIntranetSharepoint', 'SetPropertyValue', array($FIELD['ROW']['UniqueId'], $fld['FIELD_ID'])));
             }
             $value = null;
             break;
         case 'ContentTypeId':
         case 'Lookup':
         case 'Computed':
         case 'Text':
         default:
             $bParseAsFile = false;
             if ($bProperty) {
                 $dbRes = CIBlockProperty::GetByID($prop, $IBLOCK_ID);
                 if ($arRes = $dbRes->Fetch()) {
                     if ($arRes['PROPERTY_TYPE'] == 'F') {
                         $bParseAsFile = true;
                     }
                 }
             } elseif ($fld['FIELD_ID'] == 'PREVIEW_PICTURE' || $fld['FIELD_ID'] == 'DETAIL_PICTURE') {
                 $bParseAsFile = true;
             }
             if ($bParseAsFile) {
                 $arQueue[] = array('SP_METHOD' => 'LoadFile', 'SP_METHOD_PARAMS' => array('URL' => $value), 'CALLBACK' => array('CIntranetSharepoint', 'SetPropertyValue', array($FIELD['ROW']['UniqueId'], $fld['FIELD_ID'])));
                 $value = null;
             }
     }
     if ($bProperty) {
         return array('VALUE' => $value, 'PROPERTY' => $prop);
     } else {
         return array('VALUE' => $value, 'FIELD' => $fld['FIELD_ID']);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:83,代码来源:sharepoint.php

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

示例15: createDataExcel

 protected function createDataExcel()
 {
     $obList = new CList($this->arIBlock["ID"]);
     $gridOptions = new CGridOptions($this->arResult["GRID_ID"]);
     $gridColumns = $gridOptions->GetVisibleColumns();
     $gridSort = $gridOptions->GetSorting(array("sort" => array("name" => "asc")));
     $this->arResult["ELEMENTS_HEADERS"] = array();
     $arSelect = array("ID", "IBLOCK_ID");
     $arProperties = array();
     $this->arResult["FIELDS"] = $arListFields = $obList->GetFields();
     foreach ($arListFields as $fieldId => $arField) {
         if (!count($gridColumns) || in_array($fieldId, $gridColumns)) {
             if (substr($fieldId, 0, 9) == "PROPERTY_") {
                 $arProperties[] = $fieldId;
             } else {
                 $arSelect[] = $fieldId;
             }
         }
         if ($fieldId == "CREATED_BY") {
             $arSelect[] = "CREATED_USER_NAME";
         }
         if ($fieldId == "MODIFIED_BY") {
             $arSelect[] = "USER_NAME";
         }
         $this->arResult["ELEMENTS_HEADERS"][$fieldId] = array("name" => htmlspecialcharsex($arField["NAME"]), "default" => true, "sort" => $arField["MULTIPLE"] == "Y" ? "" : $fieldId);
     }
     if (!count($gridColumns) || in_array("IBLOCK_SECTION_ID", $gridColumns)) {
         $arSelect[] = "IBLOCK_SECTION_ID";
     }
     $this->arResult["ELEMENTS_HEADERS"]["IBLOCK_SECTION_ID"] = array("name" => Loc::getMessage("CC_BLL_COLUMN_SECTION"), "default" => true, "sort" => false);
     /* FILTER */
     $sections = array();
     foreach ($this->arResult["LIST_SECTIONS"] as $id => $name) {
         $sections[$id] = $name;
     }
     $this->arResult["FILTER"] = array(array("id" => "list_section_id", "type" => "list", "items" => $sections, "filtered" => $this->arResult["SECTION_ID"] !== false, "filter_value" => $this->arResult["SECTION_ID"], "value" => $this->arResult["SECTION_ID"]));
     $i = 1;
     $arFilterable = array();
     $arDateFilter = array();
     foreach ($arListFields as $fieldId => $arField) {
         if ($arField["TYPE"] == "ACTIVE_FROM" || $arField["TYPE"] == "ACTIVE_TO") {
             $this->arResult["FILTER"][$i] = array("id" => "DATE_" . $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
             $arFilterable["DATE_" . $fieldId] = "";
             $arDateFilter["DATE_" . $fieldId] = true;
         } elseif ($arField["TYPE"] == "DATE_CREATE" || $arField["TYPE"] == "TIMESTAMP_X") {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
             $arFilterable[$fieldId] = "";
             $arDateFilter[$fieldId] = true;
         } elseif (is_array($arField["PROPERTY_USER_TYPE"]) && array_key_exists("GetPublicFilterHTML", $arField["PROPERTY_USER_TYPE"])) {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "custom", "enable_settings" => false, "value" => call_user_func_array($arField["PROPERTY_USER_TYPE"]["GetPublicFilterHTML"], array($arField, array("VALUE" => $fieldId, "FORM_NAME" => "filter_" . $this->arResult["GRID_ID"], "GRID_ID" => $this->arResult["GRID_ID"]))));
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "SORT" || $arField["TYPE"] == "N") {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "number");
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "G") {
             $items = array();
             $prop_secs = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $arField["LINK_IBLOCK_ID"]));
             while ($ar_sec = $prop_secs->Fetch()) {
                 $items[$ar_sec["ID"]] = str_repeat(". ", $ar_sec["DEPTH_LEVEL"] - 1) . $ar_sec["NAME"];
             }
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "E") {
             //Should be handled in template
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "E", "value" => $arField);
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "L") {
             $items = array();
             $propEnums = CIBlockProperty::GetPropertyEnum($arField["ID"]);
             while ($arEnum = $propEnums->Fetch()) {
                 $items[$arEnum["ID"]] = $arEnum["VALUE"];
             }
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
             $arFilterable[$fieldId] = "";
         } elseif (in_array($arField["TYPE"], array("S", "S:HTML", "NAME", "DETAIL_TEXT", "PREVIEW_TEXT"))) {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]));
             $arFilterable[$fieldId] = "?";
         } else {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]));
             $arFilterable[$fieldId] = "";
         }
         $i++;
     }
     $arFilter = array();
     $gridFilter = $gridOptions->GetFilter($this->arResult["FILTER"]);
     foreach ($gridFilter as $key => $value) {
         if (substr($key, -5) == "_from") {
             $op = ">=";
             $newKey = substr($key, 0, -5);
         } elseif (substr($key, -3) == "_to") {
             $op = "<=";
             $newKey = substr($key, 0, -3);
             if (array_key_exists($newKey, $arDateFilter)) {
                 if (!preg_match("/\\d\\d:\\d\\d:\\d\\d\$/", $value)) {
                     $value .= " 23:59:59";
                 }
             }
         } else {
             $op = "";
             $newKey = $key;
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:class.php


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