diff --git a/lam/lib/lamPDF.inc b/lam/lib/lamPDF.inc new file mode 100644 index 00000000..041a7b2d --- /dev/null +++ b/lam/lib/lamPDF.inc @@ -0,0 +1,130 @@ + => array(, , , ) + */ + var $fontList = array( + 'BitstreamVeraSans-Roman' => array('vera.php', 'verab.php', 'verabi.php', 'verai.php') + ); + + /** + * + * + * @param string $account_type + * @param array $page_definitions + */ + function lamPDF($account_type = "user",$page_definitions = array(),$fontName) { + $this->fontName = $fontName; + define('FPDF_FONTPATH', $_SESSION['lampath'] . "lib/" . 'font/'); + // Call constructor of superclass + $this->FPDF('P','mm','A4'); + + $this->page_definitions = $page_definitions; + + // Open PDF file and write some basic information + $this->Open(); + $this->AddFont($this->fontName, '', $this->fontList[$this->fontName][0]); + $this->AddFont($this->fontName, 'B', $this->fontList[$this->fontName][1]); + $this->AddFont($this->fontName, 'I', $this->fontList[$this->fontName][2]); + $this->AddFont($this->fontName, 'BI', $this->fontList[$this->fontName][3]); + $this->setFont($this->fontName,"",12); + $this->setTitle($this->page_definitions['headline']); + $this->setCreator("LDAP Account Manager"); + $this->setMargins($this->page_definitions['margin-left'],$this->page_definitions['margin-top'],$this->page_definitions['margin-right']); + $this->setAutoPageBreak(true,$this->page_definitions['margin-bottom']); + } + + /** + * + */ + function header() { + if($this->page_definitions['filename'] != 'none') { + $imageFile = substr(__FILE__,0,strlen(__FILE__)- 14) . "config/pdf/logos/" . $this->page_definitions['filename']; + $width = $this->page_definitions['logo-width']; + $height = $this->page_definitions['logo-height']; + if($this->page_definitions['logo-max'] == true) { + if(($width / $height) <= 2.5) { + $factor = 20 / $height; + $width = $factor * $width; + $height = 20; + } + else { + $factor = 50 / $width; + $height = $factor * $height; + $width = 50; + } + } + $this->Image($imageFile,10,10,$width,$height,"JPG"); + } + $this->SetY(18); + $this->SetFont($this->fontName,"B",18); + $this->Cell(170,5,$this->page_definitions['headline'],0,1,"R",0); + $this->Ln(3); + $this->SetLineWidth(0.4); + $this->Line(10,$this->page_definitions['margin-top'] + 30,200,$this->page_definitions['margin-top'] + 30); + $this->Line(10,$this->page_definitions['margin-top'] + 32,200,$this->page_definitions['margin-top'] + 32); + $this->SetY(50); + } + + /** + * + */ + function footer() { + $this->SetLineWidth(0.4); + $this->Line(10,280,200,280); + $this->Line(10,282,200,282); + $this->SetY(286); + $this->SetFont($this->fontName,"",7); + $this->Cell(0,5,_("This document was automatically created by LDAP Account Manager"),0,0,"C",0); + } +} + +?> \ No newline at end of file diff --git a/lam/lib/pdf.inc b/lam/lib/pdf.inc index 315d94b1..e88ac77e 100644 --- a/lam/lib/pdf.inc +++ b/lam/lib/pdf.inc @@ -32,12 +32,6 @@ $Id$ /** PDF line width */ define('LAMPDF_LINEWIDTH',190); -/** PDF generator class */ -include_once("fpdf.php"); - -/** Unicode support for FPDF */ -include_once("ufpdf.php"); - /** XML functions */ include_once('xml_parser.inc'); @@ -61,6 +55,13 @@ $line_width = LAMPDF_LINEWIDTH; */ function createModulePDF($accounts,$pdf_structure="default") { + /** PDF generator class */ + include_once("fpdf.php"); + /** Unicode support for FPDF */ + include_once("ufpdf.php"); + /** LAM PDF generator class */ + include_once("lamPDF.inc"); + global $key; // Get account type from account container if none was specified or @@ -328,101 +329,3 @@ function processAttributes($attrs,$return = array()) { return $return; } } - - -/** - * Creates a LAM information page in PDF format. - * - * @package PDF - */ -class lamPDF extends UFPDF { - - /** - * format settings for page layout - */ - var $page_definitions; - - /** - * current active font name - */ - var $fontName; - - /** - * list of supported fonts - * format: => array(, , , ) - */ - var $fontList = array( - 'BitstreamVeraSans-Roman' => array('vera.php', 'verab.php', 'verabi.php', 'verai.php') - ); - - /** - * - * - * @param string $account_type - * @param array $page_definitions - */ - function lamPDF($account_type = "user",$page_definitions = array(),$fontName) { - $this->fontName = $fontName; - define('FPDF_FONTPATH', $_SESSION['lampath'] . "lib/" . 'font/'); - // Call constructor of superclass - $this->FPDF('P','mm','A4'); - - $this->page_definitions = $page_definitions; - - // Open PDF file and write some basic information - $this->Open(); - $this->AddFont($this->fontName, '', $this->fontList[$this->fontName][0]); - $this->AddFont($this->fontName, 'B', $this->fontList[$this->fontName][1]); - $this->AddFont($this->fontName, 'I', $this->fontList[$this->fontName][2]); - $this->AddFont($this->fontName, 'BI', $this->fontList[$this->fontName][3]); - $this->setFont($this->fontName,"",12); - $this->setTitle($this->page_definitions['headline']); - $this->setCreator("LDAP Account Manager"); - $this->setMargins($this->page_definitions['margin-left'],$this->page_definitions['margin-top'],$this->page_definitions['margin-right']); - $this->setAutoPageBreak(true,$this->page_definitions['margin-bottom']); - } - - /** - * - */ - function header() { - if($this->page_definitions['filename'] != 'none') { - $imageFile = substr(__FILE__,0,strlen(__FILE__)- 11) . "config/pdf/logos/" . $this->page_definitions['filename']; - $width = $this->page_definitions['logo-width']; - $height = $this->page_definitions['logo-height']; - if($this->page_definitions['logo-max'] == true) { - if(($width / $height) <= 2.5) { - $factor = 20 / $height; - $width = $factor * $width; - $height = 20; - } - else { - $factor = 50 / $width; - $height = $factor * $height; - $width = 50; - } - } - $this->Image($imageFile,10,10,$width,$height,"JPG"); - } - $this->SetY(18); - $this->SetFont($this->fontName,"B",18); - $this->Cell(170,5,$this->page_definitions['headline'],0,1,"R",0); - $this->Ln(3); - $this->SetLineWidth(0.4); - $this->Line(10,$this->page_definitions['margin-top'] + 30,200,$this->page_definitions['margin-top'] + 30); - $this->Line(10,$this->page_definitions['margin-top'] + 32,200,$this->page_definitions['margin-top'] + 32); - $this->SetY(50); - } - - /** - * - */ - function footer() { - $this->SetLineWidth(0.4); - $this->Line(10,280,200,280); - $this->Line(10,282,200,282); - $this->SetY(286); - $this->SetFont($this->fontName,"",7); - $this->Cell(0,5,_("This document was automatically created by LDAP Account Manager"),0,0,"C",0); - } -} \ No newline at end of file