• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CSocNetUserToGroup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("socialnetwork")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $ownerId = CBPHelper::ExtractUsers($this->OwnerId, $documentId, true);
     $users = array_unique(CBPHelper::ExtractUsers($this->Users, $documentId, false));
     $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => SITE_ID), false, false, array("ID"));
     $row = $dbSubjects->fetch();
     if (!$row) {
         $this->WriteToTrackingService(GetMessage("BPCWG_ERROR_SUBJECT_ID"));
         return CBPActivityExecutionStatus::Closed;
     }
     $subjectId = $row['ID'];
     unset($dbSubjects, $row);
     $options = array("SITE_ID" => SITE_ID, "NAME" => $this->GroupName, "VISIBLE" => "Y", "OPENED" => "N", "CLOSED" => "N", "SUBJECT_ID" => $subjectId, "INITIATE_PERMS" => SONET_ROLES_OWNER, "SPAM_PERMS" => SONET_ROLES_USER);
     $groupId = CSocNetGroup::CreateGroup($ownerId, $options);
     if (!$groupId) {
         $this->WriteToTrackingService(GetMessage("BPCWG_ERROR_CREATE_GROUP"));
         return CBPActivityExecutionStatus::Closed;
     }
     $this->GroupId = $groupId;
     foreach ($users as $user) {
         if ($user == $ownerId) {
             continue;
         }
         CSocNetUserToGroup::Add(array("USER_ID" => $user, "GROUP_ID" => $groupId, "ROLE" => SONET_ROLES_USER, "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP, "INITIATED_BY_USER_ID" => $ownerId, "MESSAGE" => false));
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:32,代码来源:createworkgroup.php


示例2: getRelatedGroup

 function getRelatedGroup($relationID)
 {
     $arRel = CSocNetUserToGroup::GetByID($relationID);
     if ($arRel) {
         return $arRel["GROUP_NAME"];
     } else {
         return false;
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:9,代码来源:component.php


示例3: _socnet_type_check

 protected static function _socnet_type_check($USER, $iblock_type_id, $socnet_group_id)
 {
     if ($iblock_type_id === COption::GetOptionString("lists", "socnet_iblock_type_id")) {
         $socnet_role = CSocNetUserToGroup::GetUserRole($USER->GetID(), $socnet_group_id);
         if ($socnet_role == "A") {
             return CListPermissions::IS_ADMIN;
         } else {
             return CListPermissions::CAN_READ;
         }
     } else {
         return CListPermissions::WRONG_IBLOCK_TYPE;
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:13,代码来源:listperm.php


示例4: getUserGroups

 public static function getUserGroups($userId, $force = false)
 {
     static $cache = array();
     if (!$force && isset($cache[$userId])) {
         return $cache[$userId];
     }
     $cache[$userId] = array();
     if (!CModule::IncludeModule('socialnetwork')) {
         return $cache[$userId];
     }
     $userGroupFilter = array('USER_ID' => (int) $userId, '<=ROLE' => SONET_ROLES_USER);
     $dbUserGroups = CSocNetUserToGroup::GetList(array('GROUP_NAME' => 'ASC'), $userGroupFilter, false, false, array('GROUP_NAME', 'GROUP_ID'));
     while ($row = $dbUserGroups->GetNext()) {
         $cache[$userId][] = $row;
     }
     return $cache[$userId];
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:17,代码来源:functions.php


示例5: OnUserInitialize

 function OnUserInitialize($user_id, $arFields = array())
 {
     if (intval($user_id) <= 0) {
         return false;
     }
     if (CModule::IncludeModule("im")) {
         $bIM = true;
     }
     $dbRelation = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $user_id, "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, false, array("ID", "GROUP_ID"));
     while ($arRelation = $dbRelation->Fetch()) {
         if (CSocNetUserToGroup::UserConfirmRequestToBeMember($user_id, $arRelation["ID"], false) && defined("BX_COMP_MANAGED_CACHE")) {
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $arRelation["GROUP_ID"]);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_U" . $user_id);
             if ($bIM) {
                 CIMNotify::DeleteByTag("SOCNET|INVITE_GROUP|" . $user_id . "|" . intval($arRelation["ID"]));
             }
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:19,代码来源:user.php


示例6: getUserGroupWithStorage

 protected function getUserGroupWithStorage()
 {
     if (!\CBXFeatures::isFeatureEnabled("Workgroups")) {
         return array();
     }
     if (!Loader::includeModule('socialnetwork')) {
         return array();
     }
     $userId = $this->getUser()->getId();
     $currentPossibleUserGroups = $currentUserGroups = array();
     $cache = Cache::createInstance();
     $cacheTtl = defined('BX_COMP_MANAGED_CACHE') ? 3153600 : 3600 * 4;
     $cachePath = "/disk/uf/{$userId}";
     if ($cache->initCache($cacheTtl, 'group_storage_list_' . SITE_ID . '_' . $userId, $cachePath)) {
         list($currentUserGroups) = $cache->getVars();
     } else {
         $cache->startDataCache();
         $taggedCache = Application::getInstance()->getTaggedCache();
         $taggedCache->startTagCache($cachePath);
         $diskSecurityContext = new DiskSecurityContext($userId);
         $storages = Storage::getReadableList($diskSecurityContext, array('filter' => array('STORAGE.ENTITY_TYPE' => ProxyType\Group::className())));
         foreach ($storages as $storage) {
             $currentPossibleUserGroups[$storage->getEntityId()] = $storage;
         }
         unset($storage);
         $query = \CSocNetUserToGroup::getList(array('GROUP_NAME' => 'ASC'), array('USER_ID' => $userId, 'GROUP_ID' => array_keys($currentPossibleUserGroups)), false, false, array('GROUP_ID', 'GROUP_NAME', 'GROUP_ACTIVE', 'GROUP_CLOSED', 'ROLE'));
         while ($row = $query->getNext()) {
             if ($row['GROUP_ACTIVE'] == 'Y' && $row['GROUP_CLOSED'] == 'N' && $row['ROLE'] != SONET_ROLES_BAN && $row['ROLE'] != SONET_ROLES_REQUEST && isset($currentPossibleUserGroups[$row['GROUP_ID']])) {
                 $taggedCache->registerTag("sonet_features_G_{$row['GROUP_ID']}");
                 $taggedCache->registerTag("sonet_group_{$row['GROUP_ID']}");
                 $currentUserGroups[$row['GROUP_ID']] = array('STORAGE' => $currentPossibleUserGroups[$row['GROUP_ID']], 'NAME' => $row['GROUP_NAME']);
             }
         }
         $taggedCache->registerTag("sonet_user2group_U{$userId}");
         $taggedCache->endTagCache();
         $cache->endDataCache(array($currentUserGroups));
     }
     return $currentUserGroups;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:39,代码来源:controller.php


示例7: getUserGroupWithStorage

 protected function getUserGroupWithStorage()
 {
     if (!\CBXFeatures::isFeatureEnabled("Workgroups")) {
         return array();
     }
     if (!Loader::includeModule('socialnetwork')) {
         return array();
     }
     $userId = $this->getUser()->getId();
     $currentPossibleUserGroups = $currentUserGroups = array();
     $diskSecurityContext = new DiskSecurityContext($this->getUser()->getId());
     $storages = Storage::getReadableList($diskSecurityContext, array('filter' => array('STORAGE.ENTITY_TYPE' => ProxyType\Group::className())));
     foreach ($storages as $storage) {
         $currentPossibleUserGroups[$storage->getEntityId()] = $storage;
     }
     unset($storage);
     $query = \CSocNetUserToGroup::getList(array('GROUP_NAME' => 'ASC'), array('USER_ID' => $userId, 'GROUP_ID' => array_keys($currentPossibleUserGroups)), false, false, array('GROUP_ID', 'GROUP_NAME', 'GROUP_ACTIVE', 'GROUP_CLOSED', 'ROLE'));
     while ($row = $query->getNext()) {
         if ($row['GROUP_ACTIVE'] == 'Y' && $row['GROUP_CLOSED'] == 'N' && $row['ROLE'] != SONET_ROLES_BAN && $row['ROLE'] != SONET_ROLES_REQUEST && isset($currentPossibleUserGroups[$row['GROUP_ID']])) {
             $currentUserGroups[$row['GROUP_ID']] = array('STORAGE' => $currentPossibleUserGroups[$row['GROUP_ID']], 'NAME' => $row['GROUP_NAME']);
         }
     }
     return $currentUserGroups;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:24,代码来源:controller.php


示例8: getUserGroups

	public static function getUserGroups($arFields, $n, $server)
	{
		global $USER;

		$dbRes = CSocNetUserToGroup::GetList(
			array('ID' => 'ASC'),
			array(
				'USER_ID' => $USER->GetID(),
				'<=ROLE' => SONET_ROLES_USER
			), false, false, array('GROUP_ID', 'GROUP_NAME', 'ROLE')
		);

		$res = array();
		while ($arRes = $dbRes->Fetch())
		{
			$res[] = $arRes;
		}

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


示例9: array

 if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
     $arFilter["SITE_ID"] = SITE_ID;
 } else {
     $arFilter["SITE_ID"] = array(SITE_ID, false);
 }
 $cnt = 0;
 $dbEvents = CSocNetLog::GetList(array("LOG_DATE" => "DESC"), $arFilter, false, false, array("MIN_ID_JOIN" => true));
 while ($arEvents = $dbEvents->GetNext()) {
     if (intval($arParams["LOG_CNT"]) > 0 && $cnt >= $arParams["LOG_CNT"]) {
         break;
     }
     if ($arResult["Events"] == false) {
         $arResult["Events"] = array();
     }
     if ($arEvents["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
         $arCurrentUserPerms = CSocNetUserToGroup::InitUserPerms($GLOBALS["USER"]->GetID(), array("ID" => $arEvents["ENTITY_ID"], "OWNER_ID" => $arEvents["GROUP_OWNER_ID"], "INITIATE_PERMS" => $arEvents["GROUP_INITIATE_PERMS"], "VISIBLE" => $arEvents["GROUP_VISIBLE"], "OPENED" => $arEvents["GROUP_OPENED"]), $bCurrentUserIsAdmin);
         if ($arEvents["EVENT_ID"] == "system") {
             if (!$arCurrentUserPerms["UserIsMember"]) {
                 continue;
             }
         } elseif ($arEvents["EVENT_ID"] == "blog_post") {
             if (!array_key_exists("blog", $arSocNetFeaturesSettings) || !CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arEvents["ENTITY_ID"], "blog", "view_post", $bCurrentUserIsAdmin)) {
                 continue;
             }
         } elseif ($arEvents["EVENT_ID"] == "blog_post_micro") {
             if (!array_key_exists("microblog", $arSocNetFeaturesSettings) || !CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arEvents["ENTITY_ID"], "blog", "view_post", $bCurrentUserIsAdmin)) {
                 continue;
             }
         } elseif ($arEvents["EVENT_ID"] == "blog_comment") {
             if (!array_key_exists("blog", $arSocNetFeaturesSettings) || !CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arEvents["ENTITY_ID"], "blog", "view_comment", $bCurrentUserIsAdmin)) {
                 continue;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php


示例10: OnSearchCheckPermissions

 function OnSearchCheckPermissions($FIELD)
 {
     global $DB, $USER;
     $user_id = intval($USER->GetID());
     $arResult = array();
     if ($user_id > 0) {
         $arResult[] = "SU" . $user_id . "_Z";
         $rsFriends = CSocNetUserRelations::GetList(array(), array("USER_ID" => $user_id, "RELATION" => SONET_RELATIONS_FRIEND), false, false, array("ID", "FIRST_USER_ID", "SECOND_USER_ID", "DATE_CREATE", "DATE_UPDATE", "INITIATED_BY"));
         while ($arFriend = $rsFriends->Fetch()) {
             if ($arFriend["FIRST_USER_ID"] != $user_id) {
                 $arResult[] = "SU" . $arFriend["FIRST_USER_ID"] . "_M";
             }
             if ($arFriend["SECOND_USER_ID"] != $user_id) {
                 $arResult[] = "SU" . $arFriend["SECOND_USER_ID"] . "_M";
             }
         }
     }
     $rsGroups = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $user_id), false, false, array("GROUP_ID", "ROLE"));
     while ($arGroup = $rsGroups->Fetch()) {
         $arResult[] = "SG" . $arGroup["GROUP_ID"] . "_" . $arGroup["ROLE"];
     }
     return $arResult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:23,代码来源:search.php


示例11: GetMessage

 $arResult["Group"] = $arGroup;
 $arResult["CurrentUserPerms"] = CSocNetUserToGroup::InitUserPerms($GLOBALS["USER"]->GetID(), $arResult["Group"], CSocNetUser::IsCurrentUserModuleAdmin());
 if (!$arResult["CurrentUserPerms"] || !$arResult["CurrentUserPerms"]["UserCanViewGroup"] || !$arResult["CurrentUserPerms"]["UserCanSpamGroup"]) {
     $arResult["FatalError"] = GetMessage("SONET_CHAT_GROUP_ACESS");
 } else {
     $arResult["Urls"]["Group"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arResult["Group"]["ID"]));
     if ($arParams["SET_TITLE"] == "Y") {
         $APPLICATION->SetTitle($arResult["Group"]["NAME"] . ": " . GetMessage("SONET_CHAT_GROUP_TITLE"));
     }
     if (intval($arResult["Group"]["IMAGE_ID"]) <= 0) {
         $arResult["Group"]["IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID);
     }
     $arImage = CSocNetTools::InitImage($arResult["Group"]["IMAGE_ID"], 50, "/bitrix/images/socialnetwork/nopic_group_50.gif", 50, $arResult["Urls"]["Group"], true, 'target="_blank"');
     $arResult["Group"]["IMAGE_ID_FILE"] = $arImage["FILE"];
     $arResult["Group"]["IMAGE_ID_IMG"] = $arImage["IMG"];
     $dbRequests = CSocNetUserToGroup::GetList(array("USER_LAST_NAME" => "ASC", "USER_NAME" => "ASC"), array("GROUP_ID" => $arResult["Group"]["ID"], "<=ROLE" => SONET_ROLES_USER), false, false, array("ID", "USER_ID", "ROLE", "DATE_CREATE", "DATE_UPDATE", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER", "USER_IS_ONLINE"));
     if ($dbRequests) {
         $arResult["Users"] = array();
         $arResult["Users"]["List"] = false;
         while ($arRequests = $dbRequests->GetNext()) {
             if ($arResult["UserSelf"]["ID"] == $arRequests["USER_ID"]) {
                 continue;
             }
             if ($arResult["Users"]["List"] == false) {
                 $arResult["Users"]["List"] = array();
             }
             $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arRequests["USER_ID"]));
             $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arRequests["USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
             $arTmpUser = array("NAME" => htmlspecialcharsback($arRequests["USER_NAME"]), "LAST_NAME" => htmlspecialcharsback($arRequests["USER_LAST_NAME"]), "SECOND_NAME" => htmlspecialcharsback($arRequests["USER_SECOND_NAME"]), "LOGIN" => htmlspecialcharsback($arRequests["USER_LOGIN"]));
             $strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin);
             $arResult["Users"]["List"][] = array("ID" => $arRequests["ID"], "USER_ID" => $arRequests["USER_ID"], "USER_NAME" => $arRequests["USER_NAME"], "USER_LAST_NAME" => $arRequests["USER_LAST_NAME"], "USER_SECOND_NAME" => $arRequests["USER_SECOND_NAME"], "USER_LOGIN" => $arRequests["USER_LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "PATH_TO_MESSAGES_CHAT" => str_replace("#user_id#", $arRequests["USER_ID"], $arParams["PATH_TO_MESSAGES_CHAT"]), "IS_ONLINE" => $arRequests["USER_IS_ONLINE"] == "Y", "IS_MODERATOR" => $arRequests["ROLE"] != SONET_ROLES_USER);
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php


示例12: AllowToSend

	public static function AllowToSend($arParams)
	{
		$bResult = false;
		if (isset($arParams['TO_USER_ID']))
		{
			$toUserId = intval($arParams['TO_USER_ID']);

			$bResult = true;
			if(IsModuleInstalled('intranet') && CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser())
			{
				$bResult = false;
				if (CModule::IncludeModule("socialnetwork"))
				{
					global $USER, $CACHE_MANAGER;

					if(defined("BX_COMP_MANAGED_CACHE"))
						$ttl = 2592000;
					else
						$ttl = 600;

					$cache_id = 'im_user_sg_'.$USER->GetID();
					$obSGCache = new CPHPCache;
					$cache_dir = '/bx/imc/sonet';

					if($obSGCache->InitCache($ttl, $cache_id, $cache_dir))
					{
						$tmpVal = $obSGCache->GetVars();
						$bResult = in_array($toUserId, $tmpVal['EXTRANET_USERS']);
					}
					else
					{
						if(defined("BX_COMP_MANAGED_CACHE"))
							$CACHE_MANAGER->StartTagCache($cache_dir);

						$dbUsersInGroup = CSocNetUserToGroup::GetList(
							array(),
							array(
								"USER_ID" => $USER->GetID(),
								"<=ROLE" => SONET_ROLES_USER,
								"GROUP_SITE_ID" => CExtranet::GetExtranetSiteID(),
								"GROUP_ACTIVE" => "Y",
								"GROUP_CLOSED" => "N"
							),
							false,
							false,
							array("ID", "GROUP_ID", "GROUP_NAME")
						);

						$arUserSocNetGroups = Array();
						$arUserSG = Array();
						while ($ar = $dbUsersInGroup->GetNext(true, false))
						{
							$arUserSocNetGroups[] = $ar["GROUP_ID"];
							$arUserSG['SG'.$ar['GROUP_ID']] = array(
								'id' => 'SG'.$ar['GROUP_ID'],
								'status' => 'close',
								'name' => GetMessage('IM_CL_GROUP_SG').$ar['GROUP_NAME']
							);
							if(defined("BX_COMP_MANAGED_CACHE"))
							{
								$CACHE_MANAGER->RegisterTag('sonet_group_'.$ar['GROUP_ID']);
								$CACHE_MANAGER->RegisterTag('sonet_user2group_G'.$ar['GROUP_ID']);
							}
						}

						$arExtranetUsers = Array();
						$arUserInGroup = Array();
						$arWoUserInGroup = Array();
						if (count($arUserSocNetGroups) > 0)
						{
							$dbUsersInGroup = CSocNetUserToGroup::GetList(
								array(),
								array(
									"GROUP_ID" => $arUserSocNetGroups,
									"<=ROLE" => SONET_ROLES_USER,
									"USER_ACTIVE" => "Y"
								),
								false,
								false,
								array("ID", "USER_ID", "GROUP_ID")
							);

							while ($ar = $dbUsersInGroup->GetNext(true, false))
							{
								if($USER->GetID() != $ar["USER_ID"])
								{
									$arExtranetUsers[$ar["USER_ID"]] = $ar["USER_ID"];

									if (isset($arUserInGroup["SG".$ar["GROUP_ID"]]))
										$arUserInGroup["SG".$ar["GROUP_ID"]]['users'][] = $ar["USER_ID"];
									else
										$arUserInGroup["SG".$ar["GROUP_ID"]] = Array('id' => "SG".$ar["GROUP_ID"], 'users' => Array($ar["USER_ID"]));

									if (isset($arWoUserInGroup["extranet"]))
										$arWoUserInGroup["extranet"]['users'][] = $ar["USER_ID"];
									else
										$arWoUserInGroup["extranet"] = Array('id' => "extranet", 'users' => Array($ar["USER_ID"]));
								}
							}
							if (isset($arWoUserInGroup['extranet']) && isset($arWoUserInGroup['extranet']['users']))
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:im_contact_list.php


示例13: GetMessage

            if ($arParams["SET_NAV_CHAIN"] != "N") {
                $APPLICATION->AddChainItem($arResult["Group"]["NAME"], $arResult["Urls"]["Group"]);
                $APPLICATION->AddChainItem(GetMessage("SONET_C37_PAGE_TITLE"));
            }
            if ($arResult["CurrentUserPerms"]["UserIsOwner"]) {
                $arResult["FatalError"] = GetMessage("SONET_C37_IS_OWNER") . ". ";
            } elseif (!$arResult["CurrentUserPerms"]["UserIsMember"]) {
                $arResult["FatalError"] = GetMessage("SONET_C37_NOT_MEMBER") . ". ";
            } else {
                if ($arParams["SET_TITLE"] == "Y") {
                    $APPLICATION->SetTitle($arResult["Group"]["NAME"] . ": " . GetMessage("SONET_C37_PAGE_TITLE"));
                }
                $arResult["ShowForm"] = "Input";
                if ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["save"]) > 0 && check_bitrix_sessid()) {
                    $errorMessage = "";
                    if (strlen($errorMessage) <= 0) {
                        if (!CSocNetUserToGroup::DeleteRelation($GLOBALS["USER"]->GetID(), $arResult["Group"]["ID"]) && ($e = $APPLICATION->GetException())) {
                            $errorMessage .= $e->GetString();
                        }
                    }
                    if (strlen($errorMessage) > 0) {
                        $arResult["ErrorMessage"] = $errorMessage;
                    } else {
                        $arResult["ShowForm"] = "Confirm";
                    }
                }
            }
        }
    }
}
$this->IncludeComponentTemplate();
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php


示例14: GetSocnetGroup

 public static function GetSocnetGroup($arParams = array())
 {
     global $USER;
     $userId = intval($USER->GetID());
     $arSocnetGroups = array();
     $arSelect = array();
     if (isset($arParams['id'])) {
         if (empty($arParams['id'])) {
             return $arSocnetGroups;
         } else {
             foreach ($arParams['id'] as $value) {
                 $arSelect[] = intval($value);
             }
         }
     }
     if (isset($arParams['site_id']) && strlen($arParams['site_id']) > 0) {
         $siteId = $arParams['site_id'];
     } else {
         $siteId = SITE_ID;
     }
     $arFilter = array("USER_ID" => $userId, "ID" => $arSelect, "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => $siteId, "GROUP_ACTIVE" => "Y");
     if (isset($arParams['GROUP_CLOSED'])) {
         $arFilter['GROUP_CLOSED'] = $arParams['GROUP_CLOSED'];
     }
     $arSocnetGroupsTmp = array();
     $rsGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arFilter, false, array("nTopCount" => 500), array("ID", "GROUP_ID", "GROUP_NAME", "GROUP_DESCRIPTION", "GROUP_IMAGE_ID"));
     while ($arGroup = $rsGroups->Fetch()) {
         $arGroupTmp = array("id" => $arGroup["GROUP_ID"], "entityId" => $arGroup["GROUP_ID"], "name" => htmlspecialcharsbx($arGroup["GROUP_NAME"]), "desc" => htmlspecialcharsbx($arGroup["GROUP_DESCRIPTION"]));
         if ($arGroup["GROUP_IMAGE_ID"]) {
             $imageFile = CFile::GetFileArray($arGroup["GROUP_IMAGE_ID"]);
             if ($imageFile !== false) {
                 $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => intval($arParams["THUMBNAIL_SIZE_WIDTH"]) > 0 ? $arParams["THUMBNAIL_SIZE_WIDTH"] : 30, "height" => intval($arParams["THUMBNAIL_SIZE_HEIGHT"]) > 0 ? $arParams["THUMBNAIL_SIZE_HEIGHT"] : 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
                 $arGroupTmp["avatar"] = $arFileTmp["src"];
             }
         }
         $arSocnetGroupsTmp[$arGroupTmp['id']] = $arGroupTmp;
     }
     if (isset($arParams['features']) && !empty($arParams['features'])) {
         self::GetSocnetGroupFilteredByFeaturePerms($arSocnetGroupsTmp, $arParams['features']);
     }
     foreach ($arSocnetGroupsTmp as $value) {
         $value['id'] = 'SG' . $value['id'];
         $arSocnetGroups[$value['id']] = $value;
     }
     return $arSocnetGroups;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:46,代码来源:log_destination.php


示例15: CreateGroup

 function CreateGroup($ownerID, $arFields, $bAutoSubscribe = true)
 {
     global $APPLICATION, $DB;
     $ownerID = IntVal($ownerID);
     if ($ownerID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_OWNERID") . ". ", "ERROR_OWNERID");
         return false;
     }
     if (!isset($arFields) || !is_array($arFields)) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_FIELDS") . ". ", "ERROR_FIELDS");
         return false;
     }
     $DB->StartTransaction();
     $arFields["=DATE_CREATE"] = $GLOBALS["DB"]->CurrentTimeFunction();
     $arFields["=DATE_UPDATE"] = $GLOBALS["DB"]->CurrentTimeFunction();
     $arFields["=DATE_ACTIVITY"] = $GLOBALS["DB"]->CurrentTimeFunction();
     $arFields["ACTIVE"] = "Y";
     $arFields["OWNER_ID"] = $ownerID;
     if (!is_set($arFields, "SPAM_PERMS") || strlen($arFields["SPAM_PERMS"]) <= 0) {
         $arFields["SPAM_PERMS"] = SONET_ROLES_OWNER;
     }
     $groupID = CSocNetGroup::Add($arFields);
     if (!$groupID || IntVal($groupID) <= 0) {
         $errorMessage = "";
         if ($e = $APPLICATION->GetException()) {
             $errorMessage = $e->GetString();
             $errorID = $e->GetID();
             if (StrLen($errorID) <= 0 && isset($e->messages) && is_array($e->messages) && is_array($e->messages[0]) && array_key_exists("id", $e->messages[0])) {
                 $errorID = $e->messages[0]["id"];
             }
         }
         if (StrLen($errorMessage) <= 0) {
             $errorMessage = GetMessage("SONET_UR_ERROR_CREATE_GROUP") . ". ";
         }
         if (StrLen($errorID) <= 0) {
             $errorID = "ERROR_CREATE_GROUP";
         }
         $GLOBALS["APPLICATION"]->ThrowException($errorMessage, $errorID);
         $DB->Rollback();
         return false;
     }
     $arFields1 = array("USER_ID" => $ownerID, "GROUP_ID" => $groupID, "ROLE" => SONET_ROLES_OWNER, "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "INITIATED_BY_TYPE" => SONET_INITIATED_BY_USER, "INITIATED_BY_USER_ID" => $ownerID, "MESSAGE" => false);
     if (!CSocNetUserToGroup::Add($arFields1)) {
         $errorMessage = "";
         if ($e = $APPLICATION->GetException()) {
             $errorMessage = $e->GetString();
         }
         if (StrLen($errorMessage) <= 0) {
             $errorMessage = GetMessage("SONET_UR_ERROR_CREATE_U_GROUP") . ". ";
         }
         $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_CREATE_GROUP");
         $DB->Rollback();
         return false;
     }
     if ($bAutoSubscribe) {
         CSocNetLogEvents::AutoSubscribe($ownerID, SONET_ENTITY_GROUP, $groupID);
     }
     CSocNetSubscription::Set($ownerID, "SG" . $groupID, "Y");
     $DB->Commit();
     return $groupID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:61,代码来源:group.php


示例16: while

 while ($arGroup = $dbGroup->GetNext()) {
     if ($arCacheResult["Groups"]["List"] == false) {
         $arCacheResult["Groups"]["List"] = array();
     }
     $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arGroup["ID"]));
     if (intval($arGroup["IMAGE_ID"]) <= 0) {
         $arGroup["IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID);
     }
     $arImageResized = false;
     $imageFile = CFile::GetFileArray($arGroup["IMAGE_ID"]);
     if ($imageFile !== false) {
         $arImageResized = CFile::ResizeImageGet($imageFile, array("width" => $arParams["THUMBNAIL_SIZE"], "height" => $arParams["THUMBNAIL_SIZE"]), BX_RESIZE_IMAGE_EXACT);
     }
     $arImage = CSocNetTools::InitImage($arGroup["IMAGE_ID"], 150, "/bitrix/images/socialnetwork/nopic_group_150.gif", 150, $pu, true);
     if ($arParams["PAGE"] == "group_request_group_search") {
         $arCurrentUserPerms4Group = CSocNetUserToGroup::InitUserPerms($arResult["User"]["ID"], array("ID" => $arGroup["ID"], "OWNER_ID" => $arGroup["OWNER_ID"], "INITIATE_PERMS" => $arGroup["INITIATE_PERMS"], "VISIBLE" => $arGroup["VISIBLE"], "OPENED" => $arGroup["OPENED"]), CSocNetUser::IsCurrentUserModuleAdmin());
     }
     $arCacheResult["Groups"]["List"][] = array("GROUP_ID" => $arGroup["ID"], "GROUP_NAME" => $arGroup["NAME"], "GROUP_DESCRIPTION" => strlen($arGroup["DESCRIPTION"]) > 50 ? substr($arGroup["DESCRIPTION"], 0, 50) . "..." : $arGroup["DESCRIPTION"], "GROUP_PHOTO" => $arGroup["IMAGE_ID"], "GROUP_PHOTO_FILE" => $arImage["FILE"], "GROUP_PHOTO_IMG" => $arImage["IMG"], "GROUP_PHOTO_RESIZED" => $arImageResized, "GROUP_URL" => $pu, "GROUP_REQUEST_USER_URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_REQUEST_USER"], array("group_id" => $arGroup["ID"], "user_id" => $arResult["UserRequest"]["ID"])), "CAN_INVITE2GROUP" => $arParams["PAGE"] != "user_groups" ? $arCurrentUserPerms4Group && $arCurrentUserPerms4Group["UserCanInitiate"] : false, "FULL" => array("DATE_CREATE_FORMATTED" => date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["DATE_CREATE"], CSite::GetDateFormat("FULL"))), "DATE_UPDATE_FORMATTED" => date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["DATE_UPDATE"], CSite::GetDateFormat("FULL"))), "DATE_ACTIVITY_FORMATTED" => date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["DATE_ACTIVITY"], CSite::GetDateFormat("FULL")))));
     $arGroupID[] = $arGroup["ID"];
 }
 if (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite()) {
     $arExtranetGroupID = array();
     $dbGroupTmp = CSocNetGroup::GetList(array(), array("ID" => $arGroupID, "SITE_ID" => CExtranet::GetExtranetSiteID()), false, false, array("ID"));
     while ($arGroupTmp = $dbGroupTmp->Fetch()) {
         $arExtranetGroupID[] = $arGroupTmp["ID"];
     }
     if (count($arExtranetGroupID) > 0 && is_array($arCacheResult["Groups"]["List"])) {
         foreach ($arCacheResult["Groups"]["List"] as $key => $arGroupTmp) {
             $arCacheResult["Groups"]["List"][$key]["IS_EXTRANET"] = in_array($arGroupTmp["GROUP_ID"], $arExtranetGroupID) ? "Y" : "N";
         }
     }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php


示例17: GetFormHtml

 public function GetFormHtml($arParams = false)
 {
     global $USER;
     if (is_array($arParams["socnetgroups"]) && $arParams["socnetgroups"]["disabled"] == "true") {
         return false;
     }
     $currElements = '';
     if (is_array($arParams[$this->id]) && ($group_id = intval($arParams[$this->id]["group_id"])) > 0) {
         $arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 4);
         $arFilter = array("ID" => $group_id, "ACTIVE" => "Y");
         if (!CSocNetUser::IsCurrentUserModuleAdmin($arParams["SITE_ID"])) {
             $arFilter["CHECK_PERMISSIONS"] = $USER->GetID();
         }
         $rsGroups = CSocNetGroup::GetList(array(), $arFilter);
         if ($arGroup = $rsGroups->Fetch()) {
             $arItem = array("ID" => "SG" . $arGroup['ID'], "AVATAR" => '/bitrix/js/main/core/images/access/avatar-user-everyone.png', "NAME" => $arGroup['NAME'], "DESC" => $arGroup['DESCRIPTION'], "OPEN" => "Y", "CHECKBOX" => array("#ID#_A" => GetMessage("authprov_sg_a"), "#ID#_E" => GetMessage("authprov_sg_e"), "#ID#_K" => GetMessage("authprov_sg_k")));
             if ($arGroup["IMAGE_ID"]) {
                 $imageFile = CFile::GetFileArray($arGroup["IMAGE_ID"]);
                 if ($imageFile !== false) {
                     $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
                     $arItem["AVATAR"] = $arFileTmp["src"];
                 }
             }
             $currElements .= CFinder::GetFinderItem($arFinderParams, $arItem);
         }
     }
     $elements = "";
     $arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 3);
     $arLRU = CAccess::GetLastRecentlyUsed($this->id);
     if (!empty($arLRU)) {
         $arLast = array();
         $arLastID = array();
         $arElements = array();
         foreach ($arLRU as $val) {
             if (preg_match('/^SG([0-9]+)_([A-Z])/', $val, $match)) {
                 $arLast[$match[2]][$match[1]] = $match[1];
                 $arLastID[$match[1]] = $match[1];
             }
         }
         if (!empty($arLastID)) {
             $arFilter = array("ID" => $arLastID, "ACTIVE" => "Y");
             if ($arParams["SITE_ID"] != '') {
                 $arFilter["SITE_ID"] = $arParams["SITE_ID"];
             }
             if (!CSocNetUser::IsCurrentUserModuleAdmin($arParams["SITE_ID"])) {
                 $arFilter["CHECK_PERMISSIONS"] = $USER->GetID();
             }
             $rsGroups = CSocNetGroup::GetList(array("NAME" => "ASC"), $arFilter);
             while ($arGroup = $rsGroups->Fetch()) {
                 $arItem = array("ID" => $arGroup['ID'], "AVATAR" => '/bitrix/js/main/core/images/access/avatar-user-everyone.png', "NAME" => $arGroup['NAME'], "DESC" => $arGroup['DESCRIPTION']);
                 if ($arGroup["IMAGE_ID"]) {
                     $imageFile = CFile::GetFileArray($arGroup["IMAGE_ID"]);
                     if ($imageFile !== false) {
                         $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
                         $arItem["AVATAR"] = $arFileTmp["src"];
                     }
                 }
                 $arElements[$arItem['ID']] = $arItem;
             }
             foreach ($arLRU as $val) {
                 if (preg_match('/^SG([0-9]+)_([A-Z])/', $val, $match)) {
                     $arItem = $arElements[$match[1]];
                     if ($match[2] == 'K') {
                         $arItem['ID'] = 'SG' . $arElements[$match[1]]['ID'] . '_K';
                         $arItem['NAME'] = $arElements[$match[1]]['NAME'] . ': ' . GetMessage("authprov_sg_k");
                     } else {
                         if ($match[2] == 'E') {
                             $arItem['ID'] = 'SG' . $arElements[$match[1]]['ID'] . '_E';
                             $arItem['NAME'] = $arElements[$match[1]]['NAME'] . ': ' . GetMessage("authprov_sg_e");
                         } else {
                             if ($match[2] == 'A') {
                                 $arItem['ID'] = 'SG' . $arElements[$match[1]]['ID'] . '_A';
                                 $arItem['NAME'] = $arElements[$match[1]]['NAME'] . ': ' . GetMessage("authprov_sg_a");
                             }
                         }
                     }
                     $elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
                 }
             }
         }
     }
     $arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 4);
     $arFilter = array("USER_ID" => $USER->GetID(), "<=ROLE" => SONET_ROLES_USER, "GROUP_ACTIVE" => "Y");
     if ($arParams["SITE_ID"] != '') {
         $arFilter["GROUP_SITE_ID"] = $arParams["SITE_ID"];
     }
     $rsGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arFilter, false, array(), array("ID", "GROUP_ID", "GROUP_NAME", "GROUP_DESCRIPTION", "GROUP_IMAGE_ID"));
     $myElements = '';
     while ($arGroup = $rsGroups->Fetch()) {
         $arItem = array("ID" => "SG" . $arGroup['GROUP_ID'], "AVATAR" => $arGroup['GROUP_IMAGE_ID'], "NAME" => $arGroup['GROUP_NAME'], "DESC" => $arGroup['GROUP_DESCRIPTION'], "CHECKBOX" => array("#ID#_A" => GetMessage("authprov_sg_a"), "#ID#_E" => GetMessage("authprov_sg_e"), "#ID#_K" => GetMessage("authprov_sg_k")));
         if ($arGroup["GROUP_IMAGE_ID"]) {
             $imageFile = CFile::GetFileArray($arGroup["GROUP_IMAGE_ID"]);
             if ($imageFile !== false) {
                 $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
                 $arItem["AVATAR"] = $arFileTmp["src"];
             }
         }
         $myElements .= CFinder::GetFinderItem($arFinderParams, $arItem);
     }
     $arPanels = array();
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:authproviders.php


示例18: GetGroupMembers

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CSocServAuthDB类代码示例发布时间:2022-05-20
下一篇:
PHP CSocNetUserRelations类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap