Source for file htmlexport.php
Documentation is available at htmlexport.php
* Construct an HTML export from array representation
* @author Stuart Prescott
* @copyright Copyright Stuart Prescott
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* path (bumblebee root)/inc/export/htmlexport.php
/** Load ancillary functions */
require_once 'inc/typeinfo.php';
/** constants for defining export formatting and codes */
require_once 'inc/exportcodes.php';
* Construct an HTML export from array representation
/** @var string html-rendered data */
/** @var boolean export the data as one big table with header rows between sections */
/** @var ArrayExport data to export */
/** @var string header to the report */
* Create the HTMLExport object
* @param ArrayExport &$exportArray
$this->ea =
& $exportArray;
* convert the 2D array into an HTML table representation of the data
//$this->log('Making HTML representation of data');
$metaData =
$ea['metadata'];
for ($i=
0; $i<
$numrows; $i++
) {
switch ($ea[$i]['type']) {
$buf .=
'<div id="bumblebeeExport">';
$buf .=
'<div class="exportHeader">'.
xssqw($ea[$i]['data']).
'</div>'.
$eol;
$this->header =
$ea[$i]['data'];
$buf .=
'<div class="exportSectionHeader">'.
xssqw($ea[$i]['data']).
'</div>'.
$eol;
$tableMetaData =
$ea[$i]['metadata'];
$numcols =
$tableMetaData['numcols'];
$buf .=
'<table class="exportdata">'.
$eol;
$buf .=
'<tr class="header">'
$buf .=
'<tr class="totals">'
$buf .=
'<tr class="footer">'
switch ($ea[$i]['type']) {
$buf .=
'<div id="bumblebeeExport">';
$buf .=
'</table></div>';
$buf .=
'<div class="exportHeader">'.
xssqw($ea[$i]['data']).
'</div>'.
$eol;
$buf .=
'<table class="exportdata">'.
$eol;
$tableMetaData =
$ea[$i]['metadata'];
$numcols =
$tableMetaData['numcols'];
$buf .=
'<tr class="exportSectionHeader"><td colspan="'.
$numcols.
'" class="exportSectionHeader">'
.
xssqw($ea[$i]['data']).
'</td></tr>'.
$eol;
$buf .=
'<tr class="header">'
$buf .=
'<tr class="footer">'
$buf .=
'<tr class="totals">'
# unset($ea[$i]); //FIXME: try to free memory as we are using it
* generate the HTML for a row
$numfields =
count($row); //FIXME: can this be cached?
for ($j=
0; $j<
$numfields; $j++
) {
* generate the HTML for a single cell
$align =
($align!=
'' ?
'align='.
$align :
'');
$t .=
'<td '.
$align.
'>'.
htmlentities($val, ENT_QUOTES, 'UTF-8').
'</td>';
* embed the html within a blank page to create the report in a separate window
* @return string html snippet that will open a new window with the html report
* @todo //TODO: potential memory hog (stores HTML output in three places at once)
$filename =
$conf->value('export', 'htmlWrapperFile');
$fd =
fopen($filename, 'r');
$title =
T_('Data export');
$contents =
preg_replace('/__BASEPATH__/', $conf->BasePath, $contents);
$contents =
preg_replace('/__CONTENTS__/', $table, $contents);
//encode the HTML so that it doesn't get interpreted by the browser and cause big problems
//the PHP function rawurlencode() can be reversed by the JavaScript function unescape()
//which is then a convenient pairing to use rather than replacing everything manually.
$jsbuf =
'<script type="text/javascript">
function BBwriteAll(data) {
bboutwin = window.open("", "bumblebeeOutput", "");
bboutwin.document.write(unescape(data));
bboutwin.document.close();
</script><a href="javascript:BBwriteAll(data)">'.
T_('Open Window').
'</a>';
Documentation generated on Tue, 06 Mar 2007 10:01:34 +0000 by phpDocumentor 1.3.0