Beispiel #1
0
                 break;
             case 'xlsx':
                 $oP = new ajax_page('');
                 $oExporter = new ExcelExporter();
                 $oExporter->SetObjectList($oFilter);
                 // Run the export by chunk of 1000 objects to limit memory usage
                 $oExporter->SetChunkSize(1000);
                 do {
                     $aStatus = $oExporter->Run();
                     // process one chunk
                 } while ($aStatus['code'] != 'done' && $aStatus['code'] != 'error');
                 if ($aStatus['code'] == 'done') {
                     $oP->SetContentType('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
                     $oP->SetContentDisposition('attachment', $oFilter->GetClass() . '.xlsx');
                     $oP->add(file_get_contents($oExporter->GetExcelFilePath()));
                     $oExporter->Cleanup();
                 } else {
                     $oP->add('Error, xlsx export failed: ' . $aStatus['message']);
                 }
                 break;
             default:
                 $oP = new WebPage("iTop - Export");
                 $oP->add("Unsupported format '{$sFormat}'. Possible values are: html, csv, spreadsheet or xml.");
         }
     }
 } catch (Exception $e) {
     $oP = new WebPage("iTop - Export");
     $oP->p("Error the query can not be executed.");
     if ($e instanceof CoreException) {
         $oP->p($e->GetHtmlDesc());
     } else {