[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: carte.php,v 1.14 2004/10/23 16:55:07 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/adherents/cartes/carte.php,v $ 21 * 22 */ 23 24 /*! \file htdocs/adherents/cartes/carte.php 25 \ingroup adherent 26 \brief Page de creation d'une carte PDF 27 \version $Revision: 1.14 $ 28 */ 29 30 require ("./pre.inc.php"); 31 require (DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); 32 33 require_once ('PDF_card.class.php'); 34 35 // liste des patterns remplacable dans le texte a imprimer 36 $patterns = array ( 37 '/%PRENOM%/', 38 '/%NOM%/', 39 '/%SERVEUR%/', 40 '/%SOCIETE%/', 41 '/%ADRESSE%/', 42 '/%CP%/', 43 '/%VILLE%/', 44 '/%PAYS%/', 45 '/%EMAIL%/', 46 '/%NAISS%/', 47 '/%PHOTO%/', 48 '/%TYPE%/', 49 '/%ID%/', 50 '/%ANNEE%/' 51 ); 52 /* 53 *------------------------------------------------- 54 * Pour créer l'objet on a 2 moyens : 55 * Soit on donne les valeurs en les passant dans un tableau (sert pour un format personnel) 56 * Soit on donne le type d'étiquette au format AVERY 57 *------------------------------------------------- 58 */ 59 60 //$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); 61 $pdf = new PDF_card('CARD', 1, 1); 62 63 $pdf->Open(); 64 $pdf->AddPage(); 65 66 // Choix de l'annee d'impression ou annee courante. 67 if (!isset($annee)){ 68 $now = getdate(); 69 $annee=$now['year']; 70 } 71 72 // requete en prenant que les adherents a jour de cotisation 73 $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"; 74 $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; 75 $sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND datefin > now()"; 76 $sql .= " ORDER BY d.rowid ASC "; 77 78 $result = $db->query($sql); 79 if ($result) 80 { 81 $num = $db->num_rows(); 82 $i = 0; 83 while ($i < $num) 84 { 85 $objp = $db->fetch_object($result); 86 // attribut a remplacer 87 $replace = array ( 88 ucfirst(strtolower($objp->prenom)), 89 strtoupper($objp->nom), 90 "http://".$_SERVER["SERVER_NAME"]."/", 91 $objp->societe, 92 ucwords(strtolower($objp->adresse)), 93 $objp->cp, 94 strtoupper($objp->ville), 95 ucfirst(strtolower($objp->pays)), 96 $objp->email, 97 $objp->naiss, 98 $objp->photo, 99 $objp->type, 100 $objp->rowid, 101 $annee 102 ); 103 // imprime le texte specifique sur la carte 104 //$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/"); 105 $pdf->Add_PDF_card(preg_replace ($patterns, $replace, ADHERENT_CARD_TEXT),preg_replace ($patterns, $replace, ADHERENT_CARD_HEADER_TEXT),preg_replace ($patterns, $replace, ADHERENT_CARD_FOOTER_TEXT)); 106 $i++; 107 } 108 109 $db->close(); 110 $pdf->Output(); 111 }else{ 112 llxHeader(); 113 print "Erreur de la base de données"; 114 llxFooter("<em>Dernière modification $Date: 2004/10/23 16:55:07 $ révision $Revision: 1.14 $</em>"); 115 } 116 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |