本文整理汇总了PHP中CSocNetUserToGroup::SendEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUserToGroup::SendEvent方法的具体用法?PHP CSocNetUserToGroup::SendEvent怎么用?PHP CSocNetUserToGroup::SendEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetUserToGroup
的用法示例。
在下文中一共展示了CSocNetUserToGroup::SendEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Add
function Add($arFields)
{
global $DB;
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetUserToGroup::CheckFields("ADD", $arFields)) {
return false;
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetUserToGroupAdd");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
return false;
}
}
$arInsert = $DB->PrepareInsert("b_sonet_user2group", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($arInsert[0]) > 0) {
$arInsert[0] .= ", ";
}
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0) {
$arInsert[1] .= ", ";
}
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0) {
$strSql = "INSERT INTO b_sonet_user2group(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
CSocNetGroup::SetStat($arFields["GROUP_ID"]);
CSocNetSearch::OnUserRelationsChange($arFields["USER_ID"]);
$events = GetModuleEvents("socialnetwork", "OnSocNetUserToGroupAdd");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
}
if ($arFields["INITIATED_BY_TYPE"] == SONET_INITIATED_BY_GROUP && $arFields["SEND_MAIL"] != "N" && !IsModuleInstalled("im")) {
CSocNetUserToGroup::SendEvent($ID, "SONET_INVITE_GROUP");
}
}
if ($ID) {
global $arSocNetUserInRoleCache;
if (!isset($arSocNetUserInRoleCache) || !is_array($arSocNetUserInRoleCache)) {
$arSocNetUserInRoleCache = array();
}
$arSocNetUserInRoleCache[$arFields["USER_ID"] . "_" . $arFields["GROUP_ID"]] = $arFields["ROLE"];
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $arFields["GROUP_ID"]);
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_U" . $arFields["USER_ID"]);
}
}
return $ID;
}