Interface Inx_Api_Reporting_ReportEngine

Description

The Inx_Api_Reporting_ReportEngine is used to generate reports.

The Inx_Api_Reporting_ReportEngine is used to generate reports. To generate a report, you first need to create an Inx_Api_Reporting_ReportRequest which contains the relevant information needed to generate the report:

  • The report name
  • The output format (e.g. OUTPUT_FORMAT_HTML, OUTPUT_FORMAT_PDF_A4)
  • The output locale (e.g. "de_DE", "en_GB")
  • The output time zone (e.g. "Europe/Berlin", "America/New_York")
  • Probably some report specific properties (e.g. "listid")
The report request is sent to the server where the actual report generation takes place. The ReportEngine returns an Inx_Api_Reporting_ReportTicket which can be used to retrieve the result as Inx_Api_Reporting_DownloadableResult. However, be aware that the report generation is processed asynchronous. Therefore, the DownloadableResult must be polled until it is available. Once it is available an Inx_Api_InputStream may be retrieved which can be used to download the report in the desired output format.

The following snippet shows how to download the report 'SystemDomainDistribution' as PDF report in the German locale and time zone with a limit of 20 entries and save it to the file 'SystemDomainDistribution.pdf':

 $oReportRequest = new Inx_Api_Reporting_ReportRequest( "SystemDomainDistribution",
 		Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_PDF_A4, "de_DE", "Europe/Berlin" );
 $oReportRequest->putParameter( "limit", "20" );

 $oReportEngine = $oSession->getReportEngine();
 $oReportTicket = $oReportEngine->generate( $oReportRequest, false );

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

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

 if( $oReportTicket != null )
 {
 	$oReportTicket->close();
 }

The download() method - which is not part of the API - may be used to save the report to a file on disk. The following snippet shows the definition of the download() method:

 function download($inputStream, $sFileName)
 {
  $handle = fopen($sFileName, 'w+b');
  while (($ch = $inputStream->read()) != -1)
  {
   fwrite($handle, $ch);
  }

  $inputStream->close();
  fclose($handle);
 }

Please note: some reports require you to specify the type of the mailing for which the report is built. To specify this mailing type, use the Inx_Api_Reporting_ReportRequest::putMailingTypeParameter($sKey, $oMailingType) method which accepts Inx_Api_Reporting_ReportMailingTypes.

For a complete list of the available reports and the properties associated with them, see Appendix A of the API developer guide.

Located in /Api/Reporting/ReportEngine.php (line 85)


	
			
Method Summary
Inx_Api_Reporting_ConfigDescriptor getDescriptor (string $sReportName, string $sLocale)
array getReportNames ()
Methods
generate (line 99)

This method is used to initiate the generation of the report specified by the given Inx_Api_Reporting_ReportRequest.

This method is used to initiate the generation of the report specified by the given Inx_Api_Reporting_ReportRequest. The returned Inx_Api_Reporting_ReportTicket may be used to poll for the Inx_Api_Reporting_DownloadableResult used to download the generated report. For an example on how to do this, see the documentation of this class.

  • return: a report ticket which can be used to poll for the DownloadableResult.
  • access: public
Inx_Api_Reporting_ReportTicket generate (Inx_Api_Reporting_ReportRequest $oRequest, boolean $blIgnoreCache)
  • Inx_Api_Reporting_ReportRequest $oRequest: the description of the report to generate.
  • boolean $blIgnoreCache: true if the cache shall be ignored, false otherwise. This will force the report to be generated instead of using a previously generated report.
getDescriptor (line 124)

Returns the localized Inx_Api_Reporting_ConfigDescriptor of the specified report.

Returns the localized Inx_Api_Reporting_ConfigDescriptor of the specified report. The ConfigDescriptor describes the structure and elements of the report configuration area. A ConfigDescriptor contains a set of Inx_Api_Reporting_ControlUnits which in turn contain a set of Inx_Api_Reporting_Controls. A Control describes a configuration element like the list or mailing chooser.

  • return: the localized descriptor of the specified report, or null if the report name is unknown.
  • access: public
Inx_Api_Reporting_ConfigDescriptor getDescriptor (string $sReportName, string $sLocale)
  • string $sReportName: the name of the report whose configuration descriptor shall be returned.
  • string $sLocale: the locale in which the
    1. ConfigDescriptor
    shall be returned. Use the name of the locale, with the language (defined by ISO-639) or the language and country (defined by ISO-3166) separated by an underscore. For example: "de_DE", "de_CH", "de", "en", "en_GB", "it_IT", "fr_FR"
getReportNames (line 107)

Returns all names of the default and custom report types.

Returns all names of the default and custom report types.

  • return: all names of the default and custom report types.
  • access: public
array getReportNames ()
getSupportedTimeZones (line 132)

Returns all supported time zones.

Returns all supported time zones.

  • return: all supported time zones as string array.
  • access: public
array getSupportedTimeZones ()

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