13 private const SUPPORTED_IDS = [self::ALL_USERS, self::OTHER_USERS];
15 private const ALL_USERS =
'all-users';
16 private const OTHER_USERS =
'other-users';
20 parent::__construct();
22 $internalizeOption =
function (array
$options,
string $key):
void {
27 !isset($this->options[$key][
'allowView'])
28 || !is_bool($this->options[$key][
'allowView'])
31 $this->options[$key][
'allowView'] =
null;
36 foreach (self::SUPPORTED_IDS as $id)
44 return $GLOBALS[
'USER']->isAuthorized();
49 if (!self::canViewAllUsers())
56 foreach (self::SUPPORTED_IDS as $id)
64 foreach (self::getMetaUsers($ids,
$options) as $metaUser)
78 foreach (self::SUPPORTED_IDS as $id)
91 $intranetInstalled = ModuleManager::isModuleInstalled(
'intranet');
101 foreach ($ids as $id)
103 if (!isset($users[$id]) && in_array($id, self::SUPPORTED_IDS,
true))
110 isset($itemOptions[
'allowView']) && is_bool($itemOptions[
'allowView'])
111 ? $itemOptions[
'allowView'] :
117 $itemOptions[
'sort'] ??= $sort;
118 $users[$id] = self::getMetaUserItem($id, $itemOptions);
124 return array_values($users);
129 return self::getMetaUserItem(self::ALL_USERS,
$options);
132 private static function getMetaUserItem(
string $id, array
$options = []):
Item
137 $title = self::getTitle($id);
148 $availableInRecentTab =
149 isset(
$options[
'availableInRecentTab']) && is_bool(
$options[
'availableInRecentTab'])
158 'entityId' =>
'meta-user',
161 'searchable' => $searchable,
163 'deselectable' => $deselectable,
164 'availableInRecentTab' => $availableInRecentTab,
169 private static function getTitle(
string $id): ?string
171 $intranetInstalled = ModuleManager::isModuleInstalled(
'intranet');
173 if ($id === self::ALL_USERS)
176 $intranetInstalled ?
'SOCNET_ENTITY_SELECTOR_ALL_EMPLOYEES' :
'SOCNET_ENTITY_SELECTOR_ALL_USERS'
180 if ($id === self::OTHER_USERS)
183 $intranetInstalled ?
'SOCNET_ENTITY_SELECTOR_OTHER_EMPLOYEES' :
'SOCNET_ENTITY_SELECTOR_OTHER_USERS'
static getMessage($code, $replace=null, $language=null)
$GLOBALS['____1444769544']