Subversion Repositories Applications.papyrus

Rev

Rev 1467 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1467 Rev 1571
Line 17... Line 17...
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: inscription.fonct.php,v 1.30 2007-06-25 09:59:03 alexandre_tb Exp $
22
// CVS : $Id: inscription.fonct.php,v 1.31 2007-09-06 08:28:32 alexandre_tb Exp $
23
/**
23
/**
24
* Fonctions du module inscription
24
* Fonctions du module inscription
25
*
25
*
26
* Fonctions du module inscription
26
* Fonctions du module inscription
27
*
27
*
Line 29... Line 29...
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Florian Schmitt <florian@ecole-et-nature.org>
32
*@author        Florian Schmitt <florian@ecole-et-nature.org>
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.30 $ $Date: 2007-06-25 09:59:03 $
34
*@version       $Revision: 1.31 $ $Date: 2007-09-06 08:28:32 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 390... Line 390...
390
 *
390
 *
391
 * @global  ins_db  Un pointeur vers un objet PEAR::DB connecté
391
 * @global  ins_db  Un pointeur vers un objet PEAR::DB connecté
392
 * @return
392
 * @return
393
 */
393
 */
Line 394... Line -...
394
 
-
 
395
function envoie_mail() //A COMPLETER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
396
{
394
 
397
    //include_once PAP_CHEMIN_RACINE.'api/pear/Mail/mime.php' ;
395
function envoie_mail() {
398
    include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
396
    include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
Line 399... Line 397...
399
    $crlf="\n";
397
    $crlf="\n";
400
    
398
    
401
    $headers ['From'] = $GLOBALS['ins_config']['ic_from_mail_confirmation'] ;
399
    $headers ['From'] = $GLOBALS['ins_config']['ic_from_mail_confirmation'] ;
Line 402... Line -...
402
    $headers ['Subject'] = html_entity_decode(INS_MAIL_COORD_SUJET) ;
-
 
403
    $headers ['Reply-To'] = $GLOBALS['ins_config']['ic_from_mail_confirmation'] ;
-
 
404
    
400
    $headers ['Subject'] = html_entity_decode(INS_MAIL_COORD_SUJET) ;
405
    //$mime = new Mail_mime($crlf);
401
    $headers ['Reply-To'] = $GLOBALS['ins_config']['ic_from_mail_confirmation'] ;
406
    
402
    
Line 407... Line 403...
407
    $requete = "select *, ".INS_CHAMPS_LABEL_PAYS." from ".INS_ANNUAIRE.",".INS_TABLE_PAYS.
403
    $requete = "select *, ".INS_CHAMPS_LABEL_PAYS." from ".INS_ANNUAIRE.",".INS_TABLE_PAYS.
408
            " where ".INS_CHAMPS_MAIL."=\"".$GLOBALS['AUTH']->getUsername()."\"".
404
            " where ".INS_CHAMPS_MAIL."=\"".$GLOBALS['AUTH']->getUsername()."\"".
409
            " and ".INS_CHAMPS_ID_PAYS."=".INS_CHAMPS_PAYS;
405
            " and ".INS_CHAMPS_ID_PAYS."=".INS_CHAMPS_PAYS;
410
 
406
 
411
    $resultat = $GLOBALS['ins_db']->query($requete) ;
407
    $resultat = $GLOBALS['ins_db']->query($requete) ;
-
 
408
    if (DB::isError ($resultat)) {
412
    if (DB::isError ($resultat)) {
409
        die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
-
 
410
    }
413
        die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
411
    $ligne  = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
414
    }
-
 
415
    $ligne  = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
-
 
416
    $body_entete = INS_MAIL_COORD_CORPS."\n" ;
-
 
417
    $body = "mail : ".$ligne[INS_CHAMPS_MAIL]."\n" ;
-
 
418
    $body .= "------------------------------------------\n";
-
 
419
    $body .= INS_NOM.": ".html_entity_decode($ligne[INS_CHAMPS_NOM])." \n" ;
412
    $valeur = $ligne;
420
    $body .= INS_PRENOM.' : '.html_entity_decode($ligne[INS_CHAMPS_PRENOM])." \n" ;
413
    $body_entete = INS_MAIL_COORD_CORPS."\n" ;
421
    $body .= INS_PAYS." : ".html_entity_decode($ligne[INS_CHAMPS_LABEL_PAYS])." \n" ;
414
 
Line 422... Line 415...
422
    $body .= "-------------------------------------------\n" ;
415
    // On recupere le template de l inscription
423
    
416
	
-
 
417
    include_once GEN_CHEMIN_API.'/formulaire/formulaire.fonct.inc.php';
-
 
418
    $tableau= formulaire_valeurs_template_champs($GLOBALS['ins_config']['ic_inscription_template']);
-
 
419
    
-
 
420
    for ($i=0; $i<count($tableau); $i++) {
-
 
421
		//cas des checkbox et des listes
-
 
422
		if ($tableau[$i]['type']=='liste') {
-
 
423
			if (is_int($tableau[$i]['nom_bdd'])) {
-
 
424
				$body .= $tableau[$i]['label'].' : '.$valeur[$tableau[$i]['nom_bdd']]."\n";
-
 
425
			} else {
-
 
426
				if(isset($valeur[$tableau[$i]['nom_bdd']])) {
-
 
427
					
-
 
428
					list ($table, $col_id, $col_label, $col_langue, $langue) = explode (',', $tableau[$i]['table_source']);
-
 
429
					$requete = 'select '.$col_label.' from '.$table.' where '.$col_id.'="'.$valeur[$tableau[$i]['nom_bdd']].'"';;
-
 
430
					if (isset($col_langue)) $requete .= ' and '.$col_langue.' like "'.INS_LANGUE_DEFAUT.'%"';
-
 
431
					$resultat = $GLOBALS['ins_db']->getOne($requete);
-
 
432
					$body .= $tableau[$i]['label'].' : '. $resultat."\n";
-
 
433
				}
-
 
434
			}
-
 
435
		} elseif ($tableau[$i]['type']=='checkbox') {
-
 
436
			
-
 
437
		}
-
 
438
		//cas des champs texte
424
    //$mime->setTXTBody($body);
439
		elseif ($tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='champs_mail') {
425
    //$mime->setHTMLBody(info()) ;
440
			//on mets les slashes pour les saisies dans les champs texte et textearea
426
    
441
			$body .= $tableau[$i]['label'].' : '.$valeur[$tableau[$i]['nom_bdd']]."\n";
Line 427... Line -...
427
    //$body = $mime->get();
-
 
428
    //$headers = $mime->headers($headers);
442
		}
429
    $body = html_entity_decode($body);
443
	}
430
    $mail = & Mail::factory('mail') ;
444
    $body = html_entity_decode($body);
431
    $mail -> send ($ligne[INS_CHAMPS_MAIL], $headers, $body) ;
445
    $mail = & Mail::factory('mail') ;
432
    
446
    $mail -> send ($ligne[INS_CHAMPS_MAIL], $headers, $body) ;
Line 527... Line 541...
527
}
541
}
Line 528... Line 542...
528
 
542
 
529
/* +--Fin du code ----------------------------------------------------------------------------------------+
543
/* +--Fin du code ----------------------------------------------------------------------------------------+
530
*
544
*
-
 
545
* $Log: not supported by cvs2svn $
-
 
546
* Revision 1.30  2007-06-25 09:59:03  alexandre_tb
-
 
547
* ajout de carte_google, mise en place des templates avec api/formulaire, configuration de multiples inscriptions, ajout de modele pour les mails
531
* $Log: not supported by cvs2svn $
548
*
532
* Revision 1.29  2007-05-25 14:32:17  alexandre_tb
549
* Revision 1.29  2007-05-25 14:32:17  alexandre_tb
533
* en cours
550
* en cours
534
*
551
*
535
* Revision 1.28  2007/04/20 08:39:37  alexandre_tb
552
* Revision 1.28  2007/04/20 08:39:37  alexandre_tb