本文整理汇总了PHP中CSocNetUserRelations::SendEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUserRelations::SendEvent方法的具体用法?PHP CSocNetUserRelations::SendEvent怎么用?PHP CSocNetUserRelations::SendEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetUserRelations
的用法示例。
在下文中一共展示了CSocNetUserRelations::SendEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Update
function Update($ID, $arFields)
{
global $DB;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetUserRelations::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetUserRelationsUpdate");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID, $arFields)) === false) {
return false;
}
}
$arUserRelationOld = CSocNetUserRelations::GetByID($ID);
$strUpdate = $DB->PrepareUpdate("b_sonet_user_relations", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
$strSql = "UPDATE b_sonet_user_relations SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$events = GetModuleEvents("socialnetwork", "OnSocNetUserRelationsUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
if ((!array_key_exists("SEND_MAIL", $arFields) || $arFields["SEND_MAIL"] != "N") && !IsModuleInstalled("im")) {
$mailType = "";
if ($arUserRelationOld["RELATION"] != SONET_RELATIONS_FRIEND && $arFields["RELATION"] == SONET_RELATIONS_FRIEND) {
$mailType = "AGREE_FRIEND";
} elseif ($arUserRelationOld["RELATION"] != SONET_RELATIONS_BAN && $arFields["RELATION"] == SONET_RELATIONS_BAN) {
$mailType = "BAN_FRIEND";
} elseif ($arUserRelationOld["RELATION"] != SONET_RELATIONS_REQUEST && $arFields["RELATION"] == SONET_RELATIONS_REQUEST) {
$mailType = "INVITE_FRIEND";
}
if (StrLen($mailType) > 0) {
CSocNetUserRelations::SendEvent($ID, $mailType);
}
}
CSocNetSearch::OnUserRelationsChange($arUserRelationOld["FIRST_USER_ID"]);
CSocNetSearch::OnUserRelationsChange($arUserRelationOld["SECOND_USER_ID"]);
} else {
$ID = False;
}
return $ID;
}