Interface Inx_Api_Reporting_DownloadableResult

Description

Use the Inx_Api_Reporting_DownloadableResult to download a generated report.

Use the Inx_Api_Reporting_DownloadableResult to download a generated report. A DownloadableResult can be obtained using Inx_Api_Reporting_ReportTicket::fetchDownloadableResult(). The report ticket is returned by Inx_Api_Reporting_ReportEngine::generate($oRequest, $blIgnoreCache). As the report generation is an asynchronous process, the DownloadableResult must be polled. Inx_Api_Reporting_ReportTicket::fetchDownloadableResult() will return null as long as the report generation has not finished. <p/> The following snippet shows how to download a report using the DownloadableResult:

 $oResult = $oReportTicket->fetchDownloadableResult();
 while( $oResult == null )
 {
 	sleep( 3 );
 	$oResult = $oReportTicket->fetchDownloadableResult();
 }

 $sOutputFile = "SystemDomainDistribution.pdf";
 download( $oResult->getInputStream(), $sOutputFile );

 if( $oReportTicket != null )
 {
 	$oReportTicket->close();
 }
<p/> Some output formats (e.g.
  1. OUTPUT_FORMAT_HTML
,
  1. OUTPUT_FORMAT_HTML_INXLINKS
or
  1. OUTPUT_FORMAT_CSV
) are provide as ZIP compressed archive file, as these formats usually contain several files. The PDF output formats on the other hand are provided as single PDF files. The
  1. download()
method presented in the following snippet is used to download these files, but will not uncompress ZIP files:
 function download($inputStream, $sFileName)
 {
  $handle = fopen($sFileName, 'w+b');
  while (($ch = $inputStream->read()) != -1)
  {
   fwrite($handle, $ch);
  }

  $inputStream->close();
  fclose($handle);
 }
<p/> For a more complete example on how to generate and download reports, see the Inx_Api_Reporting_ReportEngine documentation.

  • version: $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
  • see: Inx_Api_Reporting_ReportEngine
  • since: API 1.3

Located in /Api/Reporting/DownloadableResult.php (line 63)


	
			
Method Summary
Methods
getContentType (line 97)

This method returns the content type of the data in the form of a string.

This method returns the content type of the data in the form of a string. <p/> It always returns one of the following types:

  1. "zip" - if the output format is one of:
    • Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_HTML,
    • Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_HTML_INXLINKS or
    • Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_CSV
  2. "pdf" - if the output format is one of
    • Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_PDF_A4
    • Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_PDF_US_LETTER
    • Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_PDF_US_LEGAL

  • return: the content type.
  • access: public
string getContentType ()
getCreationDate (line 106)

Returns the creation date of this report.

Returns the creation date of this report. The date will be returned as ISO-8601 formatted datetime string.

  • return: the creation date of this report.
  • access: public
string getCreationDate ()
getInputStream (line 71)

Returns an Inx_Api_InputStream which can be used to download the report.

Returns an Inx_Api_InputStream which can be used to download the report.

  • return: an Inx_Api_InputStream to download the report.
  • access: public
Inx_Api_InputStream getInputStream ()

Documentation generated on Thu, 17 Sep 2015 14:27:24 +0200 by phpDocumentor 1.3.2