21 public static function getData($options = array())
25 'ITEMS_LAST' => array(),
26 'DEST_SORT' => array(),
27 'ADDITIONAL_INFO' => array()
30 $filterParams = array(
31 "DEST_CONTEXT" => $options[
"context"],
32 "ALLOW_EMAIL_INVITATION" => (isset($options[
"allowEmailInvitation"]) && $options[
"allowEmailInvitation"] ==
"Y")
35 if (!empty($options[
'contextCode']))
37 $filterParams[
"CODE_TYPE"] = $options[
'contextCode'];
40 $dataAdditional = array();
41 $destSortData = \CSocNetLogDestination::getDestinationSort($filterParams, $dataAdditional);
42 $result[
"DEST_SORT"] = $destSortData;
43 $lastItems = $items = array();
44 \CSocNetLogDestination::fillLastDestination(
50 isset($options[
"allowAddUser"])
51 && $options[
"allowAddUser"] ==
'Y'
54 isset($options[
"allowSearchEmailUsers"])
55 && $options[
"allowSearchEmailUsers"] ==
'Y'
58 isset($options[
"allowEmailInvitation"])
59 && $options[
"allowEmailInvitation"] ==
'Y'
64 "DATA_ADDITIONAL" => $dataAdditional
70 && \Bitrix\Socialnetwork\ComponentHelper::getAllowToAllDestination()
71 && (!isset($options[
"enableAll"]) || $options[
"enableAll"] !=
'N')
74 $lastItems[
'GROUPS'] = array(
77 $items[
'GROUPS'] = array(
81 ModuleManager::isModuleInstalled(
'intranet')
89 $result[
"ITEMS_LAST"] = $lastItems;
91 if ($options[
"enableSonetgroups"] !=
'N')
93 $limitReached =
false;
94 $sonetGroupsList = \Bitrix\Socialnetwork\ComponentHelper::getSonetGroupAvailable(array(
98 $result[
"SONETGROUPS_LIMITED"] = ($limitReached ?
'Y' :
'N');
101 !empty($lastItems[
'SONETGROUPS'])
102 && !empty($sonetGroupsList)
105 $lastSonetGroupsList = array();
106 foreach ($lastItems[
'SONETGROUPS'] as $value)
108 if (!array_key_exists($value, $sonetGroupsList))
110 $lastSonetGroupsList[] = intval(mb_substr($value, 2));
113 if (!empty($lastSonetGroupsList))
115 $sonetGroupsAdditionalList = \CSocNetLogDestination::getSocnetGroup(array(
116 'features' => array(
"blog", array(
"premoderate_post",
"moderate_post",
"write_post",
"full_post")),
117 'id' => $lastSonetGroupsList
119 if (!empty($sonetGroupsAdditionalList))
121 $sonetGroupsList = array_merge($sonetGroupsList, $sonetGroupsAdditionalList);
125 $items[
'SONETGROUPS'] = $sonetGroupsList;
130 $result[
'EXTRANET_USER'] =
'Y';
131 $items[
'USERS'] = \CSocNetLogDestination::getExtranetUser();
135 $lastUserList = array();
136 if(!empty($lastItems[
'USERS']))
138 foreach ($lastItems[
'USERS'] as $value)
140 $lastUserList[] = str_replace(
'U',
'', $value);
144 $result[
'EXTRANET_USER'] =
'N';
145 if (!empty($lastUserList))
147 $items[
'USERS'] = \CSocNetLogDestination::getUsers(array(
148 'id' => $lastUserList,
149 'CRM_ENTITY' => ModuleManager::isModuleInstalled(
'crm')
152 isset($options[
'extranetContext'])
153 && in_array($options[
'extranetContext'], array(self::EXTRANET_CONTEXT_INTERNAL, self::EXTRANET_CONTEXT_EXTERNAL))
156 foreach($items[
'USERS'] as $key => $value)
158 if (isset($value[
"isExtranet"]))
162 $value[
"isExtranet"] ==
'Y'
163 && $options[
'extranetContext'] == self::EXTRANET_CONTEXT_INTERNAL
166 $value[
"isExtranet"] ==
'N'
167 && $options[
'extranetContext'] == self::EXTRANET_CONTEXT_EXTERNAL
171 unset($items[
'USERS'][$key]);
180 isset($options[
"allowAddUser"])
181 && $options[
"allowAddUser"] ==
'Y'
184 isset($options[
"allowSearchEmailUsers"])
185 && $options[
"allowSearchEmailUsers"] ==
'Y'
188 isset($options[
"allowEmailInvitation"])
189 && $options[
"allowEmailInvitation"] ==
'Y'
193 $items[
'LAST'] = $result[
"ITEMS_LAST"];
194 \CSocNetLogDestination::fillEmails($items);
195 $result[
"ITEMS_LAST"] = $items[
'LAST'];
196 unset($items[
'LAST']);
201 $options[
"enableDepartments"] ==
"Y"
202 && ModuleManager::isModuleInstalled(
'intranet')
206 $structure = \CSocNetLogDestination::getStucture(array(
"LAZY_LOAD" =>
true));
207 $items[
'DEPARTMENT'] = $structure[
'department'];
208 $items[
'DEPARTMENT_RELATION'] = $structure[
'department_relation'];
209 $result[
'ADDITIONAL_INFO'][
'DEPARTMENT'] = array(
215 $result[
"ITEMS"] = $items;
217 $lastItems = array();
218 foreach($result[
"ITEMS_LAST"] as $group => $items)
221 foreach($result[
"ITEMS_LAST"][$group] as $key => $value)
223 $lastItems[$group][$key] = ++$i;
226 $result[
"ITEMS_LAST"] = $lastItems;
231 public static function getList($params = array())
233 $itemsSelected = $params[
'itemsSelected'];
237 'SONETGROUPS' => array(),
239 'DEPARTMENTS' => array()
242 $sonetGroupIdList = $userIdList = $departmentIdList = array();
243 foreach ($itemsSelected as $code => $entityGroup)
245 if ($entityGroup ==
'users')
247 $userIdList[] = str_replace(
'U',
'', $code);
249 elseif ($entityGroup ==
'sonetgroups')
251 $sonetGroupIdList[] = str_replace(
'SG',
'', $code);
253 elseif ($entityGroup ==
'department')
255 $departmentIdList[] = str_replace(
'DR',
'', $code);
259 if (!empty($userIdList))
264 if (!empty($sonetGroupIdList))
269 if (!empty($departmentIdList))
279 $entities[
'GROUPS'] = array(
283 ModuleManager::isModuleInstalled(
'intranet')
292 $entities[
'GROUPS'] = array();