Subversion Repositories Applications.papyrus

Rev

Blame | Last modification | View Log | RSS feed

<?php

//vim: set expandtab tabstop=4 shiftwidth=4: 
// +-----------------------------------------------------------------------------------------------+
// | PHP version 4.0                                                                               |
// +-----------------------------------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group                                      |
// +-----------------------------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license,                                | 
// | that is bundled with this package in the file LICENSE, and is                                 |
// | available at through the world-wide-web at                                                    |
// | http://www.php.net/license/2_02.txt.                                                          |
// | If you did not receive a copy of the PHP license and are unable to                            |
// | obtain it through the world-wide-web, please send a note to                                   |
// | license@php.net so we can mail you a copy immediately.                                        |
// +-----------------------------------------------------------------------------------------------+
/**
*
*Page permettant l'affichage des informations de cartographie des inscrits
*
*@package cartographie
//Auteur original :
*@author                Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@copyright         Tela-Botanica 2000-2004
*@version             03 mai 2004
// +-----------------------------------------------------------------------------------------------+
//
// $Id: car_cartographie.fonct.php,v 1.1 2004-12-15 13:30:20 alex Exp $
// FICHIER : $RCSfile: car_cartographie.fonct.php,v $
// AUTEUR    : $Author: alex $
// VERSION : $Revision: 1.1 $
// DATE        : $Date: 2004-12-15 13:30:20 $
*/

/** function carto_texte_cocher ()
*
*
*       @return string  HTML
*/

function carto_texte_cocher () {
    $res .= "<div class=\"texte\">".CAR_CHECK_UNCHECK ;
    $res .= "&nbsp;<input type=\"checkbox\" name=\"selecttotal\" onclick=\"javascript:setCheckboxes('formmail');\"></div>";
    return $res ;
}
/** function carto_formulaire ()
*
*
*
*       @return string  HTML
*/
function carto_formulaire ($titre_mail="", $corps = "") {
    global $HTTP_USER_AGENT, $GS_GLOBAL ;
    $res .= "<div class=\"chapo\">".CAR_ENVOYER_MAIL."</div>\n";
    $res .= "<div>\n<table width=\"100%\" border=\"0\">\n"
            .'<tr><td class="texte">'.CAR_SUJET.' :</td>'."\n"
            .'<td><input class="forml" type="text" name="titre_mail" size="60" value="'.$GLOBALS['titre_mail'].'"></td>'."\n"
            .'</tr><tr><td class="texte" valign="top">'.CAR_MESSAGE.'&nbsp;:&nbsp;</td>'."\n"
            .'<td><textarea class="forml" name="corps" rows="5" cols="60">'.$GLOBALS['corps'].'</textarea></td>'."\n"
            .'</tr><tr><td></td><td align="center">';
    if (ereg ("Gecko",$HTTP_USER_AGENT)) {
        $res.='<input class="spip_bouton" type="submit" value="'.CAR_ENVOYER.'">';
    } else {
        $res.='<input class="spip_bouton" type="submit" onclick="javascript:confirmer();" value="'.CAR_ENVOYER.'">';
    }
    $res.="</td>\n</tr>\n</table>\n</div></form>\n";
    return $res ;
}

/**
 *  Renvoie le code HTML de la liste des inscrits
 *  en fonction de la requete passé en parametre
 *
 * @return  Renvoie le code HTML de la liste des inscrits
 */

function listes_inscrit ($requete, $url, $select, $argument, &$db, $niveau = 'pays') {
    $res = "<div>";
    $res .= "<form action=\"$url&amp;mailer=1"."&amp;select=$select\" method=\"post\" name=\"formmail\">\n
                <tr><td>\n
                        <table id=\"table_outilsreseaux\" width=\"100%\">\n
                            <colgroup>
                                <col />
                                <col />
                                <col />
                                <col />
                                <col />
                                <col />
                            </colgroup>
                                <thead>\n
                                        <th>&nbsp;</th>\n
                                        <th>".CAR_NOM."</th>\n
                                        <th>".CAR_PRENOM."</th>\n
                                        <th>".CAR_DATE_INS."</th>\n
                                        <th>".($niveau == 'pays' ? CAR_REGION : CAR_CP)."</th>\n
                                        <th>".CAR_VILLE."</th>\n
                                </thead>\n";
        

    $resultat= $GLOBALS['car_db']->query($requete);
    if (DB::isError($resultat)) {
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
    }
    $indic=0;
    $i=1;
    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
        if ($indic==0) {
            $res.="<tr class=\"ligne_impaire\">\n";
            $indic=1;
        }
        else {
            $res.="<tr class=\"ligne_paire\">\n";
            $indic=0;
        }
        $res.="<td><input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\"></td>\n
                        <td>".$ligne[CAR_CHAMPS_NOM]."&nbsp;</td>\n
                        <td>".$ligne[CAR_CHAMPS_PRENOM]."&nbsp;</td>\n
                        <td>".date("d m Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."&nbsp;</td>\n
                        <td>".($niveau == 'pays' ? $ligne[CAR_CHAMPS_REGION] : $ligne[CAR_CHAMPS_CODE_POSTAL])."&nbsp;</td>\n
                        <td>".$ligne[CAR_CHAMPS_VILLE]."&nbsp;</td>\n" ;
        $res .= "</tr>\n";
    }
    
    $res .= "</table></div>\n";
    return $res ;
}

/** envoie_mail()
 *
 *
 * @return  envoie l'email
 */

function envoie_mail () {
    $requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
            " where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
    $resultat = $GLOBALS['car_db']->query($requete);
    if (DB::isError($resultat)) {
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
    }
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
    $entete = "From: <".$ligne[CAR_CHAMPS_MAIL].">\n";
    
    $GLOBALS['corps'] .= CAR_TEXTE_FIN_MAIL;
    $GLOBALS['corps'] = stripslashes($GLOBALS['corps']) ;
    $liste = "" ;
    foreach ($GLOBALS['select'] as $key => $value) {
        mail ($value, stripslashes($GLOBALS['titre_mail']), $GLOBALS['corps'] , $entete) ;
        $liste .= $value."\n" ;
    }
    
    $GLOBALS['corps'] .= "\n----------------------------------------------------------------------------";
    $GLOBALS['corps'] .= "\n".CAR_MESSAGE_ENVOYE_A." :\n $liste" ;
    
    mail (CAR_MAIL_ADMIN, stripslashes($GLOBALS['titre_mail']), $GLOBALS['corps'], $entete);
    $GLOBALS['corps'] = '';
    $GLOBALS['titre_mail'] = '';
}
//-- Fin du code source    ------------------------------------------------------------
/*
* $Log: not supported by cvs2svn $
*
*/
?>