Subversion Repositories Sites.obs-saisons.fr

Compare Revisions

Ignore whitespace Rev 5 → Rev 6

/branches/v1.0-Amère nouvelle/SPIP-v1-8-3/modules/liste_inscrit.php
New file
0,0 → 1,325
<?
// +--------------------------------------------------------------------------------+
// | liste_inscrit.php |
// +--------------------------------------------------------------------------------+
// | Copyright (c) 2002 |
// +--------------------------------------------------------------------------------+
// | |
// +--------------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +--------------------------------------------------------------------------------+
//
// $Id: liste_inscrit.php,v 1.6 2005/03/14 10:10:02 alex Exp $
 
global $HTTP_USER_AGENT;
 
define("LATIN1_UC_CHARS", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ");
define("LATIN1_LC_CHARS", "àáâãäåæçèéêëìíîïðñòóôõöøùúûüý");
 
if (!function_exists("uc_latin1")) {
 
function uc_latin1 ($str) {
$str = strtoupper(strtr($str, LATIN1_LC_CHARS, LATIN1_UC_CHARS));
return strtr($str, array("ß" => "SS"));
}
}
 
$javascript = "<script language=\"javascript\">\n" .
"function confirmer ()
{
if (window.confirm ('Cliquez sur OK pour confirmer.')) {
window.formmail.submit();
}
}
function setCheckboxes(the_form)
{
var do_check=document.forms[the_form].elements['selecttotal'].checked;
var elts = document.forms[the_form].elements['select[]'];
var elts_cnt = (typeof(elts.length) != 'undefined')
? elts.length
: 0;
if (elts_cnt) {
for (var i = 0; i < elts_cnt; i++) {
elts[i].checked = do_check;
} // Fin for
}
else {
elts.checked = do_check;
} // Fin if... else
return true;
} // Fin de la fonction 'setCheckboxes()'" .
"</script>";
 
echo $javascript;
 
$url = $GLOBALS['car_url']->getURL() ;
 
$corps = (isset($_POST['corps'])) ? $_POST['corps'] : '' ;
$titre_mail = (isset($_POST['titre_mail'])) ? $_POST['titre_mail'] : '';
 
$tabmonde = explode ('*',$monde->historique);
 
// Premier cas, on vient de cliquer sur un pays qui n'est pas
// la France, on affiche les adhérents de ce pays
 
if (count($tabmonde) == 3) {
$argument = $tabmonde[2];
$requete = "select * from carto_PAYS where CP_ID_pays='$argument'";
$resultat = $GLOBALS['car_db']->query($requete);
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$pays = $ligne->CP_Intitule_pays;
$monde->nom = $monde->nom.'*'.$pays;
$tabonglet = explode ('*', $monde->historique);
$tabnom = explode ('*', $monde->nom);
foreach ($tabonglet as $key => $value) {
$res .= '<a class="chemin_carto"' ;
if ($key == 0) {
$chemin = $value;
$value = 'monde';
$res .= " href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key] ;
}
else if ($key == (count($tabonglet)-1)) {
$res .= ">&nbsp;&gt;&nbsp;$pays";
}
else {
$chemin .= '*'.$value;
$res .= " href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key] ;
}
$res .= '</a>' ;
}
 
$capitale = $ligne->CP_Intitule_capitale;
$requete_2 = " SELECT count(".CAR_CHAMPS_ID.") as nbr".
" from ".CAR_ANNUAIRE.
" where ".CAR_CHAMPS_CE_PAYS."='$argument'";
if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
$requete_2 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
}
$resultat_2 = $GLOBALS['car_db']->query($requete_2);
if (DB::isError($resultat_2)) {
die ($resultat_2->getMessage().'<br />'.$resultat_2->getDebugInfo()) ;
}
$ligne_2 = $resultat_2->fetchRow(DB_FETCHMODE_OBJECT) ;
$res .= '<h1 class="titre1_cartographie">'.$pays.' ('.$capitale.') : ' ;
if ($ligne_2->nbr == 0) {
$res .= 'aucun inscrit '.CAR_LABEL_PROJET."</h1>\n";
if (!$GLOBALS['car_auth']->getAuth()) {
//$res .= AUTH_formulaire_login();
} else {
$res .= '<div class="message_pas_dinscrit">'.CAR_PAS_D_INSCRIT.'</div>'."\n" ;
}
return $res ;
} else if ($ligne_2->nbr == 1) {
$res .= $ligne_2->nbr." inscrit " ;
} else {
$res .= $ligne_2->nbr." inscrits " ;
}
$res .= CAR_LABEL_PROJET."</h1>\n";
if (!$GLOBALS['car_auth']->getAuth()) {
//$res .= AUTH_formulaire_login();
} else {
$res .= '<form action="'.$url.'&amp;mailer=1&amp;fin=true" method="post" name="formmail">'.
' <div id="div_inscrit">'.
' <table id="table_inscrits">'.
' <thead>'.
' <tr>'.
' <th>&nbsp;</th>'.
' <th>'.CAR_NOM.'</th>'.
' <th>'.CAR_DATE_INS.'</th>'.
' <th>'.CAR_VILLE.'</th>'.
' </tr>'.
' </thead>'.
' <tbody>';
$requete = "select * from ".CAR_ANNUAIRE.
" where ".CAR_CHAMPS_CE_PAYS."='$argument'";
if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
$requete .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
}
$requete .= " order by ".CAR_CHAMPS_VILLE;
$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>&nbsp;".
"<input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\" />".
"</td>".
"<td>";
if ($ligne['PARTICIPANT_NOM_PRENOM_VISIBLE']) {
$res .= strtoupper($ligne[CAR_CHAMPS_NOM])."&nbsp;".
str_replace(' - ', '-', ucwords(strtolower(str_replace('-', ' - ', $ligne[CAR_CHAMPS_PRENOM]))));
} else {
$res .= $ligne['PARTICIPANT_PSEUDO'];
}
$res .= "&nbsp;</td>\n
<td>".date("d.m.Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."&nbsp;</td>
<td>".uc_latin1($ligne[CAR_CHAMPS_VILLE])."&nbsp;</td>\n";
$res .= "</tr>\n";
}
$res .= "</tbody></table></div>\n";
if ($mailer == 1) {
if (!is_array($select)) {
$res .= "<div>".CAR_NO_DESTINATAIRE."</div>";
} else {
$res .= envoie_mail($GLOBALS['car_db']);
}
} else {
$res .= carto_texte_cocher();
}
$res .= carto_formulaire($titre_mail, $corps) ;
}
 
 
// 2 ème cas, on vient de cliquer sur un département français
 
} else if (count($tabmonde) == 4) {
$argument = $tabmonde[3];
$requete = "SELECT * FROM ".CAR_TABLE_DPT." WHERE lpad(".CAR_CHAMPS_CARTO_DEP.", 2, '0' )='$argument'";
$resultat = $GLOBALS['car_db']->query($requete);
if (DB::isError($resultat)) {
die ($resultat->getMessage() .'<br />'.$resultat->getDebugInfo());
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$nom = $ligne[CAR_CHAMPS_NOM_DEP];
$tabonglet=explode ('*', $monde->historique);
$tabnom=explode ('*', $monde->nom);
$res.="<div>\n";
foreach ($tabonglet as $key=>$value) {
if ($key==0) {
$chemin=$value;
$value='monde';
$res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
else if ($key==(count($tabonglet)-1)) {
$res.="<a class=\"chemin_carto\">&nbsp;&gt;&nbsp;$nom</a>";
}
else {
$chemin.='*'.$value;
$res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
}
$res .= "</div>\n";
$requete_2 = " SELECT count(".CAR_CHAMPS_ID.") as nbr".
" FROM ".CAR_ANNUAIRE.
" WHERE ".CAR_CHAMPS_DPT." = '$argument'".
" AND ".CAR_CHAMPS_CE_PAYS."='fr'";
if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
$requete_2 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
}
$resultat_2 = $GLOBALS['car_db']->query($requete_2);
if (DB::isError($resultat_2)) {
die ($resultat_2->getMessage().'<br />'.$resultat_2->getDebugInfo()) ;
}
$ligne_2 = $resultat_2->fetchRow(DB_FETCHMODE_OBJECT);
 
$res .= '<h1 class="titre1_cartographie">'.$nom.' : ' ;
if ($ligne_2->nbr == 0) {
$res .= 'aucun inscrit '.CAR_LABEL_PROJET."</h1>\n";
if (!$GLOBALS['car_auth']->getAuth()) {
// $res .= AUTH_formulaire_login();
} else {
$res .= '<div class="message_pas_dinscrit">'.CAR_PAS_D_INSCRIT.'</div>'."\n" ;
}
return $res ;
} else if ($ligne_2->nbr == 1) {
$res .= $ligne_2->nbr." inscrit " ;
} else {
$res .= $ligne_2->nbr." inscrits " ;
}
$res .= CAR_LABEL_PROJET."</h1>\n";
if (!$GLOBALS['car_auth']->getAuth()) {
// $res .= AUTH_formulaire_login();
} else {
$res.= "<form action=\"$url&amp;argument=$argument&amp;fin=true&amp;mailer=1\"
method=\"post\" name=\"formmail\">
<div id=\"div_inscrit\"><table id=\"table_inscrits\">
<thead>
<tr>
<th>&nbsp;</th>
<th>".CAR_NOM."</th>
<th>".CAR_DATE_INS."</th>
<th>".CAR_CP."</th>
<th>".CAR_VILLE."</th>
</tr></thead><tbody>\n";
$requete = "SELECT * FROM ".CAR_ANNUAIRE.
" WHERE ".CAR_CHAMPS_DPT." = '$argument'".
" AND ".CAR_CHAMPS_CE_PAYS."='fr'";
if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
$requete .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
}
$requete .= " ORDER BY ".CAR_CHAMPS_VILLE;
$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>&nbsp;".
"<input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\" />".
"</td>".
"<td>";
if ($ligne['PARTICIPANT_NOM_PRENOM_VISIBLE']) {
$res .= uc_latin1($ligne[CAR_CHAMPS_NOM])."&nbsp;".
str_replace(' - ', '-', ucwords(strtolower(str_replace('-', ' - ', $ligne[CAR_CHAMPS_PRENOM]))));
} else {
$res .= $ligne['PARTICIPANT_PSEUDO'];
}
$res .= "&nbsp;</td>\n
<td>".date("d m Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."</td>
<td>".$ligne[CAR_CHAMPS_CODE_POSTAL]."&nbsp;</td>
<td>".uc_latin1($ligne[CAR_CHAMPS_VILLE])."&nbsp;</td>
</tr>\n";
}
$res.="</tbody></table></div>\n";
if ($mailer==1) {
if (!is_array($select)) {
$res.= CAR_NO_DESTINATAIRE;
} else {
$res .= envoie_mail($GLOBALS['car_db']) ;
}
} else {
$res .=carto_texte_cocher() ;
}
$res .= carto_formulaire($titre_mail, $corps) ;
}
}
?>