123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <?php
- require("fpdf.php");
- class GCPDF extends FPDF
- {
- var $feld = array("","","","");
- var $pdf_version = "1.0";
- var $produkt = "Undefiniert";
- function setFeld ($feld) {
- $this->feld = $feld;
- }
- function Header()
- {
- //assign Props:
- $this -> produkt = $_POST['pdf_titel'];
- //LucidaSansUnicode 20
- $this->SetFont('LucidaSansUnicode','', 20);
- //Font Color
- $this->SetTextColor(17, 17,175);
- //Fill Color
- $this->SetFillColor(147, 147, 147);
- //Title
- $this->Cell(160,7,$this->produkt,0,0,'L');
- //LucidaSansUnicode 10
- $this->SetFont('LucidaSansUnicode','',10);
- //Font Color
- $this->SetTextColor(147, 147, 147);
- //Niederlassung
- $this->Cell(60,7,$this->feld[0],0,0,'L');
- //Planner Version
- $this->Cell(60,7,$this->feld[1],0,1,'L');
- //Font Color
- $this->SetTextColor(255, 255, 255);
- //Version
- //$this->Cell(286,4,'PDF Generator Version: '.$this->pdf_version,0,1,'L',1);
- //Font Color
- $this->SetTextColor(255, 255, 255);
- //nach rechts
- $this->Cell(160,4,'',0,0,'L',1);
- //Bereich
- $this->Cell(60,4,$this->feld[2],0,0,'L',1);
- //Kategorie
- $this->Cell(60,4,$this->feld[3],0,0,'L',1);
- //Line break
- $this->Ln(15);
- }
- function Footer()
- {
- //Übermalen
- $this->SetTextColor(255, 255, 255);
- $this->SetX(0);
- $this->SetX(160);
- $this->Cell();
- $datenquelle = 'Datei';
- //Position at 1.5 cm from bottom
- $this->SetY(-15);
- //Arial italic 8
- $this->SetFont('Arial','I',8);
- //Font Color
- $this->SetTextColor(147, 147, 147);
- //Date
- $timestamp = time();
- $date = date("d.m.Y", $timestamp);
- $time = date("H:i:s", $timestamp);
- //Date
- $this->Cell(1,5,'Erstellungsdatum: '.$date . ' - ' . $time,0,0,'L');
- //Page number
- $this->Cell(0,5,'- Seite '.$this->PageNo().'/{nb} -',0,1,'C');
- //Arial italic 8
- $this->SetFont('Arial','',6);
- //Copyright information
- $this->Cell(0,4,'PDF Generator Version: ' . $this -> pdf_version . ' Copyright 2005 Global-Cube Business Solutions',0,0,'C');
- }
- function insertData ($daten)
- {
- foreach ($daten as $key_tabelle => $tabelle)
- {
- if (!isset($daten[$key_tabelle][0][0])) die ("\$daten[" . $key_tabelle . "][0][0] ist undefiniert!");
- foreach ($tabelle as $key_zeile => $zeile)
- {
- foreach ($zeile as $key_zelle => $zelle)
- {
- //echo "Tabelle: ".$key_tabelle." - Zeile: ".$key_zeile." - Zelle: ".$key_zelle." - Zelleninhalt: ".@$zelle['TEXT']." - Zellenbreite: ".@$zelle['WIDTH']." Background: ".@$zelle['BG_COLOR'][0].", ".@$zelle['BG_COLOR'][1].", ".@$zelle['BG_COLOR'][2]."<br>";
- if (!isset($daten[$key_tabelle][0][$key_zelle])) $daten[$key_tabelle][0][$key_zelle] = array();
- if (!isset($daten[$key_tabelle][$key_zeile][0])) $daten[$key_tabelle][$key_zeile][0] = array();
- if (!isset($daten[$key_tabelle][$key_zeile][$key_zelle])) $daten[$key_tabelle][$key_zeile][$key_zelle] = array();
- if (($key_zeile == 0) && ($key_zelle > 0))
- {
- $ausgabe[$key_tabelle][$key_zeile][($key_zelle - 1)] = array_merge($daten[$key_tabelle][0][0], $daten[$key_tabelle][0][$key_zelle]);
- }
- if (($key_zeile > 0) && ($key_zelle > 0))
- {
- $ausgabe[$key_tabelle][$key_zeile][($key_zelle - 1)] = array_merge($daten[$key_tabelle][0][0], $daten[$key_tabelle][0][$key_zelle], $daten[$key_tabelle][$key_zeile][0], $daten[$key_tabelle][$key_zeile][$key_zelle]);
- }
- }
- }
- }
- foreach ($ausgabe as $key_tabelle => $tabelle)
- {
- $cols = count($tabelle[0]);
- $rows = count ($tabelle) - 1;
- //initialize the table with 3 columns
- $this->Table_Init($cols);
- //set header style
- foreach ($tabelle[1] as $key_titel => $titel)
- {
- $header_type[$key_titel] = $titel;
- }
- $this->Set_Header_Type($header_type);
- //set data style
- foreach ($tabelle[0] as $key_spalten_format => $spalten_format)
- {
- $data_type[$key_spalten_format] = $tabelle[0][$key_spalten_format];
- }
- $this->Set_Data_Type($data_type);
- //draw the first header
- $this->Draw_Header();
- for($i=1; $i < $rows; $i++)
- {
- for($k=0; $k < $cols; $k++)
- {
- $data[$k] = $ausgabe[$key_tabelle][$i+1][$k];
- }
- $this->Draw_Data($data);
- }
- }
- $this->Set_Header_Type($header_type);
- $this->Draw_Table_Border();
- }
- }
- ?>
|