- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/app.php
- Класс: BitrixImApp
- Вызов: App::getListForJs
static function getListForJs($lang = LANGUAGE_ID)
{
$apps = self::getListCache($lang);
$userId = $GLOBALS['USER']? $GLOBALS['USER']->GetId(): 0;
$isExtranet = $userId && BitrixImUser::getInstance($userId)->isExtranet();
$isConnector = $userId && BitrixImUser::getInstance($userId)->isConnector();
$result = Array();
foreach ($apps as $app)
{
if ($isConnector && $app['LIVECHAT_SUPPORT'] != 'Y')
continue;
else if ($isExtranet && $app['EXTRANET_SUPPORT'] != 'Y')
continue;
$botData = BitrixImBot::getCache($app['BOT_ID']);
$result[] = Array(
'id' => $app['ID'],
'botId' => $app['BOT_ID'],
'botCode' => htmlspecialcharsbx($botData['CODE'] ?? ''),
'domainHash' => self::getDomainHash($app['HASH']),
'userHash' => self::getUserHash($userId, $app['HASH']),
'code' => htmlspecialcharsbx($app['CODE']),
'url' => $app['ICON_URL'],
'iframe' => $app['IFRAME'],
'iframeWidth' => $app['IFRAME_WIDTH'],
'iframeHeight' => $app['IFRAME_HEIGHT'],
'iframePopup' => $app['IFRAME_POPUP'] == 'Y',
'js' => $app['JS'],
'context' => ToLower($app['CONTEXT']),
'hidden' => $app['HIDDEN'] == 'Y',
'title' => $app['TITLE'],
'description' => $app['DESCRIPTION'],
'copyright' => $app['COPYRIGHT'],
);
}
return $result;
}