本文整理汇总了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;
}