當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CSocNetUserToGroup::CheckFields方法代碼示例

本文整理匯總了PHP中CSocNetUserToGroup::CheckFields方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSocNetUserToGroup::CheckFields方法的具體用法?PHP CSocNetUserToGroup::CheckFields怎麽用?PHP CSocNetUserToGroup::CheckFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CSocNetUserToGroup的用法示例。


在下文中一共展示了CSocNetUserToGroup::CheckFields方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Update

 function Update($ID, $arFields)
 {
     global $DB;
     if (!CSocNetGroup::__ValidateID($ID)) {
         return false;
     }
     $ID = IntVal($ID);
     $arUser2GroupOld = CSocNetUserToGroup::GetByID($ID);
     if (!$arUser2GroupOld) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_NO_USER2GROUP"), "ERROR_NO_USER2GROUP");
         return false;
     }
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CSocNetUserToGroup::CheckFields("UPDATE", $arFields, $ID)) {
         return false;
     }
     $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetUserToGroupUpdate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($ID, $arFields)) === false) {
             return false;
         }
     }
     $strUpdate = $DB->PrepareUpdate("b_sonet_user2group", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($strUpdate) > 0) {
             $strUpdate .= ", ";
         }
         $strUpdate .= $key . "=" . $value . " ";
     }
     if (strlen($strUpdate) > 0) {
         $strSql = "UPDATE b_sonet_user2group SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         CSocNetGroup::SetStat($arUser2GroupOld["GROUP_ID"]);
         CSocNetSearch::OnUserRelationsChange($arUser2GroupOld["USER_ID"]);
         if (array_key_exists("GROUP_ID", $arFields) && $arUser2GroupOld["GROUP_ID"] != $arFields["GROUP_ID"]) {
             CSocNetGroup::SetStat($arFields["GROUP_ID"]);
         }
         $events = GetModuleEvents("socialnetwork", "OnSocNetUserToGroupUpdate");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array($ID, $arFields));
         }
         global $arSocNetUserInRoleCache;
         if (!isset($arSocNetUserInRoleCache) || !is_array($arSocNetUserInRoleCache)) {
             $arSocNetUserInRoleCache = array();
         }
         if (array_key_exists($arUser2GroupOld["USER_ID"] . "_" . $arUser2GroupOld["GROUP_ID"], $arSocNetUserInRoleCache)) {
             unset($arSocNetUserInRoleCache[$arUser2GroupOld["USER_ID"] . "_" . $arUser2GroupOld["GROUP_ID"]]);
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $arUser2GroupOld["GROUP_ID"]);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_U" . $arUser2GroupOld["USER_ID"]);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group");
         }
     } else {
         $ID = False;
     }
     return $ID;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:64,代碼來源:user_group.php


注:本文中的CSocNetUserToGroup::CheckFields方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。