Exemplo n.º 1
0
 * Retrieve export data from POST Request sent by chart
 * Parse the Request stream into export data readable by this script
 *
 * Store export data into an array containing keys 'stream' (contains encoded
 * image data) ; 'meta' ( contains an array with 'width', 'height' and 'bgColor' keys) ;
 * and 'parameters' ( array of all export parameters from chart as keys, like - exportFormat,
 * exportFileName, exportAction etc.)
 */
$exportRequestStream = $_POST;
$exportData = parseExportRequestStream($exportRequestStream);
/**
 * Get the name of the export resource (php file) as per export format
 * Dynamically include the resource. The resource would process the data
 * and perform all export related tasks
 */
$exporterResource = getExporter($exportData['parameters']["exportformat"], $exportData["streamtype"]);
// if resource is not found terminate with error report
if (!@(include $exporterResource)) {
    raise_error(404, true);
}
/*
 * Pass export stream and meta values to the export processor &
 * get back the export binary
 */
$exportObject = exportProcessor($exportData['stream'], $exportData['meta'], $exportData['parameters']);
/*
 * Send the export binary to output module which would either save to a server directory
 * or send the export file to download. Download terminates the process while
 * after save the output module sends back export status
 */
$exportedStatus = outputExportObject($exportObject, $exportData['parameters']);
Exemplo n.º 2
0
 * Retrieve export data from POST Request sent by chart
 * Parse the Request stream into export data readable by this script
 *  
 * Store export data into an array containing keys 'stream' (contains encoded 
 * image data) ; 'meta' ( contains an array with 'width', 'height' and 'bgColor' keys) ;
 * and 'parameters' ( array of all export parameters from chart as keys, like - exportFormat, 
 * exportFileName, exportAction etc.)
 */
$exportRequestStream = $_POST;
$exportData = parseExportRequestStream($exportRequestStream);
/**
 * Get the name of the export resource (php file) as per export format
 * Dynamically include the resource. The resource would process the data   
 * and perform all export related tasks
 */
$exporterResource = getExporter($exportData['parameters']["exportformat"]);
// if resource is not found terminate with error report
if (!@(include $exporterResource)) {
    raise_error(404, true);
}
/*
 * Pass export stream and meta values to the export processor & 
 * get back the export binary  
 */
$exportObject = exportProcessor($exportData['stream'], $exportData['meta']);
/*
 * Send the export binary to output module which would either save to a server directory
 * or send the export file to download. Download terminates the process while
 * after save the output module sends back export status 
 */
$exportedStatus = outputExportObject($exportObject, $exportData['parameters']);