Csv::init

  1. Bitrix24 API (v. 23.675.0)
  2. translate
  3. Csv
  4. init
  • Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/controller/export/csv.php
  • Класс: Bitrix\Translate\Controller\Export\Csv
  • Вызов: Csv::init
protected function init()
{
	parent::init();

	if ($this->request->get('tabId') !== null)
	{
		$this->tabId = (int)$this->request->get('tabId');
		$this->filter = new Translate\Filter($this->tabId);
	}

	// untranslated only
	$this->collectUntranslated = ($this->request->get('collectUntranslated') === 'Y');

	// with samples
	$this->appendSamples = ($this->request->get('appendSamples') === 'Y');
	$this->samplesCount = (int)$this->request->get('samplesCount') ?: 10;

	$this->samplesRestriction = [];
	if (!empty($this->request->get('samplesRestriction')))
	{
		$this->samplesRestriction = array_filter($this->request->get('samplesRestriction'), 'intVal');
	}

	//  encoding
	$this->convertEncoding = ($this->request->get('convertEncoding') === 'Y');

	$this->encodingOut = '';
	if ($this->convertEncoding)
	{
		$this->encodingOut = 'utf-8';
	}

	// languages
	$enabledLanguages = Translate\Config::getEnabledLanguages();
	$languages = $this->request->get('languages');
	if (\is_array($languages) && !\in_array('all', $languages))
	{
		$languages = \array_intersect($languages, $enabledLanguages);
		$sortLang = \array_flip($enabledLanguages);
		\usort(
			$languages,
			function ($a, $b) use ($sortLang)
			{
				$a = $sortLang[$a];
				$b = $sortLang[$b];
				return (($a == $b) ? 1 : ($a < $b ? -1 : 1));
			}
		);
	}
	else
	{
		$languages = $enabledLanguages;
	}
	$this->languages = $languages;
}

Добавить комментарий