30 'ITEMS_LAST' =>
array(),
31 'ITEMS_HIDDEN' =>
array(),
32 'ADDITIONAL_INFO' =>
array(
34 'GROUPS_LIST' =>
array(
36 'TITLE' => Loc::getMessage(
'MAIN_UI_SELECTOR_TITLE_USERS'),
38 'DESC_LESS_MODE' =>
'Y',
42 'SORT_SELECTED' => 200
53 $selectedUserList =
array();
54 if (!empty($selectedItems[$entityType]))
56 $selectedUserList = array_map(
59 return preg_replace(
'/^U(\d+)$/',
'$1',
$code);
61 $selectedItems[$entityType]
65 $allowSearchSelf = (!isset(
$options[
'allowSearchSelf']) ||
$options[
'allowSearchSelf'] !==
'N');
68 if (!empty($selectedUserList))
70 $selected = \CSocNetLogDestination::getUsers([
71 'id' => $selectedUserList,
72 'CRM_ENTITY' => ModuleManager::isModuleInstalled(
'crm'),
73 'IGNORE_ACTIVITY' =>
'Y',
74 'ALLOW_BOTS' => (isset(
$options[
'allowBots']) &&
$options[
'allowBots'] ===
'Y')
80 $items[$entityType] = \CSocNetLogDestination::getExtranetUser();
81 $result[
'ADDITIONAL_INFO'][
'EXTRANET_USER'] =
'Y';
83 if (!empty($selectedItems[$entityType]))
85 foreach($selectedItems[$entityType] as
$code)
95 if(!empty($lastItems[$entityType]))
97 $result[
"ITEMS_LAST"] = array_values($lastItems[$entityType]);
99 $result[
"ITEMS_LAST"] = array_values(array_intersect(
$result[
"ITEMS_LAST"], array_keys(
$result[
'ITEMS'])));
104 if(!empty($lastItems[$entityType]))
106 $lastUserList = array_map(
109 return preg_replace(
'/^U(\d+)$/',
'$1',
$code);
111 $lastItems[$entityType]
115 $result[
'ADDITIONAL_INFO'][
'EXTRANET_USER'] =
'N';
118 if (!empty($lastUserList))
120 $items[$entityType] = \CSocNetLogDestination::getUsers([
121 'id' => $lastUserList,
122 'CRM_ENTITY' => ModuleManager::isModuleInstalled(
'crm'),
123 'ONLY_WITH_EMAIL' => (isset(
$options[
'onlyWithEmail']) &&
$options[
'onlyWithEmail'] ===
'Y' ?
'Y' :
''),
124 'ALLOW_BOTS' => (isset(
$options[
'allowBots']) &&
$options[
'allowBots'] ===
'Y')
125 ], $allowSearchSelf);
128 $items[$entityType] = array_merge(
$items[$entityType], $selected);
135 foreach(
$items[$entityType] as
$key => $value)
137 if (isset($value[
"isExtranet"]))
141 $value[
"isExtranet"] ===
'Y'
145 $value[
"isExtranet"] ===
'N'
151 unset($lastItems[$entityType][
$key]);
157 if (!empty($selectedItems[$entityType]))
159 foreach($selectedItems[$entityType] as
$code)
168 foreach(
$items[$entityType] as
$key => $value)
171 !empty($value[
'isEmail'])
172 && $value[
'isEmail'] ===
'Y'
176 unset($lastItems[$entityType][
$key]);
180 $result[
"ITEMS_LAST"] = array_values($lastItems[$entityType]);
188 isset(
$options[
"allowSearchEmailUsers"])
189 &&
$options[
"allowSearchEmailUsers"] ===
'Y'
192 isset(
$options[
"allowEmailInvitation"])
193 &&
$options[
"allowEmailInvitation"] ===
'Y'
198 \CSocNetLogDestination::fillEmails(
$items);
205 empty(
$items[$entityType])
207 is_array(
$items[$entityType])
211 && ModuleManager::isModuleInstalled(
'intranet')
218 $lastUserList =
array();
222 'LAST_ACTIVITY_DATE' =>
'DESC'
225 '!=UF_DEPARTMENT' =>
false,
227 'CONFIRM_CODE' =>
false
229 'select' =>
array(
'ID'),
232 while($userFields =
$res->fetch())
234 $lastUserList[] = $userFields[
'ID'];
237 $items[$entityType] = array_merge((is_array(
$items[$entityType]) ?
$items[$entityType] :
array()), \CSocNetLogDestination::getUsers([
238 'id' => $lastUserList,
239 'ONLY_WITH_EMAIL' => (isset(
$options[
'onlyWithEmail']) &&
$options[
'onlyWithEmail'] ===
'Y' ?
'Y' :
''),
240 'ALLOW_BOTS' => (isset(
$options[
'allowBots']) &&
$options[
'allowBots'] ===
'Y')
241 ], $allowSearchSelf));
242 foreach(
$items[$entityType] as $item)
244 $result[
"ITEMS_LAST"][] =
'U'.$item[
'entityId'];
251 &&
$options[
"showVacations"] ===
'Y'
266 'ADDITIONAL_INFO' =>
array()
272 !empty($entityOptions[
'allowSearch'])
273 && $entityOptions[
'allowSearch'] ===
'N'
279 $requestFields = (!empty(
$params[
'requestFields']) ?
$params[
'requestFields'] : []);
280 $commonOptions = (!empty($requestFields[
'options']) ? $requestFields[
'options'] : []);
282 $search = $requestFields[
'searchString'];
283 $searchConverted = (!empty($requestFields[
'searchStringConverted']) ? $requestFields[
'searchStringConverted'] :
false);
286 $searchModified =
false;
287 $result[
"ITEMS"] = \CSocNetLogDestination::searchUsers(
290 "NAME_TEMPLATE" => $nameTemplate,
291 "SELF" => (!empty($entityOptions[
'allowSearchSelf']) && $entityOptions[
'allowSearchSelf'] ===
'Y'),
292 "EMPLOYEES_ONLY" => (!empty($entityOptions[
'scope']) && $entityOptions[
'scope'] ===
"I"),
293 "EXTRANET_ONLY" => (!empty($entityOptions[
'scope']) && $entityOptions[
'scope'] ===
"E"),
294 "DEPARTAMENT_ID" => (
295 !empty($commonOptions[
'siteDepartmentId'])
296 && (
int)$commonOptions[
'siteDepartmentId'] > 0
297 ? (
int)$commonOptions[
'siteDepartmentId']
300 "EMAIL_USERS" => (!empty($entityOptions[
'allowSearchByEmail']) && $entityOptions[
'allowSearchByEmail'] ===
'Y'),
301 "CRMEMAIL_USERS" => (!empty($entityOptions[
'allowSearchCrmEmailUsers']) && $entityOptions[
'allowSearchCrmEmailUsers'] ===
'Y'),
302 "NETWORK_SEARCH" =>
false,
303 "ONLY_WITH_EMAIL" => (isset($entityOptions[
'onlyWithEmail']) && $entityOptions[
'onlyWithEmail'] ===
'Y' ?
'Y' :
''),
304 'ALLOW_BOTS' => (isset($entityOptions[
'allowBots']) && $entityOptions[
'allowBots'] ===
'Y'),
305 'SHOW_ALL_EXTRANET_CONTACTS' => (isset($entityOptions[
'showAllExtranetContacts']) && $entityOptions[
'showAllExtranetContacts'] ===
'Y')
310 if (!empty($searchModified))
312 $result[
'SEARCH'] = $searchModified;
318 && $search !== $searchConverted
321 $result[
"ITEMS"] = \CSocNetLogDestination::searchUsers(
323 "SEARCH" => $searchConverted,
324 "NAME_TEMPLATE" => $nameTemplate,
325 "SELF" => (!empty($entityOptions[
'allowSearchSelf']) && $entityOptions[
'allowSearchSelf'] ===
'Y'),
326 "EMPLOYEES_ONLY" => (!empty($entityOptions[
'scope']) && $entityOptions[
'scope'] ===
"I"),
327 "EXTRANET_ONLY" => (!empty($entityOptions[
'scope']) && $entityOptions[
'scope'] ===
"E"),
328 "DEPARTAMENT_ID" => (
329 !empty($commonOptions[
'siteDepartmentId'])
330 && (
int)$commonOptions[
'siteDepartmentId'] > 0
331 ? (
int)$commonOptions[
'siteDepartmentId']
334 "EMAIL_USERS" => (!empty($entityOptions[
'allowSearchByEmail']) && $entityOptions[
'allowSearchByEmail'] ===
'Y'),
335 "CRMEMAIL_USERS" => (!empty($entityOptions[
'allowSearchCrmEmailUsers']) && $entityOptions[
'allowSearchCrmEmailUsers'] ===
'Y'),
336 "NETWORK_SEARCH" =>
false,
337 'ALLOW_BOTS' => (isset($entityOptions[
'allowBots']) && $entityOptions[
'allowBots'] ===
'Y'),
338 'SHOW_ALL_EXTRANET_CONTACTS' => (isset($entityOptions[
'showAllExtranetContacts']) && $entityOptions[
'showAllExtranetContacts'] ===
'Y')
343 $result[
'SEARCH'] = $searchConverted;