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


PHP CSocNetUserToGroup::GetList方法代码示例

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


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

示例1: 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

示例2: 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

示例3: extractUsersFromExtendedGroup

 /**
  * Method return array of user ids, extracting from special codes. Supported: user (U), group (G),
  * intranet (IU, D, DR, Dextranet, UA), socnet (SU, SG1_A, SG1_E, SG1_K)
  *
  * @param string $code - group code, ex. group_D1
  * @return bool|array
  */
 public static function extractUsersFromExtendedGroup($code)
 {
     if (strpos($code, 'group_') !== 0) {
         return false;
     }
     $code = strtoupper(substr($code, strlen('group_')));
     if (strpos($code, 'G') === 0) {
         $group = (int) substr($code, 1);
         if ($group <= 0) {
             return array();
         }
         $result = array();
         $iterator = CUser::GetList($b = "ID", $o = "ASC", array("GROUPS_ID" => $group, "ACTIVE" => "Y"));
         while ($user = $iterator->fetch()) {
             $result[] = $user['ID'];
         }
         return $result;
     }
     if (preg_match('/^(U|IU|SU)([0-9]+)$/i', $code, $match)) {
         return array($match[2]);
     }
     if ($code == 'UA' && CModule::IncludeModule('intranet')) {
         $result = array();
         $iterator = CUser::GetList($by = "id", $order = "asc", array('ACTIVE' => 'Y', '>UF_DEPARTMENT' => 0), array('FIELDS' => array('ID')));
         while ($user = $iterator->fetch()) {
             $result[] = $user['ID'];
         }
         return $result;
     }
     if (preg_match('/^(D|DR)([0-9]+)$/', $code, $match) && CModule::IncludeModule('intranet')) {
         $recursive = $match[1] == 'DR';
         $id = $match[2];
         $iblockId = COption::GetOptionInt('intranet', 'iblock_structure');
         $departmentIds = array($id);
         if ($recursive) {
             $iterator = CIBlockSection::GetList(array('ID' => 'ASC'), array('=IBLOCK_ID' => $iblockId, 'ID' => $id), false, array('ID', 'LEFT_MARGIN', 'RIGHT_MARGIN', 'DEPTH_LEVEL'));
             $section = $iterator->fetch();
             $filter = array('=IBLOCK_ID' => $iblockId, ">LEFT_MARGIN" => $section["LEFT_MARGIN"], "<RIGHT_MARGIN" => $section["RIGHT_MARGIN"], ">DEPTH_LEVEL" => $section['DEPTH_LEVEL']);
             $iterator = CIBlockSection::GetList(array("left_margin" => "asc"), $filter, false, array('ID'));
             while ($section = $iterator->fetch()) {
                 $departmentIds[] = $section['ID'];
             }
             unset($iterator, $section, $filter);
         }
         $result = array();
         $iterator = CUser::GetList($by = "id", $order = "asc", array('ACTIVE' => 'Y', 'UF_DEPARTMENT' => $departmentIds), array('FIELDS' => array('ID')));
         while ($user = $iterator->fetch()) {
             $result[] = $user['ID'];
         }
         return $result;
     }
     if ($code == 'Dextranet' && CModule::IncludeModule('extranet')) {
         $result = array();
         $iterator = CUser::GetList($by = "id", $order = "asc", array(COption::GetOptionString("extranet", "extranet_public_uf_code", "UF_PUBLIC") => "1", "!UF_DEPARTMENT" => false, "GROUPS_ID" => array(CExtranet::GetExtranetUserGroupID())), array('FIELDS' => array('ID')));
         while ($user = $iterator->fetch()) {
             $result[] = $user['ID'];
         }
         return $result;
     }
     if (preg_match('/^SG([0-9]+)_?([AEK])?$/', $code, $match) && CModule::IncludeModule('socialnetwork')) {
         $groupId = (int) $match[1];
         $role = isset($match[2]) ? $match[2] : 'K';
         $iterator = CSocNetUserToGroup::GetList(array("USER_ID" => "ASC"), array("=GROUP_ID" => $groupId, "<=ROLE" => $role, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
         $result = array();
         while ($user = $iterator->fetch()) {
             $result[] = $user['USER_ID'];
         }
         return $result;
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon,代码行数:78,代码来源:helper.php

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: GetUserGroups

 static function GetUserGroups($userID = 0, $bGetFolders = true)
 {
     static $oCache = null;
     static $CACHE_PATH = "/webdav/sonet_user_groups/";
     if (!CBXFeatures::IsFeatureEnabled("Workgroups")) {
         return array();
     }
     $userID = intval($userID);
     if (intval($userID) <= 0) {
         $userID = $GLOBALS['USER']->GetID();
     }
     //$currentUserGroups = CWebDavBase::CustomDataCache($CACHE_PATH, $userID);
     //if (!$currentUserGroups)
     //{
     $currentUserGroups = array();
     $db_res = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), array("USER_ID" => $userID), false, false, array("GROUP_ID", "GROUP_NAME", "GROUP_ACTIVE", "GROUP_CLOSED", "ROLE"));
     while ($res = $db_res->GetNext()) {
         if ($res['GROUP_ACTIVE'] == 'Y' && $res['GROUP_CLOSED'] == 'N' && $res['ROLE'] != SONET_ROLES_BAN && $res['ROLE'] != SONET_ROLES_REQUEST) {
             $currentUserGroups[$res["GROUP_ID"]] = $res;
         }
     }
     $arGroupID = array_keys($currentUserGroups);
     if (is_array($arGroupID) && sizeof($arGroupID) > 0) {
         $arFeatures = CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arGroupID, 'files');
         foreach ($arFeatures as $groupID => $enabled) {
             if (!$enabled) {
                 unset($currentUserGroups[$groupID]);
             }
         }
     }
     if ($bGetFolders) {
         $groupIBlock = CWebDavIblock::LibOptions('group_files', false, SITE_ID);
         if ($groupIBlock && isset($groupIBlock['id']) && intval($groupIBlock['id']) > 0) {
             $arFilter = array("IBLOCK_ID" => intval($groupIBlock['id']), "SECTION_ID" => 0, "CHECK_PERMISSIONS" => "N");
             $dbSection = CIBlockSection::GetList(array(), $arFilter, false, array('ID', 'SOCNET_GROUP_ID'));
             while ($arGroupSection = $dbSection->Fetch()) {
                 if (isset($currentUserGroups[$arGroupSection['SOCNET_GROUP_ID']])) {
                     $currentUserGroups[$arGroupSection['SOCNET_GROUP_ID']]['SECTION_ID'] = $arGroupSection['ID'];
                 }
             }
             //CWebDavBase::CustomDataCache($CACHE_PATH, $userID, $currentUserGroups, 'wd_socnet, iblock_id_'.intval($groupIBlock['id'])); // do not save to cache if LibOptions('group_files') is empty
         }
     }
     //}
     return $currentUserGroups;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:46,代码来源:iblocksocnet.php

示例10: GetGroupMembers

 function GetGroupMembers($arParams, &$bAddCurUser = false)
 {
     // TODO: CHECK PERMISSIONS
     $dbMembers = CSocNetUserToGroup::GetList(array("RAND" => "ASC"), array("GROUP_ID" => $arParams['groupId'], "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("USER_ID", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN"));
     $arMembers = array();
     if ($dbMembers) {
         while ($arMember = $dbMembers->GetNext()) {
             if ($arMember["USER_ID"] == $this->userId) {
                 $bAddCurUser = true;
                 continue;
             }
             $name = trim($arMember['USER_NAME'] . ' ' . $arMember['USER_LAST_NAME']);
             if ($name == '') {
                 $name = trim($arMember['USER_LOGIN']);
             }
             $arMembers[] = array('id' => $arMember["USER_ID"], 'name' => $name, 'status' => 'Q', 'busy' => $this->GetGuestAccessibility(array('userId' => $arMember["USER_ID"], 'from' => $arParams['from'], 'to' => $arParams['to'])));
         }
     }
     return $arMembers;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:20,代码来源:event_calendar.php

示例11: GetUsersFromUserGroup

 public function GetUsersFromUserGroup($group, $documentId)
 {
     $diskId = self::processGetDiskIdByDocId((int) $documentId);
     if ($diskId !== null) {
         return self::proxyToDisk(__FUNCTION__, array($group, $diskId));
     }
     $arResult = array();
     $arParameters = array("IBlockId" => 0, "OwnerType" => "", "OwnerId" => 0);
     if (strLen($documentId) <= 0) {
         return $arResult;
     }
     $res = explode("_", $documentId);
     if (count($res) == 4) {
         $arParameters = array("IBlockId" => $res[1], "OwnerType" => $res[2], "OwnerId" => $res[3]);
     } elseif (intVal($documentId) > 0) {
         $db_res = CIBlockElement::GetList(array(), array("ID" => $documentId, "SHOW_NEW" => "Y", "SHOW_HISTORY" => "Y"), false, false, array("ID", "IBLOCK_ID", "CREATED_BY", "IBLOCK_SECTION_ID"));
         $arElement = $db_res->Fetch();
         if (!$arElement) {
             return false;
         }
         $arParameters["IBlockId"] = $arElement["IBLOCK_ID"];
         $arParameters["CreatedBy"] = $arElement["CREATED_BY"];
         $dbSectionsChain = CIBlockSection::GetNavChain($arElement["IBLOCK_ID"], $arElement["IBLOCK_SECTION_ID"]);
         if ($arSect = $dbSectionsChain->Fetch()) {
             $arParameters["OwnerType"] = intVal($arSect["SOCNET_GROUP_ID"]) > 0 ? "group" : "user";
             $arParameters["OwnerId"] = intVal($arSect["SOCNET_GROUP_ID"]) > 0 ? $arSect["SOCNET_GROUP_ID"] : $arSect["CREATED_BY"];
         }
     }
     $sGroup = strtoupper($group);
     if ($sGroup == "AUTHOR") {
         return array($arParameters["CreatedBy"]);
     } elseif ($sGroup == SONET_RELATIONS_TYPE_NONE) {
         return array($arParameters["OwnerId"]);
     } elseif ($arParameters["OwnerId"] <= 0) {
         return array();
     }
     if ($arParameters["OwnerType"] == "user") {
         $db_res = CSocNetUserRelations::GetRelatedUsers($arParameters["OwnerId"], SONET_RELATIONS_FRIEND);
         if ($db_res && ($res = $db_res->Fetch())) {
             do {
                 if ($res["FIRST_USER_ID"] == $arParameters["OwnerId"]) {
                     $arResult[] = $res["SECOND_USER_ID"];
                 } else {
                     $arResult[] = $res["FIRST_USER_ID"];
                 }
             } while ($res = $db_res->Fetch());
         }
     } else {
         if ($sGroup == SONET_ROLES_OWNER) {
             $arGroup = CSocNetGroup::GetByID($arParameters["OwnerId"]);
             if ($arGroup) {
                 $arResult[] = $arGroup["OWNER_ID"];
             }
         } elseif ($sGroup == SONET_ROLES_MODERATOR) {
             $db = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $arParameters["OwnerId"], "<=ROLE" => SONET_ROLES_MODERATOR, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
             while ($ar = $db->Fetch()) {
                 $arResult[] = $ar["USER_ID"];
             }
         } elseif ($sGroup == SONET_ROLES_USER) {
             $db = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $arParameters["OwnerId"], "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
             while ($ar = $db->Fetch()) {
                 $arResult[] = $ar["USER_ID"];
             }
         }
     }
     return $arResult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:iblocksocnetbizproc.php

示例12: CPHPCache

 //cache data
 $cache = new CPHPCache();
 $cache_time = 3600 * 24 * 365;
 $cache_path = '/tasks_mobile_cache/' . $action;
 $cache_id = 'tasks|' . $action . '|' . (int) $userId . time();
 if ($cache->InitCache($cache_time, $cache_id, $cache_path)) {
     $cachedData = $cache->GetVars();
     $data = $cachedData["DATA"];
     $dataId = $cachedData["dataId"];
 } else {
     $GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
     $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U" . $userId);
     $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group");
     $data = array();
     $arFilter = array('ID' => array(), 'ACTIVE' => 'Y');
     $dbUserGroups = CSocNetUserToGroup::GetList(array('GROUP_NAME' => 'ASC'), array('USER_ID' => $userId, '<=ROLE' => SONET_ROLES_USER, 'GROUP_ACTIVE' => 'Y'), false, false, array('GROUP_ID'));
     if ($dbUserGroups) {
         while ($arUserGroups = $dbUserGroups->GetNext()) {
             $arFilter['ID'][] = $arUserGroups['GROUP_ID'];
         }
     }
     if (count($arFilter['ID']) > 0) {
         $dbSocnetGroup = CSocNetGroup::GetList(array('NAME' => 'ASC'), $arFilter, false, false, array('ID', 'NAME', 'IMAGE_ID'));
         $woGroupName = GetMessage('MB_TASKS_TASK_EDIT_WO_GROUP');
         if (ToUpper(SITE_CHARSET) !== 'UTF-8') {
             $woGroupName = $APPLICATION->ConvertCharsetArray($woGroupName, SITE_CHARSET, 'utf-8');
         }
         $data[] = array('ID' => 0, 'NAME' => (string) $woGroupName, 'OUTSECTION' => 1);
         while ($arSocnetGroup = $dbSocnetGroup->Fetch()) {
             if (intval($arSocnetGroup['IMAGE_ID']) > 0) {
                 $arImage = CFile::ResizeImageGet($arSocnetGroup['IMAGE_ID'], array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_EXACT, false);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php

示例13: while

        while ($arGroup = $dbGroups->GetNext()) {
            $arGroup["GROUP_URL"] = 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);
            }
            $arImage = CSocNetTools::InitImage($arGroup["IMAGE_ID"], 50, "/bitrix/images/socialnetwork/nopic_group_50.gif", 50, $arGroup["GROUP_URL"], true);
            $arGroup["IMAGE_FILE"] = $arImage["FILE"];
            $arGroup["IMAGE_IMG"] = $arImage["IMG"];
            $arGroup["FULL_DATE_CHANGE_FORMATED"] = date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["DATE_ACTIVITY"], CSite::GetDateFormat("FULL")));
            $arResult["Groups"][] = $arGroup;
        }
        $this->IncludeComponentTemplate();
    }
} else {
    if (!CModule::IncludeModule("socialnetwork")) {
        ShowError(GetMessage("SONET_MODULE_NOT_INSTALL"));
        return;
    }
    $arResult["Urls"]["GroupSearch"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_SEARCH"], array());
    $dbGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), array("USER_ID" => $GLOBALS["USER"]->GetID(), "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => SITE_ID, "GROUP_ACTIVE" => "Y"), false, array("nTopCount" => $arParams["ITEMS_COUNT"]), array("ID", "GROUP_ID", "GROUP_NAME", "GROUP_DESCRIPTION", "GROUP_IMAGE_ID", "GROUP_DATE_ACTIVITY"));
    $arResult["Groups"] = array();
    while ($arGroup = $dbGroups->GetNext()) {
        $arGroup["GROUP_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arGroup["GROUP_ID"]));
        $arImage = CSocNetTools::InitImage($arGroup["GROUP_IMAGE_ID"], 50, "/bitrix/images/socialnetwork/nopic_group_50.gif", 50, $arGroup["GROUP_URL"], true);
        $arGroup["IMAGE_FILE"] = $arImage["FILE"];
        $arGroup["IMAGE_IMG"] = $arImage["IMG"];
        $arGroup["FULL_DATE_CHANGE_FORMATED"] = date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["GROUP_DATE_ACTIVITY"], CSite::GetDateFormat("FULL")));
        $arResult["Groups"][] = array("GROUP_URL" => $arGroup["GROUP_URL"], "IMAGE_FILE" => $arGroup["IMAGE_FILE"], "IMAGE_IMG" => $arGroup["IMAGE_IMG"], "FULL_DATE_CHANGE_FORMATED" => $arGroup["FULL_DATE_CHANGE_FORMATED"], "ID" => $arGroup["GROUP_ID"], "NAME" => $arGroup["GROUP_NAME"], "DESCRIPTION" => $arGroup["GROUP_DESCRIPTION"], "IMAGE_ID" => $arGroup["GROUP_IMAGE_ID"], "DATE_ACTIVITY" => $arGroup["GROUP_DATE_ACTIVITY"]);
    }
    $this->IncludeComponentTemplate();
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例14: Update


//.........这里部分代码省略.........
         $arSiteID = array();
         if (is_set($arFields, "SITE_ID")) {
             if (is_array($arFields["SITE_ID"])) {
                 $arSiteID = $arFields["SITE_ID"];
             } else {
                 $arSiteID[] = $arFields["SITE_ID"];
             }
             $arFields["SITE_ID"] = false;
             $str_SiteID = "''";
             foreach ($arSiteID as $v) {
                 $arFields["SITE_ID"] = $v;
                 $str_SiteID .= ", '" . $DB->ForSql($v) . "'";
             }
         }
     }
     $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetGroupUpdate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
             return false;
         }
     }
     if (array_key_exists("IMAGE_ID", $arFields) && is_array($arFields["IMAGE_ID"]) && (!array_key_exists("MODULE_ID", $arFields["IMAGE_ID"]) || strlen($arFields["IMAGE_ID"]["MODULE_ID"]) <= 0)) {
         $arFields["IMAGE_ID"]["MODULE_ID"] = "socialnetwork";
     }
     CFile::SaveForDB($arFields, "IMAGE_ID", "socialnetwork");
     $strUpdate = $DB->PrepareUpdate("b_sonet_group", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($strUpdate) > 0) {
             $strUpdate .= ", ";
         }
         $strUpdate .= $key . "=" . $value . " ";
     }
     if (strlen($strUpdate) > 0) {
         $strSql = "UPDATE b_sonet_group SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if (count($arSiteID) > 0) {
             $strSql = "DELETE FROM b_sonet_group_site WHERE GROUP_ID=" . $ID;
             $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
             $strSql = "INSERT INTO b_sonet_group_site(GROUP_ID, SITE_ID) " . "SELECT " . $ID . ", LID " . "FROM b_lang " . "WHERE LID IN (" . $str_SiteID . ") ";
             $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
             $arLogID = array();
             $dbResult = CSocNetLog::GetList(array(), array("LOG_RIGHTS" => "SG" . $ID), false, false, array("ID"));
             while ($arResult = $dbResult->Fetch()) {
                 $DB->Query("DELETE FROM b_sonet_log_site WHERE LOG_ID = " . $arResult["ID"] . "", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
                 $DB->Query("\n\t\t\t\t\t\tINSERT INTO b_sonet_log_site(LOG_ID, SITE_ID)\n\t\t\t\t\t\tSELECT " . $arResult["ID"] . ", LID\n\t\t\t\t\t\tFROM b_lang\n\t\t\t\t\t\tWHERE LID IN (" . $str_SiteID . ")\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
                 $arLogID[] = $arResult["ID"];
             }
             $dbResult = CSocNetLog::GetList(array(), array("!ID" => $arLogID, "ENTITY_ID" => $ID, "ENTITY_TYPE" => SONET_ENTITY_GROUP), false, false, array("ID"));
             while ($arResult = $dbResult->Fetch()) {
                 $DB->Query("DELETE FROM b_sonet_log_site WHERE LOG_ID = " . $arResult["ID"] . "", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
                 $DB->Query("\n\t\t\t\t\t\tINSERT INTO b_sonet_log_site(LOG_ID, SITE_ID)\n\t\t\t\t\t\tSELECT " . $arResult["ID"] . ", LID\n\t\t\t\t\t\tFROM b_lang\n\t\t\t\t\t\tWHERE LID IN (" . $str_SiteID . ")\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
             }
         }
         unset($GLOBALS["SONET_GROUP_CACHE"][$ID]);
         if (defined("BX_COMP_MANAGED_CACHE")) {
             if ($bClearCommonTag) {
                 $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group");
             }
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group_" . $ID);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $ID);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group");
         }
         $GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_GROUP", $ID, $arFields);
         $events = GetModuleEvents("socialnetwork", "OnSocNetGroupUpdate");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
         }
         if (CModule::IncludeModule("search")) {
             $arGroupNew = CSocNetGroup::GetByID($ID);
             if ($arGroupNew) {
                 if ($arGroupNew["ACTIVE"] == "N" && $arGroupOld["ACTIVE"] == "Y") {
                     CSearch::DeleteIndex("socialnetwork", "G" . $ID);
                 } elseif ($arGroupNew["ACTIVE"] == "Y") {
                     $BODY = CSocNetTextParser::killAllTags($arGroupNew["~DESCRIPTION"]);
                     $BODY .= $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("SONET_GROUP", $ID);
                     $arSearchIndexSiteID = array();
                     $rsGroupSite = CSocNetGroup::GetSite($ID);
                     while ($arGroupSite = $rsGroupSite->Fetch()) {
                         $arSearchIndexSiteID[$arGroupSite["LID"]] = str_replace("#group_id#", $ID, COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", $arGroupSite["LID"]));
                     }
                     $arSearchIndex = array("SITE_ID" => $arSearchIndexSiteID, "LAST_MODIFIED" => $arGroupNew["DATE_ACTIVITY"], "PARAM1" => $arGroupNew["SUBJECT_ID"], "PARAM2" => $ID, "PARAM3" => "GROUP", "PERMISSIONS" => $arGroupNew["VISIBLE"] == "Y" ? array('G2') : array('SG' . $ID . '_A', 'SG' . $ID . '_E', 'SG' . $ID . '_K'), "PARAMS" => array("socnet_group" => $ID, "entity" => "socnet_group"), "TITLE" => $arGroupNew["~NAME"], "BODY" => $BODY, "TAGS" => $arGroupNew["~KEYWORDS"]);
                     CSearch::Index("socialnetwork", "G" . $ID, $arSearchIndex, True);
                 }
                 if ($arGroupNew["OPENED"] == "Y" && $arGroupOld["OPENED"] == "N") {
                     $dbRequests = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $ID, "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_USER), false, false, array("ID"));
                     if ($dbRequests) {
                         $arIDs = array();
                         while ($arRequests = $dbRequests->GetNext()) {
                             $arIDs[] = $arRequests["ID"];
                         }
                         CSocNetUserToGroup::ConfirmRequestToBeMember($GLOBALS["USER"]->GetID(), $ID, $arIDs, $bAutoSubscribe);
                     }
                 }
             }
         }
     } elseif (!$GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_GROUP", $ID, $arFields)) {
         $ID = False;
     }
     return $ID;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:group.php

示例15: GetRights

 protected static function GetRights($USER_ID)
 {
     if (IsModuleInstalled("extranet")) {
         $rsUser = CUser::GetByID($USER_ID);
         if ($arUser = $rsUser->Fetch()) {
             if (intval($arUser["UF_DEPARTMENT"][0]) <= 0) {
                 $bExtranetUser = true;
             }
         }
     }
     if ($bExtranetUser && CModule::IncludeModule("socialnetwork")) {
         $rsSocNetUserToGroup = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $USER_ID), false, false, array("GROUP_ID"));
         $arResult = array();
         while ($arSocNetUserToGroup = $rsSocNetUserToGroup->Fetch()) {
             $arResult[] = "SG" . $arSocNetUserToGroup["GROUP_ID"] . "_" . SONET_ROLES_USER;
             $arResult[] = "SG" . $arSocNetUserToGroup["GROUP_ID"] . "_" . SONET_ROLES_MODERATOR;
             $arResult[] = "SG" . $arSocNetUserToGroup["GROUP_ID"] . "_" . SONET_ROLES_OWNER;
         }
         return $arResult;
     } else {
         return array("G2");
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:23,代码来源:notify.php


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