本文整理匯總了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;
}