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


PHP CList::Save方法代码示例

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


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

示例1: CIBlock

 //For existing iblock add rights to rule
 $arFields["RIGHTS_MODE"] = "E";
 $arFields["RIGHTS"] = CListPermissions::MergeRights($arParams["~IBLOCK_TYPE_ID"], $arDBRights, $arPOSTRights);
 //Update existing or add new
 $ob = new CIBlock();
 if ($arIBlock) {
     $res = $ob->Update($arIBlock["ID"], $arFields);
     if ($res) {
         $res = $arIBlock["ID"];
     }
 } else {
     $res = $ob->Add($arFields);
     if ($res) {
         $obList = new CList($res);
         $obList->AddField(array("SORT" => 10, "NAME" => GetMessage("CC_BLLE_NAME_FIELD"), "IS_REQUIRED" => "Y", "MULTIPLE" => "N", "TYPE" => "NAME", "DEFAULT_VALUE" => ""));
         $obList->Save();
     }
 }
 if ($res) {
     if (strlen($arFields["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork')) {
         CSocNetGroup::SetLastActivity($arFields["SOCNET_GROUP_ID"]);
     }
     //Clear components cache
     $CACHE_MANAGER->ClearByTag("lists_list_" . $res);
     $CACHE_MANAGER->ClearByTag("lists_list_any");
     $CACHE_MANAGER->CleanDir("menu");
     $tab_name = $arResult["FORM_ID"] . "_active_tab";
     //And go to proper page
     if (isset($_POST["save"])) {
         LocalRedirect($arResult["LISTS_URL"]);
     } elseif ($arIBlock) {
开发者ID:vim84,项目名称:b-markt,代码行数:31,代码来源:component.php

示例2: createIBlock

 private static function createIBlock($iblockType, $iblock, $pictureType, $picture, $siteId = null)
 {
     if (is_null($siteId)) {
         $siteId = \CSite::GetDefSite();
     }
     $db = \CIBlock::GetList(array(), array("IBLOCK_TYPE_ID" => $iblockType, "CODE" => $iblock["CODE"], "CHECK_PERMISSIONS" => "N", "SITE_ID" => $siteId));
     if ($res = $db->Fetch()) {
         return $res["ID"];
     }
     $fields = array("NAME" => $iblock["NAME"], "DESCRIPTION" => $iblock["DESCRIPTION"], "IBLOCK_TYPE_ID" => $iblockType, "SORT" => $iblock["SORT"], "CODE" => $iblock["CODE"], "WORKFLOW" => "N", "ELEMENTS_NAME" => $iblock["ELEMENTS_NAME"], "ELEMENT_NAME" => $iblock["ELEMENT_NAME"], "ELEMENT_ADD" => $iblock["ELEMENT_ADD"], "ELEMENT_EDIT" => $iblock["ELEMENT_EDIT"], "ELEMENT_DELETE" => $iblock["ELEMENT_DELETE"], "SECTIONS_NAME" => $iblock["SECTIONS_NAME"], "SECTION_NAME" => $iblock["SECTION_NAME"], "SECTION_ADD" => $iblock["SECTION_ADD"], "SECTION_EDIT" => $iblock["SECTION_EDIT"], "SECTION_DELETE" => $iblock["SECTION_DELETE"], "BIZPROC" => "Y", "SITE_ID" => array($siteId), "RIGHTS_MODE" => "E");
     if ($iblock["SOCNET_GROUP_ID"]) {
         $fields["SOCNET_GROUP_ID"] = $iblock["SOCNET_GROUP_ID"];
     }
     static $exts = array("image/jpeg" => "jpg", "image/png" => "png", "image/gif" => "gif");
     if (!empty($picture) && isset($exts[$pictureType])) {
         $fn = \CTempFile::GetFileName();
         Main\IO\Directory::createDirectory($fn);
         $fn .= md5(mt_rand()) . "." . $exts[$pictureType];
         $f = fopen($fn, "wb");
         fwrite($f, $picture);
         fclose($f);
         $fields["PICTURE"] = \CFile::MakeFileArray($fn);
     }
     $ob = new \CIBlock();
     $res = $ob->Add($fields);
     if ($res) {
         self::createIBlockRights($res);
         $list = new \CList($res);
         if (isset($iblock["~NAME_FIELD"])) {
             $list->UpdateField("NAME", $iblock["~NAME_FIELD"]);
         }
         $list->Save();
         \CLists::setLiveFeed(1, $res);
         return $res;
     }
     return 0;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:37,代码来源:importer.php


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