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


PHP CIBlockType::Update方法代码示例

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


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

示例1: applySnapshot

 public function applySnapshot($data, $dbVersion = null)
 {
     $iblockData = $this->handleNullValues($data['iblock']);
     $typeData = $this->handleNullValues($data['type']);
     $res = new ApplyResult();
     $type = new \CIBlockType();
     if (!\CIBlockType::GetByID($typeData['ID'])->Fetch()) {
         $res->setSuccess($type->Add($typeData));
     } else {
         $res->setSuccess($type->Update($typeData['ID'], $typeData));
     }
     if (!$res->isSuccess()) {
         return $res->setMessage($type->LAST_ERROR);
     }
     $extId = $iblockData['ID'];
     if ($dbVersion) {
         $id = $this->getCurrentVersionId($extId, $dbVersion);
     } else {
         $id = $extId;
     }
     if (!$dbVersion && !IblockTable::getById($id)->fetch()) {
         $addRes = IblockTable::add(array('ID' => $id, 'IBLOCK_TYPE_ID' => $typeData['ID'], 'NAME' => 'add'));
         if (!$addRes->isSuccess()) {
             throw new \Exception('add iblock error ' . implode(', ', $addRes->getErrorMessages()));
         }
     }
     $iblock = new \CIBlock();
     if ($id && ($currentData = IblockTable::getById($id)->fetch())) {
         $iblockData['PICTURE'] = $currentData['PICTURE'];
         $res->setSuccess((bool) $iblock->Update($id, $iblockData));
     } else {
         unset($iblockData['PICTURE']);
         $res->setSuccess((bool) ($id = $iblock->Add($iblockData)));
         $this->registerCurrentVersionId($id, $this->getReferenceValue($extId, $dbVersion));
     }
     $res->setId($id);
     return $res->setMessage($iblock->LAST_ERROR);
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:38,代码来源:iblockhandler.php

示例2: updateIBlockType

 /**
  * @param string $id
  * @param array $arFields
  *
  * @throws MigrationException
  */
 protected function updateIBlockType($id, array $arFields)
 {
     if (!$this->iBlockTypeGateway->Update($id, $arFields)) {
         throw new MigrationException($this->iBlockTypeGateway->LAST_ERROR);
     }
 }
开发者ID:rocko61rus,项目名称:QuetzalTools,代码行数:12,代码来源:AbstractIBlockMigration.php

示例3: foreach

    }
    if (empty($arTypesToShow)) {
        $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
    } else {
        $arFilter["=ID"] = $arTypesToShow;
    }
}
// Editing handling (rights check should be done!)
if ($USER->IsAdmin() && $lAdmin->EditAction()) {
    foreach ($FIELDS as $ID => $arFields) {
        if (!$lAdmin->IsUpdated($ID)) {
            continue;
        }
        $DB->StartTransaction();
        $obBlocktype = new CIBlockType();
        $res = $obBlocktype->Update($ID, $arFields);
        if (!$res) {
            $lAdmin->AddUpdateError(GetMessage("IBLOCK_TYPE_ADMIN_ERR_SAVE") . " ("" . htmlspecialcharsbx($ID) . ""): " . $obBlocktype->LAST_ERROR, $ID);
            $DB->Rollback();
        }
        $DB->Commit();
    }
}
if ($USER->IsAdmin() && ($arID = $lAdmin->GroupAction())) {
    if ($_REQUEST['action_target'] == 'selected') {
        $rsData = CIBlockType::GetList($arOrder, $arFilter);
        while ($arRes = $rsData->Fetch()) {
            $arID[] = $arRes['ID'];
        }
    }
    foreach ($arID as $ID) {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:iblock_type_admin.php

示例4: array

}
if (!CModule::IncludeModule("iblock")) {
    return;
}
COption::SetOptionString('iblock', 'use_htmledit', 'Y');
$arTypes = array(array("ID" => "photos", "SECTIONS" => "Y", "IN_RSS" => "N", "SORT" => 100, "LANG" => array()), array("ID" => "news", "SECTIONS" => "Y", "IN_RSS" => "Y", "SORT" => 200, "LANG" => array()), array("ID" => "services", "SECTIONS" => "Y", "IN_RSS" => "N", "SORT" => 300, "LANG" => array()), array("ID" => "photos", "SECTIONS" => "Y", "IN_RSS" => "N", "SORT" => 100, "LANG" => array()), array("ID" => "job", "SECTIONS" => "Y", "IN_RSS" => "N", "SORT" => 400, "LANG" => array()));
$arLanguages = array();
$rsLanguage = CLanguage::GetList($by, $order, array());
while ($arLanguage = $rsLanguage->Fetch()) {
    $arLanguages[] = $arLanguage["LID"];
}
$iblockType = new CIBlockType();
foreach ($arTypes as $arType) {
    $dbType = CIBlockType::GetList(array(), array("=ID" => $arType["ID"]));
    if ($dbType->Fetch()) {
        $iblockType->Update($arType["ID"], array("SECTIONS" => "Y"));
    } else {
        foreach ($arLanguages as $languageID) {
            WizardServices::IncludeServiceLang("type.php", $languageID);
            $code = strtoupper($arType["ID"]);
            $arType["LANG"][$languageID]["NAME"] = GetMessage($code . "_TYPE_NAME");
            $arType["LANG"][$languageID]["ELEMENT_NAME"] = GetMessage($code . "_ELEMENT_NAME");
            if ($arType["SECTIONS"] == "Y") {
                $arType["LANG"][$languageID]["SECTION_NAME"] = GetMessage($code . "_SECTION_NAME");
            }
        }
        $iblockType->Add($arType);
    }
}
?>
 
开发者ID:spas-viktor,项目名称:books,代码行数:30,代码来源:types.php

示例5: updateType

 /**
  * @throws \TAOUpdateTypeException
  */
 protected static function updateType($data)
 {
     global $DB;
     $DB->StartTransaction();
     $o = new \CIBlockType();
     $res = $o->Update($data['ID'], $data);
     if (!$res) {
         $DB->Rollback();
         throw new \TAOUpdateTypeException("Error update type " . $data['ID']);
     } else {
         $DB->Commit();
     }
 }
开发者ID:techart,项目名称:bitrix.tao,代码行数:16,代码来源:type.php

示例6: IblockTypeUpdate

 /**
  * @param string $name
  */
 protected function IblockTypeUpdate($data)
 {
     global $DB;
     if (empty(trim($data['ID']))) {
         throw new \Exception('You must set iblock type ID');
     }
     $name = trim($data['ID']);
     $res = \CIBlockType::GetList([], ['=ID' => $name]);
     if ($ob = $res->Fetch()) {
         $ib = new \CIBlockType();
         $DB->StartTransaction();
         $id = $ib->Update($ob['ID'], $data);
         if ($id) {
             $DB->Commit();
             echo "Update {$name} iblock type\r\n";
         } else {
             $DB->Rollback();
             throw new \Exception("Can't create {$name} iblock type");
         }
     } else {
         throw new \Exception("Iblock type don't exists");
     }
     return $id;
 }
开发者ID:marvin255,项目名称:bxmigrate,代码行数:27,代码来源:Coded.php


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