Subversion Repositories Sites.obs-saisons.fr

Compare Revisions

Problem with comparison.

Ignore whitespace Rev HEAD → Rev 1

/obs_saisons/SPIP-v1-8-3/modules/bibliotheque/car_cartographie.fonct.php
New file
0,0 → 1,192
<?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.4 2005/03/11 17:27:23 alex Exp $
// FICHIER : $RCSfile: car_cartographie.fonct.php,v $
// AUTEUR : $Author: alex $
// VERSION : $Revision: 1.4 $
// DATE : $Date: 2005/03/11 17:27:23 $
*/
 
/** function carto_texte_cocher ()
*
*
* @return string HTML
*/
 
function carto_texte_cocher () {
$res = '<p class="cocher">'.CAR_CHECK_UNCHECK ;
$res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');" />'.
'</p>';
return $res ;
}
/** function carto_formulaire ()
*
*
*
* @return string HTML
*/
function carto_formulaire ($titre_mail = '', $corps = '') {
$res = '<div id="redaction">'."\n";
$res .= '<div id="redaction_tete"></div>'."\n";
$res .= '<h2 class="chapo">'.CAR_ENVOYER_MAIL.'</h2>'."\n";
$res .= '<table id="formulaire_mail" border="0">'."\n".
' <tr>' .
' <td class="texte">'.CAR_SUJET.' :</td>'."\n".
' <td><input class="forml" type="text" name="titre_mail" size="60" value="'.$titre_mail.'" /></td>'."\n".
' </tr>'."\n".
' <tr>'."\n".
' <td class="texte" valign="top">'.CAR_MESSAGE.'&nbsp;:&nbsp;</td>'."\n".
' <td><textarea class="forml" name="corps" rows="5" cols="60">'.$corps.'</textarea></td>'."\n".
' </tr>'."\n".
' <tr>'."\n".
' <td>&nbsp;</td>'."\n".
' <td>';
if (ereg('Gecko', $GLOBALS['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 id="redaction_pied"/></div>'."\n".
'</div>'."\n".
'</form>'."\n";
$res .= '<p class="attention surveillance">'.CAR_SURVEILLANCE.'</p>' ;
$res .= '<p class="information message_a_tous">'.sprintf(CAR_MESSAGE_A_TOUS, '<a href="'.CAR_URL_ACTUALITE.'">'.CAR_ACTUALITE.'</a>').'</p>' ;
return $res ;
}
 
/**
* La fonction carto_getNbInscrits renvoit une phrase complete indiquant le
* nombre d'inscrits dans zone passee en argument
* @param string identifiant de carte ex: europe
* @return string
*/
 
function carto_ad_consulterNbreInscrits ($id_carte)
{
global $NOM_FICHIER;
$titre_carte = carto_consulterTitreCarte($id_carte);
$type_zone_carte = carto_consulterTypeZoneCarte ($id_carte);
switch ($type_zone_carte){
case '0' :
$requete =
' SELECT count('.CAR_CHAMPS_ID.') as nbr'.
' FROM '.CAR_ANNUAIRE.
' WHERE '.CAR_CHAMPS_DPT.' <> 999';
break;
case '1' :
$requete =
' SELECT count('.CAR_CHAMPS_ID.') as nbr'.
' FROM '.CAR_ANNUAIRE.', '.CAR_TABLE_PAYS.
' WHERE '.CAR_CHAMPS_CE_PAYS.' = cp_id_pays'.
' AND cp_id_continent = "'.carto_consulterIdZoneGeoCarte ($id_carte).'"';
break;
case '2' :
$requete =
' SELECT count('.CAR_CHAMPS_ID.') as nbr'.
' FROM '.CAR_ANNUAIRE.''.
' WHERE '.CAR_CHAMPS_DPT.' != "999"'.
' AND '.CAR_CHAMPS_CE_PAYS.' = "fr"';
break;
}
if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
$requete .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
}
$resultat = mysql_query($requete) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
'<b>Nom fonction : </b> carto_ad_consulterNbreInscrits<br/>'.
'<b>Requete : </b>'.$requete.
'<br/><br/><b>Erreur : </b>'.mysql_error());
$ligne = mysql_fetch_object ($resultat) ;
$res = '<h1 class="titre1_cartographie">'.$titre_carte.' : ' ;
if ($ligne->nbr == 0) {
$res .= 'aucun inscrit' ;
}
else if ($ligne->nbr == 1) {
$res .= $ligne->nbr.' inscrit' ;
}
else {
$res .= $ligne->nbr.' inscrits ';
}
return $res.' &agrave; l\'Observatoire des Saisons</h1>' ;
}
 
/**
* Envoie un email à tous les adhérents sélectionnés
*
* @return string Renvoie le message 'votre message a été envoyé'
*/
 
function envoie_mail (&$db) {
$res = "<h3>".CAR_MAIL_ENVOYER."</h3>\n" ;
$requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
" where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
$resultat = $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";
$_POST['corps'] .= CAR_TEXTE_FIN_MAIL;
$_POST['corps'] = stripslashes($_POST['corps']) ;
$liste = "" ;
foreach ($_POST['select'] as $key => $value) {
mail($value, CAR_PREFIXE_MAIL.stripslashes($_POST['titre_mail']), $_POST['corps'], $entete) ;
$liste .= $value."\n" ;
}
$_POST['corps'] .= "\n----------------------------------------------------------------------------";
$_POST['corps'] .= "\n".CAR_MESSAGE_APPLI."\n" ;
$_POST['corps'] .= "\n".CAR_MESSAGE_ENVOYE_A.":\n $liste" ;
// Envoie du message aux administrateurs
foreach ($GLOBALS['mail_admin'] as $courriel) {
if (!mail($courriel, CAR_PREFIXE_MAIL.'[Administration] '.stripslashes($_POST['titre_mail']), $_POST['corps'], $entete)) {
trigger_error("Le courriel n'a pas été envoyé à : $courriel", E_USER_WANRNING);
}
}
$_POST['corps']='';
$_POST['titre_mail']='';
return $res ;
}
 
?>