379 lines
21 KiB
PHP
379 lines
21 KiB
PHP
<?php
|
|
require_once('php/inc_start_time.php');
|
|
require_once('php/inc_fonctions.php');
|
|
require_once('php/inc_fx_messages.php');
|
|
require_once('php/inc_fx_reserver.php');
|
|
require_once('php/inc_fx_panier.php');
|
|
|
|
global $vPaypal_devise,$vPage, $vDomaine, $vblnEnvironementDev, $strCode,$vPaypaladv,$vPaypaladv_SANDBOX;
|
|
$arrEvenementDon = $arrDonation = $arrDonation = $tabEvenement = null;
|
|
$strPage = "dons.php";
|
|
|
|
// récupérer le paramètre de langue, français par défaut
|
|
if (!empty($_GET['lang']))
|
|
$strLangue = $_GET['lang'];
|
|
else
|
|
$strLangue = 'fr';
|
|
|
|
$_SESSION['lang'] = $strLangue;
|
|
|
|
// 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 (!empty($_GET['plus']))
|
|
$intPlus = 1;
|
|
else
|
|
$intPlus = 0;
|
|
|
|
$vtexte_page = obtenirTextepage($vPage, $strLangue, 2);
|
|
|
|
// récupérer le code et les infos de l'événement
|
|
if (!empty($_GET['code'])) {
|
|
$strCode = $code = $_GET['code'];
|
|
$tabEvenement = fxGetEvenements($strCode, $strLangue);
|
|
|
|
if (intval($tabEvenement['general']['eve_id']) == 646 && trim($intParticipant) == '') { // patch pour défi 808 2021
|
|
$intParticipant = fxGetParticipantSolo($intEpreuveCommandee);
|
|
}
|
|
|
|
$arrDonation = fxGetDonation($intEpreuveCommandee, $intParticipant);
|
|
|
|
// trouver le nom de l'épreuve
|
|
if ($arrDonation != null) {
|
|
$arrEvenementDon = fxGetEvenements(fxGetEvenementsUrl($arrDonation['evenement']['eve_id_don']), $strLangue);
|
|
|
|
foreach ($tabEvenement['epreuves'] as $tabEpreuves) {
|
|
if ($tabEpreuves['epr_id'] == $arrDonation['equipe']['epr_id']) {
|
|
if (trim($tabEpreuves['epr_categorie_' . $strLangue]) != '') {
|
|
$strEpreuve = $tabEpreuves['epr_categorie_' . $strLangue] . ' - ';
|
|
} else {
|
|
$strEpreuve = '';
|
|
}
|
|
|
|
$strEpreuve .= fxUnescape($tabEpreuves['epr_type_' . $strLangue]);
|
|
|
|
if (trim($tabEpreuves['epr_nom_' . $strLangue]) != '' )
|
|
$strEpreuve .= ' - ' . fxUnescape($tabEpreuves['epr_nom_' . $strLangue]);
|
|
}
|
|
}
|
|
} else {
|
|
echo 'ERREUR!';
|
|
exit;
|
|
}
|
|
}
|
|
|
|
// si le code est vide ou bien que l'événement n'existe pas, retourner à la page d'accueil
|
|
if (empty($_GET['code']) || !isset($_GET['pec_id']) || $tabEvenement == null) {
|
|
header('Location: ' . $vDomaine);
|
|
exit;
|
|
}
|
|
|
|
$strLienFr = "/don/" . $strCode . "/" . $intEpreuveCommandee;
|
|
$strLienEn = "/donate/" . $strCode . "/" . $intEpreuveCommandee;
|
|
|
|
if ($intParticipant != '') {
|
|
$strLienFr .= '/' . $intParticipant;
|
|
$strLienEn .= '/' . $intParticipant;
|
|
}
|
|
|
|
$strMetaTitle = fxRemoveHtml(fxUnescape($tabEvenement['general']['eve_nom_' . $strLangue]) . $strEpreuve);
|
|
$strMetaDescription = fxGetNbWords(fxUnescape($tabEvenement['general']['eve_description_' . $strLangue]), 50);
|
|
$keywords = fxRemoveHtml(fxUnescape($tabEvenement['general']['eve_keywords_' . $strLangue]));
|
|
//OPEN GRAPH VALUES
|
|
if (trim($tabEvenement['general']['eve_og_image']) != '') {
|
|
$strOGImage = $GLOBALS['vDomaine'] . '/images/evenements/' . fxUnescape($tabEvenement['general']['eve_og_image']);
|
|
}
|
|
if (trim($tabEvenement['general']['eve_og_title_' . $strLangue]) != '') {
|
|
$strOGTitle = fxUnescape($tabEvenement['general']['eve_og_title_' . $strLangue]);
|
|
}
|
|
if (trim($tabEvenement['general']['eve_og_description_' . $strLangue]) != '') {
|
|
$strOGDescription = fxUnescape($tabEvenement['general']['eve_og_description_' . $strLangue]);
|
|
}
|
|
|
|
require_once("inc_header.php");
|
|
?>
|
|
<div id="page">
|
|
<div id="main">
|
|
<div class="container bg-white p-3 p-xl-5">
|
|
|
|
|
|
<?php
|
|
// MSIN-4172
|
|
// text
|
|
if (intval($tabEvenement['general']['eve_id_don']) > 0) {
|
|
$sqlText_dons = "SELECT * from inscriptions_evenements WHERE eve_id = " . intval($tabEvenement['general']['eve_id_don']);
|
|
$arrText_dons = $objDatabase->fxGetRow($sqlText_dons);
|
|
|
|
$strText = $arrText_dons["eve_details_reserver_" . $strLangue];
|
|
echo("<div class='m-3 text-left'>");
|
|
echo $strText;
|
|
echo("</div>");
|
|
}
|
|
?>
|
|
|
|
<h2><?php echo $strEpreuve ; ?></h2>
|
|
<?php
|
|
if (isset($_SESSION['msg']) && $_SESSION['msg'] != '') {
|
|
echo fxMessage($_SESSION['msg']);
|
|
}
|
|
|
|
echo $strDonation = fxShowDonation($arrDonation, $strLangue);
|
|
|
|
// afficher le formulaire du participant
|
|
if ($strDonation != '') {
|
|
$tabInscription = $tabParticipant = $tabPartQuestions = $tabEpreuveQuestions = $tabInfosEpreuve = array();
|
|
$tabChampsValues = fxGetInfosChamps($arrEvenementDon['general']['eve_id'], 'com');
|
|
$tabEpreuve = fxGetEpreuve($arrDonation['evenement']['epr_id_don']); // trouver les infos de l'épreuve
|
|
$tabDates = fxGetDatesAge($arrDonation['evenement']['epr_id_don']);
|
|
|
|
if (isset($_SESSION['com_id'])) {
|
|
echo fxcreatejavachange($tabChampsValues['champs'] . ",com_id_1" , $tabChampsValues['values'].",com_id", 'compte', 'change_value_compte()', $_SESSION['com_info']);
|
|
}
|
|
|
|
$arrDonateurs = fxGetDonateurs($arrEvenementDon['general']['eve_id'], $intEpreuveCommandee, $intParticipant);
|
|
$intTopDonateur = 3;
|
|
|
|
if ($arrDonateurs != null) {
|
|
$intNbDonnateurs = count($arrDonateurs);
|
|
|
|
if ($intTopDonateur > $intNbDonnateurs || $intPlus == 1) {
|
|
$intTopDonateur = $intNbDonnateurs;
|
|
}
|
|
|
|
if ($strLangue == 'fr') {
|
|
$strPageDon = 'dons';
|
|
$strLien = $strLienFr;
|
|
} else {
|
|
$strPageDon = 'donations';
|
|
$strLien = $strLienEn;
|
|
}
|
|
?>
|
|
<div class="card box_participant mb-3">
|
|
<div class="card-header">
|
|
<h2><?php afficheTexte('dons_titrelistedonateurs'); ?></h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= $intTopDonateur; $intCtr++) {
|
|
?>
|
|
<dl class="border-bottom row m-0">
|
|
<dt class="col-9">
|
|
<?php
|
|
if ($arrDonateurs[$intCtr]['pd_anonyme'] == 1) {
|
|
afficheTexte('dons_anonyme');
|
|
} else {
|
|
if (trim($arrDonateurs[$intCtr]['pd_nom']) != '') {
|
|
echo fxUnescape($arrDonateurs[$intCtr]['pd_nom']);
|
|
} else {
|
|
echo fxUnescape($arrDonateurs[$intCtr]['com_nom']), ', ' . fxUnescape($arrDonateurs[$intCtr]['com_prenom']);
|
|
}
|
|
}
|
|
?>
|
|
</dt>
|
|
<dd class="col-3 text-right">
|
|
<?php echo fxShowPrix($arrDonateurs[$intCtr]['pd_montant'], $strLangue); ?>
|
|
</dd>
|
|
</dl>
|
|
<?php
|
|
}
|
|
if ($intNbDonnateurs > $intTopDonateur) {
|
|
?>
|
|
<div class="mt-3">
|
|
<?php /* <a href="<?php echo $vDomaine . '/' . $tabEvenement['general']['eve_label_url'] . '/' . $strPageDon . '?pec_id=' . $intEpreuveCommandee . '&par_id=' . $intParticipant; ?>"><?php afficheTexte('dons_voir-tous-donateurs'); ?></a> */ ?>
|
|
<a class="btn btn-secondary rounded-0" href="<?php echo $strLien; ?>?plus=1"><?php afficheTexte('dons_voir-tous-donateurs'); ?></a>
|
|
</div>
|
|
<?php
|
|
} else {
|
|
if ($intPlus == 1) {
|
|
?>
|
|
<div class="mt-3">
|
|
<a class="btn btn-secondary rounded-0" href="<?php echo $strLien; ?>"><?php afficheTexte('dons_voir-moins-donateurs'); ?></a>
|
|
</div>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
<form action="<?php echo $vDomaine; ?>/paiement_redirect.php" id="frm_dons" name="frm_dons" method="post">
|
|
<input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response">
|
|
<div class="card box_participant mb-3">
|
|
<div class="card-header">
|
|
<h2><?php afficheTexte('dons_montant'); ?></h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="form-group row">
|
|
<label for="sel_don" class="control-label col-12 col-lg-3 text-lg-right">
|
|
<?php afficheTexte('dons_montant'); ?>
|
|
<span class="d-inline-block d-lg-none">*</span>
|
|
</label>
|
|
<div class="col-12 col-lg-7">
|
|
<select class="form-control rounded-0" id="sel_don" name="sel_don" required>
|
|
<option value="" selected="selected"><?php if ($strLangue == 'fr') { ?>-- Faites un choix --<?php } else { ?>-- Choose one --<?php } ?></option>
|
|
<option value="5"><?php echo fxShowPrix(5, $strLangue); ?></option>
|
|
<option value="10"><?php echo fxShowPrix(10, $strLangue); ?></option>
|
|
<option value="25"><?php echo fxShowPrix(25, $strLangue); ?></option>
|
|
<option value="50"><?php echo fxShowPrix(50, $strLangue); ?></option>
|
|
<option value="75"><?php echo fxShowPrix(75, $strLangue); ?></option>
|
|
<option value="100"><?php echo fxShowPrix(100, $strLangue); ?></option>
|
|
<option value="250"><?php echo fxShowPrix(250, $strLangue); ?></option>
|
|
<option value="500"><?php echo fxShowPrix(500, $strLangue); ?></option>
|
|
<option value="other"><?php if ($strLangue == 'fr') { ?>Autre<?php } else { ?>Other<?php } ?></option>
|
|
</select>
|
|
</div>
|
|
<div class="col-lg-2 d-none d-lg-inline-block">*</div>
|
|
</div>
|
|
<?php // TODOsl: valider le contenu de ce champs ?>
|
|
<div id="div_txt_don" style="display: none;">
|
|
<div class="form-group row">
|
|
<label class="control-label col-12 col-lg-3 text-lg-right" for="txt_don">
|
|
<?php afficheTexte('dons_montant_autre'); ?>
|
|
<span class="d-inline-block d-lg-none">*</span>
|
|
</label>
|
|
<div class="col-12 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="txt_don" name="txt_don" placeholder="<?php afficheTexte('dons_montant_autre-placeholder'); ?>" required>
|
|
</div>
|
|
<div class="col-lg-2 d-none d-lg-inline-block">*</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
if ($arrEvenementDon['general']['eve_question_recu_don'] == '1') {
|
|
?>
|
|
<div class="form-group row">
|
|
<label class="control-label col-12 col-lg-3 text-lg-right" for="sel_recu">
|
|
<?php afficheTexte('dons_recu'); ?>
|
|
<span class="d-inline-block d-lg-none">*</span>
|
|
</label>
|
|
<div class="col-12 col-lg-7">
|
|
<select class="form-control rounded-0" id="sel_recu" name="sel_recu" required>
|
|
<option value="" selected="selected"><?php if ($strLangue == 'fr') { ?>-- Faites un choix --<?php } else { ?>-- Choose one --<?php } ?></option>
|
|
<option value="1"><?php if ($strLangue == 'fr') { ?>Oui<?php } else { ?>Yes<?php } ?></option>
|
|
<option value="0"><?php if ($strLangue == 'fr') { ?>Non<?php } else { ?>No<?php } ?></option>
|
|
</select>
|
|
</div>
|
|
<div class="col-lg-2 d-none d-lg-inline-block">*</div>
|
|
</div>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<input type="hidden" id="sel_recu" name="sel_recu" value="0">
|
|
<?php
|
|
}
|
|
?>
|
|
<div class="form-group row">
|
|
<label class="control-label col-12 col-lg-3 text-lg-right" for="sel_anonyme">
|
|
<?php afficheTexte('dons_anonymous'); ?>
|
|
<span class="d-inline-block d-lg-none">*</span>
|
|
</label>
|
|
<div class="col-12 col-lg-7">
|
|
<select class="form-control rounded-0" id="sel_anonyme" name="sel_anonyme" required>
|
|
<option value="" selected="selected"><?php if ($strLangue == 'fr') { ?>-- Faites un choix --<?php } else { ?>-- Choose one --<?php } ?></option>
|
|
<option value="1"><?php if ($strLangue == 'fr') { ?>Oui<?php } else { ?>Yes<?php } ?></option>
|
|
<option value="0"><?php if ($strLangue == 'fr') { ?>Non<?php } else { ?>No<?php } ?></option>
|
|
</select>
|
|
</div>
|
|
<div class="col-lg-2 d-none d-lg-inline-block">*</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<input type="hidden" id="eve_id" name="eve_id" value="<?php echo $tabEvenement['general']['eve_id']; ?>">
|
|
<input type="hidden" id="eve_prefixe" name="eve_prefixe" value="<?php echo $arrEvenementDon['general']['eve_prefixe']; ?>">
|
|
<input type="hidden" id="eve_id_don" name="eve_id_don" value="<?php echo $arrDonation['evenement']['eve_id_don']; ?>">
|
|
<input type="hidden" id="epr_id" name="epr_id" value="<?php echo $arrDonation['evenement']['epr_id_don']; ?>">
|
|
<input type="hidden" id="pec_id" name="pec_id" value="<?php echo $arrDonation['equipe']['pec_id_original']; ?>">
|
|
<input type="hidden" id="par_id" name="par_id" value="<?php if (isset($arrDonation['participant'])) { echo $arrDonation['participant']['par_id_original']; } else { echo 0; } ?>">
|
|
<?php
|
|
// initialiser les variables
|
|
$strRules = $strMessages = '';
|
|
$tabCalendriers = $tabCodepostal = $tabTelephones = array();
|
|
|
|
$tabProvinces = fxGetProvinces(0, $strLangue); // récupérer les provinces
|
|
$tabInfos = fxGetInfosParticipants($arrEvenementDon['general']['eve_id']); // récupérer les infos à demander aux participants
|
|
$tabPays = fxGetPays(0, $strLangue); // récupérer les pays
|
|
|
|
$tabQuestionsParticipant = fxGetQuestions('par', $arrEvenementDon['general']['eve_id'], $arrDonation['evenement']['epr_id_don'], 'add'); // récupérer les questions à demander aux participants
|
|
$tabQuestionsEpreuve = fxGetQuestions('epr', $arrEvenementDon['general']['eve_id'], $arrDonation['evenement']['epr_id_don'], 'add'); // récupérer les questions à demander pour l'épreuve
|
|
?>
|
|
<div class="card box_participant mb-3" id="box_participant_1">
|
|
<input type="hidden" id="com_id_1" name="com_id_1" value="">
|
|
<div class="card-header">
|
|
<h2><?php afficheTexte('dons_donateur'); ?></h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<?php fxShowInfosParticipants($tabRules, $tabMessages, $tabCalendriers, $tabInfos, $tabDates, $tabProvinces, $tabPays, $tabEpreuve, $tabParticipant, 1, 1, 'add', '', '', '', $strLangue, 0, true, $tabCodepostal, $tabTelephones); ?>
|
|
</div>
|
|
<?php
|
|
if (isset($tabInscription['participants']))
|
|
$intNbInscriptions = count($tabInscription['participants']);
|
|
else
|
|
$intNbInscriptions = 0;
|
|
|
|
fxShowQuestions($tabRules, $tabMessages, $tabQuestionsParticipant, $tabEpreuve, $tabPartQuestions, 1, 1, 'add', $strLangue, $intNbInscriptions, 0, $tabCodepostal, $tabTelephones);
|
|
?>
|
|
</div>
|
|
<br>
|
|
<?php // MSIN-3855
|
|
// ajouter switch pour paypaladvance
|
|
if ($vPaypaladv) {
|
|
echo fxShowBlocPaiementpaypaladvance($tabEvenement,1, $strLangue);
|
|
?>
|
|
<div class="text-center">
|
|
<button type="button" id="card-field-submit-button" name="card-field-submit-button"
|
|
class="btn btn-primary rounded-0 mb-2"<?php echo $strDisabled; ?>>
|
|
|
|
<i class="fa fa-credit-card mr-2" aria-hidden="true"></i>
|
|
<?php if ($strLangue == 'fr') { ?>Faire un don<?php } else { ?>Donate<?php } ?>
|
|
|
|
</button>
|
|
<div id="paypal-button-container" style="<?php echo $strDisabledpaypal; ?>"></div>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
} else {
|
|
echo fxShowBlocPaiement($tabEvenement, 1, $strLangue);
|
|
?> <div class="text-center">
|
|
<button type="submit" id="btn_dons" name="btn_dons" class="btn btn-primary rounded-0 mb-2">
|
|
<i class="fa fa-cart-arrow-down mr-2" aria-hidden="true"></i>
|
|
<?php if ($strLangue == 'fr') { ?>Faire un don<?php } else { ?>Donate<?php } ?>
|
|
</button>
|
|
</div>
|
|
<?php
|
|
} ?>
|
|
|
|
|
|
|
|
|
|
|
|
</form>
|
|
<p> </p>
|
|
<?php
|
|
if ($strLangue == 'fr') {
|
|
?>
|
|
<p><strong>* Ces cases sont obligatoires.</strong></p>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<p><strong>* These fields are mandatory. If you do not fill them, your registration may not be well recorded.</strong></p>
|
|
<?php
|
|
}
|
|
?>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php require_once("inc_footer.php");
|