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


PHP CIBlock::GetFields方法代码示例

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


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

示例1: generateUpdateCode

 /**
  * Генерация кода обновления инфоблока
  *
  * @param $params array
  * @return mixed
  */
 public function generateUpdateCode($params)
 {
     $this->checkParams($params);
     $code = false;
     foreach ($this->ownerItemDbData as $iblockData) {
         $updateFields = $iblockData;
         Helper::unsetFields(array('ID'), $updateFields);
         $updateFields['FIELDS'] = \CIBlock::GetFields($iblockData['ID']);
         $this->setUserGroupId($iblockData['ID'], $iblockData);
         $code = $code . $this->getMethodContent('Bim\\Db\\Iblock\\IblockIntegrate', 'Update', array($updateFields['CODE'], $updateFields)) . PHP_EOL . PHP_EOL;
     }
     return $code;
 }
开发者ID:cjp2600,项目名称:bim-core,代码行数:19,代码来源:Iblock.php

示例2: getFields

 public function getFields()
 {
     if (!isset($this->fields)) {
         $this->fields = array();
         $res = \CIBlock::GetFields($this->id);
         foreach ($res as $k => $element) {
             $this->fields[$k] = new Field($k, $element);
         }
         foreach (self::$standardFields as $field) {
             if (!array_key_exists($field, $this->fields)) {
                 $this->fields[$field] = array('CODE' => $field);
             }
         }
     }
     return $this->fields;
 }
开发者ID:AlexSmerw,项目名称:domino,代码行数:16,代码来源:Object.class.php

示例3: mergeIblockFields

 public function mergeIblockFields($iblockId, $fields)
 {
     $default = \CIBlock::GetFields($iblockId);
     $fields = $this->arraySoftMerge($default, $fields);
     \CIBlock::SetFields($iblockId, $fields);
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:6,代码来源:IblockHelper.php

示例4: GetMessage

" target="_blank"><?php 
                echo GetMessage("IB_E_GOTO_BP");
                ?>
</a>
			<?php 
            }
            ?>
		</td>
	</tr>
	<?php 
        }
        $tabControl->BeginNextTab();
        if ($bVarsFromForm) {
            $arFields = $_REQUEST["FIELDS"];
        } else {
            $arFields = CIBlock::GetFields($ID);
        }
        $arDefFields = CIBlock::GetFieldsDefaults();
        foreach ($arDefFields as $FIELD_ID => $arField) {
            if ($arField["VISIBLE"] == "N") {
                continue;
            }
            if (!preg_match("/^LOG_/", $FIELD_ID)) {
                continue;
            }
            ?>
		<tr>
			<td width="40%"><label for="FIELDS[<?php 
            echo $FIELD_ID;
            ?>
][IS_REQUIRED]"><?php 
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:iblock_edit.php

示例5: ImportMetaData


