• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/controller/export/csv.php
  • Класс: BitrixTranslateControllerExportCsv
  • Вызов: Csv::downloadAction
public function downloadAction(int $tabId, string $type)
{
	if ($tabId <= 0)
	{
		throw new MainArgumentException("Missing 'tabId' parameter");
	}
	if (empty($type) || !in_array($type, ['export', 'samples'], true))
	{
		throw new MainArgumentException("Missing 'type' parameter");
	}

	$this->keepField($type)->restoreProgressParameters();

	if (!empty($this->{$type}['filePath']) && !empty($this->{$type}['fileName']))
	{
		$path = new MainIOFile($this->{$type}['filePath']);
		if ($path->isExists())
		{
			$response = new MainEngineResponseFile(
				$path->getPath(),
				$this->{$type}['fileName'],
				$this->{$type}['fileType']
			);

			return $response;
		}
	}

	$this->addError(new Error('File not found'));
}