- Модуль: voximplant
- Путь к файлу: ~/bitrix/modules/voximplant/lib/integration/im.php
- Класс: BitrixVoximplantIntegrationIm
- Вызов: Im::notifyAdmins
static function notifyAdmins($notification, array $buttons = array())
{
if(!Loader::includeModule('im'))
return;
$notification = Encoding::convertEncodingToCurrent($notification);
$admins = array();
$cursor = CAllGroup::GetGroupUserEx(1);
while($user = $cursor->fetch())
{
$admins[] = $user["USER_ID"];
}
$messageFields = array(
"FROM_USER_ID" => 0,
"NOTIFY_TYPE" => IM_NOTIFY_SYSTEM,
"NOTIFY_MODULE" => "voximplant",
"NOTIFY_EVENT" => "notifications",
//"NOTIFY_TAG" => "TELEPHONY_NOTIFICATION",
"NOTIFY_MESSAGE" => $notification,
"NOTIFY_MESSAGE_OUT" => strip_tags($notification)
);
$attach = new CIMMessageParamAttach();
if(!empty($buttons))
{
foreach ($buttons as $button)
{
$attach->AddLink(array(
"NAME" => Encoding::convertEncodingToCurrent($button['TEXT']),
"LINK" => static::replaceLinkMacros($button['LINK'])
));
}
}
if (!$attach->IsEmpty())
{
$messageFields['ATTACH'] = $attach;
}
foreach ($admins as $adminId)
{
$message = $messageFields;
$message['TO_USER_ID'] = $adminId;
CIMNotify::Add($message);
}
}