| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> 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: html_cerfafr.modules.php,v 1.4.2.1 2006/01/14 13:50:08 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/modules/dons/html_cerfafr.modules.php,v $ 21 */ 22 23 /** 24 \file htdocs/includes/dons/html_cerfafr.php 25 \ingroup don 26 \brief Formulaire de don 27 \version $Revision: 1.4.2.1 $ 28 */ 29 30 require_once(DOL_DOCUMENT_ROOT."/master.inc.php"); 31 require_once(DOL_DOCUMENT_ROOT."/projetdon.class.php"); 32 require_once(DOL_DOCUMENT_ROOT."/don.class.php"); 33 34 35 36 /** 37 \class html_cerfafr 38 \brief Classe permettant de générer les propales au modèle Azur 39 */ 40 41 class html_cerfafr extends ModeleDon 42 { 43 /** 44 \brief Constructeur 45 \param db Handler accès base de donnée 46 */ 47 function html_cerfafr($db) 48 { 49 global $conf,$langs; 50 51 $this->db = $db; 52 $this->name = "cerfafr"; 53 $this->description = "Modèle de reçu de dons"; 54 } 55 56 57 /** 58 \brief Renvoi dernière erreur 59 \return string Dernière erreur 60 */ 61 function pdferror() 62 { 63 return $this->error; 64 } 65 66 67 /** 68 \brief Fonction générant le recu sur le disque 69 \param id Id du recu à générer 70 \return int >0 si ok, <0 si ko 71 */ 72 function write_file($id) 73 { 74 global $conf,$langs,$user,$mysoc; 75 $langs->load("main"); 76 77 $don = new Don($this->db); 78 $don->fetch($id); 79 80 $filename = sanitize_string($don->id); 81 $dir = $conf->don->dir_output . "/" . get_exdir("$filename}"); 82 $file = $dir . "/" . $filename . ".html"; 83 84 if (! is_dir($dir)) 85 { 86 if (create_exdir($dir) < 0) 87 { 88 $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); 89 return -1; 90 } 91 } 92 93 // Defini contenu 94 $donmodel=DOL_DOCUMENT_ROOT ."/includes/modules/dons/html_cerfafr.html"; 95 $html = implode('', file($donmodel)); 96 $html = eregi_replace('__REF__',$id,$html); 97 $html = eregi_replace('__DATE__',dolibarr_print_date($don->date),$html); 98 $html = eregi_replace('__IP__',$user->ip,$html); 99 $html = eregi_replace('__AMOUNT__',$don->amount,$html); 100 $html = eregi_replace('__CURRENCY__',$langs->trans("Currency".$conf->monnaie),$html); 101 $html = eregi_replace('__CURRENCYCODE__',$conf->monnaie,$html); 102 $html = eregi_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->nom,$html); 103 $html = eregi_replace('__MAIN_INFO_SOCIETE_ADRESSE__',$mysoc->adresse,$html); 104 $html = eregi_replace('__MAIN_INFO_SOCIETE_CP__',$mysoc->cp,$html); 105 $html = eregi_replace('__MAIN_INFO_SOCIETE_VILLE__',$mysoc->ville,$html); 106 $html = eregi_replace('__DONATOR_NAME__',$don->nom,$html); 107 $html = eregi_replace('__DONATOR_ADDRESS__',$don->adresse,$html); 108 $html = eregi_replace('__DONATOR_ZIP__',$don->cp,$html); 109 $html = eregi_replace('__DONATOR_TOWN__',$don->ville,$html); 110 $html = eregi_replace('__PAYMENTMODE_LIB__ ',$don->modepaiement,$html); 111 $html = eregi_replace('__NOW__',dolibarr_print_date(time()),$html); 112 113 // Sauve fichier sur disque 114 dolibarr_syslog("html_cerfafr::write_file $file"); 115 $handle=fopen($file,"w"); 116 fwrite($handle,$html); 117 fclose($handle); 118 119 return 1; 120 } 121 } 122 123 ?>
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 |
|