//.........这里部分代码省略.........
             if (isset($arIBlock["CATALOG_XML_ID"]) && $this->use_offers) {
                 $this->CheckProperty($arIBlock["ID"], "CML2_LINK", array("NAME" => GetMessage("IBLOCK_XML2_CATALOG_ELEMENT"), "PROPERTY_TYPE" => "E", "USER_TYPE" => "SKU", "LINK_IBLOCK_ID" => $this->GetIBlockByXML_ID($arIBlock["CATALOG_XML_ID"]), "FILTRABLE" => "Y"));
             }
         }
         $this->next_step["IBLOCK_ID"] = $arIBlock["ID"];
         $this->next_step["XML_ELEMENTS_PARENT"] = $XML_ELEMENTS_PARENT;
     }
     if ($meta_data_xml_id) {
         $rs = $this->_xml_file->GetList(array(), array("PARENT_ID" => $xml_root_id, "NAME" => $this->mess["IBLOCK_XML2_METADATA"]), array("ID"));
         while ($arMetadata = $rs->Fetch()) {
             //Find referenced metadata
             $bMetaFound = false;
             $meta_roots = array();
             $rsMetaRoots = $this->_xml_file->GetList(array("ID" => "asc"), array("PARENT_ID" => $arMetadata["ID"]));
             while ($arMeta = $rsMetaRoots->Fetch()) {
                 if (isset($arMeta["VALUE_CLOB"])) {
                     $arMeta["VALUE"] = $arMeta["VALUE_CLOB"];
                 }
                 if ($arMeta["NAME"] == $this->mess["IBLOCK_XML2_ID"] && $arMeta["VALUE"] == $meta_data_xml_id) {
                     $bMetaFound = true;
                 }
                 $meta_roots[] = $arMeta;
             }
             //Get xml parents of the properties and sections
             if ($bMetaFound) {
                 foreach ($meta_roots as $arMeta) {
                     if ($arMeta["NAME"] == $this->mess["IBLOCK_XML2_GROUPS"]) {
                         $XML_SECTIONS_PARENT = $arMeta["ID"];
                     } elseif ($arMeta["NAME"] == $this->mess["IBLOCK_XML2_PROPERTIES"]) {
                         $XML_PROPERTIES_PARENT = $arMeta["ID"];
                     } elseif ($arMeta["NAME"] == $this->mess["IBLOCK_XML2_GROUPS_PROPERTIES"]) {
                         $XML_SECTIONS_PROPERTIES_PARENT = $arMeta["ID"];
                     } elseif ($arMeta["NAME"] == $this->mess["IBLOCK_XML2_SECTION_PROPERTIES"]) {
                         $XML_SECTION_PROPERTIES = $arMeta["ID"];
                     } elseif ($arMeta["NAME"] == $this->mess["IBLOCK_XML2_PRICE_TYPES"]) {
                         $XML_PRICES_PARENT = $arMeta["ID"];
                     } elseif ($arMeta["NAME"] == $this->mess["IBLOCK_XML2_STORES"]) {
                         $XML_STORES_PARENT = $arMeta["ID"];
                     } elseif ($arMeta["NAME"] == $this->mess["IBLOCK_XML2_BASE_UNITS"]) {
                         $XML_BASE_UNITS_PARENT = $arMeta["ID"];
                     }
                 }
                 break;
             }
         }
     }
     $iblockFields = CIBlock::GetFields($arIBlock["ID"]);
     $iblockFields["XML_IMPORT_START_TIME"] = array("NAME" => "XML_IMPORT_START_TIME", "IS_REQUIRED" => "N", "DEFAULT_VALUE" => date("Y-m-d H:i:s"));
     CIBlock::SetFields($arIBlock["ID"], $iblockFields);
     if ($XML_PROPERTIES_PARENT) {
         $result = $this->ImportProperties($XML_PROPERTIES_PARENT, $arIBlock["ID"]);
         if ($result !== true) {
             return $result;
         }
     }
     if ($XML_SECTION_PROPERTIES) {
         $result = $this->ImportSectionProperties($XML_SECTION_PROPERTIES, $arIBlock["ID"]);
         if ($result !== true) {
             return $result;
         }
     }
     if ($XML_SECTIONS_PROPERTIES_PARENT) {
         $result = $this->ImportSectionsProperties($XML_SECTIONS_PROPERTIES_PARENT, $arIBlock["ID"]);
         if ($result !== true) {
             return $result;
         }
     }
     if ($XML_PRICES_PARENT) {
         if ($this->bCatalog) {
             $result = $this->ImportPrices($XML_PRICES_PARENT, $arIBlock["ID"], $IBLOCK_LID);
             if ($result !== true) {
                 return $result;
             }
         }
     }
     if ($XML_STORES_PARENT) {
         if ($this->bCatalog && CBXFeatures::IsFeatureEnabled('CatMultiStore')) {
             $result = $this->ImportStores($XML_STORES_PARENT);
             if ($result !== true) {
                 return $result;
             }
         }
     }
     if ($XML_BASE_UNITS_PARENT) {
         if ($this->bCatalog) {
             $result = $this->ImportBaseUnits($XML_BASE_UNITS_PARENT);
             if ($result !== true) {
                 return $result;
             }
         }
     }
     $this->next_step["section_sort"] = 100;
     $this->next_step["XML_SECTIONS_PARENT"] = $XML_SECTIONS_PARENT;
     $rs = $this->_xml_file->GetList(array(), array("PARENT_ID" => $xml_root_id, "NAME" => $this->mess["IBLOCK_XML2_PRODUCTS_SETS"]), array("ID", "ATTRIBUTES"));
     $ar = $rs->Fetch();
     if ($ar) {
         $this->next_step["SETS"] = $ar["ID"];
     }
     return true;
 }
