22 if (UserIndexTable::getEntity()->fullTextIndexEnabled(
'SEARCH_USER_CONTENT'))
25 $findDepartmentOnly =
false;
27 if (array_key_exists(
'FIND', $fields))
29 $find = trim($fields[
'FIND']);
31 if (Search\Content::isIntegerToken($find))
33 $find = Search\Content::prepareIntegerToken($find);
37 $find = Search\Content::prepareStringToken($find);
42 $validFields = Array(
'ID' => 1,
'NAME' => 1,
'LAST_NAME' => 1,
'SECOND_NAME' => 1,
'WORK_POSITION' => 1);
43 foreach ($fields as $key => $value)
45 if (isset($validFields[$key]) && $validFields[$key])
47 if (Search\Content::isIntegerToken($value))
49 $find .=
' '.Search\Content::prepareIntegerToken($value);
53 $find .=
' '.Search\Content::prepareStringToken($value);
59 if (array_key_exists(
'UF_DEPARTMENT_NAME', $fields))
63 $findDepartmentOnly =
true;
65 if (Search\Content::isIntegerToken($fields[
'UF_DEPARTMENT_NAME']))
67 $find .=
' '.Search\Content::prepareIntegerToken($fields[
'UF_DEPARTMENT_NAME']);
71 $find .=
' '.Search\Content::prepareStringToken($fields[
'UF_DEPARTMENT_NAME']);
77 if (Search\Content::canUseFulltextSearch($find, Search\Content::TYPE_MIXED))
79 $fiendField = $findDepartmentOnly?
'*INDEX.SEARCH_DEPARTMENT_CONTENT':
'*INDEX.SEARCH_USER_CONTENT';
80 $result[$fiendField] = $find;
86 if (array_key_exists(
'FIND', $fields))
88 $find = trim($fields[
'FIND']);
89 $find = explode(
' ', $find);
90 foreach ($find as $findWord)
97 $intResult = Array(
'LOGIC' =>
'OR');
98 $validFields = Array(
'ID',
'NAME',
'LAST_NAME',
'SECOND_NAME',
'WORK_POSITION',
'UF_DEPARTMENT_NAME');
99 foreach ($validFields as $key)
103 $intResult[
'=ID'] = intval($findWord);
107 $intResult[
'%=INDEX.'.$key] = $helper->forSql($findWord).
'%';
110 $result[] = $intResult;
114 $result[
'LOGIC'] =
'AND';
115 $result = Array($result);
120 $validFields = Array(
'ID' => 1,
'NAME' => 1,
'LAST_NAME' => 1,
'SECOND_NAME' => 1,
'WORK_POSITION' => 1,
'UF_DEPARTMENT_NAME' => 1);
121 foreach ($fields as $key => $value)
127 if (isset($validFields[$key]))
131 $result[
'=ID'] = intval($value);
135 $result[
'%=INDEX.'.$key] = $helper->forSql($value).
'%';
153 if (UserIndexTable::getEntity()->fullTextIndexEnabled(
'SEARCH_ADMIN_CONTENT'))
156 if (array_key_exists(
'FIND', $fields))
158 $find = trim($fields[
'FIND']);
160 if (Search\Content::isIntegerToken($find))
162 $find = Search\Content::prepareIntegerToken($find);
166 $find = Search\Content::prepareStringToken($find);
171 $validFields = Array(
'ID' => 1,
'NAME' => 1,
'LAST_NAME' => 1,
'SECOND_NAME' => 1,
'WORK_POSITION' => 1,
'EMAIL' => 1,
'LOGIN' => 1);
172 foreach ($fields as $key => $value)
174 if (isset($validFields[$key]) && $validFields[$key])
176 if (Search\Content::isIntegerToken($value))
178 $find .=
' '.Search\Content::prepareIntegerToken($value);
182 $find .=
' '.Search\Content::prepareStringToken($value);
189 if (Search\Content::canUseFulltextSearch($find, Search\Content::TYPE_MIXED))
191 $result[
'*INDEX.SEARCH_ADMIN_CONTENT'] = $find;
197 if (array_key_exists(
'FIND', $fields))
199 $find = trim($fields[
'FIND']);
200 $find = explode(
' ', $find);
201 foreach ($find as $findWord)
208 $intResult = Array(
'LOGIC' =>
'OR');
209 $validFields = Array(
'ID',
'NAME',
'LAST_NAME',
'SECOND_NAME',
'WORK_POSITION',
'LOGIN',
'EMAIL');
210 foreach ($validFields as $key)
214 $intResult[
'=ID'] = intval($findWord);
216 else if ($key ==
'LOGIN' || $key ==
'EMAIL')
218 $intResult[
'%='.$key] = $helper->forSql($findWord).
'%';
222 $intResult[
'%=INDEX.'.$key] = $helper->forSql($findWord).
'%';
225 $result[] = $intResult;
229 $result[
'LOGIC'] =
'AND';
230 $result = Array($result);
235 $validFields = Array(
'ID' => 1,
'NAME' => 1,
'LAST_NAME' => 1,
'SECOND_NAME' => 1,
'WORK_POSITION' => 1,
'LOGIN' => 1,
'EMAIL' => 1);
236 foreach ($fields as $key => $value)
242 if (isset($validFields[$key]))
246 $result[
'=ID'] = intval($value);
248 else if ($key ==
'LOGIN' || $key ==
'EMAIL')
250 $result[
'%='.$key] = $helper->forSql($value).
'%';
254 $result[
'%=INDEX.'.$key] = $helper->forSql($value).
'%';
292 $cacheName =
'iblock_structure';
293 $cachePath =
'/bx/user/company/structure';
294 $iblockStructureId = Config\Option::get(
'intranet',
'iblock_structure', 0);
298 $companyStructure = Array();
299 $cache = Data\Cache::createInstance();
300 if ($cache->initCache($cacheTtl, $cacheName, $cachePath) &&
false)
302 $companyStructure = $cache->getVars();
310 $orm = \Bitrix\Iblock\SectionTable::getList(Array(
'select' => Array(
'ID',
'NAME',
'DEPTH_LEVEL',
'IBLOCK_SECTION_ID'),
'filter' => Array(
'=IBLOCK_ID' => $iblockStructureId,
'=ACTIVE' =>
'Y',),));
311 while ($department = $orm->fetch())
313 $companyStructure[$department[
'ID']] = $department;
316 $taggedCache->startTagCache($cachePath);
317 $taggedCache->registerTag(
'iblock_id_'.$iblockStructureId);
318 $taggedCache->endTagCache();
320 if ($cache->startDataCache())
322 $cache->endDataCache($companyStructure);
326 if (is_array($departmentIds) && !empty($departmentIds))
328 foreach ($departmentIds as $id)
330 if (!array_key_exists($id, $companyStructure))
335 $result[] = $companyStructure[$id];
373 global $USER_FIELD_MANAGER;
375 static $supportedUserFieldTypeIDs = [
393 $ufList = $USER_FIELD_MANAGER->getUserFields(
UserTable::getUfId(), $userId, LANGUAGE_ID,
false);
395 $userTypeMap = array_fill_keys($supportedUserFieldTypeIDs,
true);
396 foreach($ufList as $key => $userField)
399 !isset($userTypeMap[$userField[
'USER_TYPE_ID']])
400 || $userField[
'EDIT_IN_LIST'] ===
"N"
403 unset($ufList[$key]);
406 $ufList = self::postFilterFields($ufList);
409 foreach($ufList as $userField)
411 $ufValuesList[] = self::getUserFieldValue($userField);
414 return implode(
' ', $ufValuesList);