Beispiel #1
0
function DoExport(Page $oP, BulkExport $oExporter, $bInteractive = false)
{
    $exportResult = $oExporter->GetHeader();
    $aStatus = array();
    do {
        $exportResult .= $oExporter->GetNextChunk($aStatus);
    } while ($aStatus['code'] != 'done' && $aStatus['code'] != 'error');
    if ($aStatus['code'] == 'error') {
        $oExporter->Cleanup();
        ReportErrorAndExit("Export failed: '{$aStatus['message']}'");
    } else {
        $exportResult .= $oExporter->GetFooter();
        $oP->SetContentType($oExporter->GetMimeType());
        $oP->add($exportResult);
        $oExporter->Cleanup();
    }
}
Beispiel #2
0
function DoExport(WebPage $oP, BulkExport $oExporter, $bInteractive = false)
{
    $oExporter->SetHttpHeaders($oP);
    $exportResult = $oExporter->GetHeader();
    $aStatus = array();
    do {
        $exportResult .= $oExporter->GetNextChunk($aStatus);
    } while ($aStatus['code'] != 'done' && $aStatus['code'] != 'error');
    if ($aStatus['code'] == 'error') {
        $oExporter->Cleanup();
        ReportErrorAndExit("Export failed: '{$aStatus['message']}'");
    } else {
        $exportResult .= $oExporter->GetFooter();
        $sMimeType = $oExporter->GetMimeType();
        if (substr($sMimeType, 0, 5) == 'text/') {
            $sMimeType .= ';charset=' . strtolower($oExporter->GetCharacterSet());
        }
        $oP->SetContentType($sMimeType);
        $oP->SetContentDisposition('attachment', $oExporter->GetDownloadFileName());
        $oP->add($exportResult);
        $oExporter->Cleanup();
    }
}