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


PHP CSocNetUserToGroup::Delete方法代码示例

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


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

示例1: IntVal

                 $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");
         }
     }
     if (strlen($errorMessage) > 0) {
         $arResult["ErrorMessage"] = $errorMessage;
     }
 } elseif (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite() && intval($_REQUEST["invite_user_id"]) > 0) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例2: DeleteRelation

	function DeleteRelation($userID, $groupID)
	{
		global $APPLICATION;

		$userID = IntVal($userID);
		if ($userID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_USER_ID");
			return false;
		}

		$groupID = IntVal($groupID);
		if ($groupID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_GROUPID"), "ERROR_GROUPID");
			return false;
		}

		$dbResult = CSocNetUserToGroup::GetList(
			array(),
			array(
				"GROUP_ID" => $groupID,
				"USER_ID" => $userID,
			),
			false,
			false,
			array("ID", "ROLE", "GROUP_VISIBLE")
		);

		if ($arResult = $dbResult->Fetch())
		{
			if ($arResult["ROLE"] != SONET_ROLES_USER && $arResult["ROLE"] != SONET_ROLES_MODERATOR)
				return false;

			if (CSocNetUserToGroup::Delete($arResult["ID"]))
			{
				$arGroupSiteID = array();
				$rsGroupSite = CSocNetGroup::GetSite($groupID);
				while($arGroupSite = $rsGroupSite->Fetch())
				{
					$arGroupSiteID[] = $arGroupSite["LID"];

					//get server name
					$rsSites = CSite::GetByID($arGroupSite["LID"]);
					$arSite = $rsSites->Fetch();
					$serverName = $arSite["SERVER_NAME"];
					if (strlen($serverName) <= 0)
					{
						if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0)
							$serverName = SITE_SERVER_NAME;
						else
							$serverName = COption::GetOptionString("main", "server_name", $GLOBALS["SERVER_NAME"]);
					}

					if (strlen($serverName) > 0)
					{
						$protocol = (CMain::IsHTTPS() ? "https" : "http");
						$serverName = $protocol."://".$serverName;
					}
				}

				$fullWorkgroupsUrl = $serverName.COption::GetOptionString("socialnetwork", "workgroups_page", false, $arGroupSiteID["0"]);

				$logID = CSocNetLog::Add(
					array(
						"ENTITY_TYPE" => SONET_ENTITY_GROUP,
						"ENTITY_ID" => $groupID,
						"EVENT_ID" => "system",
						"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
						"TITLE_TEMPLATE" => false,
						"TITLE" => "unjoin",
						"MESSAGE" => $userID,
						"URL" => $fullWorkgroupsUrl,
						"MODULE_ID" => false,
						"CALLBACK_FUNC" => false,
						"USER_ID" => $userID,
						"SITE_ID" => $arGroupSiteID
					),
					false
				);
				if (intval($logID) > 0)
				{
					$tmpID = $logID;
					CSocNetLog::Update($logID, array("TMP_ID" => $tmpID));
					CSocNetLogRights::Add($logID, array("SA", "U".$userID, "S".SONET_ENTITY_GROUP.$groupID, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_OWNER, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_MODERATOR, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_USER));
					CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $tmpID);
				}
			}
			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_DELETE_RELATION");
				return false;
			}
		}
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:101,代码来源:user_group.php

示例3: DeleteRelation

 function DeleteRelation($userID, $groupID)
 {
     global $APPLICATION;
     $userID = IntVal($userID);
     if ($userID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_USER_ID");
         return false;
     }
     $groupID = IntVal($groupID);
     if ($groupID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_GROUPID"), "ERROR_GROUPID");
         return false;
     }
     $dbResult = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $groupID, "USER_ID" => $userID), false, false, array("ID", "ROLE", "GROUP_VISIBLE", "GROUP_NAME"));
     if ($arResult = $dbResult->Fetch()) {
         if ($arResult["ROLE"] != SONET_ROLES_USER && $arResult["ROLE"] != SONET_ROLES_MODERATOR) {
             return false;
         }
         if (CSocNetUserToGroup::Delete($arResult["ID"])) {
             if (IsModuleInstalled("im")) {
                 $arNotifyParams = array("TYPE" => "unjoin", "RELATION_ID" => $arResult["ID"], "USER_ID" => $userID, "GROUP_ID" => $groupID, "GROUP_NAME" => $arResult["GROUP_NAME"]);
                 CSocNetUserToGroup::NotifyImToModerators($arNotifyParams);
                 CSocNetSubscription::DeleteEx($userID, "SG" . $groupID);
             }
         } 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_DELETE_RELATION");
             return false;
         }
     } else {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_NO_USER2GROUP"), "ERROR_NO_MEMBER_REQUEST");
         return false;
     }
     CSocNetUserToGroup::__SpeedFileCheckMessages($userID);
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:42,代码来源:user_group.php

示例4: elseif

        die;
    } elseif ($_POST['ACTION'] == 'M2U' && !CSocNetUserToGroup::TransferModerator2Member($GLOBALS["USER"]->GetID(), $arGroup["ID"], $arRelationID, CSocNetUser::IsCurrentUserModuleAdmin())) {
        echo CUtil::PhpToJsObject(array('ERROR' => 'USER_ACTION_FAILED: ' . (($e = $APPLICATION->GetException()) ? $e->GetString() : "")));
        die;
    } elseif ($_POST['ACTION'] == 'SETOWNER' && !CSocNetUserToGroup::SetOwner($arUserID[0], $arGroup["ID"], $arGroup)) {
        echo CUtil::PhpToJsObject(array('ERROR' => 'USER_ACTION_FAILED: ' . (($e = $APPLICATION->GetException()) ? $e->GetString() : "")));
        die;
    } elseif ($_POST['ACTION'] == 'BAN' && !CSocNetUserToGroup::BanMember($GLOBALS["USER"]->GetID(), $arGroup["ID"], $arRelationID, CSocNetUser::IsCurrentUserModuleAdmin())) {
        echo CUtil::PhpToJsObject(array('ERROR' => 'USER_ACTION_FAILED: ' . (($e = $APPLICATION->GetException()) ? $e->GetString() : "")));
        die;
    } elseif ($_POST['ACTION'] == 'UNBAN' && !CSocNetUserToGroup::UnBanMember($GLOBALS["USER"]->GetID(), $arGroup["ID"], $arRelationID, CSocNetUser::IsCurrentUserModuleAdmin())) {
        echo CUtil::PhpToJsObject(array('ERROR' => 'USER_ACTION_FAILED: ' . (($e = $APPLICATION->GetException()) ? $e->GetString() : "")));
        die;
    } elseif ($_POST['ACTION'] == 'EX') {
        foreach ($arRelalationData as $relationData) {
            //group owner can't exclude himself from the group
            if ($relationData["ROLE"] == SONET_ROLES_OWNER) {
                echo CUtil::PhpToJsObject(array('ERROR' => 'SONET_GUE_T_OWNER_CANT_EXCLUDE_HIMSELF'));
                die;
            }
            if (!CSocNetUserToGroup::Delete($relationData["ID"], true)) {
                echo CUtil::PhpToJsObject(array('ERROR' => 'USER_ACTION_FAILED: ' . (($e = $APPLICATION->GetException()) ? $e->GetString() : "")));
                die;
            }
        }
    }
    echo CUtil::PhpToJsObject(array('SUCCESS' => 'Y'));
} else {
    echo CUtil::PhpToJsObject(array('ERROR' => 'SESSION_ERROR'));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:ajax.php


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