generation de carte d'adherent bcp plus generique (se basse sur des constantes definis par l'administrateur pour la mise en page de la carte)
This commit is contained in:
parent
b808c97629
commit
cc474d4df7
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
//define('FPDF_FONTPATH','font/');
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -23,36 +22,48 @@
|
|||||||
*/
|
*/
|
||||||
require($GLOBALS["DOCUMENT_ROOT"]."/adherents/pre.inc.php");
|
require($GLOBALS["DOCUMENT_ROOT"]."/adherents/pre.inc.php");
|
||||||
require($GLOBALS["DOCUMENT_ROOT"]."/adherent.class.php");
|
require($GLOBALS["DOCUMENT_ROOT"]."/adherent.class.php");
|
||||||
require($GLOBALS["DOCUMENT_ROOT"]."/adherent_type.class.php");
|
|
||||||
require($GLOBALS["DOCUMENT_ROOT"]."/adherents/adherent_options.class.php");
|
|
||||||
require($GLOBALS["DOCUMENT_ROOT"]."/cotisation.class.php");
|
|
||||||
require($GLOBALS["DOCUMENT_ROOT"]."/paiement.class.php");
|
|
||||||
require($GLOBALS["DOCUMENT_ROOT"]."/adherents/XML-RPC.functions.php");
|
|
||||||
|
|
||||||
require_once("../pre.inc.php");
|
|
||||||
require_once('PDF_card.class.php');
|
require_once('PDF_card.class.php');
|
||||||
|
|
||||||
/*-------------------------------------------------
|
// liste des patterns remplacable dans le texte a imprimer
|
||||||
Pour créer l'objet on a 2 moyens :
|
$patterns = array (
|
||||||
Soit on donne les valeurs en les passant dans un tableau (sert pour un format personnel)
|
'/%PRENOM%/',
|
||||||
Soit on donne le type d'étiquette au format AVERY
|
'/%NOM%/',
|
||||||
-------------------------------------------------*/
|
'/%SERVEUR%/',
|
||||||
|
'/%SOCIETE%/',
|
||||||
|
'/%ADRESSE%/',
|
||||||
|
'/%CP%/',
|
||||||
|
'/%VILLE%/',
|
||||||
|
'/%PAYS%/',
|
||||||
|
'/%EMAIL%/',
|
||||||
|
'/%NAISS%/',
|
||||||
|
'/%PHOTO%/',
|
||||||
|
'/%TYPE%/',
|
||||||
|
'/%ID%/',
|
||||||
|
'/%ANNEE%/'
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
*-------------------------------------------------
|
||||||
|
* Pour créer l'objet on a 2 moyens :
|
||||||
|
* Soit on donne les valeurs en les passant dans un tableau (sert pour un format personnel)
|
||||||
|
* Soit on donne le type d'étiquette au format AVERY
|
||||||
|
*-------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
// 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_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, 1);
|
$pdf = new PDF_card('CARD', 1, 1);
|
||||||
//$db = new Db();
|
|
||||||
|
|
||||||
$pdf->Open();
|
$pdf->Open();
|
||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
|
|
||||||
|
// Choix de l'annee d'impression ou annee courante.
|
||||||
if (!isset($annee)){
|
if (!isset($annee)){
|
||||||
$now = getdate();
|
$now = getdate();
|
||||||
$annee=$now['year'];
|
$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";
|
// requete en prenant que les adherents a jour de cotisation
|
||||||
|
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin, adresse,cp,ville,pays, t.libelle as type, d.naiss, d.email, d.photo";
|
||||||
$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
|
$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
|
||||||
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND datefin > now()";
|
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND datefin > now()";
|
||||||
$sql .= " ORDER BY d.rowid ASC ";
|
$sql .= " ORDER BY d.rowid ASC ";
|
||||||
@ -65,12 +76,28 @@ if ($result)
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object( $i);
|
$objp = $db->fetch_object( $i);
|
||||||
$pdf->Add_PDF_card(sprintf("%s\n%s\n%s\n%s\n%s, %s\n%s", $objp->type." n° ".$objp->rowid,ucfirst(strtolower($objp->prenom))." ".strtoupper($objp->nom),"<".$objp->email.">", ucwords(strtolower($objp->adresse)), $objp->cp, strtoupper($objp->ville), ucfirst(strtolower($objp->pays))),$annee,"Association FreeLUG http://www.freelug.org/");
|
// attribut a remplacer
|
||||||
|
$replace = array (
|
||||||
|
ucfirst(strtolower($objp->prenom)),
|
||||||
|
strtoupper($objp->nom),
|
||||||
|
"http://".$_SERVER["SERVER_NAME"]."/",
|
||||||
|
$objp->societe,
|
||||||
|
ucwords(strtolower($objp->adresse)),
|
||||||
|
$objp->cp,
|
||||||
|
strtoupper($objp->ville),
|
||||||
|
ucfirst(strtolower($objp->pays)),
|
||||||
|
$objp->email,
|
||||||
|
$objp->naiss,
|
||||||
|
$objp->photo,
|
||||||
|
$objp->type,
|
||||||
|
$objp->rowid,
|
||||||
|
$annee
|
||||||
|
);
|
||||||
|
// imprime le texte specifique sur la carte
|
||||||
|
//$pdf->Add_PDF_card(sprintf("%s\n%s\n%s\n%s\n%s, %s\n%s", $objp->type." n° ".$objp->rowid,ucfirst(strtolower($objp->prenom))." ".strtoupper($objp->nom),"<".$objp->email.">", ucwords(strtolower($objp->adresse)), $objp->cp, strtoupper($objp->ville), ucfirst(strtolower($objp->pays))),$annee,"Association FreeLUG http://www.freelug.org/");
|
||||||
|
$pdf->Add_PDF_card(preg_replace ($patterns, $replace, ADH_CARD_TEXT),preg_replace ($patterns, $replace, ADH_CARD_HEADER_TEXT),preg_replace ($patterns, $replace, ADH_CARD_FOOTER_TEXT));
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
// On imprime les étiquettes
|
|
||||||
// for($i=0;$i<$num;$i++)
|
|
||||||
// $pdf->Add_PDF_Label(sprintf("%s\n%s\n%s\n%s, %s, %s", "Laurent $i", 'Immeuble Titi', 'av. fragonard', '06000', 'NICE', 'FRANCE'));
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
$pdf->Output();
|
$pdf->Output();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user