Made many changes related to PDF output

This commit is contained in:
Andre Lorbach 2009-12-04 13:52:37 +01:00
parent 3b09a95b62
commit a54ef1cd4c
4 changed files with 163 additions and 10 deletions

View File

@ -191,7 +191,13 @@ class Template {
{
// FIXED BY ANDRE | Do not convert OBJECTS into strings!
if ( !is_object($k) && !is_object($v) )
{
// Replace normal variables
$template = str_replace('{'.$k.'}', "$v", $template);
// Replace variables with options, use Callback function!
$template = preg_replace( '/{'.$k.':(.*?):(.*?)}/ie', 'InsertTemplateVariable("$v", "\\1", "\\2")', $template );
}
}
}
}
@ -294,7 +300,30 @@ class Template {
// return processed template
return $template;
}
}
function InsertTemplateVariable($szValue, $szOperation, $szOption)
{
// Set Default
$szResult = $szValue;
switch ( $szOperation )
{
case "trunscate":
if ( is_numeric($szOption) && strlen($szValue) > $szOption)
$szResult = substr($szValue, 0, $szOption) . " ...";
break;
case "forcelinebreak":
if ( is_numeric($szOption) && strlen($szValue) > $szOption)
$szResult = wordwrap($szValue, $szOption, "<br>", true);
break;
default:
// Nothing
break;
}
// return result
return $szResult;
}
?>

View File