开发者ID:nycmic,项目名称:bittest,代码行数:101,代码来源:cml2.php

示例6: GetArrayByID

 /**
  * <p>Возвращает массив <a href="http://dev.1c-bitrix.ru/api_help/iblock/fields.php#fiblock">полей</a> информационного блока.</p> <p><b>Примечание</b>: если инфоблока с таким ID не существует, то функция вернет false.</p>
  *
  *
  *
  *
  * @param int $ID  Идентификатор информационного блока <br>
  *
  *
  *
  * @param string $FIELD = "" Идентификатор поля. Если этот параметр задан, то функция вернет
  * значение конкретного поля. <br>
  *
  *
  *
  * @return array <p>Массив полей инфоблока.</p>
  *
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?<br>echo CIBlock::GetArrayByID($IBLOCK_ID, "NAME");<br>?&gt;
  * </pre>
  *
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li><a href="http://dev.1c-bitrix.ru/api_help/iblock/fields.php#fiblock">Поля инфоблока</a></li>
  * </ul><a name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/GetArrayByID.php
  * @author Bitrix
  */
 public static function GetArrayByID($ID, $FIELD = "")
 {
     /** @global CDatabase $DB */
     global $DB;
     $ID = intval($ID);
     if (CACHED_b_iblock === false) {
         $res = $DB->Query("\n\t\t\t\tSELECT b_iblock.*," . $DB->DateToCharFunction("TIMESTAMP_X") . " TIMESTAMP_X\n\t\t\t\tfrom  b_iblock\n\t\t\t\tWHERE ID = " . $ID);
         $arResult = $res->Fetch();
         if ($arResult) {
             $arMessages = CIBlock::GetMessages($ID);
             $arResult = array_merge($arResult, $arMessages);
             $arResult["FIELDS"] = CIBlock::GetFields($ID);
         }
     } else {
         global $CACHE_MANAGER;
         $bucket_size = intval(CACHED_b_iblock_bucket_size);
         if ($bucket_size <= 0) {
             $bucket_size = 20;
         }
         $bucket = intval($ID / $bucket_size);
         $cache_id = $bucket_size . "iblock" . $bucket;
         if ($CACHE_MANAGER->Read(CACHED_b_iblock, $cache_id, "b_iblock")) {
             $arIBlocks = $CACHE_MANAGER->Get($cache_id);
         } else {
             $arIBlocks = array();
             $res = $DB->Query("\n\t\t\t\t\tSELECT b_iblock.*," . $DB->DateToCharFunction("TIMESTAMP_X") . " TIMESTAMP_X\n\t\t\t\t\tfrom  b_iblock\n\t\t\t\t\tWHERE ID between " . $bucket * $bucket_size . " AND " . (($bucket + 1) * $bucket_size - 1));
             while ($arIBlock = $res->Fetch()) {
                 $arMessages = CIBlock::GetMessages($arIBlock["ID"]);
                 $arIBlock = array_merge($arIBlock, $arMessages);
                 $arIBlock["FIELDS"] = CIBlock::GetFields($arIBlock["ID"]);
                 $arIBlocks[$arIBlock["ID"]] = $arIBlock;
             }
             $CACHE_MANAGER->Set($cache_id, $arIBlocks);
         }
         if (isset($arIBlocks[$ID])) {
             $arResult = $arIBlocks[$ID];
             if (!array_key_exists("ELEMENT_DELETE", $arResult)) {
                 $arMessages = CIBlock::GetMessages($ID);
                 $arResult = array_merge($arResult, $arMessages);
                 CIBlock::CleanCache($ID);
             }
             if (!array_key_exists("FIELDS", $arResult)) {
                 $arResult["FIELDS"] = CIBlock::GetFields($ID);
                 CIBlock::CleanCache($ID);
             }
         } else {
             $arResult = false;
         }
     }
     if ($FIELD) {
         return $arResult[$FIELD];
     } else {
         return $arResult;
     }
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:89,代码来源:iblock.php

示例7: run


//.........这里部分代码省略.........
             }
             if (isset($defs[$k]) && $defs[$k] == $data[$k]) {
                 unset($data[$k]);
             }
         }
         $sites = '';
         $res = \CIBlock::GetSite($id);
         while ($row = $res->Fetch()) {
             $sites .= $sites != '' ? ',' : '';
             $sites .= "'" . $row['SITE_ID'] . "'";
         }
         unset($data['ELEMENTS_NAME']);
         unset($data['ELEMENT_NAME']);
         $sData = self::generateArrayExport($data, '        ');
         $sDescription = self::generateSimpleStringFunctionText('description', $description, '');
         $sDescriptionType = self::generateSimpleStringFunctionText('descriptionType', $descriptionType, 'text');
         $sIsActive = self::generateSimpleStringFunctionText('isActive', $isactive, true);
         $sSort = self::generateSimpleStringFunctionText('sort', $sort, '500');
         $sSites = "\n\n    public function sites()\n    {\n        return array({$sites});\n    }";
         $properties = array();
         $result = \CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $id, 'CHECK_PERMISSIONS' => 'N'));
         $defs = array('VERSION' => '1', 'FILTRABLE' => 'N', 'SEARCHABLE' => 'N', 'LIST_TYPE' => 'L', 'COL_COUNT' => '30', 'ROW_COUNT' => '1', 'MULTIPLE' => 'N', 'SORT' => '500', 'IS_REQUIRED' => 'N', 'WITH_DESCRIPTION' => 'N', 'MULTIPLE_CNT' => '5');
         while ($row = $result->Fetch()) {
             $code = trim($row['CODE']);
             if ($code == '') {
                 $code = 'PROP_' . $row['ID'];
             }
             $pid = $row['ID'];
             unset($row['ID']);
             unset($row['TIMESTAMP_X']);
             unset($row['IBLOCK_ID']);
             unset($row['ACTIVE']);
             unset($row['CODE']);
             foreach (array_keys($row) as $k) {
                 if (empty($row[$k])) {
                     unset($row[$k]);
                 }
                 if (isset($defs[$k]) && $defs[$k] == $row[$k]) {
                     unset($row[$k]);
                 }
             }
             if ($row['PROPERTY_TYPE'] == 'L') {
                 $items = array();
                 $res = \CIBlockPropertyEnum::GetList(array(), array('PROPERTY_ID' => $pid, 'CHECK_PERMISSIONS' => 'N'));
                 while ($lrow = $res->Fetch()) {
                     $iid = $lrow['ID'];
                     $eid = $lrow['EXTERNAL_ID'];
                     unset($lrow['ID']);
                     unset($lrow['EXTERNAL_ID']);
                     unset($lrow['XML_ID']);
                     unset($lrow['TMP_ID']);
                     unset($lrow['PROPERTY_ID']);
                     unset($lrow['PROPERTY_NAME']);
                     unset($lrow['PROPERTY_CODE']);
                     unset($lrow['PROPERTY_SORT']);
                     if ($lrow['SORT'] == '500') {
                         unset($lrow['SORT']);
                     }
                     if ($lrow['DEF'] == 'N') {
                         unset($lrow['DEF']);
                     }
                     if (count($lrow) == 1 && isset($lrow['VALUE'])) {
                         $lrow = $lrow['VALUE'];
                     }
                     $items[$eid] = $lrow;
                 }
                 $row['ITEMS'] = $items;
             }
             if (isset($row['LINK_IBLOCK_ID']) && !$forCache) {
                 $row['LINK_IBLOCK_CODE'] = \TAO::getInfoblockCode($row['LINK_IBLOCK_ID']);
                 unset($row['LINK_IBLOCK_ID']);
             }
             $properties[$code] = $row;
         }
         $sProperties = self::generateArrayExport($properties, '        ');
         $messages = \CIBlock::GetMessages($id);
         $sMessages = self::generateArrayExport($messages, '        ');
         $fields = self::trimArrayValues(\CIBlock::GetFields($id));
         $defFields = self::defaultFields();
         foreach (array_keys($fields) as $field) {
             if (isset($defFields[$field])) {
                 $md5 = md5(serialize($fields[$field]));
                 $def = md5(serialize($defFields[$field]));
                 if ($md5 == $def) {
                     //unset($fields[$field]);
                 } else {
                     //var_dump($fields[$field], $defFields[$field]);
                 }
             }
         }
         $sFields = self::generateArrayExport($fields, '        ');
         $permissions = \CIBlock::GetGroupPermissions($id);
         $sPermissions = self::generateArrayExport($permissions, '        ');
         ob_start();
         include \TAO::taoDir() . '/views/template-iblock.phtml';
         $content = "<?php\n" . ob_get_clean();
         return $content;
     }
     return false;
 }
