• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/import/gmailcsvfileimport.php
  • Класс: Bitrix\Crm\Import\GMailCsvFileImport
  • Вызов: GMailCsvFileImport::getInstantMessengers
public function getInstantMessengers(&$data)
{
	$map = $this->headerMap;
	if($map === null)
	{
		throw new Main\SystemException("Invalid operation. HeaderMap is not assigned.");
	}

	$result = array();
	$i = 1;
	$typeKey = "IM {$i} - Service";
	$valueKey = "IM {$i} - Value";

	$types = '';
	$values = '';
	while($this->tryToGetValue($typeKey, $data, $types, $map) && $types !== ''
		&& $this->tryToGetValue($valueKey, $data, $values, $map) && $values !== '')
	{
		$types = explode(':::', $types);
		$values = explode(':::', $values);

		foreach($types as $k => $type)
		{
			$type = trim($type);

			$value = isset($values[$k]) ? trim($values[$k]) : '';
			if($value === '')
			{
				continue;
			}

			$result[] = array(
				'VALUE_TYPE' => $type,
				'VALUE' => $value
			);
		}

		$i++;
		$typeKey = "IM {$i} - Service";
		$valueKey = "IM {$i} - Value";
	}
	return $result;
}