• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/classes/general/report_helper.php
  • Класс: CReportHelper
  • Вызов: CReportHelper::buildHTMLSelectTreePopup
static function buildHTMLSelectTreePopup($tree, $withReferencesChoose = false, $level = 0)
{
	if (is_array($withReferencesChoose))
	{
		$filtrableGroups = $withReferencesChoose;
		$isRefChoose = true;
	}
	else
	{
		$filtrableGroups = [];
		$isRefChoose = $withReferencesChoose;
	}
	
	$html = '';

	$i = 0;

	foreach($tree as $treeElem)
	{
		$isLastElem = (++$i == count($tree));

		$fieldDefinition = $treeElem['fieldName'];
		$branch = $treeElem['branch'];

		$fieldType = null;
		$customColumnTypes = static::getCustomColumnTypes();
		if (array_key_exists($fieldDefinition, $customColumnTypes))
		{
			$fieldType = $customColumnTypes[$fieldDefinition];
		}
		else
		{
			$fieldType = $treeElem['field'] ? static::getFieldDataType($treeElem['field']) : null;
		}

		// file fields is not filtrable
		if ($isRefChoose && ($fieldType === 'file' || $fieldType === 'disk_file'))
		{
			continue;
		}

		// multiple money fields is not filtrable
		if ($isRefChoose && $fieldType === 'money'
			&& $treeElem['isUF'] === true
			&& is_array($treeElem['ufInfo'])
			&& isset($treeElem['ufInfo']['MULTIPLE'])
			&& $treeElem['ufInfo']['MULTIPLE'] === 'Y')
		{
			continue;
		}

		if (empty($branch))
		{
			// single field
			$htmlElem = static::buildSelectTreePopupElelemnt(
				$treeElem['humanTitle'], $treeElem['fullHumanTitle'], $fieldDefinition, $fieldType,
				($treeElem['isUF'] === true && is_array($treeElem['ufInfo'])) ? $treeElem['ufInfo'] : array()
			);

			if ($isLastElem && $level > 0)
			{
				$htmlElem = str_replace(
					'
', '
', $htmlElem ); } $html .= $htmlElem; } else { // add branch $scalarTypes = array('integer', 'float', 'string', 'text', 'boolean', 'file', 'disk_file', 'datetime', 'enum', 'employee', 'crm', 'crm_status', 'iblock_element', 'iblock_section', 'money'); if ($isRefChoose && !in_array($fieldDefinition, $filtrableGroups, true) && (in_array($fieldType, $scalarTypes) || empty($fieldType)) ) { // ignore virtual branches (without references) continue; } $html .= sprintf('
%s
', $treeElem['humanTitle']); $html .= '
'; // add self if ($isRefChoose) { $html .= static::buildSelectTreePopupElelemnt( GetMessage('REPORT_CHOOSE').'...', $treeElem['humanTitle'], $fieldDefinition, $fieldType ); } $html .= static::buildHTMLSelectTreePopup($branch, $withReferencesChoose, $level+1); $html .= '
'; } } return $html; }