1<?php
2/* $Id: pdf.class.php,v 1.9 2003/12/03 17:32:35 k-fish Exp $ */
3
4class PDF extends FPDF{
5    function PDF(){
6	$this->FPDF();
7    }
8
9    // header
10    function Header(){
11	global $conn;
12
13	// base settings
14	$this->SetFont("Arial","B",12);
15	$this->SetTextColor(0,0,210);
16
17	// logo
18	$this->Image("./templates/default/media/mgw_logo.png",148,12,50);
19
20	// line at the top
21	$this->SetLineWidth(0.8);
22	$this->Line(10,10,200,10);
23	$this->SetLineWidth(0.2);
24
25	// company data
26	$compname = (isset($this->row["name1"])) ? $this->row["name1"] : '';
27	$compnr = (isset($this->row["telephone"])) ? $this->row["telephone"] : '';
28	$url = (isset($this->row["company_url"])) ? $this->row["company_url"] : '';
29	$this->SetY(14);
30	$this->MultiCell(0,5.5,"$compname \n$compnr \n$url ",0,"L");
31	$this->Line(10,$this->GetY()+2,200,$this->GetY()+2);
32
33	// table header
34	$this->SetTextColor(210,0,0);
35	$this->Text(20,$this->GetY()+7,Lang::getLanguageString("pdfname"));
36	$this->SetX(94);
37	$this->Text($this->GetX(),$this->GetY()+7,Lang::getLanguageString("pdfno"));
38	$this->SetX(154);
39	$this->Text($this->GetX(),$this->GetY()+7,Lang::getLanguageString("pdfmobile"));
40	$this->Line(10,$this->GetY()+9,200,$this->GetY()+9);
41
42	// finish up
43	$this->SetTextColor(0,0,0);
44	$this->setY(35);
45    }
46
47    //Pied de page
48    function Footer(){
49	global $conn;
50
51	$this->SetFont("Arial","",8);
52	$this->SetY(-15);
53
54	$this->SetLineWidth(0.8);
55	$this->Line(10,$this->GetY(),200,$this->GetY());
56	$this->Text(10,$this->GetY()+4,date($_SESSION["MGW"]->settings["datefmt"]." ".$_SESSION["MGW"]->settings["timefmt"]));
57	$this->Text(100,$this->GetY()+4,Lang::getLanguageString("pdfpage")." ".$this->PageNo()."/{nb}");
58    }
59
60    function Body(&$res){
61	$this->res =& $res;
62	$this->row = $this->res->FetchRow();
63	$this->rows = 1;
64	$this->AddPage();
65	$this->SetFont('Arial','',12);
66	$y=$this->GetY()+3;
67
68	do{
69	    $y+=7;
70
71	    $this->Text(20,$y,$this->row["lastname"].", ".$this->row["firstname"]);
72
73	    // just show up only the personal nr (call-through nr)
74	    if(!strrpos($this->row["tel_company"],"-")){
75		$ctnr = substr($this->row["tel_company"], strrpos($this->row["tel_company"],"-"),strlen($this->row["tel_company"])-strrpos($this->row["tel_company"],"-"));
76	    }
77	    else{
78		$ctnr = $this->row["tel_company"];
79	    }
80	    $this->Text(94,$y,$ctnr);
81	    $this->Text(154,$y,$this->row["tel_mobile"]);
82
83	    if($this->rows++==34){
84		$this->rows=1;
85		$this->AddPage();
86		$y=$this->GetY()+3;
87	    }
88	    else{
89		$this->Line(10,$y+2,200,$y+2);
90		$this->SetY($y+2);
91	    }
92	} while($this->row = $this->res->FetchRow());
93    }
94}
95?>