Files
ms1inscription-v5/php/inc_fx_compte.php
stephan 5936cdb61c Add legacy promoteur functionality and migration enhancements
This commit introduces several enhancements related to the legacy promoteur system. It adds a new function to check if the legacy promoteur site is enabled and updates various functions to utilize this check, ensuring that legacy features are only accessible when appropriate. Additionally, it refines the migration process for legacy accounts, including improved handling of migration statistics and event access. The admin interface is updated to reflect these changes, enhancing the overall management of legacy promoteur accounts. The version code is updated to reflect these changes.
2026-07-01 14:14:25 -04:00

2796 lines
147 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// fonction qui affiche le formulaire du compte client (SL)
// param : tableau contenant les infos du compte client, action (add/mod), langue d'affichage
// créé : 2013-04-18
function fxShowFormCompte($tabCompte, $strAction, $strLangue)
{
global $vDomaine;
// sortir la liste des provinces et des pays
$tabProvinces = fxGetProvinces(0, $strLangue);
$tabPays = fxGetPays(0, $strLangue);
$type = $strAction;
if ($type == 'addaffilie' || $type == 'add' || $type == 'checkout')
$mem_btn = "btn_save";
else
$mem_btn = "btn_mod";
?>
<script type="text/javascript">
$(function () {
var validator = $("#frm_compte").validate({
ignore: ".ignore,:hidden:not(input[type='hidden'])",
rules: {
/*com_naissance: {
dateCA: true
},*/
com_courriel: {
remote: "<?php echo $vDomaine; ?>/ajax_verif_courriel.php"
},
com_telephone1: {phoneUS: true},
com_telephone2: {phoneUS: true},
com_contact_urgence_telephone: {phoneUS: true},
com_courriel_confirm: {equalTo: "#com_courriel"},
<?php
if ($type == 'mod') {
?>
old_com_password: {
required: function (element) {
return $("#com_password_a").val().length > 0;
},
remote: "<?php echo $vDomaine; ?>/ajax_verif_password.php?id=<?php echo $_SESSION['com_id']; ?>"
},
<?php
}
if ($type == 'add' || $type == 'checkout') {
?>
com_password_a: {
required: true,
minlength: 6
},
<?php
} else {
?>
com_password_a: {
required: function (element) {
return $("#old_com_password").val().length > 0;
},
minlength: 6
},
<?php
}
?>
com_password_b: {
<?php
if ($type == 'add' || $type == 'checkout') {
?>
required: true,
<?php
}
?>
equalTo: "#com_password_a"
}
},
messages: {
com_prenom: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer le prénom<?php } else { ?>Please enter the first name<?php } ?>",
com_nom: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer le nom de famille<?php } else { ?>Please enter the last name<?php } ?>",
com_naissance_year: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer l'année de naissance<?php } else { ?>Please enter the birth year<?php } ?>",
com_naissance_month: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer le mois de naissance<?php } else { ?>Please enter the birth month<?php } ?>",
com_naissance_day: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer le jour de naissance<?php } else { ?>Please enter the birth day<?php } ?>",
/*com_naissance: {
required: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer la date de naissance<?php } else { ?>Please enter the birthdate<?php } ?>",
dateCA: "<?php if ($strLangue == 'fr') { ?>La date de naissance doit être sous le format AAAA-MM-JJ<?php } else { ?>The birthdate must be in the format YYYY-MM-DD<?php } ?>"
},*/
com_sexe: "<?php if ($strLangue == 'fr') { ?>Veuillez choisir le sexe<?php } else { ?>Please choose the gender<?php } ?>",
com_adresse: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer l'adresse<?php } else { ?>Please enter the address<?php } ?>",
com_ville: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer la ville<?php } else { ?>Please enter the city<?php } ?>",
pro_id: "<?php if ($strLangue == 'fr') { ?>Veuillez choisir la province<?php } else { ?>Please choose the province<?php } ?>",
com_codepostal: {required: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer le code postal/zip<?php } else { ?>Please enter the postal/zip code<?php } ?>"/*, postalZipCode: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer un code postal/zip valide<?php } else { ?>Please enter a valid postal/zip code<?php } ?>" */},
com_telephone1: {
required: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer le numéro de téléphone<?php } else { ?>Please enter the phone number<?php } ?>",
phoneUS: "<?php if ($strLangue == 'fr') { ?>Le numéro de téléphone doit être sous le format 555-555-5555<?php } else { ?>The phone number must be under the format 555-555-5555<?php } ?>"
},
com_telephone2: {phoneUS: "<?php if ($strLangue == 'fr') { ?>Le numéro de téléphone doit être sous le format 555-555-5555<?php } else { ?>The phone number must be under the format 555-555-5555<?php } ?>"},
com_contact_urgence_telephone: {phoneUS: "<?php if ($strLangue == 'fr') { ?>Le numéro de téléphone doit être sous le format 555-555-5555<?php } else { ?>The phone number must be under the format 555-555-5555<?php } ?>"},
old_com_password: {
required: "<?php if ($strLangue == 'fr') { ?>L'ancien mot de passe est requis pour changer de mot de passe<?php } else { ?>---<?php } ?>",
remote: "<?php if ($strLangue == 'fr') { ?>Pas le bon mot de passe<?php } else { ?>not proper password<?php } ?>",
minlength: "<?php if ($strLangue == 'fr') { ?>Minimum 6 caracteres<?php } else { ?>not proper password<?php } ?>"
},
com_courriel: {
required: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer le courriel<?php } else { ?>Please enter the email<?php } ?>",
email: "<?php if ($strLangue == 'fr') { ?>Le courriel doit être une adresse valide<?php } else { ?>The email must be a valid address<?php } ?>",
remote: "<?php if ($strLangue == 'fr') { ?>Ce courriel est déjà utilisé, veuillez en choisir un autre<?php } else { ?>This email is already in use, please choose another one<?php } ?>"
},
com_courriel_confirm: {
required: "<?php if ($strLangue == 'fr') { ?>Veuillez confirmer le courriel<?php } else { ?>Please confirm the email<?php } ?>",
email: "<?php if ($strLangue == 'fr') { ?>Le courriel doit être une adresse valide<?php } else { ?>The email must be a valid address<?php } ?>",
equalTo: "<?php if ($strLangue == 'fr') { ?>La confirmation et le courriel ne correspondent pas<?php } else { ?>The confirmation and email don't match<?php } ?>"
},
<?php
if ($type == 'add' || $type == 'checkout') {
?>
com_password_a: {
required: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer un mot de passe<?php } else { ?>Please enter a password<?php } ?>",
minlength: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer 6 caractères minimum<?php } else { ?>Please enter at least 6 characters<?php } ?>"
},
<?php
}
?>
com_password_b: {
<?php
if ($type == 'add' || $type == 'checkout') {
?>
required: "<?php if ($strLangue == 'fr') { ?>Veuillez confirmer le mot de passe<?php } else { ?>Please confirm the password<?php } ?>",
<?php
}
?>
equalTo: "<?php if ($strLangue == 'fr') { ?>La confirmation et le mot de passe ne correspondent pas<?php } else { ?>The confirmation and password don't match<?php } ?>"
},
com_login: {
required: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer un nom d'utilisateur<?php } else { ?>Please enter a username<?php } ?>",
remote: "<?php if ($strLangue == 'fr') { ?>Ce nom d'utilisateur est déjà utilisé, veuillez en choisir un autre<?php } else { ?>This username is already in use, please choose another one<?php } ?>"
}
}
});
function checkDays() {
var daysInMonth = new Date($('#com_naissance_year').val(), $('#com_naissance_month').val(), 0).getDate();
if ($('#com_naissance_day').val() > daysInMonth) {
$('#com_naissance_day').val(daysInMonth);
}
$('#com_naissance_day option:gt(' + (daysInMonth) + ')').attr('disabled', true);
}
function fxSetDateInput() { // mettre la date modifiée dans le input du calendrier
$('#com_naissance').val($('#com_naissance_year').val() + '-' + $('#com_naissance_month').val() + '-' + $('#com_naissance_day').val());
}
$('#com_naissance_year').change(function () {
$('#com_naissance_month option').removeAttr('disabled'); // Enable all months
$('#com_naissance_month').change(); // Cascade changes
checkDays(); // Ensure only valid dates
fxSetDateInput();
validator.element("#com_naissance");
});
$('#com_naissance_month').change(function () {
$('#com_naissance_day option').removeAttr('disabled'); // Enable all days
checkDays(); // Ensure only valid dates
fxSetDateInput();
validator.element("#com_naissance");
});
$('#com_naissance_day').change(function () {
fxSetDateInput();
validator.element("#com_naissance");
});
<?php
if ($type == 'mod') {
?>
$("#com_password_a").blur(function () {
$("#old_com_password").valid();
});
$("#frm_compte").valid();
<?php
} elseif ($tabCompte != 2) {
?>
$("#frm_compte").valid();
<?php
}
?>
$('#com_courriel').on('keyup', function (e) {
$('#com_login').text($('#com_courriel').val());
});
$("#com_telephone1,#com_telephone2,#com_contact_urgence_telephone").mask('000-000-0000');
// RECAPTCHA V3
$('#<?php echo $mem_btn; ?>').click(function () {
var form_compte = $('#frm_compte');
if (form_compte.valid()) {
var $preloader = $('#preloader');
var $preloader_text = $('#preloader_text');
$preloader_text.html('<?php afficheTexte('preloader_wait', 1, 0, 1); ?>');
$preloader.show();
grecaptcha.ready(function () {
grecaptcha.execute('<?php echo RECAPTCHA_SITE_KEY; ?>', {action: '<?php echo $strAction . '_compte'; ?>'}).then(function (token) {
document.getElementById('g-recaptcha-response').value = token;
form_compte.submit();
$('body').css('cursor', 'wait');
});
});
}
});
});
</script>
<form action="<?php echo $vDomaine; ?>/<?php if ($strLangue == 'fr') { ?>compte<?php } else { ?>account<?php } ?>"
id="frm_compte" name="frm_compte" method="post">
<input type="hidden" name="form_action" value="<?php echo urlencode(base64_encode($strAction . '-compte')); ?>">
<input type="hidden" name="form_id" value="<?php echo urlencode(base64_encode($tabCompte['com_id'])); ?>">
<input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response">
<?php
if ($type == 'checkout') {
?>
<input type="hidden" id="txt_panier" name="txt_panier" value="<?php echo $tabCompte['no_panier']; ?>">
<?php
}
if ($strAction == 'mod') {
$strReadOnly = " readonly ";
$strDisable = "disabled";
$steStyle = 'STYLE="background-color: #8b8989;"';
} else {
$strReadOnly = "";
$strDisable = "";
$steStyle = ' ';
} ?>
<div class="form-group row">
<?php $strAsterix = '<small id="com_prenom_HelpInline" class="text-muted">*</small>'; ?>
<label for="com_prenom" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_prenom'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_prenom', $type, $tabCompte); ?> maxlength="50"
required <?php echo $strDisable; ?>>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<?php $strAsterix = '<small id="com_nom_HelpInline" class="text-muted">*</small>'; ?>
<label for="com_nom" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_nom'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_nom', $type, $tabCompte); ?> maxlength="50"
required <?php echo $strDisable; ?>>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<?php $strAsterix = '<small id="com_naissance_HelpInline" class="text-muted">*</small>'; ?>
<label for="com_naissance" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_naissance'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col col-lg-2">
<select class="form-control rounded-0" id="com_naissance_year" name="com_naissance_year"
required <?php echo $strDisable; ?> >
<option value=""
selected="selected"><?php if ($strLangue == 'fr') { ?>-- Année --<?php } else { ?>-- Year --<?php } ?></option>
<?php
$strAnneeDebut = date('Y', strtotime('-90 year'));
$strAnneeCourante = date('Y', strtotime('-1 year'));
if ($tabCompte != 2)
$tabNaissance = explode('-', $tabCompte['com_naissance']);
for ($intCtr3 = $strAnneeCourante; $intCtr3 >= $strAnneeDebut; $intCtr3--) {
$mem_selected = '';
if (isset($tabNaissance[0])) {
if ($intCtr3 == $tabNaissance[0])
$mem_selected = "selected='selected'";
}
?>
<option value="<?php echo $intCtr3; ?>"<?php echo $mem_selected ?> <?php echo fxFormFieldChecklist('com_naissance', $type, $tabCompte, $intCtr3, '') ?>><?php echo $intCtr3; ?></option>
<?php
}
?>
</select>
</div>
<div class="col col-lg-3">
<select class="form-control rounded-0" id="com_naissance_month" name="com_naissance_month"
required <?php echo $strDisable; ?> >
<option value=""
selected="selected"><?php if ($strLangue == 'fr') { ?>-- Mois --<?php } else { ?>-- Month --<?php } ?></option>
<?php
for ($intCtr3 = 1; $intCtr3 <= 12; $intCtr3++) {
if (strlen($intCtr3) < 2)
$strValue = '0' . $intCtr3;
else
$strValue = $intCtr3;
$mem_selected = '';
if (isset($tabNaissance[1])) {
if ($intCtr3 == $tabNaissance[1])
$mem_selected = "selected='selected'";
}
?>
<option value="<?php echo $strValue; ?>" <?php echo $mem_selected; ?>><?php echo fxMois(date('Y-m-d', strtotime('2000-' . $strValue . '-01')), $strLangue); ?></option>
<?php } ?>
</select>
</div>
<div class="col col-lg-2">
<select class="form-control rounded-0" id="com_naissance_day" name="com_naissance_day"
required <?php echo $strDisable; ?>>
<option value=""
selected="selected"><?php if ($strLangue == 'fr') { ?>-- Jour --<?php } else { ?>-- Day --<?php } ?></option>
<?php
for ($intCtr3 = 1; $intCtr3 <= 31; $intCtr3++) {
if (strlen($intCtr3) < 2)
$strValue = '0' . $intCtr3;
else
$strValue = $intCtr3;
?>
<option value="<?php echo $strValue; ?>"<?php if (isset($tabNaissance) && isset($tabNaissance[2]) && $tabNaissance[2] == $strValue) { ?> selected="selected" <?php } ?>><?php echo $intCtr3; ?></option>
<?php
}
?>
</select>
<input type="hidden" id="com_naissance" name="com_naissance"
value="<?php if (isset($tabNaissance)) echo $tabCompte['com_naissance'] ?>">
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<?php $strAsterix = '<small id="com_sexe_HelpInline" class="text-muted">*</small>'; ?>
<label class="col-form-label col-12 col-lg-3 text-lg-right" for="com_sexe">
<?php afficheTexte('fiche_com_sexe'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<select class="form-control rounded-0" id="com_sexe" name="com_sexe"
required <?php echo $strDisable; ?>>
<option value=""<?php if ($strAction == 'add') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') { ?>-- Faites un choix --<?php } else { ?>-- Choose one --<?php } ?></option>
<option value="f" <?php echo fxFormFieldChecklist('com_sexe', $type, $tabCompte, 'f', ''); ?>><?php if ($strLangue == 'fr') { ?>Femme<?php } else { ?>Female<?php } ?></option>
<option value="h" <?php echo fxFormFieldChecklist('com_sexe', $type, $tabCompte, 'h', ''); ?>><?php if ($strLangue == 'fr') { ?>Homme<?php } else { ?>Male<?php } ?></option>
<option value="n" <?php echo fxFormFieldChecklist('com_sexe', $type, $tabCompte, 'n', ''); ?>><?php if ($strLangue == 'fr') { ?>Non-binaire<?php } else { ?>Non-binary<?php } ?></option>
<option value="a" <?php echo fxFormFieldChecklist('com_sexe', $type, $tabCompte, 'a', ''); ?>><?php if ($strLangue == 'fr') { ?>Autre<?php } else { ?>Other<?php } ?></option>
</select>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<?php $strAsterix = ''; ?>
<label for="com_adresse" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_adresse'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_adresse', $type, $tabCompte); ?> maxlength="100">
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<label for="com_adresse2"
class="col-form-label col-12 col-lg-3 text-lg-right"><?php afficheTexte('fiche_com_adresse2'); ?></label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_adresse2', $type, $tabCompte); ?> maxlength="100">
</div>
</div>
<div class="form-group row">
<?php $strAsterix = '<small id="com_ville_HelpInline" class="text-muted">*</small>'; ?>
<label for="com_ville" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_ville'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_ville', $type, $tabCompte); ?> maxlength="50"
required>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<?php $strAsterix = '<small id="pro_id_HelpInline" class="text-muted">*</small>'; ?>
<label for="pro_id" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_pro_id'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<select class="form-control rounded-0" id="pro_id" name="pro_id" required>
<option value=""<?php if ($strAction == 'add') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') { ?>-- Faites un choix --<?php } else { ?>-- Choose one --<?php } ?></option>
<?php
for ($intCtr = 1; $intCtr <= count($tabProvinces); $intCtr++) {
?>
<option data-test="<?php echo $tabCompte['pro_id'] ?>"
value="<?php echo $tabProvinces[$intCtr]['pro_id']; ?>" <?php if (isset($tabCompte['pro_id']) && $tabProvinces[$intCtr]['pro_id'] == $tabCompte['pro_id']) { ?> selected="selected"<?php } ?>><?php echo $tabProvinces[$intCtr]['pro_nom_' . $strLangue]; ?></option>
<?php
}
?>
</select>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<?php $strAsterix = '<small id="com_codepostal_HelpInline" class="text-muted">*</small>'; ?>
<label for="com_codepostal" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_codepostal'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_codepostal', $type, $tabCompte); ?> maxlength="7"
required>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<?php $strAsterix = '<small id="pay_id_HelpInline" class="text-muted">*</small>'; ?>
<label for="pay_id" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_pay_id'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<select class="form-control rounded-0" id="pay_id" name="pay_id" required>
<?php
for ($intCtr = 1; $intCtr <= count($tabPays); $intCtr++) {
?>
<option value="<?php echo $tabPays[$intCtr]['pay_id']; ?>"<?php echo fxFormFieldChecklist('pay_id', $type, $tabCompte, $tabPays[$intCtr]['pay_id'], 1); ?>><?php echo $tabPays[$intCtr]['pay_nom_' . $strLangue]; ?></option>
<?php
}
?>
</select>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<?php $strAsterix = '<small id="com_telephone1_HelpInline" class="text-muted">*</small>'; ?>
<label for="com_telephone1" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_telephone1'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_telephone1', $type, $tabCompte); ?> maxlength="12"
placeholder="514-555-1212" required>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<label for="com_telephone2"
class="col-form-label col-12 col-lg-3 text-lg-right"><?php afficheTexte('fiche_com_telephone2'); ?></label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_telephone2', $type, $tabCompte); ?> maxlength="12"
placeholder="514-555-1212">
</div>
</div>
<div class="form-group row">
<label for="com_contact_urgence_nom"
class="col-form-label col-12 col-lg-3 text-lg-right"><?php afficheTexte('com_contact_urgence_nom'); ?></label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_contact_urgence_nom', $type, $tabCompte); ?>
maxlength="100">
</div>
</div>
<div class="form-group row">
<label for="com_contact_urgence_telephone"
class="col-form-label col-12 col-lg-3 text-lg-right"><?php afficheTexte('com_contact_urgence_telephone'); ?></label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="text" <?php echo fxFormFieldInfo('com_contact_urgence_telephone', $type, $tabCompte); ?>
maxlength="12" placeholder="514-555-1212">
</div>
</div>
<?php
// membre affilie
if ($_SESSION['com_id'] == $tabCompte['com_id']) {
if ($type != 'mod') {
?>
<div class="form-group row">
<?php $strAsterix = '<small id="com_courriel_HelpInline" class="text-muted">*</small>'; ?>
<label for="com_courriel" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_courriel'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="email" <?php echo fxFormFieldInfo('com_courriel', $type, $tabCompte); ?>
maxlength="100" required>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<?php
} elseif ($type == 'mod') {
?>
<div class="form-group row">
<label for="com_courrieltxt"
class="col-form-label col-12 col-lg-3 text-lg-right"><?php afficheTexte('fiche_com_courriel_actuel'); ?></label>
<div class="col-12 col-lg-7">
<div class="form-text" id="com_courrieltxt"><?php echo $tabCompte['com_courriel']; ?></div>
</div>
</div>
<div class="form-group row">
<label for="com_courriel"
class="col-form-label col-12 col-lg-3 text-lg-right"><?php afficheTexte('fiche_com_courriel_new'); ?></label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="email" <?php echo fxFormFieldInfo('com_courriel', $type, 2); ?> maxlength="100">
</div>
</div>
<?php
}
}
// membre affilie
if ($_SESSION['com_id'] == $tabCompte['com_id']) {
?>
<div class="form-group row">
<?php
if ($type != 'mod') {
$strAsterix = '<small id="com_courriel_confirm_HelpInline" class="text-muted">*</small>';
} else {
$strAsterix = '';
}
?>
<label for="com_courriel_confirm" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_courriel_confirm'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0"
type="email" <?php echo fxFormFieldInfo('com_courriel_confirm', $type, $tabCompte); ?>
maxlength="100"<?php if ($strAction == 'add') { ?> required<?php } ?>>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<?php
}
?>
<div class="form-group row pb-5">
<?php $strAsterix = '<small id="com_langue_HelpInline" class="text-muted">*</small>'; ?>
<label for="com_langue" class="col-form-label col-12 col-lg-3 text-lg-right">
<?php afficheTexte('fiche_com_langue'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<select class="form-control rounded-0" id="com_langue" name="com_langue" required>
<option value="en" <?php echo fxFormFieldChecklist('com_langue', $type, $tabCompte, 'en', $strLangue); ?> ><?php if ($strLangue == 'fr') { ?>Anglais<?php } else { ?>English<?php } ?></option>
<option value="fr" <?php echo fxFormFieldChecklist('com_langue', $type, $tabCompte, 'fr', $strLangue); ?> ><?php if ($strLangue == 'fr') { ?>Fran&ccedil;ais<?php } else { ?>French<?php } ?></option>
</select>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<?php
// membre affilie
if ($_SESSION['com_id'] == $tabCompte['com_id']) {
if ($type != 'mod') {
?>
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right"
for="com_login"><?php afficheTexte('fiche_com_login'); ?></label>
<div class="col-12 col-lg-7">
<div class="form-text" id="com_login"><?php if ($tabCompte == 2) {
afficheTexte('fiche_creation_login');
} else {
echo $tabCompte['com_login'];
} ?></div>
</div>
</div>
<?php
} elseif ($type == 'mod') {
?>
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right"
for="com_login"><?php afficheTexte('fiche_com_login'); ?> :</label>
<div class="col-12 col-lg-7">
<div class="form-text" id="com_login"><?php echo $tabCompte['com_login']; ?></div>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right"
for="old_com_password"><?php afficheTexte('fiche_com_vieux_password'); ?> :</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0" type="password" id="old_com_password"
name="old_com_password">
</div>
</div>
<?php
}
}
// membre affilie
if ($_SESSION['com_id'] == $tabCompte['com_id']) {
?>
<div class="form-group row">
<?php
if ($type != 'mod') {
$strAsterix = '<small id="fiche_com_password_a_HelpInline" class="text-muted">*</small>';
} else {
$strAsterix = '';
}
?>
<label class="col-form-label col-12 col-lg-3 text-lg-right" for="com_password_a">
<?php afficheTexte('fiche_com_password_a'); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0" type="password" id="com_password_a" name="com_password_a">
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<div class="form-group row">
<?php
if ($type != 'mod') {
$strAsterix = '<small id="fiche_com_password_b_HelpInline" class="text-muted">*</small>';
} else {
$strAsterix = '';
}
?>
<label class="col-form-label col-12 col-lg-3 text-lg-right" for="com_password_b">
<?php
if ($type == 'mod')
afficheTexte('fiche_com_password_modif_b');
else
afficheTexte('fiche_com_password_new_b');
?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix; ?>
</span>
</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0" type="password" id="com_password_b" name="com_password_b">
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix; ?>
</div>
</div>
<?php } ?>
<div class="form-group row">
<div class="col-12 col-lg-7 offset-lg-4">
<button type="button" id="<?php echo $mem_btn ?>" name="<?php echo $mem_btn ?>" value="save"
class="btn btn-primary rounded-0"><?php afficheTexte('glogal_save', 1, 0, 1); ?> </button>
<?php
if ($strAction != 'add') {
?>
<button type="button" class="btn btn-secondary rounded-0 btn_page_prec"
data-code="<?php echo fxGetReferer(); ?>"><?php afficheTexte('btn_annulerinscriptions') ?></button>
<?php
}
?>
</div>
</div>
</form>
<?php
if ($strLangue == 'fr') {
?>
<div class="alert alert-warning my-3">
<strong>* Ces cases sont obligatoires.</strong>
</div>
<?php
} else {
?>
<div class="alert alert-warning my-3">
<strong>* These fields are mandatory.</strong>
</div>
<?php
}
}
// fonction qui ajoute ou modifie un compte client (SL)
// param : action (add/mod), infos du compte client, données POST, langue
// créé : 2013-04-18
function fxSetCompte($strAction, $tabCompte, $tabData, $strLangue)
{
global $objDatabase, $vDomaine, $vblnEnvironementDev, $vClient;
$autologin = $strStep = $code = '';
$ObjCaptcha = new \clsRecaptcha\clsRecaptcha();
$Retorno = $ObjCaptcha->fxGetCaptcha($_POST['g-recaptcha-response']);
if ($Retorno->success) {
// nouveau id
$mem_id = base64_decode(urldecode($tabData['form_id']));
switch ($strAction) {
case 'add': // AJOUT
$tabData['com_naissance'] = $tabData['com_naissance_year'] . "-" . $tabData['com_naissance_month'] . "-" . $tabData['com_naissance_day'];
$tabData['com_password'] = password_hash($tabData['com_password'], PASSWORD_DEFAULT); // faire un hash
$tabData['com_actif'] = 1; // activer le compte
// former le INSERT
$tabFieldsValues = fxListFieldsValues($tabData, 'com_id', 'inscriptions_comptes', $GLOBALS['arrConDatabaseMain']['db']);
// verification des champs obligatoire
$champsobligatoires = array('b' => "com_prenom", "com_nom", "com_naissance", "com_sexe", "com_adresse", "com_ville", "pro_id", "com_codepostal", "pay_id", "com_telephone1", "com_langue", "com_password", "com_login", "com_courriel");
if (count(array_intersect($tabFieldsValues['pasvide'], $champsobligatoires)) != count($champsobligatoires)) {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e101';
else
$_SESSION['msg'] = 'e501';
break;
}
// vérifie si le courrier et login existe
$sqlValide = "SELECT COUNT(com_courriel) FROM inscriptions_comptes WHERE (com_login = '" . $tabData['com_login'] . "' OR com_courriel = '" . $tabData['com_courriel'] . "') AND com_actif = 1";
$nbValide = $objDatabase->fxGetVar($sqlValide);
if ($nbValide > 0) {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e101';
else
$_SESSION['msg'] = 'e501';
break;
}
// insérer les infos du participants
$sqlInsert = "INSERT INTO inscriptions_comptes " . $tabFieldsValues['set'] . " ,com_creation = '" . fxGetDateTime() . "', com_ip = '" . $_SERVER['REMOTE_ADDR'] . "'";
$qryInsert = $objDatabase->fxQuery($sqlInsert);
// récupérer le id ajouté
$intCompte = $objDatabase->fxGetLastId();
// Associer le compte au no panier, si le client à choisit de créer un compe apr ès une commande
if (isset($tabData['txt_panier'])) {
$sqlUpdate = "UPDATE inscriptions_panier_acheteurs SET com_id = " . intval($intCompte) . " WHERE no_panier = '" . $tabData['txt_panier'] . "'";
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
$sqlUpdate = "UPDATE inscriptions_panier_epreuves_commandees SET com_id = " . intval($intCompte) . " WHERE no_panier = '" . $tabData['txt_panier'] . "'";
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
require_once 'inc_fx_panier.php';
fxMajCopieParticipantAcheteurCompte($tabData['txt_panier'], $intCompte);
}
// récupérer le code et les infos de l'événement
if (isset($_SESSION['eve_label_url'])) {
$code = $_SESSION['eve_label_url'];
$tabEvenement = fxGetEvenements($code, $strLangue);
}
if (isset($tabEvenement) && $tabEvenement['general']['eve_checkout_login'] == "1") {
// pas toujours
$autologin = true;
$sqlUpdate = "UPDATE inscriptions_comptes set com_actif = 1 where com_id = " . $intCompte;
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
// metre les info login
$sqlCourriel = "SELECT * FROM inscriptions_comptes WHERE com_id = " . $intCompte;
$infoCompte = $objDatabase->fxGetRow($sqlCourriel);
$_SESSION['com_id'] = $infoCompte['com_id'];
$_SESSION['com_prenom'] = $infoCompte['com_prenom'];
$_SESSION['vadmin_texte'] = false;
$_SESSION['com_info'] = $infoCompte;
// liste des compte affilie
$sqlAffilie = "SELECT * FROM inscriptions_comptes WHERE com_affilie = '" . $_SESSION['com_id'] . "'";
$infoAffilie = $objDatabase->fxGetResults($sqlAffilie);
$_SESSION['com_affilie'] = $infoAffilie;
// metre dans l'info compte la liste des evenement prive
$_SESSION['com_info']['eve_prive'] = explode(',', $infoCompte['com_eve_prive']);
header("Location: " . $vDomaine . '/panier/checkout/' . $code);
exit;
} else {
// envoyer un courriel de confirmation
if ($strLangue == 'fr') { // FRANCAIS
$subject = "Veuillez confirmer votre adresse courriel";
$message = 'Bonjour ' . $tabData['com_prenom'] . ',<br><br>Merci d\'avoir créé votre compte sur ' . $vClient . '.<br>Veuillez cliquer sur le bouton ci-dessous afin de confirmer votre adresse courriel.';
$attachment_url = $vDomaine . '/compte.php?valider&courriel=' . $tabData['com_courriel'] . '&id=' . $intCompte;
$attachment_label = "Confirmez ici";
// $datetime = 'Message envoyé automatiquement le: ' . fxShowDate(fxGetDate(), $strLangue) . ' @ ' . fxGetTime();
} else { // ANGLAIS
$subject = "Please confirm your email address";
$message = 'Hello ' . $tabData['com_prenom'] . ',<br><br>Thank you for creating your account on ' . $vClient . '.<br>Please click the button below to confirm your email address.';
$attachment_url = $vDomaine . '/compte.php?valider&lang=en&courriel=' . $tabData['com_courriel'] . '&id=' . $intCompte;
$attachment_label = "Confirm here";
// $datetime = 'Auto-message sent on: ' . fxRemoveHtml(fxShowDate(fxGetDate(), $strLangue)) . ' @ ' . fxGetTime();
}
$body = fxGetMailFormat(false, false, true, false, $strLangue);
$body = str_replace('%logo%', $vDomaine . '/images/logoms1inscription.png', $body);
$body = str_replace('%to_mail%', $tabData['com_courriel'], $body);
$body = str_replace('%subject%', $subject, $body);
$body = str_replace('%message%', $message, $body);
$body = str_replace('%attachment_url%', $attachment_url, $body);
$body = str_replace('%attachment_label%', $attachment_label, $body);
$ok = fxSendMail($subject, $body, $tabData['com_courriel'], $tabData['com_prenom'] . ' ' . $tabData['com_nom'], $GLOBALS['vEmail'], $GLOBALS['vClient'], 1, 0);
// définir le message à affiche
if ($strLangue == 'fr')
$_SESSION['msg'] = 'm109';
else
$_SESSION['msg'] = 'm509';
// définir la prochaine étape
$strStep = 'login';
}
// récupérer les infos mises à jour
$sqlCourriel = "SELECT * FROM inscriptions_comptes WHERE com_id=" . $intCompte;
$infoCompte = $objDatabase->fxGetRow($sqlCourriel);
if ($infoCompte != null) {
$_SESSION['com_prenom'] = $infoCompte['com_prenom'];
$_SESSION['com_info'] = $infoCompte;
}
break;
case 'addaffilie': // ajour dun membre addaffilie
$tabData['com_naissance'] = $tabData['com_naissance_year'] . "-" . $tabData['com_naissance_month'] . "-" . $tabData['com_naissance_day'];
// $tabData['com_password'] = password_hash($tabData['com_password'], PASSWORD_DEFAULT); // faire un hash
$tabData['com_actif'] = 1; // activer le compte
$tabData['com_affilie'] = $_SESSION['com_id'];
// former le INSERT
$tabFieldsValues = fxListFieldsValues($tabData, 'com_id', 'inscriptions_comptes', $GLOBALS['arrConDatabaseMain']['db']);
// verification des champs obligatoire
$champsobligatoires = array('b' => "com_prenom", "com_nom", "com_naissance", "com_sexe", "com_langue");
//$champsobligatoires = array('b' => "com_prenom", "com_nom", "com_naissance", "com_sexe", "com_adresse", "com_ville", "pro_id", "com_codepostal", "pay_id", "com_telephone1", "com_langue");
if (count(array_intersect($tabFieldsValues['pasvide'], $champsobligatoires)) != count($champsobligatoires)) {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e101';
else
$_SESSION['msg'] = 'e501';
break;
}
// insérer les infos du participants
$sqlInsert = "INSERT INTO inscriptions_comptes " . $tabFieldsValues['set'] . " ,com_creation = '" . fxGetDateTime() . "', com_ip = '" . $_SERVER['REMOTE_ADDR'] . "'";
$qryInsert = $objDatabase->fxQuery($sqlInsert);
// récupérer le id ajouté
$intCompte = $objDatabase->fxGetLastId();
// récupérer les infos mises à jour
// liste des compte affilie
$sqlAffilie = "SELECT * FROM inscriptions_comptes WHERE com_affilie = '" . $_SESSION['com_id'] . "'";
$infoAffilie = $objDatabase->fxGetResults($sqlAffilie);
$_SESSION['com_affilie'] = $infoAffilie;
break;
case 'mod': // MODIFICATION
if (!isset($mem_id)) {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e101';
else
$_SESSION['msg'] = 'e501';
break;
}
if (isset($tabData['com_password'])) { // si le mot de passea changé, faire un hash
$tabData['com_password'] = password_hash($tabData['com_password'], PASSWORD_DEFAULT);
}
$tabFieldsValues = fxListFieldsValues($tabData, 'com_id', 'inscriptions_comptes', $GLOBALS['arrConDatabaseMain']['db']);
// verification des champs obligatoire
$champsobligatoires = array('b' => "com_telephone1", "com_langue");
//$champsobligatoires = array('b' => "com_adresse", "com_ville", "pro_id", "com_codepostal", "pay_id", "com_telephone1", "com_langue");
if (count(array_intersect($tabFieldsValues['pasvide'], $champsobligatoires)) != count($champsobligatoires)) {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e101';
else
$_SESSION['msg'] = 'e501';
break;
}
// $tabData['com_naissance'] = $tabData['com_naissance_year'] . "-" . $tabData['com_naissance_month'] . "-" . $tabData['com_naissance_day'];
$tabFieldsValues = fxListFieldsValues($tabData, 'com_id', 'inscriptions_comptes', $GLOBALS['arrConDatabaseMain']['db']);
// update les infos du participants
$sqlUpdate = "UPDATE inscriptions_comptes " . $tabFieldsValues['set'] . ", com_maj = now() where com_id=" . $mem_id;
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
if ($qryUpdate == false) { // S'il y a eu erreur lors de mise à jour du compte, log du SQL
fxcreer_log("ERREUR SQL UPDATE - fxSetCompte('" . $strAction . "')" . $sqlUpdate);
}
// récupérer les infos mises à jour
$sqlCourriel = "SELECT * FROM inscriptions_comptes WHERE com_id=" . $_SESSION['com_id'];
$infoCompte = $objDatabase->fxGetRow($sqlCourriel);
// voir si on modifi le compte looger
if ($mem_id == $_SESSION['com_id']) {
if ($infoCompte != null) {
$_SESSION['com_prenom'] = $infoCompte['com_prenom'];
$_SESSION['com_info'] = $infoCompte;
}
}
// définir le message à affiche
if ($strLangue == 'fr')
$_SESSION['msg'] = 'm113';
else
$_SESSION['msg'] = 'm513';
// définir la prochaine étape
$strStep = 'accueil';
break;
}
} else {
}
if ($strLangue == 'fr')
$strPage = 'compte';
else
$strPage = 'account';
header("Location: " . $vDomaine . '/' . $strPage . '/' . $strStep . "?reloadinf=true&autologin=" . $autologin);
exit;
}
// Valider le nouveau compte client
function fxValiderCompte($strLangue = 'fr')
{
global $objDatabase, $vDomaine;
if (isset($_GET['courriel']) && isset($_GET['id'])) {
$sqlClient = "SELECT com_id FROM inscriptions_comptes WHERE com_courriel = '" . $objDatabase->fxEscape($_GET['courriel']) . "' AND com_id = " . intval($_GET['id']);
$nbClient = $objDatabase->fxGetRow($sqlClient);
// vérifier si un autre compte avec ce courriel a déjà été activé
$sqlClientActif = "SELECT COUNT(com_id) FROM inscriptions_comptes WHERE com_courriel = '" . $objDatabase->fxEscape($_GET['courriel']) . "' AND com_id <> " . intval($_GET['id']) . " AND com_actif = 1";
$nbClientActif = $objDatabase->fxGetVar($sqlClientActif);
// si compte avec ce courriel est déjà activé
if ($nbClientActif > 0) { // afficher erreur et lien pour retrouver mot de passe
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e146';
else
$_SESSION['msg'] = 'e546';
} else { // Activer compte
if (isset($nbClient['com_id'])) {
$sqlUpdate = "UPDATE inscriptions_comptes SET com_confirme = 1, com_actif = 1 WHERE com_courriel = '" . $objDatabase->fxEscape($_GET['courriel']) . "' AND com_id = " . intval($_GET['id']);
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
if ($qryUpdate == false) { // S'il y a eu erreur lors de mise à jour du compte, log du SQL
fxcreer_log("ERREUR SQL UPDATE - fxValiderCompte()" . $sqlUpdate);
}
if ($strLangue == 'fr')
$_SESSION['msg'] = 'p111';
else
$_SESSION['msg'] = 'p511';
} else {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e106';
else
$_SESSION['msg'] = 'e506';
}
}
} else {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e106';
else
$_SESSION['msg'] = 'e506';
}
if ($strLangue == 'fr')
$strPage = 'compte';
else
$strPage = 'account';
$strStep = 'login';
header("Location: " . $vDomaine . '/' . $strPage . '/' . $strStep);
exit;
}
function fxShowFormPassword($strLangue)
{
global $vDomaine;
?>
<script type="text/javascript">
$(function () {
$("#frm_password").validate({
messages: {
txt_courriel: {
required: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer votre courriel<?php } else { ?>Please enter your email<?php } ?>",
email: "<?php if ($strLangue == 'fr') { ?>Le courriel doit être une adresse valide<?php } else { ?>The email must be a valid address<?php } ?>"
}
}
});
// RECAPTCHA V3
$('#btn_password').click(function () {
var form_compte = $('#frm_password');
if (form_compte.valid()) {
var $preloader = $('#preloader');
var $preloader_text = $('#preloader_text');
$preloader_text.html('<?php afficheTexte('preloader_wait', 1, 0, 1); ?>');
$preloader.show();
grecaptcha.ready(function () {
grecaptcha.execute('<?php echo RECAPTCHA_SITE_KEY; ?>', {action: 'password'}).then(function (token) {
document.getElementById('g-recaptcha-response').value = token;
form_compte.submit();
$('body').css('cursor', 'wait');
});
});
}
});
});
</script>
<?php
if (isset($_SESSION['msg']))
echo fxMessage($_SESSION['msg']);
?>
<form action="<?php echo $vDomaine; ?>/<?php if ($strLangue == 'fr') { ?>compte/motdepasse<?php } else { ?>account/motdepasse<?php } ?>"
id="frm_password" name="frm_password" method="post">
<input type="hidden" name="form_action" value="<?php echo urlencode(base64_encode('password')); ?>">
<input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response">
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right"
for="txt_courriel"><?php if ($strLangue == 'fr') { ?>Courriel<?php } else { ?>Email<?php } ?>
:</label>
<div class="col-12 col-lg-7">
<input type="email" id="txt_courriel" name="txt_courriel" class="form-control rounded-0" autofocus
required>
</div>
</div>
<div class="form-group row">
<div class="col-12 col-lg-7 offset-lg-3">
<button type="button" id="btn_password" name="btn_password"
class="btn btn-primary rounded-0"><?php if ($strLangue == 'fr') { ?>Envoyer<?php } else { ?>Send<?php } ?></button>
</div>
</div>
</form>
<?php
}
function fxCourrielPerduCompte($strLangue)
{
global $objDatabase, $vDomaine, $vClient;
$ObjCaptcha = new \clsRecaptcha\clsRecaptcha();
$Retorno = $ObjCaptcha->fxGetCaptcha($_POST['g-recaptcha-response']);
if ($Retorno->success) {
$sqlClient = "SELECT com_id, com_nom, com_prenom, com_password, com_courriel, com_login FROM inscriptions_comptes WHERE com_courriel = '" . $objDatabase->fxEscape($_POST['txt_courriel']) . "' AND com_actif = 1";
$infoCompte = $objDatabase->fxGetRow($sqlClient);
if ($infoCompte == null) {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e115';
else
$_SESSION['msg'] = 'e515';
} else {
$strToken = uniqid('', true);
$strDate = fxGetDateTime();
$sqlUpdate = "UPDATE inscriptions_comptes SET com_reset_token = '$strToken', com_reset_date = '$strDate' WHERE com_id = " . intval($infoCompte['com_id']);
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
if ($strLangue == 'fr') { // FRANÇAIS
$subject = "Réinitialiser votre mot de passe";
$message = 'Bonjour ' . fxUnescape($infoCompte['com_prenom']) . ',<br><br>suite à votre demande, voici un lien temporaire pour réinitialiser votre mot de passe:<br><br>Nom d\'usager:<br>' . $infoCompte['com_login'] . '<br><br>Cliquez le bouton ci-dessous pour réinitialiser votre mot de passe.';
$attachment_url = $vDomaine . '/compte/reset?t=' . $strToken . '&m=' . $infoCompte['com_courriel'] . '&id=' . $infoCompte['com_id'];
$attachment_label = "Réinitialsez ici";
$_SESSION['msg'] = 'm114';
} else { // ANGLAIS
$subject = "Reset your password";
$message = 'Hello ' . fxUnescape($infoCompte['com_prenom']) . ',<br><br>following your request, here is a temporary link to reset your password:<br><br>Username:<br>' . $infoCompte['com_login'] . '<br><br>Click the button below to reset your password.';
$attachment_url = $vDomaine . '/account/reset?t=' . $strToken . '&m=' . $infoCompte['com_courriel'] . '&id=' . $infoCompte['com_id'];
$attachment_label = "Reset here";
$_SESSION['msg'] = 'm514';
}
$body = fxGetMailFormat(false, false, true, false, $strLangue);
$body = str_replace('%logo%', $vDomaine . '/images/logoms1inscription.png', $body);
$body = str_replace('%to_mail%', $infoCompte['com_courriel'], $body);
$body = str_replace('%subject%', $subject, $body);
$body = str_replace('%message%', $message, $body);
$body = str_replace('%attachment_url%', $attachment_url, $body);
$body = str_replace('%attachment_label%', $attachment_label, $body);
$blnMail = fxSendMail($subject, $body, $infoCompte['com_courriel'], $infoCompte['com_prenom'] . ' ' . $infoCompte['com_nom'], $GLOBALS['vEmail'], $GLOBALS['vClient'], 1, 0);
if (!$blnMail) {
fxcreer_log('ERREUR - Demande de password (' . $objDatabase->fxEscape($_POST['txt_courriel']) . ')');
}
}
} else {
}
if ($strLangue == 'fr')
$strPage = 'compte';
else
$strPage = 'account';
header("Location: " . $vDomaine . '/' . $strPage . '/login');
exit;
}
function fxLoginCompte($infoLogin, $strLangue)
{
global $objDatabase, $vDomaine;
$arrRetour = array();
$arrRetour['state'] = 'error';
$mem_retour = isset($infoLogin['url_retour']) ? $infoLogin['url_retour'] : '';
if ($mem_retour && isset($infoLogin['com_id'])) {
$sqlCourriel = "SELECT * FROM inscriptions_comptes WHERE com_id = " . intval($infoLogin['com_id']);
$infoCompte = $objDatabase->fxGetRow($sqlCourriel);
$infoLogin['txt_password'] = $infoCompte['com_password'];
} else {
$sqlCourriel = "SELECT * FROM inscriptions_comptes WHERE com_login = '" . $objDatabase->fxEscape($infoLogin['txt_login']) . "' AND com_actif = 1";
$infoCompte = $objDatabase->fxGetRow($sqlCourriel);
}
if ($infoCompte != null) {
if (strcasecmp($infoLogin['txt_password'], $infoCompte['com_password']) == 0) {
$blnSuccess = true;
$strHashPassword = ', com_password = ' . password_hash($infoLogin['txt_password'], PASSWORD_DEFAULT) . "'"; // faire un hash
} else {
$blnSuccess = password_verify($infoLogin['txt_password'], $infoCompte['com_password']);
$strHashPassword = '';
}
if ($blnSuccess) {
// mettre à jour le ip et la date de dernière visite
$arrRetour['state'] = $sqlUpdate = "UPDATE inscriptions_comptes SET com_ip = '" . $_SERVER['REMOTE_ADDR'] . "', com_lastvisit = '" . fxGetDateTime() . "'$strHashPassword WHERE com_id = " . intval($infoCompte['com_id']);
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
if ($qryUpdate == false) { // S'il y a eu erreur lors de mise à jour du compte, log du SQL
fxcreer_log("ERREUR SQL UPDATE - fxLoginCompte()" . $sqlUpdate);
}
//$_SESSION['logged'] = 1;
$_SESSION['com_id'] = $infoCompte['com_id'];
$_SESSION['vadmin_texte'] = false;
$_SESSION['com_info'] = $infoCompte;
// liste des compte affilie
$sqlAffilie = "SELECT * FROM inscriptions_comptes WHERE com_affilie = '" . $_SESSION['com_id'] . "'";
$infoAffilie = $objDatabase->fxGetResults($sqlAffilie);
$_SESSION['com_affilie'] = $infoAffilie;
if ($infoCompte['com_admin'] == 1) {
// pour afficher le débug des text
$_SESSION['vadmin_texte'] = true;
}
// Associer le compte au no panier, si le client à choisit de créer un compe apr ès une commande
if (isset($_SESSION['no_panier'])) {
$tabData['txt_panier'] = $_SESSION['no_panier'];
$mem_panierinfo = fxNbItemsPanier($_SESSION['no_panier']);
$intNbItems = $mem_panierinfo['nbitem'];
$intCompte = $infoCompte['com_id'];
if ($intNbItems > 0) {
$sqlUpdate = "UPDATE inscriptions_panier_acheteurs SET com_id = " . intval($intCompte) . " WHERE no_panier = '" . $tabData['txt_panier'] . "'";
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
$sqlUpdate = "UPDATE inscriptions_panier_epreuves_commandees SET com_id = " . intval($intCompte) . " WHERE no_panier = '" . $tabData['txt_panier'] . "'";
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
require_once 'inc_fx_panier.php';
fxMajCopieParticipantAcheteurCompte($tabData['txt_panier'], $intCompte);
}
}
// metre dans l'info compte la liste des evenement prive
$_SESSION['com_info']['eve_prive'] = explode(',', $infoCompte['com_eve_prive']);
$arrRetour['state'] = 'true';
//MSIN-4339
if (!empty($_SESSION['redirect_after_login'])) {
$url = $_SESSION['redirect_after_login'];
unset($_SESSION['redirect_after_login']);
header("Location: " . $url);
exit;
}
} else {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e112';
else
$_SESSION['msg'] = 'e512';
}
} else {
if ($strLangue == 'fr')
$_SESSION['msg'] = 'e112';
else
$_SESSION['msg'] = 'e512';
}
if ($infoLogin['url_retour'] != '') {
if ($infoLogin['url_retour'] == 'admin') {
return $arrRetour;
} else {
header("Location: " . $infoLogin['url_retour']);
}
} else {
if ($strLangue == 'fr')
$strPage = 'compte';
else
$strPage = 'account';
if (($arrRetour['state'] ?? '') === 'true' && !empty($infoCompte['com_id'])) {
require_once dirname(__FILE__) . '/inc_fx_promoteur_hub.php';
if (fxPromoteurHubShouldUse($infoCompte['com_id'])) {
header('Location: ' . fxPromoteurHubUrl($strLangue));
exit;
}
}
//header("Location: " . $vDomaine . '/' . $strPage);
header("Location: " . fxGetReferer());
}
exit;
}
function fxLogout($strLangue = 'fr')
{
global $vDomaine;
$tabSuperAdmin = array();
if (!empty($_SESSION['usa_id'])) {
$tabSuperAdmin = array(
'usa_id' => $_SESSION['usa_id'],
'usa_info' => $_SESSION['usa_info'] ?? null,
'logged' => $_SESSION['logged'] ?? time(),
);
}
unset($_SESSION['com_id']);
unset($_SESSION['com_info']);
unset($_SESSION['com_prenom']);
unset($_SESSION['vadmin_texte']);
unset($_SESSION['url_retour']);
unset($_SESSION['msg_erreur']);
unset($_SESSION['promoteur_eve_id']);
unset($_SESSION['epr_id_bib']);
unset($_SESSION['com_affilie']);
$strNoPanier = $_SESSION['no_panier'] ?? null;
$_SESSION = array();
$_SESSION['date_maj'] = time();
foreach ($tabSuperAdmin as $strKey => $mixValue) {
if ($mixValue !== null) {
$_SESSION[$strKey] = $mixValue;
}
}
if ($strLangue == 'fr') {
$strPage = 'compte';
} else {
$strPage = 'account';
}
if ($strNoPanier !== null && $strNoPanier !== '') {
fxViderPanier($strNoPanier, 1);
}
if (!empty($_GET['redirect']) && $_GET['redirect'] === 'mobile') {
$strTarget = $vDomaine . ($strLangue === 'en' ? '/mobile/en' : '/mobile');
header('Location: ' . $strTarget);
exit;
}
header('Location: ' . $vDomaine . '/' . $strPage);
exit;
}
function fxShowFormReset($arrData, $strLangue)
{
global $vDomaine, $objDatabase;
$blnErreur = false;
$sqlCourriel = "SELECT * FROM inscriptions_comptes WHERE com_reset_token = '" . $objDatabase->fxEscape($arrData['t']) . "' AND com_courriel = '" . $objDatabase->fxEscape($arrData['m']) . "' AND com_actif = 1 AND com_id = " . intval($arrData['id']);
$infoCompte = $objDatabase->fxGetRow($sqlCourriel);
if ($infoCompte != null) {
if (true) {
?>
<script type="text/javascript">
$(function () {
$("#frm_reset").validate({
rules: {
com_password_a: {
minlength: 6
},
com_password_b: {
equalTo: "#com_password_a"
}
},
messages: {
com_password_a: {
required: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer un mot de passe<?php } else { ?>Please enter a password<?php } ?>",
minlength: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer 6 caractères minimum<?php } else { ?>Please enter at least 6 characters<?php } ?>"
},
com_password_b: {
required: "<?php if ($strLangue == 'fr') { ?>Veuillez confirmer le mot de passe<?php } else { ?>Please confirm the password<?php } ?>",
equalTo: "<?php if ($strLangue == 'fr') { ?>La confirmation et le mot de passe ne correspondent pas<?php } else { ?>The confirmation and password don't match<?php } ?>"
}
}
});
});
</script>
<?php
if (isset($_SESSION['msg']))
echo fxMessage($_SESSION['msg']);
?>
<div class="mb-5">
<form action="<?php echo $vDomaine; ?>/<?php if ($strLangue == 'fr') { ?>compte/reset<?php } else { ?>account/reset<?php } ?>"
id="frm_reset" name="frm_reset" method="post">
<input type="hidden" name="form_action" value="<?php echo urlencode(base64_encode('reset')); ?>">
<input type="hidden" name="t" value="<?php echo $arrData['t']; ?>">
<input type="hidden" name="m" value="<?php echo $arrData['m']; ?>">
<input type="hidden" name="id" value="<?php echo $arrData['id']; ?>">
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right"
for="com_password_a"><?php afficheTexte('fiche_com_password_a'); ?> :</label>
<div class="col-12 col-lg-3">
<input type="password" id="com_password_a" name="com_password_a" maxlength="20"
class="form-control" required>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right"
for="com_password_b"><?php afficheTexte('fiche_com_password_new_b'); ?></label>
<div class="col-12 col-lg-3">
<input type="password" id="com_password_b" name="com_password_b" maxlength="20"
class="form-control" required>
</div>
</div>
<div class="form-group row">
<div class="col-12 col-lg-3 offset-lg-4">
<button type="submit" id="btn_reset" name="btn_reset" class="btn btn-primary rounded-0">
<?php if ($strLangue == 'fr') { ?>Enregistrer<?php } else { ?>Save<?php } ?>
</button>
</div>
</div>
</form>
</div>
<?php
} else { // ERREUR demande de réinitialisation expirée
$blnErreur = true;
$_SESSION['msg'] = 'e210';
}
} else { // ERREUR compte introuvable
$blnErreur = true;
$_SESSION['msg'] = 'e209';
}
if ($blnErreur) { // si erreur, redirection
if ($strLangue == 'fr')
$strPage = 'compte';
else
$strPage = 'account';
?>
<script type="text/javascript">
document.location.href = '<?php echo $vDomaine . '/' . $strPage; ?>';
</script>
<?php
exit;
}
}
function fxResetPassword($arrData, $strLangue)
{
global $vDomaine, $objDatabase;
$strPassword = password_hash($objDatabase->fxEscape($arrData['com_password_a']), PASSWORD_DEFAULT);
$sqlUpdate = "UPDATE inscriptions_comptes SET com_password = '" . $strPassword . "' WHERE com_reset_token = '" . $objDatabase->fxEscape($arrData['t']) . "' AND com_courriel = '" . $objDatabase->fxEscape($arrData['m']) . "' AND com_actif = 1 AND com_id = " . intval($arrData['id']);
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
if ($qryUpdate !== false) { // succès
$_SESSION['msg'] = 'p211';
} else { // erreur
$_SESSION['msg'] = 'e212';
}
// redirection
if ($strLangue == 'fr')
$strPage = 'compte';
else
$strPage = 'account';
?>
<script type="text/javascript">
document.location.href = '<?php echo $vDomaine . '/' . $strPage; ?>';
</script>
<?php
exit;
}
function fxShowMenuCompte($arrCompteClient, $strLangue)
{ // affiche le menu du compte
global $objDatabase, $vDomaine;
$strPage = ($strLangue == 'fr') ? 'compte' : 'account';
// modifier mon compte
$strRetour = '
<ul class="nav flex-column ms1-menu-compte">
<li class="nav-item">
<a class="nav-list" href="' . $vDomaine . '/' . $strPage . '/modifiercompte"><i class="fa fa-user" aria-hidden="true"></i> ' . afficheTexte('compte_modifcompte_texte', 0) . '</a>
</li>
<li class="nav-item">
<a class="nav-list" href="' . $vDomaine . '/' . $strPage . '/gestionaffilie"><i class="fa fa-users" aria-hidden="true"></i> ' . afficheTexte('compte_gestioncompte_affilie_texte', 0) . '</a>
</li>
';
// liste mes abonnements
$arrAbonnement = 0;
$arrAbonnement = fxGetAbonnementsaffilie($arrCompteClient['com_id'], 1, $strLangue);
$strNbAbonnement = fxcount($arrAbonnement);
$arrAbonnement = fxGetAbonnements($arrCompteClient['com_id'], 1, $strLangue);
$strNbAbonnementnb = $strNbAbonnement + fxcount($arrAbonnement);
if ($strNbAbonnementnb != 0) {
$strNbAbonnement = '<small>(' . $strNbAbonnementnb . ' ';
$strNbAbonnement .= ($strNbAbonnementnb > 1) ? afficheTexte('compte_abonnement_pluriel', 0) : afficheTexte('compte_abonnement_singulier', 0);
$strNbAbonnement .= ')</small>';
$strRetour .= '
<li class="nav-item">
<a class="nav-list" href="' . $vDomaine . '/' . $strPage . '/mes_adhesions"><i class="fa fa-address-card" aria-hidden="true"></i> ' . afficheTexte('compte_mes_abonnement', 0) . $strNbAbonnement . '</a>
</li>
';
}
// menu promoteur v2 (hub) — comptes migres uniquement
if (!function_exists('fxPromoteurHubComUsesV2')) {
require_once dirname(__FILE__) . '/inc_fx_promoteur_hub.php';
}
$strRetour .= fxShowPromoteurHubMenuLink($arrCompteClient, $strLangue);
// menu promoteur legacy
if (!function_exists('fxInscrGestionUserHasLegacyPromoteurMenu')) {
require_once dirname(__FILE__) . '/inc_fx_inscriptions_gestion.php';
}
$blnLegacyPromoteurMenu = fxInscrGestionUserHasLegacyPromoteurMenu($arrCompteClient['com_id']);
$blnHasRapports = trim($arrCompteClient['com_rapports']) != '';
if ($blnLegacyPromoteurMenu || $blnHasRapports) {
if ($blnLegacyPromoteurMenu) {
$arrEvePromoteur = explode(',', $arrCompteClient['com_eve_promoteur']);
$intNbEvePromoteur = fxcount($arrEvePromoteur);
$strNbEvenements = '<small>(' . $intNbEvePromoteur . ' ';
$strNbEvenements .= ($intNbEvePromoteur > 1) ? afficheTexte('compte_evenement_pluriel', 0) : afficheTexte('compte_evenement_singulier', 0);
$strNbEvenements .= ')</small>';
} else {
$strNbEvenements = '';
}
$strRetour .= '
<li class="nav-item">
<a data-toggle="collapse" href="#collapsePromoteur" class="nav-list" ><i class="fa fa-tachometer" aria-hidden="true"></i> ' . afficheTexte('compte_info_promoteur', 0) . $strNbEvenements . '</a>
</li>
';
// MSIN-3880
if ($blnLegacyPromoteurMenu) {
$strRetour .= fxShowInfoPromoteurtitre($_SESSION['com_info'], $strLangue);
}
}
// Inscriptions mobile v2 — lien /mobile seulement si pas de menu promoteur legacy
if (!function_exists('fxInscrGestionGetPromoteurEveIds')) {
require_once dirname(__FILE__) . '/inc_fx_inscriptions_gestion.php';
}
$arrMobileEveIds = fxInscrGestionGetPromoteurEveIds($arrCompteClient['com_id']);
$blnShowMobileDirect = (count($arrMobileEveIds) > 0 && !fxInscrGestionUserHasPromoteurMenu($arrCompteClient['com_id']));
if ($blnShowMobileDirect) {
$strMobileUrl = $vDomaine . '/mobile';
if (count($arrMobileEveIds) === 1) {
$strMobileUrl .= '?promoteur_eve_id=' . urlencode(base64_encode($arrMobileEveIds[0]));
}
$strMobileLabel = fxInscrGestionPromoteurMenuLabel();
$strRetour .= '
<li class="nav-item">
<a class="nav-list" href="' . $strMobileUrl . '"><i class="fa fa-users" aria-hidden="true"></i> '
. htmlspecialchars($strMobileLabel, ENT_QUOTES, 'UTF-8') . '</a>
</li>
';
}
//
$arrDefis = fxGetCommandes($arrCompteClient, 3, $strLangue);
if ($arrDefis != null) {
$intNbDefis = fxcount($arrDefis['actives']);
$strNbDefis = '<small>(' . $intNbDefis . ' ';
$strNbDefis .= ($intNbDefis > 1) ? afficheTexte('compte_defi_pluriel', 0) : afficheTexte('compte_defi_singulier', 0);
$strNbDefis .= ')</small>';
$strRetour .= '
<li class="nav-item">
<a class="nav-list" href="' . $vDomaine . '/' . $strPage . '/mes_defis"><i class="fa fa-line-chart" aria-hidden="true"></i> ' . afficheTexte('compte_mes_defis', 0) . $strNbDefis . '</a>
</li>
';
}
// $strRetour .= $arrCompteClient['com_id'];
$arrBenevolats = fxGetCommandes($arrCompteClient, 2, $strLangue);
if ($arrBenevolats != null) {
$intNbBenevolats = fxcount($arrBenevolats['actives']);
$strNbBenevolats = '<small>(' . $intNbBenevolats . ' ';
$strNbBenevolats .= ($intNbBenevolats > 1) ? afficheTexte('compte_benevolat_pluriel', 0) : afficheTexte('compte_benevolat_singulier', 0);
$strNbBenevolats .= ')</small>';
$strRetour .= '
<li class="nav-item">
<a class="nav-list" href="' . $vDomaine . '/' . $strPage . '/mon_benevolat"><i class="fa fa-user-circle-o" aria-hidden="true"></i> ' . afficheTexte('compte_mon_benevolat', 0) . $strNbBenevolats . '</a>
</li>
';
}
$arrLeveesFonds = fxGetCommandes($arrCompteClient, 0, $strLangue);
if ($arrLeveesFonds != null) {
$intNbLeveesFonds = fxcount($arrLeveesFonds['actives']);
$strNbLeveesFonds = '<small>(' . $intNbLeveesFonds . ' ';
$strNbLeveesFonds .= ($intNbLeveesFonds > 1) ? afficheTexte('compte_levee_fonds_pluriel', 0) : afficheTexte('compte_levee_fonds_singulier', 0);
$strNbLeveesFonds .= ')</small>';
$strRetour .= '
<li class="nav-item">
<a class="nav-list" href="' . $vDomaine . '/' . $strPage . '/mes_levees_fonds"> <i class="fa fa-thermometer-three-quarters" aria-hidden="true"></i>' . afficheTexte('compte_mes_levees_fons', 0) . $strNbLeveesFonds . '</a>
</li>
';
}
$arrCommandes = fxGetCommandes($arrCompteClient, 1, $strLangue);
$arrListeattente = fx_liste_attente_compte($arrCompteClient["com_id"]);
$strNbCommandes = 0;
if ($arrCommandes != null || $arrListeattente != null) {
$intNbCommandes = fxcount($arrCommandes['actives']) + fxcount($arrCommandes['terminées']);
$strNbCommandes = '<small>(' . $intNbCommandes . ' ';
$strNbCommandes .= ($intNbCommandes > 1) ? afficheTexte('compte_commande_pluriel', 0) : afficheTexte('compte_commande_singulier', 0);
$strNbCommandes .= ')</small>';
}
if ($arrCommandes != null || $arrListeattente != null) {
$strRetour .= '
<li class="nav-item">
<a class="nav-list" href="' . $vDomaine . '/' . $strPage . '/mes_commandes"><i class="fa fa-credit-card" aria-hidden="true"></i> ' . afficheTexte('compte_mes_commandes', 0) . $strNbCommandes . '</a>
</li>
';
}
$strRetour .= '
</ul>
';
//MSIN-4245
// bug si pas promoteur vois pas les rapport
if (trim($arrCompteClient['com_eve_promoteur']) == '' && trim($arrCompteClient['com_rapports']) != '') {
$tabPromoRapport[] = $arrCompteClient['com_rapports'];
if ($tabPromoRapport[0] != "") {
$strRetour .="<h2>" . afficheTexte('titre_rapport', 0, 0) . "</h2>" ;
for ($intCtr = 0; $intCtr <= count($tabPromoRapport) - 1; $intCtr++) {
$memlienrap = fxGetMenussuperadm($tabPromoRapport[$intCtr], 0, 1);
if ($memlienrap != null) {
$strRetour .='
<div>
<a href="/superadm/index.php?t='.urlencode(base64_encode(fxUnescape($memlienrap['men_id']))). '&amp;a=report"
data-toto="<?php echo $intCtr ?>"
target="_blank">'.fxUnescape($memlienrap['men_nom']).'</a>
</div><br>';
}
}
}
}
return $strRetour;
}
function fxShowInfoPromoteur($arrCompteClient, $strLangue)
{ // affiche la section Info promoteur
global $objDatabase, $vDomaine, $vRepertoireFichiers;
$strRetour = '';
$qry = 'select com_eve_promoteur,com_rapports, com_eve_modifiable from inscriptions_comptes where com_id = ' . intval($arrCompteClient['com_id']);
$arrPromoteur = $objDatabase->fxGetRow($qry);
// verifier si evenement est modifiable pour l'usager courant
$strEveModifiable = $arrPromoteur['com_eve_modifiable'];
if ($arrPromoteur['com_eve_promoteur'] != '') {
if (stripos($arrPromoteur['com_eve_promoteur'], ',') > 0) {
$tabPromoEveId = explode(',', $arrPromoteur['com_eve_promoteur']);
} else {
$tabPromoEveId[] = $arrPromoteur['com_eve_promoteur'];
}
?>
<br>
<div class="promoteur">
<?php
for ($ctr = 0; $ctr < count($tabPromoEveId); $ctr++) {
$tabRapports = fxGetMenussuperadm(0, 0, 1, $tabPromoEveId[$ctr]);
$qry = 'SELECT * FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id,inscriptions_types_evenements t WHERE t.te_id = e.te_id AND e.eve_actif = 1 and e.eve_id = ' . intval($tabPromoEveId[$ctr]);
$tabEvenements = $objDatabase->fxGetResults($qry);
?>
<div class="card box_participant mb-2">
<div class="card-header">
<div class="p-2 mr-2 bg-white d-inline-block">
<img src="<?php if ($tabEvenements[1]['eve_id'] == 175) {
echo $vDomaine . $vRepertoireFichiers . "/images/evenements/" . $tabEvenements[1]['eve_photo_' . $strLangue];
} else {
echo $GLOBALS['vDomaine'] . '/images/' . $tabEvenements[1]['te_icone'];
} ?>" width="100">
</div>
<h2 class="d-inline-block"><?php echo fxUnescape($tabEvenements[1]['eve_nom_' . $strLangue]) ?></h2>
</div>
<div class="card-body">
<h2 class="card-title">
<?php echo afficheTexte('titre_rapport', 0); ?>
</h2>
<ul class="list-unstyled">
<?php
$arrEvenement = fxGetEvenementsId($tabPromoEveId[$ctr]);
if ($arrEvenement['te_id'] != 9) {
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=chrono&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>chrono + questions
</a>
</li>
<?php
}
if ($arrEvenement['te_id'] == 13) {
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=adhesions&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>adhésions actives
</a>
</li>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=adhesions-ventes&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>liste d'adhésions
annuelles
</a>
</li>
<?php
}
if ($arrEvenement['eve_rapport_finances_capitaines'] == 1) {
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=finances-pnq&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>Transactions-Finances
(capitaines seulement)
</a>
</li>
<?php
}
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=finances<?php if ($arrEvenement['te_id'] == 13) { ?>-membership<?php } ?>&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>Transactions-Finances
</a>
</li>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=remboursements&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2"
aria-hidden="true"></i><?php if ($strLangue == 'fr') echo "Paiements"; else echo "Payments" ?>
</a>
</li>
<!--
<li class="mb-2">
<a class="btn btn-primary rounded-pill" href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=remboursements&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>" target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i><?php if ($strLangue == 'fr') echo "liste de participant"; else echo "liste de participant" ?>
</a>
</li>
-->
<?php
for ($intCtr = 1; $intCtr <= count($tabRapports); $intCtr++) {
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/index.php?t=<?php echo urlencode(base64_encode(fxUnescape($tabRapports[$intCtr]['men_id']))); ?>&amp;a=report&lng=<?php echo $strLangue; ?>"
data-toto="<?php echo $intCtr; ?>" target="_blank">
<i class="fa fa-bar-chart mr-2"
aria-hidden="true"></i><?php echo fxUnescape($tabRapports[$intCtr]['men_nom']); ?>
</a>
</li>
<?php
}
?>
</ul>
<a class="btn btn-primary btn-lg rounded-0" id="btn_voir_inscriptions"
href="<?php if ($strLangue == 'fr') {
echo '/compte/inc_tableau_promoteur?promoteur_eve_id=';
} else {
echo '/account/inc_tableau_promoteur?promoteur_eve_id=';
} ?><?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>">
<i class="fa fa-wrench mr-2" aria-hidden="true"></i>
<?php if ($strLangue == 'fr') echo "Gestion de l'événement"; else echo "Event management" ?>
</a>
</div>
</div>
<?php
}
?>
</div>
<br>
<hr>
<br>
<?php
}
$tabPromoRapport[] = $arrPromoteur['com_rapports'];
if ($tabPromoRapport[0] != "") {
echo("<h2>" . afficheTexte('titre_rapport', 0, 0) . "</h2>");
for ($intCtr = 0; $intCtr <= count($tabPromoRapport) - 1; $intCtr++) {
$memlienrap = fxGetMenussuperadm($tabPromoRapport[$intCtr], 0, 1);
if ($memlienrap != null) {
?>
<div>
<a href="/superadm/index.php?t=<?php echo urlencode(base64_encode(fxUnescape($memlienrap['men_id']))); ?>&amp;a=report"
data-toto="<?php echo $intCtr ?>"
target="_blank"><?php echo fxUnescape($memlienrap['men_nom']); ?></a>
</div><br>
<?php
}
}
}
return $strRetour;
}
function fxShowPromoteurrapport($arrCompteClient, $strLangue)
{ // affiche la section Info promoteur
global $objDatabase, $vDomaine, $vRepertoireFichiers;
$strRetour = '';
$qry = 'select com_eve_promoteur,com_rapports, com_eve_modifiable from inscriptions_comptes where com_id = ' . intval($arrCompteClient['com_id']);
$arrPromoteur = $objDatabase->fxGetRow($qry);
// verifier si evenement est modifiable pour l'usager courant
$strEveModifiable = $arrPromoteur['com_eve_modifiable'];
if ($arrPromoteur['com_eve_promoteur'] != '') {
if (stripos($arrPromoteur['com_eve_promoteur'], ',') > 0) {
$tabPromoEveId = explode(',', $arrPromoteur['com_eve_promoteur']);
} else {
$tabPromoEveId[] = $arrPromoteur['com_eve_promoteur'];
}
?>
<br>
<div class="promoteur">
<?php
for ($ctr = 0; $ctr < count($tabPromoEveId); $ctr++) {
$tabRapports = fxGetMenussuperadm(0, 0, 1, $tabPromoEveId[$ctr]);
$qry = 'SELECT * FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id,inscriptions_types_evenements t WHERE t.te_id = e.te_id AND e.eve_actif = 1 and e.eve_id = ' . intval($tabPromoEveId[$ctr]);
$tabEvenements = $objDatabase->fxGetResults($qry);
?>
<div class="card box_participant mb-2">
<div class="card-header">
<div class="p-2 mr-2 bg-white d-inline-block">
<img src="<?php if ($tabEvenements[1]['eve_id'] == 175) {
echo $vDomaine . $vRepertoireFichiers . "/images/evenements/" . $tabEvenements[1]['eve_photo_' . $strLangue];
} else {
echo $GLOBALS['vDomaine'] . '/images/' . $tabEvenements[1]['te_icone'];
} ?>" width="100">
</div>
<h2 class="d-inline-block"><?php echo fxUnescape($tabEvenements[1]['eve_nom_' . $strLangue]) ?></h2>
</div>
<div class="card-body">
<h2 class="card-title">
<?php echo afficheTexte('titre_rapport', 0); ?>
</h2>
<ul class="list-unstyled">
<?php
$arrEvenement = fxGetEvenementsId($tabPromoEveId[$ctr]);
if ($arrEvenement['te_id'] != 9) {
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=chrono&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>chrono + questions
</a>
</li>
<?php
}
if ($arrEvenement['te_id'] == 13) {
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=adhesions&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>adhésions actives
</a>
</li>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=adhesions-ventes&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>liste d'adhésions
annuelles
</a>
</li>
<?php
}
if ($arrEvenement['eve_rapport_finances_capitaines'] == 1) {
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=finances-pnq&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>Transactions-Finances
(capitaines seulement)
</a>
</li>
<?php
}
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=finances<?php if ($arrEvenement['te_id'] == 13) { ?>-membership<?php } ?>&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>Transactions-Finances
</a>
</li>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=remboursements&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>"
target="_blank">
<i class="fa fa-bar-chart mr-2"
aria-hidden="true"></i><?php if ($strLangue == 'fr') echo "Paiements"; else echo "Payments" ?>
</a>
</li>
<!--
<li class="mb-2">
<a class="btn btn-primary rounded-pill" href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=remboursements&e=<?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>&lng=<?php echo $strLangue; ?>" target="_blank">
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i><?php if ($strLangue == 'fr') echo "liste de participant"; else echo "liste de participant" ?>
</a>
</li>
-->
<?php
for ($intCtr = 1; $intCtr <= count($tabRapports); $intCtr++) {
?>
<li class="mb-2">
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/superadm/index.php?t=<?php echo urlencode(base64_encode(fxUnescape($tabRapports[$intCtr]['men_id']))); ?>&amp;a=report&lng=<?php echo $strLangue; ?>"
data-toto="<?php echo $intCtr; ?>" target="_blank">
<i class="fa fa-bar-chart mr-2"
aria-hidden="true"></i><?php echo fxUnescape($tabRapports[$intCtr]['men_nom']); ?>
</a>
</li>
<?php
}
?>
</ul>
<a class="btn btn-primary btn-lg rounded-0" id="btn_voir_inscriptions"
href="<?php if ($strLangue == 'fr') {
echo '/compte/inc_tableau_promoteur?promoteur_eve_id=';
} else {
echo '/account/inc_tableau_promoteur?promoteur_eve_id=';
} ?><?php echo urlencode(base64_encode($tabPromoEveId[$ctr])); ?>">
<i class="fa fa-wrench mr-2" aria-hidden="true"></i>
<?php if ($strLangue == 'fr') echo "Gestion de l'événement"; else echo "Event management" ?>
</a>
</div>
</div>
<?php
}
?>
</div>
<br>
<hr>
<br>
<?php
}
$tabPromoRapport[] = $arrPromoteur['com_rapports'];
if ($tabPromoRapport[0] != "") {
echo("<h2>" . afficheTexte('titre_rapport', 0, 0) . "</h2>");
for ($intCtr = 0; $intCtr <= count($tabPromoRapport) - 1; $intCtr++) {
$memlienrap = fxGetMenussuperadm($tabPromoRapport[$intCtr], 0, 1);
if ($memlienrap != null) {
?>
<div>
<a href="/superadm/index.php?t=<?php echo urlencode(base64_encode(fxUnescape($memlienrap['men_id']))); ?>&amp;a=report"
data-toto="<?php echo $intCtr ?>"
target="_blank"><?php echo fxUnescape($memlienrap['men_nom']); ?></a>
</div><br>
<?php
}
}
}
return $strRetour;
}
// MSIN-3880
function fxShowInfoPromoteurtitre($arrCompteClient, $strLangue)
{ // affiche la section Info promoteur
global $objDatabase, $vDomaine, $vRepertoireFichiers;
$strRetour = ' <div class="animate__animated animate__fadeIn collapse" id="collapsePromoteur"> ';
$qry = 'select com_eve_promoteur,com_rapports, com_eve_modifiable from inscriptions_comptes where com_id = ' . intval($arrCompteClient['com_id']);
$arrPromoteur = $objDatabase->fxGetRow($qry);
// verifier si evenement est modifiable pour l'usager courant
$strEveModifiable = $arrPromoteur['com_eve_modifiable'];
if ($arrPromoteur['com_eve_promoteur'] != '') {
if (stripos($arrPromoteur['com_eve_promoteur'], ',') > 0) {
$tabPromoEveId = explode(',', $arrPromoteur['com_eve_promoteur']);
// --- Réordonner la liste par date de fin d'événement (plus récent -> plus vieux) ---
$ids = array_filter(array_map('intval', $tabPromoEveId), function($v){ return $v > 0; });
if (!empty($ids)) {
$in = implode(',', $ids);
// On ne garde que les actifs (comme ta requête dans la boucle) et on trie par eve_date_fin desc
$qrySort = "
SELECT e.eve_id,e.eve_date_fin
FROM inscriptions_evenements e
WHERE e.eve_actif = 1
AND e.eve_id IN ($in)
ORDER BY e.eve_date_fin DESC
";
// Si tu as fxGetResults :
$rowsSort = $objDatabase->fxGetResults($qrySort);
// Reconstituer la liste d'IDs dans le bon ordre
$sortedIds = [];
if (!empty($rowsSort)) {
foreach ($rowsSort as $r) {
if (isset($r['eve_id'])) $sortedIds[] = (int)$r['eve_id'];
}
}
// Si la requête a renvoyé au moins 1 ID, on remplace la liste d'origine
if (!empty($sortedIds)) {
$tabPromoEveId = $sortedIds;
}
}
// --- Fin du patch de tri ---
} else {
$tabPromoEveId[] = $arrPromoteur['com_eve_promoteur'];
}
?>
<?php
for ($ctr = 0; $ctr < count($tabPromoEveId); $ctr++) {
$tabRapports = fxGetMenussuperadm(0, 0, 1, $tabPromoEveId[$ctr]);
$qry = 'SELECT * FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id,inscriptions_types_evenements t WHERE t.te_id = e.te_id AND e.eve_actif = 1 and e.eve_id = ' . intval($tabPromoEveId[$ctr]);
$tabEvenements = $objDatabase->fxGetResults($qry);
$strRetour .= '
<li class="nav-item">';
if ($strLangue == 'fr') {
$strhref = '/compte/inc_tableau_promoteur?promoteur_eve_id=';
} else {
$strhref = '/account/inc_tableau_promoteur?promoteur_eve_id=';
}
$strhref .= urlencode(base64_encode($tabEvenements[1]['eve_id']));
$strRetour .= '
<a href="' . $strhref . '" target="_blank">';
$strRetour .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="';
if ($tabEvenements[1]['eve_id'] == 175) {
$strRetour .= $vDomaine . $vRepertoireFichiers . "/images/evenements/" . $tabEvenements[1]['eve_photo_' . $strLangue];
} else {
$strRetour .= $GLOBALS['vDomaine'] . '/images/' . $tabEvenements[1]['te_icone'];
}
$strRetour .= '" width="50"> ';
$strRetour .= '&nbsp;&nbsp;&nbsp;&nbsp;' . fxUnescape($tabEvenements[1]['eve_nom_' . $strLangue]) . '
</a>
</li>';
}
}
$strRetour .= ' </div>';
return $strRetour;
}
function fxGetCommandes($arrCompteClient, $tep_id, $strLangue)
{ // trouver les commandes
global $objDatabase;
$arrEpreuvesCommandeesActives = $arrEpreuvesCommandeesTerminees = array();
$intCtrEpreuvesCommandeesActives = $intCtrEpreuvesCommandeesTerminees = 1;
$arrRetour = null;
if (intval($tep_id) > 0) { // trouver les épreuves selon le type
if ($tep_id == 1) {
$sqlEpreuvesCommandeesold = "
SELECT *
FROM resultats_epreuves_commandees ec
JOIN inscriptions_evenements e ON ec.eve_id = e.eve_id
JOIN inscriptions_epreuves c ON ec.epr_id = c.epr_id
JOIN inscriptions_panier_acheteurs a ON ec.no_panier = a.no_panier
WHERE ec.pec_actif = 1 AND ec.com_id = " . intval($arrCompteClient['com_id']) . " AND ec.tep_id IN(1, 3)
GROUP BY ec.pec_id
ORDER BY a.ach_maj DESC, e.eve_date_debut, ec.no_commande DESC limit 100
";
$sqlEpreuvesCommandees= "
SELECT *
FROM resultats_epreuves_commandees ec
JOIN inscriptions_evenements e ON ec.eve_id = e.eve_id
JOIN inscriptions_epreuves c ON ec.epr_id = c.epr_id
JOIN inscriptions_panier_acheteurs a ON ec.no_panier = a.no_panier
JOIN inscriptions_panier_participants p ON p.pec_id = ec.pec_id_original
WHERE ec.pec_actif = 1
AND ec.com_id = " . intval($arrCompteClient['com_id']) . "
AND ec.tep_id IN(1, 3)
GROUP BY ec.pec_id
ORDER BY a.ach_maj DESC, e.eve_date_debut, ec.no_commande DESC
LIMIT 100";
//echo($sqlEpreuvesCommandees);
} else {
$sqlEpreuvesCommandees = "
SELECT *
FROM resultats_epreuves_commandees ec
JOIN inscriptions_evenements e ON ec.eve_id = e.eve_id
JOIN inscriptions_epreuves c ON ec.epr_id = c.epr_id
JOIN inscriptions_panier_acheteurs a ON ec.no_panier = a.no_panier
WHERE ec.pec_actif = 1 AND ec.com_id = " . intval($arrCompteClient['com_id']) . " AND ec.tep_id = " . intval($tep_id) . "
GROUP BY ec.pec_id
ORDER BY a.ach_maj DESC, e.eve_date_debut, ec.no_commande DESC
";
}
//$sqlEpreuvesCommandees = "SELECT * FROM resultats_epreuves_commandees ec, inscriptions_evenements e, inscriptions_epreuves c WHERE ec.eve_id = e.eve_id AND ec.epr_id = c.epr_id AND ec.pec_actif = 1 AND ec.com_id = " . intval($arrCompteClient['com_id']) . " AND ec.tep_id = " . intval($tep_id) . " GROUP BY ec.pec_id ORDER BY e.eve_date_debut, ec.no_commande DESC";
$arrEpreuvesCommandees = $objDatabase->fxGetResults($sqlEpreuvesCommandees);
} else { // trouver les épreuves de dons
$sqlEpreuvesCommandees = "
SELECT *
FROM resultats_epreuves_commandees ec
JOIN inscriptions_evenements e ON ec.eve_id = e.eve_id
JOIN inscriptions_epreuves c ON ec.epr_id = c.epr_id
JOIN inscriptions_panier_acheteurs a ON ec.no_panier = a.no_panier
WHERE ec.pec_actif = 1 AND c.epr_id_don <> 0 AND ec.com_id = " . intval($arrCompteClient['com_id']) . " AND ec.tep_id IN(1,3) AND (e.eve_id_don <> 0 OR c.epr_genere_don = 1)
GROUP BY ec.pec_id
ORDER BY a.ach_maj DESC, e.eve_date_debut, ec.no_commande DESC
";
$arrEpreuvesCommandees = $objDatabase->fxGetResults($sqlEpreuvesCommandees);
}
if ($arrEpreuvesCommandees != null) {
for ($intCtrEpreuvesCommandees = 1; $intCtrEpreuvesCommandees <= fxcount($arrEpreuvesCommandees); $intCtrEpreuvesCommandees++) {
if ($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_date_fin'] <= fxGetDate()) { // si l'événement terminé
$arrEpreuvesCommandeesTerminees[$intCtrEpreuvesCommandeesTerminees] = $arrEpreuvesCommandees[$intCtrEpreuvesCommandees];
$intCtrEpreuvesCommandeesTerminees++;
} else { // sinon, l'événement est actif
$arrEpreuvesCommandeesActives[$intCtrEpreuvesCommandeesActives] = $arrEpreuvesCommandees[$intCtrEpreuvesCommandees];
$intCtrEpreuvesCommandeesActives++;
}
}
$arrRetour['actives'] = $arrEpreuvesCommandeesActives;
$arrRetour['terminées'] = $arrEpreuvesCommandeesTerminees;
}
return $arrRetour;
}
function fxShowCommandes($arrEpreuvesCommandees, $arrCompteClient, $tep_id, $strLangue)
{ // afficher les commandes
global $objDatabase, $strEveModifiable, $vDomaine, $arrFormsTransfert, $arrFormsObjectifsDons, $arrFormsLogSettings, $arrFormsAddLogs;
$strRetour = '';
if ($arrEpreuvesCommandees != null) {
?>
<input type="hidden" id="partComId" value="<?php echo $arrCompteClient['com_id']; ?>">
<div class="table-responsive-md">
<table class="table" id="table_liste_commandes">
<thead>
<tr>
<th><?php afficheTexte('modifinscriptions_nom_eve') ?></th>
<th class="text-left">
<?php
if ($tep_id == 1) {
afficheTexte('modifinscriptions_nom_epr');
} elseif ($tep_id == 2) {
afficheTexte('modifinscriptions_nom_epr_benevole');
} elseif ($tep_id == 3) {
afficheTexte('modifinscriptions_nom_epr');
}
?>
</th>
<th class="text-left"><?php afficheTexte('modifinscriptions_date_epr') ?></th>
<?php
if ($tep_id != 3) {
?>
<th class="text-left"><?php afficheTexte('modifinscriptions_detail_epr') ?></th>
<th class="text-center"><?php afficheTexte('modifier_inscriptions_type_epr') ?></th>
<th class="text-center"><?php afficheTexte('liste_commandes_date_achat') ?></th>
<th class="text-center"><?php afficheTexte('modifier_inscriptions_facture') ?></th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
//$arrFormsTransfert = array();
for ($intCtrEpreuvesCommandees = 1; $intCtrEpreuvesCommandees <= count($arrEpreuvesCommandees); $intCtrEpreuvesCommandees++) {
$strLigneTransfert = $strLigneObjectifDons = $strLigneLogs = '';
$strStyleEdit = $strStyleCancel = $strStyleRetablir = ' d-none';
$blnCancelled = false;
$strClasse = ($intCtrEpreuvesCommandees & 1) ? '' : 'table-secondary';
if ($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['is_cancelled'] == '1') {
$strClasse .= ' table-danger';
$blnCancelled = true;
}
?>
<tr class="<?php echo $strClasse; ?>" >
<td colspan="7">
<div class="h5">
<?php
$arrCapitaine = fxGetCapitaine($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id'], $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id']);
//MSIN-4375
echo $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['par_prenom'] . ' ' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['par_nom'];
if ($arrCapitaine != false) {
echo 'Capitaine:'.$arrCapitaine['par_nom'] . ', ' . $arrCapitaine['par_prenom'];
}
?>
</div>
</td>
</tr>
<tr class="<?php echo $strClasse; ?>" id="pec_<?php echo $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original']; ?>">
<td>
<?php echo fxGetTabInscription('eve_nom_' . $strLangue, $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_id'], 'evenements', 'eve'); ?>
<?php /* <br><strong><?php echo fxGetRole($intCtrEpreuvesCommandeesntComId, $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'], $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id']);?></strong> */ ?>
</td>
<td class="text-break">
<?php echo fxGetTabInscription('epr_type_' . $strLangue, $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id'], 'epreuves', 'epr'); ?>
<br>
<?php
//MSIN-4376
//print_rsl($arrEpreuvesCommandees);
if($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_code_qr']!=1 ){
//MSIN-4323
//if($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_code_qr']==1 ){
// print_rsl($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]);
//echo($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]["eve_id"]);exit;
$result = fxcreer_qr_token([
'par_id' => $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]["par_id"],
'pec_id_original' => $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]["pec_id"],
'ach_id' => $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]["ach_id"],
'eve_id' => $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]["eve_id"],
'com_id' =>$arrEpreuvesCommandees[$intCtrEpreuvesCommandees]["com_id"],
'status' => 'actif'
]);
$token = fxdecrypt_token($result['token_enc']);
// $strRetour .= '<td> '.'<img src="'.$vDomaine .'/'.fxgenerer_qr_image($token, "https://".$_SERVER['HTTP_HOST']."/q.php").'" width="150" />'.'</td>';
?> <img src="<?php echo $vDomaine.'/php/qr_img.php?t='.urlencode($result['qr_public_id']); ?> " width="100" /> <?php
}
?>
</td>
<td>
<?php
$strDate = fxShowDate(fxGetTabInscription('epr_date', $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id'], 'epreuves', 'epr'), $GLOBALS['strLangue']);
echo $strDate;
if ($tep_id == 2) {
echo '<br>' . fxGetTabInscription('epr_nom_' . $strLangue, $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id'], 'epreuves', 'epr');
}
?>
</td>
<?php
if ($tep_id != 3) {
$tabEpreuveCourante = fxGetEpreuve($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id']);
?>
<td>
<?php
if (fxIsParEquipe($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'], $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id'])) {
?>
<button class="btn btn-sm rounded-circle" type="button" data-toggle="collapse"
data-target="#div_teammates_<?php echo $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id']; ?>"
aria-expanded="false"
aria-controls="div_teammates_<?php echo $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id']; ?>">
<i class="fa fa-info-circle fa-2x text-info" aria-hidden="true"></i>
</button>
<div class="collapse"
id="div_teammates_<?php echo $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id']; ?>">
<div class="card-body">
<?php fxGetMembresEquipe($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_id'], $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id'], $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id'], 1); ?>
</div>
</div>
<?php
} else {
afficheTexte('epreuve_individuelle');
}
?>
</td>
<td class="text-center">
<?php
if (!$blnCancelled) {
// 2016-04-07 - JSP: Vérifier si cet événement est toujours actif
$intEvenement = $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_id'];
$strCode = fxGetEvenementsUrl($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_id']);
$tabEvenement = fxGetEvenements($strCode, $strLangue);
if ($tabEvenement != null) {
if ($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['is_cancelled'] == '' || $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['is_cancelled'] == '0') {
$strStyleEdit = '';
$strStyleCancel = $strStyleRetablir = ' d-none';
} else {
$strStyleEdit = $strStyleCancel = ' d-none';
$strStyleRetablir = '';
}
if ((strstr($strEveModifiable, $intEvenement) == true || intval($tabEvenement['general']['eve_epreuve_modifiable_client']) == 1)) {
if ($tabEvenement['general']['eve_modifiable_date_limite'] . ' ' . $tabEvenement['general']['eve_modifiable_heure_limite'] >= fxGetDateTime() && !$blnCancelled) {
$strCode = fxGetEvenementsUrl($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_id']);
echo $strAffichage = '
<button class="btn btn-primary btn-sm btn-block rounded-0 btn_edit_event_client' . $strStyleEdit . '" id="modifier_' . $intCtrEpreuvesCommandees . '" data-eve_code="' . $strCode . '" data-epr_id="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id'] . '" data-eve_id="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_id'] . '" value="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'] . '">' . afficheTexte('btn_modifierinscriptions', 0) . '</button>
<button class="btn btn-secondary btn-sm btn-block rounded-0 btn_cancel_event_client' . $strStyleCancel . '" id="annuler_' . $intCtrEpreuvesCommandees . '" type="button" data-eve_code="' . $strCode . '" data-epr_id="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id'] . '" data-eve_id="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_id'] . '" value="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'] . '">' . afficheTexte('btn_annulerinscriptions', 0) . '</button>
<button class="btn btn-secondary btn-sm btn-block rounded-0 btn_retablir_event_client' . $strStyleRetablir . '" id="retablir_' . $intCtrEpreuvesCommandees . '" type="button" data-eve_code="' . $strCode . '" data-epr_id="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_id'] . '" data-eve_id="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_id'] . '" value="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'] . '">' . afficheTexte('btn_retablirinscriptions', 0) . '</button>
';
} else {
echo "<span>" . afficheTexte('inscription_non_modifiable', 0) . "</span>";
}
} else {
echo "<span>" . afficheTexte('inscription_non_modifiable', 0) . "</span>";
}
if (intval($tabEvenement['general']['eve_epreuve_transfert_client']) == 1) {
if ($tabEvenement['general']['eve_epreuve_transfert_date_limite'] . ' ' . $tabEvenement['general']['eve_epreuve_transfert_heure_limite'] >= fxGetDateTime() && !$blnCancelled) {
// options de transfert
// récupérer le coût du frais pour le switch d'épreuv
if ($tabEvenement['general']['eve_epreuve_transfert_client_sansfrais']) {
$tabFraisAutres['fa_montant'] = 0;
} else {
// options de transfert
// récupérer le coût du frais pour le switch d'épreuve
$tabFraisAutres = fxGetFraisAutres('transfert', $tabEvenement['general']['eve_frais'], $tabEvenement['general']['eve_id'], $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['tep_id']);
}
if (isset($tabFraisAutres['fa_montant']) && is_numeric($tabFraisAutres['fa_montant']) && $tabFraisAutres['fa_montant'] > 0) {
$strPrixTransfert = fxShowPrix($tabFraisAutres['fa_montant'], $strLangue, 1);
if ($tabEvenement['general']['tt_id'] > 1) {
$strPrixTransfert .= " +tx";
}
$strFrais = '
<div class="alert alert-info" role="alert">
<i class="fa fa-info-circle" aria-hidden="true"></i> ' . str_replace('%prix%', $strPrixTransfert, afficheTexte('msg_transfert_epreuve', 0)) . '
</div>
';
} else {
$strFrais = '';
}
//MSIN-4295
$arrFormsTransfert[] = $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'];
$pec_id = $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'];
$arrTransferts = fxGetTransferts($pec_id);
$strInputPrenom = 'tra_prenom_' . $pec_id;
$strInputNom = 'tra_nom_' . $pec_id;
$strInputCourriel = 'tra_courriel_' . $pec_id;
$strLigneTransfert = '
<tr class="' . $strClasse . '">
<td colspan="7">
<p>
<a class="xfer_link btn btn-secondary rounded-0" data-pec_id="' . $pec_id . '" href="#">
' . afficheTexte('btn_transfert_dossard', 0) . '
<span class="xfer_sign">
<i class="fa fa-plus ml-2" aria-hidden="true"></i>
</span>
</a>
</p>
<div class="xfer_block_' . $pec_id . '" style="display: none;">
<h3> ' . afficheTexte('msg_transfert_epreuve_titre', 0) . '</h3>
' . $strFrais . '
<p>
' . afficheTexte('msg_transfert_epreuve2', 0) . '
</p>
<div class="msg"></div>
<form action="' . $vDomaine . '/ajax_transfert.php' . '" id="frm_xfer_' . $pec_id . '" method="post">
<input type="hidden" name="pec_id" value="' . $pec_id . '">
<input type="hidden" name="com_id" value="' . $_SESSION['com_info']['com_id'] . '">
<input type="hidden" name="a" value="' . urlencode(base64_encode('inviter')) . '">
<input type="hidden" name="lang" value="' . $strLangue . '">
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right" for="' . $strInputNom . '">' . afficheTexte('msg_transfert_epreuve_Nom', 0) . '</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0" type="text" id="' . $strInputNom . '" name="' . $strInputNom . '">
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right" for="' . $strInputPrenom . '">' . afficheTexte('msg_transfert_epreuve_Prenom', 0) . '</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0" type="text" id="' . $strInputPrenom . '" name="' . $strInputPrenom . '">
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right" for="' . $strInputCourriel . '">' . afficheTexte('msg_transfert_epreuve_courriel', 0) . '</label>
<div class="col-12 col-lg-7">
<input class="form-control rounded-0" type="email" id="' . $strInputCourriel . '" name="' . $strInputCourriel . '">
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-12 col-lg-3 text-lg-right"></label>
<div class="col-12 col-lg-7">
<button class="btn btn-primary rounded-0" type="submit">' . afficheTexte('msg_transfert_epreuve_submit', 0) . '</button>
</div>
</div>
</form>
<div class="msg"></div>
<div class="xfer_list xfer_list_' . $pec_id . '">
' . fxShowTransferts($arrTransferts, $strLangue) . '
</div>
</div>
</td>
</tr>
';
}
}
} else {
echo "<span>" . afficheTexte('evenement_termine', 0) . "</span>";
}
} else {
echo "<span>" . afficheTexte('inscription_cancelled', 0) . "</span>";
}
?>
</td>
<td>
<?php echo fxShowDate($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['ach_maj'], $strLangue) . ' @ ' . fxShowTime($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['ach_maj']); ?>
</td>
<td>
<?php
$arrFactures = fxGetFactures($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original']); // trouver toutes les factures pour cette épreuve
if ($arrFactures != null) {
for ($intCtr2 = 1; $intCtr2 <= count($arrFactures); $intCtr2++) {
if ($intCtr2 > 1) {
echo '<br>';
}
?>
<a class="btn btn-primary rounded-pill btn-sm"
href="<?php echo $vDomaine; ?>/facture.php?no_panier=<?php echo $arrFactures[$intCtr2]['no_panier']; ?>&amp;lang=<?php echo $strLangue; ?>"
target="_blank"><?php echo $arrFactures[$intCtr2]['no_commande']; ?></a>
<?php
}
} else {
echo 'ERROR!';
}
?>
</td>
<?php
}
// Afficher la portion logs
if ($tep_id == 3 && !$blnCancelled) {
$strLigneTransfert = $strLigneObjectifDons = $strLigneLogs = '';
$arrLogSettings = fxShowFormLogSettings($arrEpreuvesCommandees[$intCtrEpreuvesCommandees], $strLangue);
$arrAddLogs = fxShowFormAddLog($arrEpreuvesCommandees[$intCtrEpreuvesCommandees], $strLangue);
$pec_id = $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'];
$arrLogs = fxGetLogsCourse($pec_id);
$arrFormsLogSettings[] = $arrLogSettings['forms'];
$arrFormsAddLogs[] = $arrAddLogs['forms'];
$strBoutonStats = fxShowBoutonStats($pec_id, $strLangue);
$strLigneLogs = '
<tr class="' . $strClasse . '">
<td colspan="3">
<p>
<a class="vr_link btn btn-secondary rounded-0" data-pec_id="' . $pec_id . '" href="#">' . afficheTexte('vr_link_title', 0) . ' <span class="vr_sign"><i class="fa fa-plus ml-2" aria-hidden="true"></i></span></a>
</p>
<div class="vr_block_' . $pec_id . '" style="display: none;">
' . $strBoutonStats . '
<div class="headline">
<h2>' . afficheTexte('vr_settings_title', 0) . '</h2>
</div>
<div class="msg" id="msg_' . $pec_id . '"></div>
<div class="log_settings_list log_settings_list_' . $pec_id . '">
' . $arrLogSettings['HTML'] . '
</div>
<div class="headline">
<h2>' . afficheTexte('msg_ajout_logs', 0) . '</h2>
</div>
<div class="msg"></div>
<div>
' . $arrAddLogs['HTML'] . '
</div>
<div class="headline">
<h2>' . afficheTexte('vr_log_list_title', 0) . '</h2>
</div>
<div class="msg"></div>
<div class="log_list log_list_' . $pec_id . '">
' . fxShowLogsCourse($arrLogs, $strLangue) . '
</div>
</div>
</td>
</tr>
';
} else {
$strLigneLogs = '';
}
?>
</tr>
<?php
echo $strLigneObjectifDons . $strLigneLogs . $strLigneTransfert;
}
?>
</tbody>
</table>
</div>
<?php
}
return $strRetour;
}
function fxShowListeattente($arrCompteClient, $strLangue)
{ // afficher les commandes
global $objDatabase, $strEveModifiable, $vDomaine, $arrFormsTransfert, $arrFormsObjectifsDons, $arrFormsLogSettings, $arrFormsAddLogs;
$strRetour = '';
$mem_listeattente = fx_liste_attente_compte($arrCompteClient["com_id"]);
if ($mem_listeattente != null) {
?>
<h1 id="listeattente" class="mb-3"><?php afficheTexte('listeattente_titre') ?></h1>
<div class="table-responsive-md">
<table class="table" id="table_liste_commandes">
<thead>
<tr>
<th><?php afficheTexte('modifinscriptions_nom_eve') ?></th>
<th class="text-left">
<?php
afficheTexte('modifinscriptions_nom_epr');
?>
</th>
<th class="text-left"><?php afficheTexte('modifinscriptions_date_epr') ?></th>
<th class="text-left"><?php afficheTexte('listeattente_lien') ?></th>
<th class="text-center"></th>
<th class="text-center"></th>
<th class="text-center"></th>
</tr>
</thead>
<tbody>
<?php
//$arrFormsTransfert = array();
for ($intCtrEpreuvesCommandees = 1; $intCtrEpreuvesCommandees <= count($mem_listeattente); $intCtrEpreuvesCommandees++) {
$strLigneTransfert = $strLigneObjectifDons = $strLigneLogs = '';
$strStyleEdit = $strStyleCancel = $strStyleRetablir = ' d-none';
$blnCancelled = false;
$strClasse = ($intCtrEpreuvesCommandees & 1) ? '' : 'table-secondary';
// $mem_info=fx_liste_attente_info_epreuve($mem_listeattente[$intCtrEpreuvesCommandees]["epr_id"]);
// $mem_lien = $vDomaine.'/Reserver/'.$mem_info[1]["eve_label_url"].'/'.$mem_listeattente[$intCtrEpreuvesCommandees]["epr_id"]; // Remplacez par la valeur souhaitée
$mem_result = fx_liste_attente_lien_commande($mem_listeattente[$intCtrEpreuvesCommandees]["epr_id"], intval($arrCompteClient['com_id']), intval($mem_listeattente[$intCtrEpreuvesCommandees]['lispar_id']));
if ($mem_result["statut"]) {
$mem_lien = $mem_result["lien"];
$mem_display_statut = afficheTexte('lattente_reste', 0);
$mem_display_statut = str_replace('%H%', $mem_result["remaining"], $mem_display_statut);
} else {
$mem_lien = "";
$mem_display_statut = $mem_listeattente[$intCtrEpreuvesCommandees]["cp_details_" . $strLangue];
}
// if ($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['is_cancelled'] == '1') {
// $strClasse .= ' table-danger';
// $blnCancelled = true;
// }
?>
<tr class="<?php echo $strClasse; ?>">
<td> <?php echo($mem_listeattente[$intCtrEpreuvesCommandees]["eve_nom_" . $strLangue]); ?> </td>
<td> <?php echo($mem_listeattente[$intCtrEpreuvesCommandees]["epr_type_" . $strLangue] . " " . $mem_listeattente[$intCtrEpreuvesCommandees]["epr_nom_" . $strLangue]); ?> </td>
<td> <?php echo(fxShowDate($mem_listeattente[$intCtrEpreuvesCommandees]["epr_date"], $strLangue)); ?> </td>
</td>
<td>
<?php if ($mem_lien != "") { ?>
<a class="btn btn-primary rounded-pill btn-sm" href="<?php echo($mem_lien) ?>"
target="_blank"><?php afficheTexte('lattente_commande') ?></a>
<?php } ?>
</td>
<td> <?php echo($mem_display_statut) ?></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
}
return $strRetour;
}
function fxShowLeveesFonds($arrEpreuvesCommandees, $strLangue)
{ // afficher les levées de fonds
global $objDatabase, $vDomaine, $arrFormsObjectifsDons;
if ($strLangue == 'fr') {
$strPage = 'don';
} else {
$strPage = 'donate';
}
$strRetour = '
<div class="table-responsive">
<table class="table">
';
if ($arrEpreuvesCommandees != null) {
$strRetour .= '
<thead>
<tr>
<th class="text-left">' . afficheTexte('modifinscriptions_nom_eve', 0) . '</th>
<th class="text-left">' . afficheTexte('modifinscriptions_nom_epr', 0) . ' </th>
<th class="text-left">' . afficheTexte('modifinscriptions_date_epr', 0) . '</th>
<th class="text-left">' . afficheTexte('modifinscriptions_detail_epr', 0) . '</th>
</tr>
</thead>
<tbody>
';
for ($intCtrEpreuvesCommandees = 1; $intCtrEpreuvesCommandees <= count($arrEpreuvesCommandees); $intCtrEpreuvesCommandees++) {
$arrEpreuve = array();
if (trim($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_categorie_' . $strLangue]) != '') {
$arrEpreuve[] = fxUnescape($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_categorie_' . $strLangue]);
}
if (trim($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_type_' . $strLangue]) != '') {
$arrEpreuve[] = fxUnescape($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_type_' . $strLangue]);
}
if (trim($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_nom_' . $strLangue]) != '') {
$arrEpreuve[] = fxUnescape($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_nom_' . $strLangue]);
}
$strEpreuve = implode(' - ', $arrEpreuve);
$strRetour .= '
<tr>
<td class="text-left">' . fxUnescape($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_nom_' . $strLangue]) . '</td>
<td class="text-left">' . trim($strEpreuve) . '</td>
<td class="text-left">' . fxShowDate($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['epr_date'], $strLangue) . '</td>
<td class="text-left">
<ul class="list-unstyled">
';
if (intval($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['is_cancelled']) == 1) {
$strRetour .= '
<li>
' . afficheTexte('levee_fonds_annulée', 0) . '
</li>
';
} else {
// trouver les participants de l'éreuve
$sqlParticipants = "SELECT par_nom, par_prenom, par_id_original FROM resultats_participants WHERE is_cancelled = 0 AND pec_id = " . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'] . " GROUP BY par_id_original ORDER BY par_nom, par_prenom, par_id";
$arrParticipants = $objDatabase->fxGetResults($sqlParticipants);
$strLink = $vDomaine . '/' . $strPage . '/' . fxUnescape($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['eve_label_url']) . '/';
if (intval($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_equipe']) == 1) { // afficher le lien vers la page de don de l'équipe
$strRetour .= '
<li>
' . fxUnescape($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_nom_equipe']) . '<br><a class="btn btn-primary mt-2 rounded-pill" href="' . $strLink . md5($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original']) . '">' . afficheTexte('voir_levee_fonds_equipe', 0) . '</a>
</li>
';
}
if ($arrParticipants != null) {
foreach ($arrParticipants as $intCtr => $arrPart) {
$strRetour .= '
<li>
' . fxUnescape($arrPart['par_prenom']) . ', ' . fxUnescape($arrPart['par_nom']) . '<br><a class="btn btn-primary mt-2 rounded-pill" href="' . $strLink . md5($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original']) . '/' . md5($arrPart['par_id_original']) . '">' . afficheTexte('voir_levee_fonds_participant', 0) . '</a>
</li>
';
}
}
}
$strRetour .= '
</ul>
</td>
</tr>
';
if (intval($arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['is_cancelled']) == 0) {
$arrObjectifsDons = fxShowFormObjectifsDons($arrEpreuvesCommandees[$intCtrEpreuvesCommandees], $strLangue);
$arrFormsObjectifsDons[] = $arrObjectifsDons['forms'];
$strRetour .= '
<tr>
<td colspan="4">
<p>
<a class="donation_link btn btn-secondary rounded-0" data-pec_id="' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'] . '" href="#">Objectifs dons <span class="donation_sign"><i class="fa fa-plus" aria-hidden="true"></i></span></a>
</p>
<div class="donation_block_' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'] . '" style="display: none;">
<h3>' . afficheTexte('titre_change_objectif', 0) . '</h3>
<div class="alert alert-info" role="alert">
<i class="fa fa-info-circle" aria-hidden="true"></i> Info
<p>
' . afficheTexte('msg_change_objectif', 0) . '
</p>
</div>
<div class="msg" id="msg_' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'] . '"></div>
<div class="donation_list donation_list_' . $arrEpreuvesCommandees[$intCtrEpreuvesCommandees]['pec_id_original'] . '">
' . $arrObjectifsDons['HTML'] . '
</div>
</div>
</td>
</tr>
';
}
}
$strRetour .= '
</tbody>
<tfoot>
<tr>
<th class="text-center" colspan="4">' . count($arrEpreuvesCommandees) . '&nbsp;
';
if (count($arrEpreuvesCommandees) > 1)
$strRetour .= strtolower(afficheTexte('compte_levee_fonds_pluriel', 0, 0));
else
$strRetour .= strtolower(afficheTexte('compte_levee_fonds_singulier', 0, 0));
$strRetour .= '</th>
</tr>
</tfoot>
';
}
$strRetour .= '
</table>
</div>
';
return $strRetour;
}