I can't seem to get this to work at all. I get no errors, it just doesn't work. I can tell be cause when I try to call the BuildReport function of the ReportGenerator class, it basically does nothing.
Tools:😃ebugLog is supposed to log a record to a table with the message
passed as second parameter.
require_once(dirname(__FILE__).'/../tcpdf/config/lang/eng.php');
require_once(dirname(__FILE__).'/../tcpdf/tcpdf.php');
// extend TCPF with custom functions
class MYPDF extends TCPDF {
var $partno;
function __construct() {
// wonder why there are no params passed into here
parent::__construct();
} // Constructor
public function setPartNo($part) {
$this->partno = $part;
} // public function setPartNo($part)
// ---------------------------------------------------------
// This function returns an array of RGB values to use
// for TCPDF function calls that require color values
// ---------------------------------------------------------
private function html2rgb($color) {
<SNIP>
return array($r, $g, $b);
} // private function html2rgb($color)
// ---------------------------------------------------------
// Outputs a 4pt height blank line.
// ---------------------------------------------------------
public function blankLine() {
<SNIP>
} // public function blankLine()
// ---------------------------------------------------------
// Returns the width in units based on percentage of pagewidth
// minus the margins.
// if you want to include the margins, set second param
// to false
// ---------------------------------------------------------
public function getColumnWidthByPct($pct, $excludeMargins=true) {
<SNIP>
return ($pagew * ($pct/100));
} // public function getColumnWidthByPct($pct, $excludeMargins=true)
// ---------------------------------------------------------
// Sets the Fill Color from an HTML color value
// ---------------------------------------------------------
public function setTitleColor($htmlcolor) {
<SNIP>
}
// ---------------------------------------------------------
// Sets the Fill Color from an HTML color value
// ---------------------------------------------------------
public function setLineColor($htmlcolor) {
<SNIP>
} // public function setLineColor($htmlcolor)
// ---------------------------------------------------------
// Prints a header row
// ---------------------------------------------------------
public function doRowHeader($header, $headerColInfo, $headerHt=4, $fontht=10) {
<SNIP>
} // public function doRowHeader($header, $headerColInfo, $headerHt=4, $fontht=10)
// ---------------------------------------------------------
// Prints row of $result
// ---------------------------------------------------------
public function doRows($dbresult, $columnInfo) {
<SNIP>
} // public function doRows($dbresult, $columnInfo)
// ---------------------------------------------------------
// Prints a header row containing a Photo
// ---------------------------------------------------------
public function doPhotoRow($imagelink) {
<SNIP>
} // public function doPhotoRow($imagelink)
// ---------------------------------------------------------
// Prints the footer
// ---------------------------------------------------------
public function Footer()
{
<SNIP>
} // public function Footer()
} // end class MYPDF extends TCPDF
class ReportGenerator extends ObjectModel
{
public $pdf_obj;
public function __construct()
{
parent::__construct();
// The constants being passed in the MYPDF constructor are in tcpdf_config,
// which is called from tcpdf.php
$this->pdf_obj = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
} // Constructor
// ---------------------------------------------------------
// Strips "Illegal" characters from a string
// ---------------------------------------------------------
public function stripIllegalChars($v) {
<SNIP>
return $value;
} function stripIllegalChars($v)
public function BuildReport($filename, $partno) {
$pdf_obj->setPartNo($partno);
Tools::DebugLog('ReportGenerator', 'In BuildReport');
return true;
} // function BuildReport($filename, $partno)
} // class ReportGenerator extends ObjectModel