Ejemplo n.º 1
0
    echo "failure\n", GetMessage("CC_BCE1_ERROR_CATALOG_MODULE");
} else {
    if ($_GET["mode"] == "init") {
        $_SESSION["BX_CML2_EXPORT"] = array("zip" => $arParams["USE_ZIP"] && function_exists("zip_open"), "step" => 1, "next_step" => array(), "SECTION_MAP" => array(), "PROPERTY_MAP" => false, "PRICES_MAP" => false);
        echo "zip=" . ($_SESSION["BX_CML2_EXPORT"]["zip"] ? "yes" : "no") . "\n";
    } elseif ($_GET["mode"] == "query") {
        $start_time = time();
        if ($fp = fopen("php://output", "ab")) {
            $obExport = new CIBlockCMLExport();
            if ($_SESSION["BX_CML2_EXPORT"]["step"] === 1) {
                if ($obExport->Init($fp, $arParams["IBLOCK_ID"], $_SESSION["BX_CML2_EXPORT"]["next_step"], false, $work_dir = false, $file_dir = false, $bCheckPermissions = false)) {
                    $_SESSION["BX_CML2_EXPORT"]["total"] = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y"), array());
                    $_SESSION["BX_CML2_EXPORT"]["current"] = 0;
                    echo GetMessage("CC_BCE1_PROGRESS_PRODUCT", array("#TOTAL#" => $_SESSION["BX_CML2_EXPORT"]["total"], "#COUNT#" => 0));
                    $obExport->NotCatalog();
                    $obExport->ExportFileAsURL();
                    $obExport->StartExport();
                    $obExport->StartExportMetadata();
                    $obExport->ExportProperties($_SESSION["BX_CML2_EXPORT"]["PROPERTY_MAP"]);
                    $obExport->ExportSections($_SESSION["BX_CML2_EXPORT"]["SECTION_MAP"], 0, 0);
                    $obExport->EndExportMetadata();
                    $obExport->EndExport();
                    $_SESSION["BX_CML2_EXPORT"]["next_step"] = $obExport->next_step;
                    $_SESSION["BX_CML2_EXPORT"]["step"] = 2;
                } else {
                    echo "failure\n", GetMessage("CC_BCE1_ERROR_INIT");
                }
            } elseif ($_SESSION["BX_CML2_EXPORT"]["step"] === 2) {
                if ($obExport->Init($fp, $arParams["IBLOCK_ID"], $_SESSION["BX_CML2_EXPORT"]["next_step"], false, $work_dir = false, $file_dir = false, $bCheckPermissions = false)) {
                    $obExport->NotCatalog();
                    $obExport->ExportFileAsURL();