if ($generate_pdfpreviews) {
                        $object->makePDFpreview(true);
                    }
                    break;
                case "CFile":
                    if ($ignore_files) {
                        break;
                    }
                    /** @var CFile $object */
                    $_dir = "{$dir}/{$object->object_class}/{$object->object_id}";
                    CMbPath::forceDir($_dir);
                    file_put_contents($_dir . "/" . $object->file_real_filename, @$object->getBinaryContent());
                    break;
                default:
                    // Do nothing
            }
        };
        $export->empty_values = false;
        $export->setObjectCallback($callback);
        $export->setForwardRefsTree($fwdrefs_tree);
        $xml = $export->toDOM()->saveXML();
        file_put_contents("{$dir}/export.xml", $xml);
        //CMbPath::zip($dir, dirname($dir)."/export-$date.zip");
    } catch (CMbException $e) {
        $e->stepAjax(UI_MSG_ERROR);
    }
}
CAppUI::stepAjax("%d patients au total", UI_MSG_OK, $patient_count);
if ($patient_count) {
    CAppUI::js("nextStepPatients()");
}