当前位置: 首页>>代码示例>>PHP>>正文


PHP CSocNetUserToGroup::SendRequestToJoinGroup方法代码示例

本文整理汇总了PHP中CSocNetUserToGroup::SendRequestToJoinGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUserToGroup::SendRequestToJoinGroup方法的具体用法?PHP CSocNetUserToGroup::SendRequestToJoinGroup怎么用?PHP CSocNetUserToGroup::SendRequestToJoinGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSocNetUserToGroup的用法示例。


在下文中一共展示了CSocNetUserToGroup::SendRequestToJoinGroup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: inviteGroupUsers

	public static function inviteGroupUsers($arFields)
	{
		global $USER;

		$groupID = $arFields['GROUP_ID'];
		$arUserID = $arFields['USER_ID'];
		$message = $arFields['MESSAGE'];

		if(intval($groupID) <= 0)
			throw new Exception('Wrong group ID');

		if (
			(is_array($arUserID) && count($arUserID) <= 0)
			|| (!is_array($arUserID) && intval($arUserID) <= 0)
		)
			throw new Exception('Wrong user IDs');

		if (!is_array($arUserID))
			$arUserID = array($arUserID);

		$arSuccessID = array();

		$dbRes = CSocNetGroup::GetList(array(), array(
			"ID" => $groupID,
			"CHECK_PERMISSIONS" => $USER->GetID(),
		));
		$arGroup = $dbRes->Fetch();
		if(is_array($arGroup))
		{
			foreach($arUserID as $user_id)
			{
				$isCurrentUserTmp = ($USER->GetID() == $user_id);
				$canInviteGroup = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $user_id, "invitegroup", CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false));
				$user2groupRelation = CSocNetUserToGroup::GetUserRole($user_id, $arGroup["ID"]);

				if (
					!$isCurrentUserTmp && $canInviteGroup && !$user2groupRelation
					&& CSocNetUserToGroup::SendRequestToJoinGroup($USER->GetID(), $user_id, $arGroup["ID"], $message, true)
				)
					$arSuccessID[] = $user_id;
			}
		}
		else
			throw new Exception('Socialnetwork group not found');

		return $arSuccessID;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:47,代码来源:rest.php

示例2: GetMessage

                    $arResult["CurrentUserPerms"]["InviteGroup"] = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], "invitegroup", CSocNetUser::IsCurrentUserModuleAdmin());
                    $user2groupRelation = CSocNetUserToGroup::GetUserRole($arResult["User"]["ID"], $arResult["Group"]["ID"]);
                    if ($arResult["IsCurrentUser"]) {
                        $arResult["FatalError"] = GetMessage("SONET_C11_ERR_SELF") . ". ";
                    } elseif (!$arResult["CurrentUserPerms"]["InviteGroup"]) {
                        $arResult["FatalError"] = GetMessage("SONET_C11_BAD_USER") . ". ";
                    } elseif ($user2groupRelation) {
                        $arResult["FatalError"] = GetMessage("SONET_C11_BAD_RELATION") . ". ";
                    } else {
                        $arResult["ShowForm"] = "Input";
                        if ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["save"]) > 0 && check_bitrix_sessid()) {
                            $errorMessage = "";
                            if (strlen($_POST["MESSAGE"]) <= 0) {
                                $errorMessage .= GetMessage("SONET_C11_NO_MESSAGE") . ". ";
                            }
                            if (strlen($errorMessage) <= 0 && !CSocNetUserToGroup::SendRequestToJoinGroup($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], $arResult["Group"]["ID"], $_POST["MESSAGE"]) && ($e = $APPLICATION->GetException())) {
                                $errorMessage .= $e->GetString();
                            }
                            if (strlen($errorMessage) > 0) {
                                $arResult["ErrorMessage"] = $errorMessage;
                            } else {
                                $arResult["ShowForm"] = "Confirm";
                            }
                        }
                    }
                }
            }
        }
    }
}
$this->IncludeComponentTemplate();
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例3: RequestToSonetGroups

 public static function RequestToSonetGroups($arUserId, $arGroupCode, $arGroupName, $bExtranetUser = false)
 {
     $arGroupToAdd = array();
     $strError = false;
     if (!is_array($arUserId)) {
         $arUserId = array($arUserId);
     }
     if (is_array($arGroupCode) && !empty($arGroupCode) && CModule::IncludeModule("socialnetwork")) {
         foreach ($arGroupCode as $group_code) {
             if ($bExtranetUser && preg_match('/^(SGN\\d+)$/', $group_code, $match) && is_array($arGroupName) && isset($arGroupName[$match[1]]) && strlen($arGroupName[$match[1]]) > 0 && CModule::IncludeModule("extranet") && (CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false) || $GLOBALS["APPLICATION"]->GetGroupRight("socialnetwork", false, "Y", "Y", array(CExtranet::GetExtranetSiteID(), false)) >= "K")) {
                 // check and create group, for extranet only
                 $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => CExtranet::GetExtranetSiteID()), false, false, array("ID"));
                 if ($arSubject = $dbSubjects->GetNext()) {
                     $arSocNetGroupFields = array("NAME" => $arGroupName[$match[1]], "DESCRIPTION" => "", "VISIBLE" => "N", "OPENED" => "N", "CLOSED" => "N", "SUBJECT_ID" => $arSubject["ID"], "INITIATE_PERMS" => "E", "SPAM_PERMS" => "K", "SITE_ID" => array($SITE_ID, CExtranet::GetExtranetSiteID()));
                     if ($group_id = CSocNetGroup::CreateGroup($GLOBALS["USER"]->GetID(), $arSocNetGroupFields, false)) {
                         $arGroupToAdd[] = $group_id;
                     } elseif ($e = $GLOBALS["APPLICATION"]->GetException()) {
                         $strError = $e->GetString();
                     }
                 }
             } elseif (preg_match('/^SG(\\d+)$/', $group_code, $match)) {
                 $group_id = $match[1];
                 if (($arGroup = CSocNetGroup::GetByID($group_id)) && ($arCurrentUserPerms = CSocNetUserToGroup::InitUserPerms($GLOBALS["USER"]->GetID(), $arGroup, CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false))) && $arCurrentUserPerms["UserCanInitiate"] && $arGroup["CLOSED"] != "Y") {
                     $arGroupToAdd[] = $group_id;
                 }
             }
         }
         if (!$strError) {
             foreach ($arGroupToAdd as $group_id) {
                 foreach ($arUserId as $user_id) {
                     if (!CSocNetUserToGroup::SendRequestToJoinGroup($GLOBALS["USER"]->GetID(), $user_id, $group_id, "", false)) {
                         if ($e = $GLOBALS["APPLICATION"]->GetException()) {
                             $strError .= $e->GetString();
                         }
                     }
                 }
             }
         }
     }
     return $strError;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:41,代码来源:invite_dialog.php

