Files
ms1inscription-v5/inc_list_donnateurs.php
2026-05-13 09:43:32 -04:00

342 lines
13 KiB
PHP

<?php
/*
function fxGetchamps($clef) {
$sql = "SELECT * FROM config_tableau WHERE clef = '" . $objDatabase->fxEscape($clef) . "' ORDER BY trie";
$rec = $objDatabase->fxGetResults($sql);
if ($rec===null){
$sql = "SELECT * FROM config_tableau WHERE clef = 'LISTEDONATEURGENERIQUE' ORDER BY trie";
$rec = $objDatabase->fxGetResults($sql);
}
return $rec;
}
function fxchecklangue($strtab,$i,$langues) {
if ($strtab[$i]['info1langue'] == 1)
return $strtab[$i]['info1'] . "_" . $langues;
else
return $strtab[$i]['info1'];
}
function fxGetquery($clef,$eve_id) {
$sql = "SELECT query_query FROM config_query WHERE query_clef = '" . $objDatabase->fxEscape($clef) . "' limit 1";
$rec = $objDatabase->fxGetVar($sql);
if ($rec===null){
$sql = "SELECT query_query FROM config_query WHERE query_clef = 'rapportdonationGENERIQUE' limit 1";
$rec = $objDatabase->fxGetVar($sql);
$rec = str_replace('%eve_id%', $eve_id, $rec);
}
return $rec;
}
function fxlistepreuves($evenement,$langue,$mem_selected) {
require_once('php/inc_dons.php');
// $sql = "SELECT * FROM inscriptions_panier_epreuves WHERE pan_id = " . $evenement . " ORDER BY epr_type_" . $langue;
// $sql = "SELECT * FROM inscriptions_panier_epreuves WHERE pan_id = " . $evenement . " ORDER BY epr_type_" . $langue;
$list_exeption='';
$sqlex = "SELECT * from config_query_exep where type_exep='remove' and eve_id= " . $evenement;
$recex = $objDatabase->fxGetRow($sqlex);
if ($recex)
$list_exeption="ipe.epr_id not in (". $recex['sql'].") and " ;
// $list_exeptionadd='';
$sqlex = "SELECT * from config_query_exep where type_exep='add' and eve_id= " . $evenement;
$list_exeptionadd = $objDatabase->fxGetResults($sqlex);
// if ($recex)
// $list_exeption="ipe.epr_id not in (". $recex['sql'].") and " ;
$sql = "SELECT * FROM inscriptions_panier_epreuves_commandees ipec LEFT JOIN inscriptions_panier_epreuves ipe on ipe.epr_id= ipec.epr_id where ".$list_exeption." eve_id= " . $evenement . " group by ipec.epr_id ORDER BY epr_type_" . $langue;
$rec = $objDatabase->fxGetResults($sql);
if ($mem_selected == "")
$mem_select = ' selected="selected"';
else
$mem_select = '';
$output = '<select name="rech_epreuve" id="epreuves">';
$output .= '<option value=""' . $mem_select . '>'. afficheTexte('tousinscription', 0) .'</option>';
for ($x = 1; $x <= count($rec); $x++) {
if ($mem_selected == $rec[$x]['epr_id'])
$mem_select = ' selected="selected"';
else
$mem_select = '';
$output .= '<option value="' . $rec[$x]['epr_id'] . '"' . $mem_select . '>' . $rec[$x]['epr_type_' . $langue] . "(" . $rec[$x]['epr_nom_' . $langue] . ')</option>';
}
for ($x = 1; $x <= count($list_exeptionadd); $x++) {
if ($mem_selected =="exp:".$list_exeptionadd[$x]['sql']. ':'.$list_exeptionadd[$x]['desc'])
$mem_select = ' selected="selected"';
else
$mem_select = '';
$output .= '<option value="' . "exp:".$list_exeptionadd[$x]['sql']. ':'.$list_exeptionadd[$x]['desc'].'"' . $mem_select . '> '.$list_exeptionadd[$x]['desc'].'</option>';
}
$output .='</select>';
return $output;
}
$strEpreuve = afficheTexte('toutlesepreuves',0);
$mem_where = '';
$mem_rech_epreuve = '';
// v?rifier les form POST
if (isset($_GET['rech_epreuve'])) {
if ($_GET['rech_epreuve'] != '') {
$exep=explode(":",$_GET['rech_epreuve']);
if (isset($exep[0]))
$expsuite= $exep[0];
else
$expsuite="";
if ($exep[0]=='exp'){
$mem_where .= ' and e.epr_id in( ' .$exep[1].')';
$strEpreuve=$exep[2];
$mem_rech_epreuve= $_GET['rech_epreuve'];
} else {
$mem_where .= ' and e.epr_id = ' . $_GET['rech_epreuve'];
$mem_rech_epreuve = $_GET['rech_epreuve'];
$mem_tabformat = "LISTEDONATEUREVE".$tabEvenement['general']['eve_id'];
$intEpreuve = $_GET['rech_epreuve'];
// trouver le nom de l'?preuve
foreach ($tabEvenement['epreuves'] as $tabEpreuves) {
if ($tabEpreuves['epr_id'] == $intEpreuve) {
$strEpreuve = fxUnescape($tabEpreuves['epr_type_' . $strLangue]);
if (trim($tabEpreuves['epr_nom_' . $strLangue]) != '')
$strEpreuve .= ' - ' . fxUnescape($tabEpreuves['epr_nom_' . $strLangue]);
}
}
}
} else
$mem_tabformat = "LISTEDONATEUR".$tabEvenement['general']['eve_id'];
}
$mem_rech_nom="";
if (isset($_GET['rech_nom'])) {
if($_GET['rech_nom'] != '') {
$mem_where .= " and concat(com_prenom,' ',com_nom) like '%" . $_GET['rech_nom'] . "%'" ;
$mem_rech_nom = $_GET['rech_nom'];
}
}
?>
<h1><?php afficheTexte('titrelistedonateurs'); ?></h1>
<?php
<form action="<?php echo $vDomaine; ?>/<?php echo $code; ?>/<?php if ($strLangue == 'fr') { ?>dons<?php } else { ?>donations<?php } ?>" id="frm_search" name="frm_search" method="get">
<input type="hidden" name="adm" value="<?php echo($stradm);?>">
<fieldset>
<div class="box_participant">
<div class="titre"><h2><?php if ($strLangue == 'fr') { ?>Recherche :<?php } else { ?>Search :<?php } ?></h2></div>
<label for="rech_nom" class="form"><?php afficheTexte('rech_nom'); ?> :</label>
<input type="text" name="rech_nom" value="<?php echo $mem_rech_nom; ?>">
<br>
<label for="rech_evenement" class="form"><?php afficheTexte('rech_evenement'); ?> :</label>
<?php echo fxlistepreuves($tabEvenement['general']['eve_id'], $strLangue, $mem_rech_epreuve); ?>
<br>
<label class="form"><span></span></label>
<button type="submit" id="btn_recherche" name="btn_recherche"><?php if ($strLangue == 'fr') { ?>Recherche<?php } else { ?>Search<?php } ?></button>
<br />
</div>
</fieldset>
</form>
<?php
if ($stradm != "") {
?>
<script type="text/javascript">
$().ready(function() {
$("#btn_resume").text("(<?php if ($strLangue == 'fr') { ?>cacher<?php } else { ?>hide<?php } ?>)");
$('#btn_resume').click(function(e){
e.preventDefault();
$("#bloc_resume").slideToggle(function() {
if ($(this).is(":visible"))
$("#btn_resume").text("(<?php if ($strLangue == 'fr') { ?>cacher<?php } else { ?>hide<?php } ?>)");
else if ($(this).is(":hidden"))
$("#btn_resume").text("(<?php if ($strLangue == 'fr') { ?>afficher<?php } else { ?>show<?php } ?>)");
});
});
});
</script>
<?php
//r?sumer par evenement
$sql = fxGetquery("totaldonation".$tabEvenement['general']['eve_id'],$tabEvenement['general']['eve_id']);
$strliste = $objDatabase->fxGetResults($sql);
$strtab = fxGetchamps("LISTETOTALEVE".$tabEvenement['general']['eve_id_don']);
echo '<h2>'.afficheTexte('listeparticipantsresume',0).' <a id="btn_resume" href="#"></a></h2><br>';
echo '<div id="bloc_resume">';
$strResults = '<table class="resultats"><tr class="HeaderRow">';
//entete pour le tableau
for ($i = 1; $i <= count($strtab); $i++)
$strResults .= '<td id="' . $strtab[$i]['info1'] . '" style="text-align: left; width: ' . $strtab[$i]['info3'] . ';">' . $strtab[$i]['info2_' . $strLangue] . '</td>';
//contenue le tableau
for ($x = 1; $x <= count($strliste); $x++) {
$mem_odd = ($x & 1) ? '<tr class="OddRow">' : '<tr class="EvenRow">';
$strResults .= $mem_odd;
for ($i = 1; $i <= count($strtab); $i++) {
if ($strtab[$i]['multiple'] == 1) {
$mem_field = preg_split('/,/', $strtab[$i]['info1']);
$mem_affiche = $strliste[$x][$mem_field[0]] . ' ' . $strliste[$x][$mem_field[1]];
} else
$mem_affiche = $strliste[$x][fxchecklangue($strtab, $i, $strLangue)];
// if ($mem_lientours == "TRUE" && trim($strtab[$i]['lien']) <> "") {
// if (trim($strclassement[$x][$strtab[$i]['info1']]) == "") {
//$mem_param = '?equipe=' . $strclassement[$x]['Id_Numero'] . '&amp;tabformat=' . $mem_tabformat . 'TOUR&amp;lang=' . $lang . '&where=' . $mem_whereorg . '&nocoursse=' . $mem_nocoursse . '&nocoursseorg=' . $mem_nocoursseorg . '&rettabformat=' . $mem_tabformat;
// $mem_affiche = '<a href="' . trim($strtab[$i]['lien']) . $mem_param . '"> ' . $strtab[$i]['info2_' . $lang] . '</a>';
// }
// }
if ($strLangue == 'fr')
$MEM_SUITE = 'inscrits';
else
$MEM_SUITE='registered';
$strResults .= '<td style="text-align: left;" class=""><a href="' . $vDomaine . '/' . $code . '/' . $MEM_SUITE . '?rech_epreuve=' . $strliste[$x]['epr_id'] . '">' . $mem_affiche . '</a></td>';
}
$strResults .= "</tr>";
}
$strResults .= "</table>";
echo $strResults;
echo '</div>';
}
//liste des participants
$sql = fxGetquery("rapportdonnation".$tabEvenement['general']['eve_id_don'],$tabEvenement['general']['eve_id_don']);
$sql = str_replace('%where%', $mem_where, $sql);
$strliste = $objDatabase->fxGetResults($sql);
$strtab = fxGetchamps($mem_tabformat);
echo '<br><h2>' . $strEpreuve . '</h2>';
if ($stradm!="")
echo '<h2>' . afficheTexte('nombreinscription', 0) . ' ' . count($strliste) . '</h2><br>';
$strResults = '<table align="center" class="resultats"><tr class="HeaderRow">';
//entete pour le tableau
for ($i = 1; $i <= count($strtab); $i++)
$strResults .= '<td id="' . $strtab[$i]['info1'] . '" style="text-align: left; width: ' . $strtab[$i]['info3'] . ';">' . $strtab[$i]['info2_' . $strLangue] . '</td>';
// contenue le tableau
for ($x = 1; $x <= count($strliste); $x++) {
$mem_odd = ($x & 1) ? '<tr class="OddRow">' : '<tr class="EvenRow">';
$strResults .= $mem_odd;
for ($i = 1; $i <= count($strtab); $i++) {
// stephan MSIN-2002
if ($strtab[$i]['convert']=='dons'){
$mem_field = preg_split('/,/',$strtab[$i]['info1']);
$mem_affiche = fxGetLinksDonationParticipant($strliste[$x][ $mem_field[0]], $strliste[$x][ $mem_field[1]], $strLangue);
$mem_affiche = '<a href="' . $vDomaine . '/' . $mem_affiche['link'] . '">' . $mem_affiche['label'] . '</a>';
} else {
if ($strtab[$i]['multiple']==1) {
$mem_field=preg_split('/,/',$strtab[$i]['info1']);
$mem_affiche = $strliste[$x][ $mem_field[0]].' '.$strliste[$x][ $mem_field[1]];
} else
$mem_affiche = $strliste[$x][ fxchecklangue($strtab,$i,$strLangue)];
}
$strResults .= '<td style="text-align: left;" class="">' . $mem_affiche . '</td>';
}
$strResults .= "</tr>";
}
$strResults .= "</table>";
echo $strResults;
*/
require_once 'php/inc_dons.php';
// récupérer les donnnées get
if (!empty($_GET['pec_id']))
$intEpreuveCommandee = $_GET['pec_id'];
else
$intEpreuveCommandee = '';
if (!empty($_GET['par_id']))
$intParticipant = $_GET['par_id'];
else
$intParticipant = '';
if ($strLangue == 'fr')
$strPageDon = 'don';
else
$strPageDon = 'donate';
$arrDonateurs = fxGetDonateurs($tabEvenement['general']['eve_id_don'], $intEpreuveCommandee, $intParticipant);
?>
<h1><?php afficheTexte('titrelistedonateurs'); ?></h1>
<table align="center" class="resultats">
<tr class="HeaderRow">
<td><?php afficheTexte('liste_donateurs_donateur'); ?></td>
<?php
if (trim($intParticipant) == '' && trim($intEpreuveCommandee) == '') {
?>
<td><?php afficheTexte('liste_donateurs_participant'); ?></td>
<td><?php afficheTexte('liste_donateurs_equipe'); ?></td>
<?php
}
?>
<td><?php afficheTexte('liste_donateurs_montant'); ?></td>
</tr>
<?php
for ($intCtr = 1; $intCtr <= count($arrDonateurs); $intCtr++) {
?>
<tr class="<?php if ($intCtr % 2 ) { ?>OddRow<?php } else { ?>EvenRow<?php } ?>">
<td style="text-align: left;">
<?php
if ($arrDonateurs[$intCtr]['pd_anonyme'] == 1) {
afficheTexte('dons_anonyme');
} else {
echo fxUnescape($arrDonateurs[$intCtr]['com_nom']), ', ' . fxUnescape($arrDonateurs[$intCtr]['com_prenom']);
}
?>
</td>
<?php
if (trim($intParticipant) == '' && trim($intEpreuveCommandee) == '') {
?>
<td style="text-align: left;"><?php echo fxUnescape($arrDonateurs[$intCtr]['par_nom']), ', ' . fxUnescape($arrDonateurs[$intCtr]['par_prenom']); ?></td>
<td style="text-align: left;"><?php echo fxUnescape($arrDonateurs[$intCtr]['pec_nom_equipe']); ?></td>
<?php
}
?>
<td style="text-align: right;"><?php echo fxShowPrix($arrDonateurs[$intCtr]['pd_montant'], $strLangue); ?></td>
</tr>
<?php
}
?>
</table>
<br>
<p>
<a href="<?php echo $vDomaine . '/' . $strPageDon . '/' . $tabEvenement['general']['eve_label_url'] . '/' . $intEpreuveCommandee; if (trim($intParticipant) != '') { echo '/' . $intParticipant; } ?>"><?php if ($strLangue == 'fr') { echo 'retour à la page de don'; } else { echo 'return to the donation page'; } ?></a>
</p>