當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。