- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/Configuration/General.php
- Класс: BitrixImConfigurationGeneral
- Вызов: General::getUserNotifySchemas
static function getUserNotifySchemas(array $userList): array
{
if (empty($userList))
{
return [];
}
$default = static::getDefaultSettings();
$notifySchemeValue = $default['notifyScheme'];
$encodedSettingName = static::encodeName('notifyScheme');
$query =
OptionUserTable::query()
->addSelect('USER_ID')
->addSelect(new ExpressionField('NOTIFY_SCHEMA',"IFNULL(%s, '$notifySchemeValue')", ['OPTION_STATE.VALUE']))
->registerRuntimeField(
'USER',
new Reference(
'USER',
UserTable::class,
Join::on('this.USER_ID', 'ref.ID'),
['join_type' => Join::TYPE_INNER]
)
)
->registerRuntimeField(
'OPTION_STATE',
new Reference(
'OPTION_STATE',
OptionStateTable::class,
Join::on('this.GENERAL_GROUP_ID', 'ref.GROUP_ID')
->where('ref.NAME', $encodedSettingName),
['join_type' => Join::TYPE_LEFT]
)
)
->whereIn('USER_ID', $userList)
->where('USER.ACTIVE', 'Y')
->where('USER.IS_REAL_USER', 'Y')
;
$notifySchemas = [
'simple' => [],
'expert' => [],
];
foreach ($query->exec() as $row)
{
if($row['NOTIFY_SCHEMA'] === 'simple')
{
$notifySchemas['simple'][] = (int)$row['USER_ID'];
}
elseif ($row['NOTIFY_SCHEMA'] === 'expert')
{
$notifySchemas['expert'][] = (int)$row['USER_ID'];
}
}
return $notifySchemas;
}