本文整理汇总了PHP中CSocNetGroup::SetStat方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetGroup::SetStat方法的具体用法?PHP CSocNetGroup::SetStat怎么用?PHP CSocNetGroup::SetStat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetGroup
的用法示例。
在下文中一共展示了CSocNetGroup::SetStat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnAfterUserUpdate
function OnAfterUserUpdate(&$arFields)
{
if (array_key_exists("ACTIVE", $arFields) && defined("GLOBAL_ACTIVE_VALUE") && GLOBAL_ACTIVE_VALUE != $arFields["ACTIVE"]) {
$dbResult = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $arFields["ID"]), false, false, array("GROUP_ID"));
while ($arResult = $dbResult->Fetch()) {
$arGroups[] = $arResult["GROUP_ID"];
}
for ($i = 0; $i < count($arGroups); $i++) {
CSocNetGroup::SetStat($arGroups[$i]);
}
}
}
示例2: DeleteNoDemand
function DeleteNoDemand($userID)
{
global $DB;
if (!CSocNetGroup::__ValidateID($userID)) {
return false;
}
$userID = IntVal($userID);
$bSuccess = True;
$arGroups = array();
$dbResult = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $userID), false, false, array("GROUP_ID"));
while ($arResult = $dbResult->Fetch()) {
$arGroups[] = $arResult["GROUP_ID"];
}
$DB->Query("DELETE FROM b_sonet_user2group WHERE USER_ID = " . $userID . "", true);
$tmp_count = count($arGroups);
for ($i = 0; $i < $tmp_count; $i++) {
CSocNetGroup::SetStat($arGroups[$i]);
}
global $arSocNetUserInRoleCache;
$arSocNetUserInRoleCache = array();
CSocNetUserToGroup::__SpeedFileDelete($userID);
CSocNetSearch::OnUserRelationsChange($userID);
return $bSuccess;
}
示例3: 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;
}