CCrmViewHelper::PrepareMultiFieldValuesPopup

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmViewHelper
  4. PrepareMultiFieldValuesPopup
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_view_helper.php
  • Класс: \CCrmViewHelper
  • Вызов: CCrmViewHelper::PrepareMultiFieldValuesPopup
static function PrepareMultiFieldValuesPopup($popupID, $achorID, $typeName, $arValues, $arValueTypes, $arOptions = array())
{
	CCrmComponentHelper::RegisterScriptLink('/bitrix/js/crm/common.js');

	$enableSip = is_array($arOptions) && isset($arOptions['ENABLE_SIP']) && (bool)$arOptions['ENABLE_SIP'];
	$sipParams =  $enableSip && isset($arOptions['SIP_PARAMS']) ? $arOptions['SIP_PARAMS'] : null;
	$skipFirst =  isset($arOptions['SKIP_FIRST']) ? $arOptions['SKIP_FIRST'] : false;
	$isSkipped = false;
	$arPopupItems = array();
	foreach($arValues as $valueTypeID => $values)
	{
		$valueType = isset($arValueTypes[$valueTypeID]) ? $arValueTypes[$valueTypeID] : null;

		foreach($values as $value)
		{
			if($skipFirst && !$isSkipped)
			{
				$isSkipped = true;
				continue;
			}

			$popupItemData = array(
				'value' => htmlspecialcharsbx(
					self::PrepareMultiFieldHtml(
						$typeName,
						array(
							'VALUE_TYPE_ID' => $valueTypeID,
							'VALUE_TYPE' => $valueType,
							'VALUE' => $value
						),
						$arOptions
					)
				),
				'type' => htmlspecialcharsbx(
					isset($valueType['SHORT'])? mb_strtolower($valueType['SHORT']) : ''
				)
			);

			if($enableSip)
			{
				$popupItemData['sipCallHtml'] = htmlspecialcharsbx(self::PrepareSipCallHtml($value, $sipParams));
			}

			$arPopupItems[] = &$popupItemData;
			unset($popupItemData);
		}
	}

	$topmost =  isset($arOptions['TOPMOST']) ? $arOptions['TOPMOST'] : false;
	return 'BX.CrmMultiFieldViewer.ensureCreated(\''
		.CUtil::JSEscape($popupID).'\', { \'anchorId\':\''
		.CUtil::JSEscape($achorID).'\', \'items\':'
		.CUtil::PhpToJSObject($arPopupItems)
		.', \'typeName\':\''.CUtil::JSEscape($typeName).'\''
		.', \'topmost\':'.($topmost ? 'true' : 'false')
		.' }).show();';
}

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