amelioration du design des cartes d'adherents (ajout de logo, header et footer)

This commit is contained in:
jlb 2003-08-27 17:49:28 +00:00
parent f8682c71dc
commit 24b39da556
2 changed files with 39 additions and 13 deletions

View File

@ -77,7 +77,7 @@ class PDF_card extends FPDF {
var $_COUNTX = 1;
var $_COUNTY = 1;
var $_First = 1;
// Listing of labels size
var $_Avery_Labels = array (
@ -176,7 +176,9 @@ class PDF_card extends FPDF {
'SpaceY'=>0,
'width'=>85,
'height'=>54,
'font-size'=>10)
'font-size'=>10,
'logo1'=>'logo1.jpg',
'logo2'=>'logo2.png')
);
// convert units (in to mm, mm to in)
@ -250,20 +252,40 @@ class PDF_card extends FPDF {
}
// On imprime une étiqette
function Add_PDF_card($texte) {
function Add_PDF_card($texte,$header='',$footer='') {
// We are in a new page, then we must add a page
if (($this->_COUNTX ==0) and ($this->_COUNTY==0)) {
if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) {
$this->AddPage();
}
$this->_First=0;
$_PosX = $this->_Margin_Left+($this->_COUNTX*($this->_Width+$this->_X_Space));
$_PosY = $this->_Margin_Top+($this->_COUNTY*($this->_Height+$this->_Y_Space));
if ($this->_Avery_Name == "CARD") {
$Tformat=$this->_Avery_Labels["CARD"];
$this->_Pointille($_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,1,25);
if($Tformat['logo1'] != '' and file_exists($Tformat['logo1'])){
$this->image($Tformat['logo1'],$_PosX+$this->_Width-21,$_PosY+1,20,20);
}
if($Tformat['logo2'] != '' and file_exists($Tformat['logo2'])){
$this->image($Tformat['logo2'],$_PosX+$this->_Width-21,$_PosY+25,20,20);
}
//$this->image('logo1.jpg',$_PosX+$this->_Width-21,$_PosY+1,20);
if ($header!=''){
$this->SetXY($_PosX, $_PosY+1);
$this->Cell($this->_Width, $this->_Line_Height,$header,0,1,'C');
}
$this->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height);
$this->MultiCell($this->_Width, $this->_Line_Height, $texte);
if ($footer!=''){
$this->SetXY($_PosX, $_PosY+$this->_Height-$this->_Line_Height-1);
$this->Cell($this->_Width, $this->_Line_Height,$footer,0,1,'C');
}
}else{
$this->SetXY($_PosX+3, $_PosY+3);
$this->MultiCell($this->_Width, $this->_Line_Height, $texte);
}
$this->SetXY($_PosX+3, $_PosY+3);
$this->MultiCell($this->_Width, $this->_Line_Height, $texte);
$this->_COUNTY++;
if ($this->_COUNTY == $this->_Y_Number) {

View File

@ -41,17 +41,21 @@ Soit on donne le type d'
// Dans cet exemple on va commencer l'impression des étiquettes à partir de la seconde colonne (cf les 2 derniers paramètres 1 et 2)
//$pdf = new PDF_Label(array('name'=>'perso1', 'marginLeft'=>1, 'marginTop'=>1, 'NX'=>2, 'NY'=>7, 'SpaceX'=>0, 'SpaceY'=>0, 'width'=>99.1, 'height'=>'38.1', 'metric'=>'mm', 'font-size'=>14), 1, 2);
//$pdf = new PDF_card('L7163', 1, 2);
$pdf = new PDF_card('CARD', 1, 2);
$pdf = new PDF_card('CARD', 1, 1);
//$db = new Db();
$pdf->Open();
$pdf->AddPage();
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin, adresse,cp,ville,pays";
if (!isset($annee)){
$now = getdate();
$annee=$now['year'];
}
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin, adresse,cp,ville,pays, t.libelle as type";
$sql .= " , d.email";
$sql .= " FROM llx_adherent as d";
$sql .= " WHERE d.statut = 1";
$sql .= " ORDER BY d.nom ASC ";
$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
$sql .= " ORDER BY d.rowid ASC ";
$result = $db->query($sql);
if ($result)
@ -61,7 +65,7 @@ if ($result)
while ($i < $num)
{
$objp = $db->fetch_object( $i);
$pdf->Add_PDF_card(sprintf("%s\n%s\n%s\n%s\n%s, %s, %s", "N° :".$objp->rowid,$objp->prenom." ".$objp->nom,"<".$objp->email.">", $objp->adresse, $objp->cp, $objp->ville, $objp->pays));
$pdf->Add_PDF_card(sprintf("%s\n%s\n%s\n%s\n%s, %s, %s", "Adhérent ".$objp->type."".$objp->rowid,$objp->prenom." ".$objp->nom,"<".$objp->email.">", $objp->adresse, $objp->cp, $objp->ville, $objp->pays),$annee,"Association FreeLUG http://www.freelug.org/");
$i++;
}
// On imprime les étiquettes