- Модуль: dav
- Путь к файлу: ~/bitrix/modules/dav/classes/general/exchangecontacts.php
- Класс: CDavExchangeContacts
- Вызов: CDavExchangeContacts::CreateItemBody
public function CreateItemBody($arFields)
{
$itemBody = " rn";
$itemBody .= " IPM.Contactrn";
$arMap = array_merge(self::$arMapItem, self::$arMapContact);
foreach ($arMap as $key)
{
if (!array_key_exists($key, $arFields) && !in_array($key, array("PhysicalAddresses", "PhoneNumbers", "FileAsMapping", "FileAs")))
{
continue;
}
$value = $arFields[$key];
if ($key === "FileAsMapping")
{
$itemBody .= " LastCommaFirstrn";
}
elseif ($key === "FileAs")
{
$v = $arFields["Surname"];
if ($v <> '' && ($arFields["GivenName"] <> '' || $arFields["MiddleName"] <> ''))
$v .= ", ";
$v .= $arFields["GivenName"];
if ($v <> '' && $arFields["MiddleName"] <> '')
$v .= " ";
$v .= $arFields["MiddleName"];
$itemBody .= " ".htmlspecialcharsbx($v)."rn";
}
elseif ($key === "EmailAddresses")
{
$itemBody .= " rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["EmailAddresses"])."rn";
$itemBody .= " rn";
}
elseif ($key === "PhysicalAddresses")
{
$itemBody .= " rn";
$itemBody .= " rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Business_Street"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Business_City"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Business_State"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Business_CountryOrRegion"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Business_PostalCode"])."rn";
$itemBody .= " rn";
$itemBody .= " rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Home_Street"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Home_City"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Home_State"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Home_CountryOrRegion"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhysicalAddresses_Home_PostalCode"])."rn";
$itemBody .= " rn";
$itemBody .= " rn";
}
elseif ($key === "PhoneNumbers")
{
$itemBody .= " rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhoneNumbers_HomePhone"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhoneNumbers_HomePhone2"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhoneNumbers_MobilePhone"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhoneNumbers_Pager"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhoneNumbers_BusinessPhone"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhoneNumbers_BusinessPhone2"])."rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["PhoneNumbers_OtherTelephone"])."rn";
$itemBody .= " rn";
}
elseif ($key === "ImAddresses")
{
$itemBody .= " rn";
$itemBody .= " ".htmlspecialcharsbx($arFields["ImAddresses"])."rn";
$itemBody .= " rn";
}
// elseif ($key == "ItemId")
// {
// $itemBody .= " rn";
// }
else
{
$itemBody .= " <".htmlspecialcharsbx($key).">";
if (is_bool($value))
$itemBody .= ($value ? "true" : "false");
else
$itemBody .= htmlspecialcharsbx($value);
$itemBody .= "".htmlspecialcharsbx($key).">rn";
}
}
$itemBody .= " rn";
return $itemBody;
}