示例4: foreach

             $errorMessage .= (strlen($errorMessage) > 0 ? "<br />" : "") . $strError;
             $arResult["ErrorFields"][] = "EXTRANET_BLOCK";
         } else {
             $arUserIDs[] = $ID_ADDED;
         }
     }
 }
 // send invitations
 if (is_array($arUserIDs) && count($arUserIDs) > 0) {
     foreach ($arUserIDs as $user_id) {
         $isCurrentUserTmp = $USER->GetID() == $user_id;
         $canInviteGroup = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $user_id, "invitegroup", CSocNetUser::IsCurrentUserModuleAdmin());
         $user2groupRelation = CSocNetUserToGroup::GetUserRole($user_id, $arResult["GROUP_ID"]);
         if (!$isCurrentUserTmp && $canInviteGroup && !$user2groupRelation) {
             $bMail = !is_array($arInvitedExtranetUsers) || !in_array($user_id, $arInvitedExtranetUsers);
             if (!CSocNetUserToGroup::SendRequestToJoinGroup($USER->GetID(), $user_id, $arResult["GROUP_ID"], $_POST["MESSAGE"], $bMail)) {
                 $rsUser = CUser::GetByID($user_id);
                 if ($arUser = $rsUser->Fetch()) {
                     $arErrorUsers[] = array(CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $bUseLogin), CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()) ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"])) : "");
                     if ($e = $APPLICATION->GetException()) {
                         $warningMessage .= $e->GetString();
                     }
                 }
             } elseif (is_array($arResult["POST"]["USER_IDS"]) && in_array($user_id, $arResult["POST"]["USER_IDS"])) {
                 $bInvited = true;
                 // delete from uninvited users list
                 $arKeysFound = array_keys($arResult["POST"]["USER_IDS"], $user_id);
                 foreach ($arKeysFound as $key) {
                     unset($arResult["POST"]["USER_IDS"][$key]);
                 }
             }
开发者ID:vim84,项目名称:b-markt,代码行数:31,代码来源:component.php

示例5: Str_Replace

             } else {
                 $strError = $user->LAST_ERROR;
                 if ($GLOBALS['APPLICATION']->GetException()) {
                     $err = $GLOBALS['APPLICATION']->GetException();
                     $strError .= $err->GetString();
                     $GLOBALS['APPLICATION']->ResetException();
                 }
                 $warningMessage .= Str_Replace("#EMAIL#", HtmlSpecialCharsEx($email["EMAIL"]), GetMessage("SONET_C33_CANNOT_USER_ADD") . $strError);
             }
         }
     }
     if ((!is_array($arUsersFull) || count($arUsersFull) <= 0) && (!is_array($arUserToRequest) || count($arUserToRequest) <= 0)) {
         $errorMessage .= GetMessage("SONET_C33_NO_USERS") . ". ";
     } else {
         foreach ($arUserToRequest as $arUser) {
             if (CSocNetUserToGroup::SendRequestToJoinGroup($GLOBALS["USER"]->GetID(), $arUser["ID"], $arResult["Group"]["ID"], $_POST["MESSAGE"])) {
                 $arSuccessUsers[] = array($arUser["NAME"], CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()) ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"])) : "");
             } else {
                 $arErrorUsers[] = array($arUser["NAME"], CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()) ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"])) : "");
                 if ($e = $APPLICATION->GetException()) {
                     $warningMessage .= $e->GetString();
                 }
             }
         }
     }
 }
 $arResult["SuccessUsers"] = $arSuccessUsers;
 $arResult["ErrorUsers"] = $arErrorUsers;
 $arResult["WarningMessage"] = $warningMessage;
 if (strlen($errorMessage) > 0) {
     $arResult["ErrorMessage"] = $errorMessage;
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php


注:本文中的CSocNetUserToGroup::SendRequestToJoinGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。