- Модуль: translate
- Путь к файлу: ~/bitrix/modules/translate/lib/controller/export/csv.php
- Класс: BitrixTranslateControllerExportCsv
- Вызов: Csv::detectAction
private function detectAction($path): ExportAction
{
// I. Based on pure file list.
$nextAction = self::ACTION_EXPORT_FILE_LIST;
$exporterClass = ExportFileList::class;
// II. Based on file search.
if (
!empty($this->filter['FILE_NAME'])
|| !empty($this->filter['FOLDER_NAME'])
|| !empty($this->filter['INCLUDE_PATHS'])
|| !empty($this->filter['EXCLUDE_PATHS'])
)
{
$nextAction = self::ACTION_EXPORT_FILE_SEARCH;
$exporterClass = ExportFileSearch::class;
}
// III. List of files and folders
$pathList = $this->request->get('pathList');
if (!empty($pathList))
{
$nextAction = self::ACTION_EXPORT_PATH;
$exporterClass = ExportPath::class;
}
// IV. Based on phrase search.
if (
!empty($this->filter['PHRASE_CODE'])
|| !empty($this->filter['INCLUDE_PHRASE_CODES'])
|| !empty($this->filter['EXCLUDE_PHRASE_CODES'])
|| !empty($this->filter['PHRASE_TEXT'])
)
{
$nextAction = self::ACTION_EXPORT_PHRASE_SEARCH;
$exporterClass = ExportPhraseSearch::class;
// V. List of files with codes
$codeList = $this->request->get('codeList');
if (!empty($pathList) && !empty($codeList))
{
$nextAction = self::ACTION_EXPORT_PATH;
$exporterClass = ExportPath::class;
}
}
// VI. Single file
if (preg_match("/.php$/", $path))
{
$nextAction = self::ACTION_EXPORT_FILE;
$exporterClass = ExportFile::class;
}
/** @var ExportAction $action */
$action = new $exporterClass(
$nextAction,
$this,
[
'tabId' => $this->tabId,
'collectUntranslated' => $this->collectUntranslated,
'appendSamples' => $this->appendSamples,
'samplesCount' => $this->samplesCount,
'samplesRestriction' => $this->samplesRestriction,
'convertEncoding' => $this->convertEncoding,
'encodingOut' => $this->encodingOut,
'languages' => $this->languages,
'filter' => $this->filter,
]
);
return $action;
}