- Модуль: imopenlines
- Путь к файлу: ~/bitrix/modules/imopenlines/lib/controller/widget/history.php
- Класс: BitrixImOpenLinesControllerWidgetHistory
- Вызов: History::downloadAction
public function downloadAction(int $chatId, CurrentUser $currentUser): ?BitrixMainHttpResponse
{
$liveChat = new Chat($chatId);
$chatAuthorId = (int)$liveChat->getData('AUTHOR_ID');
$currentUserId = (int)$currentUser->getId();
if ($chatAuthorId !== $currentUserId)
{
return null;
}
$chatFieldSession = $liveChat->getFieldData(Chat::FIELD_LIVECHAT);
$sessionId = $chatFieldSession['SESSION_ID'];
if ($sessionId <= 0)
{
return null;
}
ob_start();
global $APPLICATION;
$APPLICATION->IncludeComponent(
"bitrix:imopenlines.mail.history",
"html",
[
"TEMPLATE_SERVER_ADDRESS" => BitrixImOpenLinesCommon::getServerAddress(),
"TEMPLATE_SESSION_ID" => $sessionId,
"TEMPLATE_WIDGET_LOCATION" => $this->request->getHeader('referer'),
"TEMPLATE_TYPE" => 'HISTORY',
]
);
$historyComponentContent = ob_get_clean();
$response = new BitrixMainHttpResponse();
$response->addHeader('Content-Type', 'application/octet-stream');
$response->setContent($historyComponentContent);
return $response;
}