开发者ID:techart,项目名称:bitrix.tao,代码行数:101,代码来源:infoblock_export.php

示例8: foreach

<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule('iblock')) {
    return;
}
if (!empty($arCurrentValues['IBLOCK_CODE'])) {
    //select iblock's element's fields and properties
    $filter = ['CODE' => $arCurrentValues['IBLOCK_CODE']];
    if ($iblock = CIBlock::GetList([], $filter)->fetch()) {
        //select fields
        $fields = [];
        $rawFields = CIBlock::GetFields($currentIblockId);
        foreach ($rawFields as $fieldCode => $field) {
            $fields[$fieldCode] = $field['NAME'];
        }
        //element properties
        $elementProperties = [];
        $filter = ['ACTIVE' => 'Y', 'IBLOCK_ID' => $currentIblockId];
        $rsProp = CIBlockProperty::GetList([], $filter);
        while ($item = $rsProp->Fetch()) {
            $elementProperties[$item['CODE']] = '[' . $item['CODE'] . '] ' . $item['NAME'];
        }
    }
}
$arComponentParameters = CComponentUtil::GetComponentProps('notagency:materials.list', $arCurrentValues);
$arComponentParameters['PARAMETERS']['SELECT_ELEMENT_BY'] = array('PARENT' => 'BASE', 'NAME' => 'Выбирать элемент по ID или по коду', 'TYPE' => 'LIST', 'VALUES' => ['CODE' => 'по коду', 'ID' => 'по id'], 'DEFAULT' => 'CODE', 'REFRESH' => 'Y');
if ($arCurrentValues['SELECT_ELEMENT_BY'] == 'ID') {
    $arComponentParameters['PARAMETERS']['REQUEST_ELEMENT_ID'] = array('PARENT' => 'BASE', 'NAME' => 'GET или POST переменная, в которой передается id элемента', 'TYPE' => 'STRING', 'DEFAULT' => 'element_id');
开发者ID:notagency,项目名称:notagency.base,代码行数:31,代码来源:.parameters.php

示例9: __construct

    private function __construct($IBLOCK_ID, $params = array())
    {
        if (!isset($params['groups']) || !isset($params['products']))
        {
            throw new \Exception("Groups or Products not exist");
        }

        $rsCatalog = \CCatalog::GetList(array(), array('IBLOCK_ID' => intval($IBLOCK_ID)));
        if (!$arCatalog = $rsCatalog->Fetch())
        {
            throw new \Exception('Cant find catalog with ID = '.$IBLOCK_ID);
        }

        $this->CATALOG_ID = intval($arCatalog['IBLOCK_ID']);
        $this->OFFERS_ID = intval(Option::get('modifier_id'));

        if (!$this->OFFERS_ID)
        {
            // этот эксепшн можно заменить на создание инфоблока модификаторов
            throw new \Exception('Need set modifiers iblock');
        }

        $this->defaultSectionID = Option::getDefaultSectionID();
        $this->arModifiers[$this->defaultSectionID] = array(
            'XML_ID' => $this->defaultSectionID,
            'NAME'   => 'Другие модификаторы',
            'CODE'   => $this->defaultSectionID,
            'ACTIVE' => 'Y'
        );
        foreach ($params['groups'] as $arItem)
        {
            $arInfo = json_decode($arItem['additionalInfo'], true);
            $arGroup = array(
                "XML_ID"         => $arItem['id'],
                "SECTION_XML_ID" => $arItem['parentGroup'],
                "NAME"           => $arItem['name'],
                "CODE"           => $arInfo['CODE'],
                "ACTIVE"         => $arInfo['ACTIVE'] === 'N' ? 'N' : 'Y'
            );
            // группа модификаторов
            if (!$arItem['isIncludedInMenu'])
            {
                $this->arModifiers[$arItem['id']] = $arGroup;
                continue;
            }
            // обычная группа
            $this->arGroups[] = $arGroup;
        }

        foreach ($params['products'] as $arItem)
        {
            $arElement = array(
                'ACTIVE'         => 'Y',
                'XML_ID'         => $arItem['id'],
                'NAME'           => $arItem['name'],
                'CODE'           => $arItem['code'],
                'TYPE'           => strtoupper($arItem['type']),
                'DESCRIPTION'    => $arItem['description'],
                'SECTION_XML_ID' => $arItem['parentGroup'],
                'PRICE'          => doubleval($arItem['price']),
                'WEIGHT'         => $arItem['weight'] * 1000
            );
            if ($arItem['type'] === 'modifier')
            {
                $arElement['SECTION_XML_ID'] = $key = strlen($arItem['groupId']) > 0 ? $arItem['groupId'] : $this->defaultSectionID;
                $this->arModifiers[$key]['ITEMS'][] = $arElement;
                continue;
            }
            $arElement = array_merge($arElement, array(
                'MODIFIERS'       => array(),
                'GROUP_MODIFIERS' => array()
            ));
            if (!empty($arItem['modifiers'])) // обычные модификаторы
            {
                foreach ($arItem['modifiers'] as $arModifier)
                {
                    $arElement['MODIFIERS'][] = array(
                        'XML_ID'   => $arModifier['modifierId'],
                        'REQUIRED' => intval($arModifier['required']) > 0 ? 'Y' : 'N'
                    );
                }
            }
            if (!empty($arItem['groupModifiers'])) // групповые модификаторы
            {
                foreach ($arItem['groupModifiers'] as $arModifier)
                {
                    $arElement['GROUP_MODIFIERS'][] = array(
                        'XML_ID'   => $arModifier['modifierId'],
                        'REQUIRED' => intval($arModifier['required']) > 0 ? 'Y' : 'N'
                    );
                }
            }
            $this->arProducts[] = $arElement;
        }

        $iblockFields = \CIBlock::GetFields($this->CATALOG_ID);
        $iblockFields["XML_IMPORT_START_TIME"] = array(
            "NAME"          => "XML_IMPORT_START_TIME",
            "IS_REQUIRED"   => "N",
            "DEFAULT_VALUE" => date("Y-m-d H:i:s"),
//.........这里部分代码省略.........
开发者ID:phwb,项目名称:ugraweb.iiko,代码行数:101,代码来源:import.php

示例10: updateIblockFields

 public function updateIblockFields($iblockId, $fields = array())
 {
     $default = \CIBlock::GetFields($iblockId);
     $fields = array_replace_recursive($default, $fields);
     \CIBlock::SetFields($iblockId, $fields);
     return true;
 }
开发者ID:andreyryabin,项目名称:sprint.migration,代码行数:7,代码来源:IblockHelper.php


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