added PDF namespace

This commit is contained in:
Roland Gruber 2017-02-18 10:13:08 +01:00
parent 809cb97f84
commit 753b443656
18 changed files with 78 additions and 25 deletions

View File

@ -1,9 +1,11 @@
<?php
use \LAM\PDF\PDFLabelValue;
use \LAM\PDF\PDFTable;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2016 Roland Gruber
Copyright (C) 2003 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -5,7 +5,7 @@ use LAM\TYPES\ConfiguredType;
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2016 Roland Gruber
Copyright (C) 2003 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -609,7 +609,7 @@ class lamList {
if ($option == 'DN') {
$_SESSION["accountPDF"] = new accountContainer($this->type, "accountPDF");
$_SESSION["accountPDF"]->load_account(base64_decode($_POST['clickedAccount']));
$filename = createModulePDF(array($_SESSION["accountPDF"]),$pdfStruct);
$filename = \LAM\PDF\createModulePDF(array($_SESSION["accountPDF"]),$pdfStruct);
unset($_SESSION["accountPDF"]);
}
// create for all selected accounts
@ -624,7 +624,7 @@ class lamList {
$list[$i] = $_SESSION["accountPDF-$i"];
}
if (sizeof($list) > 0) {
$filename = createModulePDF($list,$pdfStruct);
$filename = \LAM\PDF\createModulePDF($list,$pdfStruct);
for ($i = 0; $i < sizeof($accounts); $i++) {
unset($_SESSION["accountPDF-$i"]);
}
@ -640,7 +640,7 @@ class lamList {
$list[$i] = $_SESSION["accountPDF-$i"];
}
if (sizeof($list) > 0) {
$filename = createModulePDF($list,$pdfStruct);
$filename = \LAM\PDF\createModulePDF($list,$pdfStruct);
for ($i = 0; $i < $entriesCount; $i++) {
// clean session
unset($_SESSION["accountPDF-$i"]);
@ -648,7 +648,7 @@ class lamList {
}
}
elseif ($option == 'SESSION') {
$filename = createModulePDF(array($_SESSION[$_POST['PDFSessionID']]),$pdfStruct);
$filename = \LAM\PDF\createModulePDF(array($_SESSION[$_POST['PDFSessionID']]),$pdfStruct);
unset($_SESSION[$_POST['PDFSessionID']]);
}
if ($filename != '') {

View File

@ -2018,8 +2018,7 @@ class accountContainer {
if (isset($this->finalDN)) {
$dn = $this->finalDN;
}
$return = array_merge($return,array('main_dn' => array(new PDFLabelValue(_('DN'), $dn))));
//$return = array_merge($return,array('main_dn' => array('<block><key>' . _('DN') . '</key><value>' . $dn . '</value></block>')));
$return = array_merge($return,array('main_dn' => array(new \LAM\PDF\PDFLabelValue(_('DN'), $dn))));
return $return;
}

View File

@ -1,11 +1,13 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2009 - 2012 Pavel Pozdniak
2009 - 2015 Roland Gruber
2009 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,10 +1,13 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2008 Thomas Manninger
2008 - 2015 Roland Gruber
2008 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,12 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2004 - 2015 Roland Gruber
Copyright (C) 2004 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,12 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2015 Roland Gruber
Copyright (C) 2005 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,12 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2016 Roland Gruber
Copyright (C) 2016 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,12 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2015 - 2016 Roland Gruber
Copyright (C) 2015 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,12 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2015 Roland Gruber
Copyright (C) 2009 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,12 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is not yet part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2012 - 2016 Roland Gruber
Copyright (C) 2012 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,12 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 - 2015 Roland Gruber
Copyright (C) 2013 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,10 +1,13 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2006 Tilo Lutz
2007 - 2015 Roland Gruber
2007 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,10 +1,13 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2008 Thomas Manninger
2008 - 2015 Roland Gruber
2008 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,12 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2011 - 2015 Roland Gruber
Copyright (C) 2011 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,12 @@
<?php
use \LAM\PDF\PDFTable;
use \LAM\PDF\PDFTableCell;
use \LAM\PDF\PDFTableRow;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 - 2016 Roland Gruber
Copyright (C) 2013 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,10 +1,11 @@
<?php
namespace LAM\PDF;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2004 Michael Duergner
2003 - 2015 Roland Gruber
2003 - 2017 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -92,7 +93,7 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
$fontName = "BitstreamVeraSans-Roman";
// Create a new PDF file acording to the account type
$pdf = new lamPDF($load['page_definitions'],$fontName);
$pdf = new \lamPDF($load['page_definitions'],$fontName);
// Loop over each account and add a new page in the PDF file for it
foreach($accounts as $account) {
@ -148,6 +149,9 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
if ($valueEntry instanceof PDFLabelValue) {
printLabelValue($pdf, $valueEntry, $fontName);
}
else if ($valueEntry instanceof PDFTable) {
printTable($pdf, $valueEntry, $fontName);
}
// Substitue XML syntax with valid FPDF methods
/**$methods = processLine($line,true,$fontName);
// Call every method
@ -203,6 +207,16 @@ function printLabelValue(&$pdf, $valueEntry, $fontName) {
$pdf->MultiCell(0, 5, $valueEntry->getValue(), 0, 'L', 0);
}
/**
* Prints a PDFTable entry.
*
* @param lamPDF $pdf PDF
* @param PDFTable $valueEntry entry
* @param string $fontName font name
*/
function printTable(&$pdf, $valueEntry, $fontName) {
}
/**
* Creates the XML code for an PDF entry.
*

View File

@ -294,7 +294,7 @@ class Uploader {
break;
}
// create and save PDF
$pdfContent = createModulePDF(array($_SESSION['mass_pdfAccount']), $pdfStructure, true);
$pdfContent = \LAM\PDF\createModulePDF(array($_SESSION['mass_pdfAccount']), $pdfStructure, true);
$fileName = $dn . '.pdf';
$pdfZip->addFromString($fileName, $pdfContent);
$_SESSION['mass_pdf']['counter'] ++;