Source for file class.MYFPDF.php

Documentation is available at class.MYFPDF.php

  1. <?php
  2.  
  3.  
  4. /**
  5.  * Verwaltet die Erstellung von PDF-Dokumentes
  6.  *
  7.  * @author Kay Koch, <kay.koch@gmx.de>
  8.  * @package src
  9.  * @subpackage pdf
  10.  */
  11.  
  12. if (version_compare(PHP_VERSION'5')) {
  13.     die('This file was generated for PHP 5');
  14. }
  15.  
  16. /* user defined includes */
  17. // section -64--88-122--2-933bcb:100f60e4e57:-7fbd-includes begin
  18. // section -64--88-122--2-933bcb:100f60e4e57:-7fbd-includes end
  19.  
  20. /**
  21.  *  user defined constants
  22.  * @staticvar string Pfad
  23.  *  zu Fonts
  24.  */
  25. define('FPDF_FONTPATH''font/');
  26.  
  27.  
  28. /**
  29.  * Verwaltet die Erstellung von PDF-Dokumentes
  30.  *
  31.  * @access public
  32.  * @author Kay Koch, <kay.koch@gmx.de>
  33.  * @package src
  34.  * @subpackage pdf
  35.  */
  36. {
  37.     // --- ATTRIBUTES ---
  38.  
  39.     
  40.     /**
  41.      * Namen des Ordners für die PDFs
  42.      *
  43.      * @access private
  44.      * @var string 
  45.      */
  46.     private $pdfFolder 'pdf';
  47.  
  48.     // --- OPERATIONS ---
  49.  
  50.     
  51.     /**
  52.      * erstellt ein PDF-Dokument zur Bestätigung der Anmeldung
  53.      *
  54.      * @access public
  55.      * @author Kay Koch, <kay.koch@gmx.de>
  56.      * @param array 
  57.      * @param EINSEE 
  58.      * @return string 
  59.      */
  60.     public function createUserPDF($buchung$oSee)
  61.     {
  62.         $returnValue = (string) '';
  63.  
  64.         // section -64--88-122--2-933bcb:100f60e4e57:-7fbc begin
  65.         try {
  66.             if (!is_writeable($this->pdfFolder))
  67.                 throw new Exception(15);
  68.             $oUPDFnew src_pdf_PDFUSER;
  69.             $oUPDF->beginNewDocument($oSee)// pdf-beginnen
  70.             $oUPDF->createDate($buchung$oSee);
  71.             $returnValue$this->getPDFPath($buchung['buch_id'].$buchung['pwd']);
  72.             if (!$oUPDF->Output($returnValue))
  73.                 throw new Exception(16);
  74.             $oUPDF->close()// Dokument abschließen
  75.             unset ($oUPDF);
  76.             $returnValue$this->getPDFPath($buchung['buch_id'].$buchung['pwd']);
  77.         catch (Exception $e{
  78.             src_tools_ERROR :: setError($e__METHOD__);
  79.         }
  80.         // section -64--88-122--2-933bcb:100f60e4e57:-7fbc end
  81.  
  82.         return (string) $returnValue;
  83.     }
  84.  
  85.     /**
  86.      * löscht ein erselles PDF-Dokument aufgrund der IBuchungs-ID
  87.      *
  88.      * @access public
  89.      * @author Kay Koch, <kay.koch@gmx.de>
  90.      * @param string 
  91.      * @return boolean 
  92.      */
  93.     public function deleteUserPDF($filename)
  94.     {
  95.         $returnValue = (bool) false;
  96.  
  97.         // section -64--88-122--2-933bcb:100f60e4e57:-7f98 begin
  98.         try {
  99.             $filepath$this->getPDFPath($filename);
  100.             if (file_exists($filepath)) {
  101.                 if (!unlink($filepath))
  102.                     throw new Exception(18);
  103.             }
  104.             $returnValuetrue;
  105.         catch (Exception $e{
  106.             src_tools_ERROR :: setError($e__METHOD__);
  107.         }
  108.         // section -64--88-122--2-933bcb:100f60e4e57:-7f98 end
  109.  
  110.         return (bool) $returnValue;
  111.     }
  112.  
  113.     /**
  114.      * Löscht ein wöchentliches PDF-Dokument
  115.      *
  116.      * @access public
  117.      * @author Kay Koch, <kay.koch@gmx.de>
  118.      * @param string 
  119.      * @return boolean 
  120.      */
  121.     public function deleteAdminPDF($name)
  122.     {
  123.         $returnValue = (bool) false;
  124.  
  125.         // section -64--88-122--2-1328c7a:1027db0d532:-7ff9 begin
  126.         // section -64--88-122--2-1328c7a:1027db0d532:-7ff9 end
  127.  
  128.         return (bool) $returnValue;
  129.     }
  130.  
  131.     /**
  132.      * liefert den Pfad zum PDF-Dokument
  133.      *
  134.      * @access public
  135.      * @author Kay Koch, <kay.koch@gmx.de>
  136.      * @param string 
  137.      * @return string 
  138.      */
  139.     public function getPDFPath($filename)
  140.     {
  141.         $returnValue = (string) '';
  142.  
  143.         // section -64--88-122--2-1328c7a:102988386a1:-7ffb begin
  144.         $returnValue src_tools_MULTI::cleanUmlaute($this->pdfFolder."/".$filename.".pdf");
  145.         // section -64--88-122--2-1328c7a:102988386a1:-7ffb end
  146.  
  147.         return (string) $returnValue;
  148.     }
  149.  
  150.     /**
  151.      * erstellt ein PDF-Dokument zur wöchentlichen Berichterstattung
  152.      *
  153.      * @access public
  154.      * @author Kay Koch, <kay.koch@gmx.de>
  155.      * @param array 
  156.      * @param EINSEE 
  157.      * @return string 
  158.      */
  159.     public function createWeekPDF($arrDatum$oSee)
  160.     {
  161.         $returnValue = (string) '';
  162.  
  163.         // section -64--88-122--2--3fd16346:103fe6f1304:-7fd8 begin
  164.         try {
  165.             if (!is_writeable($this->pdfFolder))
  166.                 throw new Exception(15);
  167.             $oWPDFnew src_pdf_PDFADMIN($this->arrBuchungen$this->prizePerPerson)// Dokument beginnen (ein See)
  168.             $oWPDF->beginNewDocument($oSee)// pdf-beginnen
  169.             //$t= src_tools_TIME :: start_timer("");
  170.             foreach ($arrDatum as $key => $value{
  171.                 $oWPDF->createDate($value$key);
  172.             }
  173.             $returnValue$this->getPDFPath($oSee->name."_".$this->backupDatum);
  174.             if (!$oWPDF->Output($returnValue)) // Dokument abschließen
  175.                 throw new Exception(16);
  176.             $oWPDF->close();
  177.         catch (Exception $e{
  178.             src_tools_ERROR :: setError($e__METHOD__);
  179.         }
  180.         // section -64--88-122--2--3fd16346:103fe6f1304:-7fd8 end
  181.  
  182.         return (string) $returnValue;
  183.     }
  184.  
  185.     /**
  186.      * setzt Buchungsdaten für das aktuelle PDF
  187.      *
  188.      * @access public
  189.      * @author Kay Koch, <kay.koch@gmx.de>
  190.      * @param array 
  191.      * @param float 
  192.      * @param date 
  193.      * @return void 
  194.      */
  195.     public function setBuchData($arrBuchungen$prizePerPerson$backupDatum)
  196.     {
  197.         // section -64--88-122--2--3fd16346:103fe6f1304:-7fcc begin
  198.         $this->prizePerPerson$prizePerPerson;
  199.         $this->backupDatum$backupDatum;
  200.         $this->arrBuchungen$arrBuchungen;
  201.         // section -64--88-122--2--3fd16346:103fe6f1304:-7fcc end
  202.     }
  203.  
  204. /* end of class src_pdf_MYFPDF */
  205.  
  206. ?>

Documentation generated on Sat, 24 Mar 2007 09:59:40 +0100 by phpDocumentor 1.3.1