• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/exchangeclientrequest.php
  • Класс: CDavExchangeClientRequest
  • Вызов: CDavExchangeClientRequest::CreateFindItemBody
public function CreateFindItemBody($arParentFolderId, $item = null, $itemShape = "AllProperties",
	$additionalProperties = array(), $arAdditionalExtendedProperties = array()
)
{
	$arMapTmp = array("idonly" => "IdOnly", "id_only" => "IdOnly", "allproperties" => "AllProperties", "all_properties" => "AllProperties");
	$itemShapeLower = mb_strtolower($itemShape);
	if (array_key_exists($itemShapeLower, $arMapTmp))
	{
		$itemShape = $arMapTmp[$itemShapeLower];
	}
	else
	{
		$itemShape = "AllProperties";
	}

	$this->body  = "<"."?xml version="1.0" encoding="utf-8"?".">rn";
	$this->body .= "rn";
	$this->body .= " rn";
	$this->body .= "  rn";
	$this->body .= "   rn";
	$this->body .= "    ".$itemShape."rn";

	$bAdditionalProperties = (is_array($additionalProperties) && !empty($additionalProperties));
	$bAdditionalExtendedProperties = (is_array($arAdditionalExtendedProperties) && !empty($arAdditionalExtendedProperties));

	if ($bAdditionalProperties || $bAdditionalExtendedProperties)
		$this->body .= "    rn";

	if ($bAdditionalProperties)
	{
		foreach ($additionalProperties as $v)
		{
			$this->body .= "     rn";
		}
	}

	if ($bAdditionalExtendedProperties)
	{
		$arProbablyExtendedFields = array('DistinguishedPropertySetId',
			'PropertyName', 'PropertyType', 'PropertySetId'
		);

		foreach ($arAdditionalExtendedProperties as $arAdditionalExtendedProperty)
		{
			$this->body .= '     body .= ' ' . $probablyFieldName . '="' . $arAdditionalExtendedProperty[$probablyFieldName] . '"';

			$this->body .= " />rn";
		}
	}

	if ($bAdditionalProperties || $bAdditionalExtendedProperties)
	{
		$this->body .= "    rn";
	}

	$this->body .= "   rn";

	if (!is_null($item))
	{
		$this->body .= "   <".htmlspecialcharsbx($item["type"]);
		foreach ($item["properties"] as $key => $value)
		{
			$this->body .= " " . htmlspecialcharsbx($key) . "="" . htmlspecialcharsbx($value) . """;
		}
		$this->body .= "/>rn";
	}

	/*
	$this->body .= "   rn";
	$this->body .= "    rn";
	$this->body .= "     rn";
	$this->body .= "     rn";
	$this->body .= "    rn";
	$this->body .= "   rn";
	*/

	$this->body .= "   rn";

	/*
	"calendar"
	array("id" => "calendar")
	array("id" => "calendar", "mailbox" => "aaa@bbb.cc")
	array("id" => "calendar", "mailbox" => array("aaa@bbb.cc", "ddd@eee.ff"))
	*/
	if (!is_array($arParentFolderId))
	{
		$arParentFolderId = ["id" => $arParentFolderId];
	}

	if (!in_array($arParentFolderId["id"], self::$arDistinguishedFolderIdNameType))
	{
		$this->body .= "    rn";
	}
	elseif (array_key_exists("mailbox", $arParentFolderId))
	{
		$arMailbox = $arParentFolderId["mailbox"];
		if (!is_array($arMailbox))
		{
			$arMailbox = [$arMailbox];
		}

		foreach ($arMailbox as $mailbox)
		{
			$this->body .= "    rn";
			$this->body .= "     ".htmlspecialcharsbx($mailbox)."rn";
			$this->body .= "    rn";
		}
	}
	else
	{
		$this->body .= "    rn";
	}

	$this->body .= "   rn";

	$this->body .= "  rn";
	$this->body .= " rn";
	$this->body .= "";
}