• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/cml2.php
  • Класс: CIBlockCMLExport
  • Вызов: CIBlockCMLExport::StartExportCatalog
function StartExportCatalog($with_metadata = true, $changes_only = false)
{
	if($this->next_step["catalog"])
		fwrite($this->fp, "t<".GetMessage("IBLOCK_XML2_OFFER_LIST").">n");
	else
		fwrite($this->fp, "t<".GetMessage("IBLOCK_XML2_CATALOG").">n");

	if($this->PRODUCT_IBLOCK_ID)
		$xml_id = $this->GetIBlockXML_ID($this->PRODUCT_IBLOCK_ID, CIBlock::GetArrayByID($this->PRODUCT_IBLOCK_ID, "XML_ID"));
	else
		$xml_id = $this->GetIBlockXML_ID($this->arIBlock["ID"], $this->arIBlock["XML_ID"]);
	$this->arIBlock["XML_ID"] = $xml_id;

	fwrite($this->fp, $this->formatXMLNode(2, GetMessage("IBLOCK_XML2_ID"), $xml_id));
	if($with_metadata)
	{
		fwrite($this->fp, $this->formatXMLNode(2, GetMessage("IBLOCK_XML2_METADATA_ID"), $xml_id));
		fwrite($this->fp, $this->formatXMLNode(2, GetMessage("IBLOCK_XML2_NAME"), $this->arIBlock["NAME"]));

		if($this->arIBlock["DESCRIPTION"] <> '')
			fwrite($this->fp, $this->formatXMLNode(2, GetMessage("IBLOCK_XML2_DESCRIPTION"), FormatText($this->arIBlock["DESCRIPTION"], $this->arIBlock["DESCRIPTION_TYPE"])));

		if($this->bExtended)
		{
			fwrite($this->fp,
				$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_CODE"), $this->arIBlock["CODE"])
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_API_CODE"), (string)$this->arIBlock["API_CODE"])
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_SORT"), intval($this->arIBlock["SORT"]))
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_LIST_URL"), $this->arIBlock["LIST_PAGE_URL"])
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_DETAIL_URL"), $this->arIBlock["DETAIL_PAGE_URL"])
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_SECTION_URL"), $this->arIBlock["SECTION_PAGE_URL"])
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_CANONICAL_URL"), $this->arIBlock["CANONICAL_PAGE_URL"])
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_PICTURE"), $this->ExportFile($this->arIBlock["PICTURE"]))
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_INDEX_ELEMENTS"), ($this->arIBlock["INDEX_ELEMENT"]=="Y"? "true": "false"))
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_INDEX_SECTIONS"), ($this->arIBlock["INDEX_SECTION"]=="Y"? "true": "false"))
				.$this->formatXMLNode(2, GetMessage("IBLOCK_XML2_BX_WORKFLOW"), ($this->arIBlock["WORKFLOW"]=="Y"? "true": "false"))
			);

			fwrite($this->fp, "tt<".GetMessage("IBLOCK_XML2_LABELS").">n");
			$arLabels = CIBlock::GetMessages($this->arIBlock["ID"]);
			foreach($arLabels as $id => $label)
			{
				fwrite($this->fp, $this->formatXMLNode(3, GetMessage("IBLOCK_XML2_LABEL"), array(
					GetMessage("IBLOCK_XML2_ID") => $id,
					GetMessage("IBLOCK_XML2_VALUE") => $label,
				)));
			}
			fwrite($this->fp, "ttn");

			$iblockTemplates = new BitrixIblockInheritedPropertyIblockTemplates($this->arIBlock["ID"]);
			$this->exportInheritedTemplates(2, $iblockTemplates);
		}
	}

	if($with_metadata || $this->only_price)
	{
		$this->ExportPrices();
	}

	if($changes_only)
		fwrite($this->fp, $this->formatXMLNode(2, GetMessage("IBLOCK_XML2_UPDATE_ONLY"), "true"));

	if($this->next_step["catalog"])
		fwrite($this->fp, "tt<".GetMessage("IBLOCK_XML2_OFFERS").">n");
	else
		fwrite($this->fp, "tt<".GetMessage("IBLOCK_XML2_POSITIONS").">n");
}