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


PHP CIBlock::SetFields方法代码示例

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


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

示例1: Add

 public static function Add($iblock_id, $arFields)
 {
     if ($iblock_id > 0) {
         $arIBlockFields = CIBlock::GetArrayByID($iblock_id, "FIELDS");
         $arIBlockFields[$arFields["TYPE"]] = $arFields;
         CIBlock::SetFields($iblock_id, $arIBlockFields);
         $GLOBALS["stackCacheManager"]->Clear("b_iblock");
     }
     return new CListElementField($iblock_id, $arFields["TYPE"], $arFields["NAME"], $arFields["SORT"]);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:10,代码来源:listfield.php

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

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

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
//Library
include_once dirname(__FILE__) . "/iblock_tools.php";
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
//Parameters
if (!is_array($arParams)) {
    $arParams = array();
}
if (strlen($arParams["site_id"]) <= 0) {
    $arParams["site_id"] = "s1";
}
//Install themes iblock
DEMO_IBlock_ImportXML("010_services_services-themes_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true);
//Import XML
if ($IBLOCK_ID = DEMO_IBlock_ImportXML("020_news_content-news_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true)) {
    //Set Some IBLOCK FIELDS
    CIBlock::SetFields($IBLOCK_ID, array("ACTIVE_FROM" => array("DEFAULT_VALUE" => "=now"), "PREVIEW_PICTURE" => array("DEFAULT_VALUE" => array("FROM_DETAIL" => "Y", "SCALE" => "Y", "WIDTH" => 200, "HEIGHT" => 200, "IGNORE_ERRORS" => "N")), "DETAIL_PICTURE" => array("DEFAULT_VALUE" => array("SCALE" => "Y", "WIDTH" => 400, "HEIGHT" => 400, "IGNORE_ERRORS" => "N"))));
    DEMO_IBlock_EditFormLayout($IBLOCK_ID, array("edit1" => array("TITLE" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_TAB_TITLE"), "FIELDS" => array("ACTIVE" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_ACTIVE"), "ACTIVE_FROM" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_ACTIVE_FROM"), "SECTIONS" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_SECTIONS"), "NAME" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_NAME"), "PREVIEW_TEXT" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PREVIEW_TEXT"), "DETAIL_TEXT" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_DETAIL_TEXT"), "DETAIL_PICTURE" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_DETAIL_PICTURE"), "TAGS" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_TAGS"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-themes") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_THEMES"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-source") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_SOURCE"), "edit1_csection1" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_edit1_csection1"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-keywords") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_KEYWORDS"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-description") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_DESCRIPTION"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-browser_title") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_BROWSER_TITLE"), "edit1_csection2" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_edit1_csection2"), "WF_STATUS_ID" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_WF_STATUS_ID")))));
    //Create directory and copy files
    $search = array("#IBLOCK.ID(XML_ID=content-news)#");
    $replace = array($IBLOCK_ID);
    DEMO_IBlock_CopyFiles("/public/content/news/", "/content/news/", false, $search, $replace);
    //Add menu item
    DEMO_IBlock_AddMenuItem("/content/.left.menu.php", array(GetMessage("DEMO_IBLOCK_CONTENT_NEWS_MENU"), "/content/news/", array(), array(), ""));
    CUrlRewriter::Add(array("CONDITION" => "#^/content/news/#", "RULE" => "", "ID" => "bitrix:news", "PATH" => "/content/news/index.php"));
}
开发者ID:Satariall,项目名称:izurit,代码行数:30,代码来源:content-news.php

示例5: Add

 public static function Add($iblock_id, $arFields)
 {
     /** @global CStackCacheManager $stackCacheManager */
     global $stackCacheManager;
     if ($iblock_id > 0) {
         $arIBlockFields = CIBlock::GetArrayByID($iblock_id, "FIELDS");
         $arIBlockFields[$arFields["TYPE"]] = $arFields;
         CIBlock::SetFields($iblock_id, $arIBlockFields);
         $stackCacheManager->Clear("b_iblock");
     }
     return new CListElementField($iblock_id, $arFields["TYPE"], $arFields["NAME"], $arFields["SORT"]);
 }
开发者ID:rasuldev,项目名称:torino,代码行数:12,代码来源:listfield.php

示例6: __construct


//.........这里部分代码省略.........
        {
            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"),
        );
        \CIBlock::SetFields($this->CATALOG_ID, $iblockFields);
    }
开发者ID:phwb,项目名称:ugraweb.iiko,代码行数:101,代码来源:import.php

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

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


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