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


PHP CIBlockRights::ConvertGroups方法代码示例

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


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

示例1: Update


//.........这里部分代码省略.........
     }
     if (is_set($arFields, "SITE_ID")) {
         $arFields["LID"] = $arFields["SITE_ID"];
     }
     if (is_set($arFields, "SECTION_PROPERTY")) {
         $arFields["SECTION_PROPERTY"] = "Y";
     }
     $RIGHTS_MODE = CIBlock::GetArrayByID($ID, "RIGHTS_MODE");
     if (!$this->CheckFields($arFields, $ID)) {
         $Result = false;
         $arFields["RESULT_MESSAGE"] =& $this->LAST_ERROR;
     } else {
         $arLID = array();
         $str_LID = "";
         if (is_set($arFields, "LID")) {
             if (is_array($arFields["LID"])) {
                 $arLID = $arFields["LID"];
             } else {
                 $arLID[] = $arFields["LID"];
             }
             $arFields["LID"] = false;
             $str_LID = "''";
             foreach ($arLID as $v) {
                 $arFields["LID"] = $v;
                 $str_LID .= ", '" . $DB->ForSql($v) . "'";
             }
         }
         unset($arFields["ID"]);
         unset($arFields["VERSION"]);
         if (array_key_exists("PICTURE", $arFields)) {
             $SAVED_PICTURE = $arFields["PICTURE"];
             CFile::SaveForDB($arFields, "PICTURE", "iblock");
         }
         $strUpdate = $DB->PrepareUpdate("b_iblock", $arFields, "iblock");
         if (array_key_exists("PICTURE", $arFields)) {
             $arFields["PICTURE"] = $SAVED_PICTURE;
         }
         $arBinds = array();
         if (is_set($arFields, "DESCRIPTION")) {
             $arBinds["DESCRIPTION"] = $arFields["DESCRIPTION"];
         }
         if (strlen($strUpdate) > 0) {
             $strSql = "UPDATE b_iblock SET " . $strUpdate . " WHERE ID=" . $ID;
             $DB->QueryBind($strSql, $arBinds);
         }
         $this->SetMessages($ID, $arFields);
         if (isset($arFields["FIELDS"]) && is_array($arFields["FIELDS"])) {
             $this->SetFields($ID, $arFields["FIELDS"]);
         }
         if (array_key_exists("RIGHTS_MODE", $arFields)) {
             if ($arFields["RIGHTS_MODE"] === "E" && $RIGHTS_MODE !== "E") {
                 CIBlock::SetPermission($ID, array());
             } elseif ($arFields["RIGHTS_MODE"] !== "E" && $RIGHTS_MODE === "E") {
                 $obIBlockRights = new CIBlockRights($ID);
                 $obIBlockRights->DeleteAllRights();
             }
             if ($arFields["RIGHTS_MODE"] === "E") {
                 $RIGHTS_MODE = "E";
             }
         }
         if ($RIGHTS_MODE === "E") {
             if (!array_key_exists("RIGHTS", $arFields) && array_key_exists("GROUP_ID", $arFields) && is_array($arFields["GROUP_ID"])) {
                 $obIBlockRights = new CIBlockRights($ID);
                 $obIBlockRights->SetRights($obIBlockRights->ConvertGroups($arFields["GROUP_ID"]));
             } elseif (array_key_exists("RIGHTS", $arFields) && is_array($arFields["RIGHTS"])) {
                 $obIBlockRights = new CIBlockRights($ID);
                 $obIBlockRights->SetRights($arFields["RIGHTS"]);
             }
         } else {
             if (array_key_exists("GROUP_ID", $arFields) && is_array($arFields["GROUP_ID"])) {
                 CIBlock::SetPermission($ID, $arFields["GROUP_ID"]);
             }
         }
         if (!empty($arLID)) {
             $strSql = "DELETE FROM b_iblock_site WHERE IBLOCK_ID=" . $ID;
             $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
             $strSql = "INSERT INTO b_iblock_site(IBLOCK_ID, SITE_ID) " . "SELECT " . $ID . ", LID " . "FROM b_lang " . "WHERE LID IN (" . $str_LID . ") ";
             $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
         }
         if (CModule::IncludeModule("search")) {
             $dbAfter = $DB->Query("SELECT ACTIVE FROM b_iblock WHERE ID=" . $ID);
             $arAfter = $dbAfter->Fetch();
             if ($arAfter["ACTIVE"] != "Y") {
                 CSearch::DeleteIndex("iblock", false, false, $ID);
             }
         }
         $_SESSION["SESS_RECOUNT_DB"] = "Y";
         $Result = true;
     }
     $this->CleanCache($ID);
     $arFields["ID"] = $ID;
     $arFields["RESULT"] =& $Result;
     foreach (GetModuleEvents("iblock", "OnAfterIBlockUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arFields));
     }
     if (defined("BX_COMP_MANAGED_CACHE")) {
         $CACHE_MANAGER->ClearByTag("iblock_id_" . $ID);
     }
     return $Result;
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:iblock.php


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