本文整理汇总了PHP中CSocNetUserToGroup::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUserToGroup::GetByID方法的具体用法?PHP CSocNetUserToGroup::GetByID怎么用?PHP CSocNetUserToGroup::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetUserToGroup
的用法示例。
在下文中一共展示了CSocNetUserToGroup::GetByID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRelatedGroup
function getRelatedGroup($relationID)
{
$arRel = CSocNetUserToGroup::GetByID($relationID);
if ($arRel) {
return $arRel["GROUP_NAME"];
} else {
return false;
}
}
示例2: array
$arIDs = array();
if (strlen($errorMessage) <= 0) {
for ($i = 0; $i <= IntVal($_POST["max_count"]); $i++) {
if ($_POST["checked_" . $i] == "Y") {
$arIDs[] = IntVal($_POST["id_" . $i]);
}
}
if (count($arIDs) <= 0) {
$errorMessage .= GetMessage("SONET_C12_NOT_SELECTED") . ". ";
}
}
if (strlen($errorMessage) <= 0) {
if (strlen($_POST["reject"]) > 0) {
$errorMessage = "";
foreach ($arIDs as $relation_id) {
$arRelation = CSocNetUserToGroup::GetByID($relation_id);
if (!$arRelation) {
continue;
}
if (!CSocNetUserToGroup::Delete($arRelation["ID"])) {
if ($e = $APPLICATION->GetException()) {
$errorMessage .= $e->GetString();
}
if (StrLen($errorMessage) <= 0) {
$errorMessage .= GetMessage("SONET_C12_CANT_DELETE_INVITATION") . $arRelation["ID"];
}
}
}
$APPLICATION->ThrowException($errorMessage, "ERROR_DELETE_RELATION");
}
}
示例3: UnBanMember
function UnBanMember($userID, $groupID, $arRelationID, $currentUserIsAdmin)
{
global $APPLICATION, $DB;
$userID = IntVal($userID);
if ($userID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_USERID");
return false;
}
$groupID = IntVal($groupID);
if ($groupID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_GROUPID"), "ERROR_GROUPID");
return false;
}
if (!is_array($arRelationID)) {
return true;
}
$arGroup = CSocNetGroup::GetByID($groupID);
if (!$arGroup || !is_array($arGroup)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UG_ERROR_NO_GROUP_ID"), "ERROR_NO_GROUP");
return false;
}
$arUserPerms = CSocNetUserToGroup::InitUserPerms($userID, $arGroup, $currentUserIsAdmin);
if (!$arUserPerms["UserCanModifyGroup"] && !$arUserPerms["UserCanModerateGroup"]) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UG_ERROR_NO_PERMS"), "ERROR_NO_PERMS");
return false;
}
$bSuccess = true;
$tmp_count = count($arRelationID);
for ($i = 0; $i < $tmp_count; $i++) {
$arRelationID[$i] = IntVal($arRelationID[$i]);
if ($arRelationID[$i] <= 0) {
continue;
}
$arRelation = CSocNetUserToGroup::GetByID($arRelationID[$i]);
if (!$arRelation) {
continue;
}
if ($arRelation["GROUP_ID"] != $groupID || $arRelation["ROLE"] != SONET_ROLES_BAN) {
continue;
}
$arFields = array("ROLE" => SONET_ROLES_USER, "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction());
if (CSocNetUserToGroup::Update($arRelation["ID"], $arFields)) {
$arMessageFields = array("FROM_USER_ID" => $userID, "TO_USER_ID" => $arRelation["USER_ID"], "MESSAGE" => str_replace("#NAME#", $arGroup["NAME"], GetMessage("SONET_UG_UNBANMEMBER_MESSAGE")), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM);
CSocNetMessages::Add($arMessageFields);
} else {
$errorMessage = "";
if ($e = $APPLICATION->GetException()) {
$errorMessage = $e->GetString();
}
if (StrLen($errorMessage) <= 0) {
$errorMessage = GetMessage("SONET_UR_ERROR_CREATE_USER2GROUP");
}
$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_UNBANMEMBER");
$bSuccess = false;
}
}
return $bSuccess;
}
示例4: 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;
}
示例5: OnSocNetUserToGroupDelete
function OnSocNetUserToGroupDelete($ID)
{
if (!defined("BX_COMP_MANAGED_CACHE")) {
return true;
}
if (!CModule::IncludeModule('socialnetwork')) {
return false;
}
global $CACHE_MANAGER;
$arUser2Group = CSocNetUserToGroup::GetByID($ID);
if (!$arUser2Group) {
return true;
}
if (array_key_exists("GROUP_ID", $arUser2Group) && array_key_exists("USER_ID", $arUser2Group) && intval($arUser2Group["GROUP_ID"]) > 0 && intval($arUser2Group["USER_ID"]) > 0) {
$dbUsersInGroup = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $arUser2Group["GROUP_ID"], "<=ROLE" => SONET_ROLES_USER), false, false, array("ID", "USER_ID"));
if ($dbUsersInGroup) {
while ($arUserInGroup = $dbUsersInGroup->GetNext()) {
$CACHE_MANAGER->ClearByTag("extranet_user_" . $arUserInGroup["USER_ID"]);
}
}
$CACHE_MANAGER->ClearByTag("extranet_user_" . $arUser2Group["USER_ID"]);
}
return true;
}