17 if (!self::checkModules())
23 $departmentIblockId = (int)\
Bitrix\Main\
Config\Option::get(
'intranet',
'iblock_structure', 0);
24 if ($departmentIblockId <= 0)
27 $cacheId =
'im_structure_'.$departmentIblockId;
28 $cachePath =
'/bx/imc/intranet/department/';
30 $cache = \Bitrix\Main\Application::getInstance()->getCache();
31 $taggedCache = \Bitrix\Main\Application::getInstance()->getTaggedCache();
33 if($cache->initCache(self::CACHE_TOKEN_TTL, $cacheId, $cachePath) &&
false)
35 return $cache->getVars();
38 $taggedCache->startTagCache($cachePath);
40 $sec = \CIBlockSection::GetList(
41 Array(
"left_margin"=>
"asc",
"SORT"=>
"ASC"),
42 Array(
"ACTIVE"=>
"Y",
"IBLOCK_ID"=>$departmentIblockId),
44 Array(
'ID',
'NAME',
'DEPTH_LEVEL',
'UF_HEAD',
'IBLOCK_SECTION_ID')
47 $departments = Array();
49 while($ar = $sec->GetNext(
true,
false))
51 $departments[$ar[
'ID']] = Array(
52 'ID' => (
int)$ar[
'ID'],
53 'NAME' => $ar[
'NAME'],
54 'FULL_NAME' => $ar[
'DEPTH_LEVEL'] > 1? $ar[
'NAME'].
' / '.$departments[$ar[
'IBLOCK_SECTION_ID']][
'FULL_NAME']: $ar[
'NAME'],
55 'MANAGER_USER_ID' => (int)$ar[
'UF_HEAD'],
59 $taggedCache->registerTag(
'iblock_id_'.$departmentIblockId);
60 $taggedCache->endTagCache();
62 $cache->startDataCache();
63 $cache->endDataCache($departments);
70 if (!self::checkModules())
73 $params = is_array($params)? $params: Array();
75 if (!isset($params[
'CURRENT_USER']) && is_object(
$GLOBALS[
'USER']))
77 $params[
'CURRENT_USER'] =
$GLOBALS[
'USER']->GetID();
80 $userId = intval($params[
'CURRENT_USER']);
86 $cacheId =
'im_sonet_extranet_v3_'.$userId;
87 $cachePath =
'/bx/imc/sonet/extranet'.\Bitrix\Im\Common::getCacheUserPostfix($userId);
89 $cache = \Bitrix\Main\Application::getInstance()->getCache();
90 $taggedCache = \Bitrix\Main\Application::getInstance()->getTaggedCache();
92 if($cache->initCache(self::CACHE_TOKEN_TTL, $cacheId, $cachePath))
94 return $cache->getVars();
97 $taggedCache->startTagCache($cachePath);
99 $db = \CSocNetUserToGroup::GetList(
102 "USER_ID" => $userId,
103 "<=ROLE" => SONET_ROLES_USER,
104 "GROUP_SITE_ID" => \CExtranet::GetExtranetSiteID(),
105 "GROUP_ACTIVE" =>
"Y",
106 "GROUP_CLOSED" =>
"N"
110 array(
"ID",
"GROUP_ID",
"GROUP_NAME")
115 while ($row = $db->GetNext(
true,
false))
117 $groupIds[] = $row[
"GROUP_ID"];
118 $groups[
'SG'.$row[
'GROUP_ID']] = array(
119 'ID' =>
'SG'.$row[
'GROUP_ID'],
120 'NAME' =>
Loc::getMessage(
'IM_INT_SN_GROUP_EXTRANET', Array(
'#GROUP_NAME#' => $row[
'GROUP_NAME'])),
124 $taggedCache->registerTag(
'sonet_group_'.$row[
'GROUP_ID']);
125 $taggedCache->registerTag(
'sonet_user2group_G'.$row[
'GROUP_ID']);
128 if (count($groups) <= 0)
133 $taggedCache->endTagCache();
135 $db = \CSocNetUserToGroup::GetList(
138 "GROUP_ID" => $groupIds,
139 "<=ROLE" => SONET_ROLES_USER,
140 "USER_ACTIVE" =>
"Y",
141 "USER_CONFIRM_CODE" =>
false
145 array(
"ID",
"USER_ID",
"GROUP_ID")
147 while ($ar = $db->GetNext(
true,
false))
149 if($ar[
"USER_ID"] == $userId)
152 $groups[
'SG'.$row[
'GROUP_ID']][
'USERS'][] = $ar[
"USER_ID"];
155 $cache->startDataCache();
156 $cache->endDataCache($groups);