@ -201,11 +201,14 @@ abstract class Report {
// Set new Outputtype
$this->_outputFormat = $newOutputType;
// Get include path
$szIncludePath = $this->GetReportIncludePath();
// Set Filebasename
$this->_baseFileName = $this->_reportFileBasicName . ".template." . $this->_outputFormat;
// Set to HTML Template if is missing!
if ( !is_file($this->_baseFileName) )
if ( !is_file( $szIncludePath . $this->_baseFileName) )
$this->_baseFileName = $this->_reportFileBasicName . ".template." . REPORT_OUTPUT_HTML;
}
@ -496,7 +499,6 @@ abstract class Report {
{
// Include Custom language file if available
IncludeLanguageFile( $szReportIncludePath . $this->_reportFileBasicName . ".lang.en.php" );
}
@ -518,9 +520,11 @@ abstract class Report {
// Convert into PDF!
include_once($gl_root_path . 'classes/html2fpdf/html2fpdf.php');
$pdf=new HTML2FPDF('landscape');
// $pdf=new HTML2FPDF('landscape');
$pdf=new HTML2FPDF();
$pdf->UseCss(true);
$pdf->AddPage();
$pdf->SetFontSize(14);
// $pdf->SetFontSize(12);
$pdf->WriteHTML( $szOutputBuffer );
// Header('Content-Type: application/pdf');
$pdf->Output('', 'I'); // Output to STANDARD Input!

View File

@ -176,7 +176,7 @@ font
/* Cells for listening */
.line0
{
font-size: 10px;
font-size: 7pt;
color: #000000;
background-color: #DDDDDD;
}
@ -187,7 +187,7 @@ font
.line1
{
font-size: 10px;
font-size: 7pt;
color: #000000;
background-color: #EEEEEE;
}
@ -198,7 +198,7 @@ font
.line2
{
font-size: 10px;
font-size: 7pt;
color: #000000;
background-color: #F5F5F5;
}

View File

@ -0,0 +1,120 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>{report_title}</title>
<style>
<!-- INCLUDE report.eventlog.monilog.css -->
</style>
</head>
<body TOPMARGIN="0" LEFTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<H3>{report_title}</H3>
<p>{report_comment}</p>
<!-- IF report_filters_enabled="true" -->
<br>
<table width="50%" cellpadding="0" cellspacing="1" border="1" align="left" class="with_border_alternate">
<tr>
<td class="cellmenu1" colspan="2" align="center">{LN_REPORT_FILTERS}</td>
</tr>
<!-- BEGIN report_filters -->
<tr>
<td class="cellmenu2">{FilterType}</td>
<td class="line1" align="left"><b>{FilterDisplay}</b></td>
</tr>
<!-- END report_filters -->
</table>
<!-- ENDIF report_filters_enabled="true" -->
<br><br>
<H3>{ln_report_summary}</H3>
<table width="200" cellpadding="0" cellspacing="1" border="1" align="left" class="with_border_alternate">
<tr>
<td class="cellmenu1" colspan="2" align="center"><b>{ln_report_event_summary}</b></td>
</tr>
<!-- BEGIN report_summary -->
<tr>
<td class="cellmenu2">{DisplayName}</td>
<td class="lineColouredWhite" bgcolor="{bgcolor}" align="right"><b>{ItemCount}</b></td>
</tr>
<!-- END report_summary -->
</table>
<br><br>
<table width="100%" cellpadding="0" cellspacing="1" border="1" align="right" class="with_border_alternate">
<tr>
<td class="cellmenu1" align="center"><b>{ln_report_computer_summary}</b></td>
</tr>
<tr>
<td class="line1">
<!-- BEGIN report_computers -->
<a href="#{FROMHOST}">{FROMHOST}</a>({ItemCount}),
<!-- END report_computers -->
</td>
</tr>
</table>
<br><br>
<H3>{ln_report_consolidation}</H3>
<!-- BEGIN report_consdata -->
<h3><a name="{FROMHOST}">{FROMHOST}</a></h3>
<table width="100%" cellpadding="0" cellspacing="1" border="1" align="center" class="with_border_alternate">
<tr>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_number}</td>
<td class="cellmenu1" align="left" width="100" nowrap>{ln_report_firstevent}</td>
<td class="cellmenu1" align="left" width="100" nowrap>{ln_report_lastevent}</td>
<td class="cellmenu1" align="left" width="50" nowrap>{ln_report_process}</td>
<td class="cellmenu1" align="left" width="100" nowrap>{ln_report_severity}</td>
<td class="cellmenu1" align="left" width="50" nowrap>{ln_report_eventid}</td>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_count}</td>
</tr>
<!-- BEGIN cons_events -->
<tr>
<td class="line1" valign="top" align="center" rowspan="2">{ZAEHLER}</td>
<td class="line1" valign="top" align="left">{FirstEvent_Date_Formatted}</td>
<td class="line1" valign="top" align="left">{LastEvent_Date_Formatted}</td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=sourceproc&q={sourceproc}" target="_blank">{sourceproc}</a></td>
<td class="line1" valign="top" align="left">{syslogseverity_text}</td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=id&q={id}" target="_blank">{id}</a></td>
<!-- IF ItemCount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#DD0000"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount>=$_colorThreshold -->
<!-- IF ItemCount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#CCCCCC"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount<$_colorThreshold -->
</tr>
<tr>
<td class="cellmenu1" align="center" valign="top" nowrap colspan="2" width="200">{ln_report_description}</td>
<td class="cellmenu1" align="left" nowrap colspan="4">{msg:forcelinebreak:40}</td>
</tr>
<!-- END cons_events -->
</table>
<!-- END report_consdata -->
<br><br>
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="mainfooter">
<tr>
<td align="center" class="line0" valign="top">Made by <a href="http://www.adiscon.com" target="_blank">Adiscon GmbH</a> (2009) &nbsp;<a href="http://www.phplogcon.org" target="_blank">Report</A> Version {report_version} </td>
<td align="center" class="line1" valign="top"><B>Partners:</B>&nbsp;<a href="http://www.rsyslog.com" target="_blank">Rsyslog</a> | &nbsp;<a href="http://www.winsyslog.com" target="_blank">WinSyslog</a></td>
</tr>
<!-- IF ShowPageRenderStats="true" -->
<tr>
<td align="center" class="line2" valign="top" colspan="2">
<small>
{LN_REPORT_FOOTER_ENDERED}: <B>{report_rendertime}</B>
&nbsp;|&nbsp;{LN_FOOTER_DBQUERIES}: <B>{TOTALQUERIES}</B>
</small>
</td>
</tr>
<!-- ENDIF ShowPageRenderStats="true" -->
</table>
</body>
</html>