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

1238 lines
74 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// récupère les champs à demander aux participants pour un événement (JSP)
// param: id de l'événement
// créé: 2014-08-15
function fxGetInfosParticipants($intEvenement)
{
global $objDatabase;
$sqlInfos = "SELECT i.inf_participant1, i.inf_required, c.* FROM inscriptions_infos_participants i, inscriptions_infos_participants_champs c WHERE i.cha_id = c.cha_id AND i.inf_actif = 1 AND i.eve_id = " . intval($intEvenement) . " ORDER BY i.inf_tri";
$tabInfos = $objDatabase->fxGetResults($sqlInfos);
return $tabInfos;
}
// récupère les questions à demander aux participants ou pour une épreuve (JSP)
// param: type (par ou epr), id de l'événement, id de l'épreuve
// créé: 2014-08-15
function fxGetQuestions($strType, $intEvenement, $intEpreuve, $strAction, $intPromoteur = 0, $intquestechue = 0)
{
global $objDatabase;
$strWhere = '';
if (isset($_SESSION['no_panier']) && $strAction == 'mod') {
$strAction = 'add';
}
if ($strType == 'epr')
$strWhere .= "AND que_epreuve = 1";
else
$strWhere .= "AND que_epreuve <> 1";
if ($intquestechue == 1 && $strAction == 'add') {
$sqlQuestions = "SELECT * FROM inscriptions_questions WHERE que_actif = 1 AND eve_id = " . intval($intEvenement) . " AND (FIND_IN_SET(" . intval($intEpreuve) . ", que_epreuves_incluses) OR que_epreuves_incluses = '') " . $strWhere . " ORDER BY que_tri, que_id";
} else {
if ($strAction == 'add') {
$sqlQuestions = "SELECT * FROM inscriptions_questions WHERE que_actif = 1 AND (que_date_limite = '0000-00-00' OR que_date_limite = '' OR que_date_limite IS NULL OR que_date_limite >= '" . fxGetDate() . "') AND eve_id = " . intval($intEvenement) . " AND (FIND_IN_SET(" . intval($intEpreuve) . ", que_epreuves_incluses) OR que_epreuves_incluses = '') " . $strWhere . " ORDER BY que_tri, que_id";
} else {
if ($intPromoteur == 1 || $intquestechue == 1) {
$sqlQuestions = "SELECT * FROM inscriptions_questions WHERE que_actif = 1 AND eve_id = " . intval($intEvenement) . " AND (FIND_IN_SET(" . intval($intEpreuve) . ", que_epreuves_incluses) OR que_epreuves_incluses = '') " . $strWhere . " ORDER BY que_tri, que_id";
} else {
$sqlQuestions = "SELECT * FROM inscriptions_questions WHERE que_actif = 1 AND (que_date_limite = '0000-00-00' OR que_date_limite = '' OR que_date_limite IS NULL OR que_date_limite >= '" . fxGetDate() . "') AND eve_id = " . intval($intEvenement) . " AND (FIND_IN_SET(" . intval($intEpreuve) . ", que_epreuves_incluses) OR que_epreuves_incluses = '') " . $strWhere . " ORDER BY que_tri, que_id";
}
}
}
$tabQuestions = $objDatabase->fxGetResults($sqlQuestions);
return $tabQuestions;
}
function fxShowInfosParticipants(&$tabRules, &$tabMessages, &$tabCalendriers, $tabInfos, $tabDates, $tabProvinces, $tabPays, $tabEpreuve, $tabParticipant, $intCtr, $intNbParticipantsMin, $strAction, $strDisabled, $strReadonly, $strStyle, $strLangue, $intPromoteur, $blnDon = false, &$tabCodepostal, &$tabTelephones)
{
global $strHintModal;
$arrEvenement = fxGetEvenementsId($tabEpreuve['eve_id']);
if ($strAction == 'auto')
$strAction = 'mod';
if ($tabInfos != null) {
for ($intCtrInfos = 1; $intCtrInfos <= count($tabInfos); $intCtrInfos++) {
$strDisabled = $strFieldDisabled = $mem_hint = $strAsterix = '';
if ($tabInfos[$intCtrInfos]['inf_required'] == 1) {
if ($intCtr <= $intNbParticipantsMin) {
$strRequired = 'true';
} else {
$strRequired = '
function(element){
return $("#' . $tabInfos[1]['cha_nom'] . '_' . $intCtr . '").val().length + $("#' . $tabInfos[2]['cha_nom'] . '_' . $intCtr . '").val().length > 0;
}
';
}
} else {
$strRequired = 'false';
}
$strField = $tabInfos[$intCtrInfos]['cha_nom'] . '_' . $intCtr;
if ($strRequired == 'true') {
$strAsterix = '
<small id="' . $strField . '_HelpInline" class="col text-muted">
*
</small>
';
}
if ($tabInfos[$intCtrInfos]['inf_participant1'] == 0 || ($tabInfos[$intCtrInfos]['inf_participant1'] == 1 && $intCtr == 1)) {
switch ($tabInfos[$intCtrInfos]['cha_nom']) {
case 'par_naissance':
$tabCalendriers[] = $strField;
$tabRules[] = $strField . ': { required: ' . $strRequired . ', dateCA: true, daterange: ["' . $tabDates['min_date'] . '", "' . $tabDates['max_date'] . '"] }';
if ($strLangue == 'fr')
$tabMessages[] = $strField . ': { required: "Veuillez entrer la date de naissance", dateCA: "La date de naissance doit être sous le format AAAA-MM-JJ", daterange: "La date de naissance doit être entre {0} et {1}" }';
else
$tabMessages[] = $strField . ': { required: "Please enter the birthdate", dateCA: "The birthdate must be in the format YYYY-MM-DD", daterange: "The birthdate must be between {0} and {1}" }';
break;
// enlever (sl)
case 'par_codepostalbad':
$tabRules[] = $strField . ': { required: ' . $strRequired . ' }';
if ($strLangue == 'fr')
$tabMessages[] = $strField . ': { required: "Veuillez entrer le code postal/zip", postalCodeCA: "Veuillez entrer un code postal canadien valide", zipcodeUS: "Veuillez entrer un code zip américain valide" }';
else
$tabMessages[] = $strField . ': { required: "Please enter the postal/zip code", postalCodeCA: "Please enter a valid Canadian postal code", zipcodeUS: "Please enter a valid US zip code" }';
break;
case 'par_telephone1':
case 'par_telephone2':
case 'par_contact_urgence_telephone':
$tabTelephones[] = $strField;
$tabRules[] = $strField . ': { required: ' . $strRequired . ', phoneUS: true }';
if ($strLangue == 'fr')
$tabMessages[] = $strField . ': { required: "Veuillez entrer le numéro de téléphone", phoneUS: "Le numéro de téléphone doit être sous le format 555-555-5555" }';
else
$tabMessages[] = $strField . ': { required: "Please enter the phone number", phoneUS: "The phone number must be under the format 555-555-5555" }';
break;
case 'par_courriel':
$tabRules[] = $strField . ': { required: ' . $strRequired . ', email: true }';
if ($strLangue == 'fr')
$tabMessages[] = $strField . ': { required: "Veuillez entrer le courriel", email: "Le courriel doit être une adresse valide" }';
else
$tabMessages[] = $strField . ': { required: "Please enter the email", email: "The email must be a valid address" }';
break;
default:
$tabRules[] = $strField . ': { required: ' . $strRequired . ' }';
if ($strLangue == 'fr')
$tabMessages[] = $strField . ': { required: "Veuillez entrer une valeur" }';
else
$tabMessages[] = $strField . ': { required: "Please enter a value" }';
if ($tabInfos[$intCtrInfos]['cha_nom'] == 'par_prenom' && $blnDon) {
if ($strLangue == 'fr') { // FRANÇAIS
$strMessage = "Si vous voulez un reçu au nom d'une entreprise, utilisez les deux champs prénom et nom pour entrer le nom de la compagnie.<br>Exemple, pour MS1 Timing Inc. Entrez :<br>Prénom : MS1<br>Nom : Timing Inc.";
} else { // ANGLAIS
$strMessage = " If you wish to issued the receipt to a company name, use both first and last name field for your company name.<br>Example: for MS1 Timing Inc. Enter :<br>firstname : MS1<br>Lastname : Timing Inc.";
}
$mem_hint = '
<button class="btn btn-sm rounded-circle" type="button" data-toggle="popover" data-content="' . htmlspecialchars($strMessage) . '">
<i class="fa fa-question-circle fa-2x text-info" aria-hidden="true"></i>
</button>
';
}
}
// afficher que les champ pour identifier un abonnement
if ($tabInfos[$intCtrInfos]['cha_abonnement'] == 0 && $tabEpreuve['tep_id'] == 4) {
$mem_hidden = 'style="display: none;';
} else {
$mem_hidden = ' ';
}
?>
<div class="form-group row" <?php echo $mem_hidden; ?> >
<label for="<?php echo $strField; ?>" class="control-label col-12 col-lg-3 text-lg-right">
<?php echo fxUnescape($tabInfos[$intCtrInfos]['cha_label_' . $strLangue]); ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix . $mem_hint; ?>
</span>
</label>
<?php
if ($tabInfos[$intCtrInfos]['cha_nom'] != 'par_naissance') {
?>
<div class="col-12 col-lg-7">
<?php
}
if ($intCtr == 1) {
switch ($tabInfos[$intCtrInfos]['cha_nom']) {
case 'par_naissance':
case 'par_sexe':
case 'par_prenom':
case 'par_nom':
if ($strAction == 'add') {
if (intval($tabEpreuve['tep_id']) == 4) {
$strDisabled = "disabled";
$strFieldDisabled = 'disabled_';
}
} elseif ($strAction == 'mod') {
if ((!isset($_SESSION ['no_panier']) && !fxIsPromoteur($_SESSION['com_info']['com_id'], $tabEpreuve['eve_id'])) || intval($tabEpreuve['tep_id']) == 4) {
$strDisabled = "disabled";
$strFieldDisabled = 'disabled_';
}
}
break;
default:
$strDisabled = $strFieldDisabled = '';
}
}
switch ($tabInfos[$intCtrInfos]['cha_type']) {
case 'text':
if ($tabInfos[$intCtrInfos]['cha_nom'] == 'par_naissance') {
if ($strAction == 'mod' && isset($tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']]))
$tabDateNaissance = explode('-', $tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']]);
?>
<div class="col-4 col-lg-2">
<label class="sr-only"
for="<?php echo $strField; ?>-year"><?php afficheTexte('year', 1, 1, 1); ?></label>
<select class="form-control rounded-0"
id="<?php echo $strField; ?>-year" <?php echo $strDisabled ?>
name="<?php echo $strField; ?>-year" <?php echo $strStyle; ?>>
<?php
if ($strAction == 'add' || ($strAction == 'mod' && !isset($tabParticipant[$intCtr]['par_naissance']))) {
?>
<option value="" selected="selected">
-- <?php afficheTexte('year', 1, 1, 1); ?> --
</option>
<?php
}
for ($intCtr3 = date('Y', strtotime($tabDates['max_date'])); $intCtr3 >= date('Y', strtotime($tabDates['min_date'])); $intCtr3--) {
?>
<option value="<?php echo $intCtr3; ?>"<?php if ($strAction == 'mod' && isset($tabDateNaissance) && $tabDateNaissance[0] == $intCtr3) { ?> selected="selected" <?php } ?>><?php echo $intCtr3; ?></option>
<?php
}
?>
</select>
</div>
<div class="col-4 col-lg-3">
<label class="sr-only"
for="<?php echo $strField; ?>-month"><?php afficheTexte('month', 1, 1, 1); ?></label>
<select class="form-control rounded-0"
id="<?php echo $strField; ?>-month" <?php echo $strDisabled ?>
name="<?php echo $strField; ?>-month" <?php echo $strStyle; ?>>
<?php
if ($strAction == 'add' || ($strAction == 'mod' && !isset($tabParticipant[$intCtr]['par_naissance']))) {
?>
<option value="" selected="selected">
-- <?php afficheTexte('month', 1, 1, 1); ?> --
</option>
<?php
}
for ($intCtr3 = 1; $intCtr3 <= 12; $intCtr3++) {
if (strlen($intCtr3) < 2)
$strValue = '0' . $intCtr3;
else
$strValue = $intCtr3;
?>
<option value="<?php echo $strValue; ?>"<?php if ($strAction == 'mod' && isset($tabDateNaissance) && $tabDateNaissance[1] == $strValue) { ?> selected="selected" <?php } ?>><?php echo fxMois(date('Y-m-d', strtotime('2000-' . $strValue . '-01')), $strLangue); ?></option>
<?php
}
?>
</select>
</div>
<div class="col-4 col-lg-2">
<label class="sr-only"
for="<?php echo $strField; ?>-day"><?php afficheTexte('day', 1, 1, 1); ?></label>
<select class="form-control rounded-0"
id="<?php echo $strField; ?>-day" <?php echo $strDisabled; ?>
name="<?php echo $strField; ?>-day" <?php echo $strStyle; ?>>
<?php
if ($strAction == 'add' || ($strAction == 'mod' && !isset($tabParticipant[$intCtr]['par_naissance']))) {
?>
<option value="" selected="selected">
-- <?php afficheTexte('day', 1, 1, 1); ?> --
</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 ($strAction == 'mod' && isset($tabDateNaissance) && $tabDateNaissance[2] == $strValue) { ?> selected="selected" <?php } ?>><?php echo $intCtr3; ?></option>
<?php
}
?>
</select>
</div>
<div class="col-12 col-lg-7 offset-lg-3">
<input type="hidden" id="<?php echo $strField; ?>"
name="<?php echo $strField; ?>" value="<?php if ($strAction == 'mod') {
echo (isset($tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']])) ? ($tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']]) : ("");
} ?>">
</div>
<?php
} else {
if ($tabInfos[$intCtrInfos]['cha_nom'] == 'par_nom' || $tabInfos[$intCtrInfos]['cha_nom'] == 'par_prenom') {
if ($strAction == 'mod' && !isset($_SESSION ['no_panier']) && $intPromoteur == 0 && $intCtr == 1) {
?>
<input type="hidden" name="<?php echo $strField; ?>"
value="<?php echo (isset($tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']])) ? ($tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']]) : (""); ?>">
<?php
}
}
?>
<input autocomplete="off" class="form-control rounded-0" type="text"
id="<?php echo $strField; ?>" name="<?php echo $strField; ?>"
value="<?php if ($strAction == 'mod') {
echo (isset($tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']])) ? ($tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']]) : ("");
} ?>" maxlength="<?php echo $tabInfos[$intCtrInfos]['cha_maxlength']; ?>"
<?php if (trim($tabInfos[$intCtrInfos]['cha_placeholder_' . $strLangue] != '')) { ?>placeholder="<?php echo $tabInfos[$intCtrInfos]['cha_placeholder_' . $strLangue]; ?>" <?php }
echo $strDisabled . $strStyle;
if ($strRequired == 'true') { ?> required aria-describedby="<?php echo $strField; ?>_HelpInline"<?php } ?>>
<?php
}
break;
case 'list':
$strFieldSelect = $strJavascript = '';
if ($tabInfos[$intCtrInfos]['cha_nom'] == 'par_sexe') {
$strFieldSelect = '-list';
//$strJavascript = ' onChange="fxSetGender(this);"';
?>
<input type="hidden" id="<?php echo $strField; ?>" name="<?php echo $strField; ?>"
value="<?php echo (isset($tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']])) ? ($tabParticipant[$intCtr][$tabInfos[$intCtrInfos]['cha_nom']]) : (""); ?>">
<?php
}
?>
<select class="form-control rounded-0" id="<?php echo $strField . $strFieldSelect; ?>"
name="<?php echo $strField . $strFieldSelect; ?>"
data-field="<?php echo $strField; ?>"
data-type="<?php echo $tabInfos[$intCtrInfos]['cha_nom']; ?>" <?php echo $strDisabled . $strStyle . $strJavascript; ?>>
<?php
if ($strAction == 'add' || ($strAction == 'mod' && (!isset($tabParticipant[$intCtr]['par_sexe']) || !isset($tabParticipant[$intCtr]['pro_id']) || !isset($tabParticipant[$intCtr]['pay_id']) || trim($tabParticipant[$intCtr]['par_sexe'])) == '' || trim($tabParticipant[$intCtr]['pro_id']) == '' || trim($tabParticipant[$intCtr]['pay_id']) == '')) {
?>
<option value=""
selected="selected"><?php if ($strLangue == 'fr') { ?>-- Faites un choix --<?php } else { ?>-- Choose one --<?php } ?></option>
<?php
}
if ($tabInfos[$intCtrInfos]['cha_nom'] == 'par_sexe') {
// MSIN-4215 pout tq
switch ($tabInfos[$intCtrInfos]["cha_autre_info"]) {
case 1:
if ($tabEpreuve['epr_sexe'] == 'm' || $tabEpreuve['epr_sexe'] == 'f') {
?>
<option value="f"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'f') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Femme (catégorie Femme)<?php } else { ?>Female (Womens category)<?php } ?>
</option>
<?php
}
if ($tabEpreuve['epr_sexe'] == 'm' || $tabEpreuve['epr_sexe'] == 'h') {
?>
<option value="h"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'h') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Homme (catégorie ouverte)<?php } else { ?>Male (Open category)<?php } ?>
</option>
<?php
}
?>
<option value="n"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'n') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Non-binaire (catégorie ouverte)<?php } else { ?>Genderfluid (Open category)<?php } ?>
</option>
<option value="a"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'a') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Autre (catégorie ouverte)<?php } else { ?>Other (Open category)<?php } ?>
</option>
<?php
break;
case 2:
if ($tabEpreuve['epr_sexe'] == 'm' || $tabEpreuve['epr_sexe'] == 'f') {
?>
<option value="f"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'f') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Femme<?php } else { ?>Female<?php } ?>
</option>
<?php
}
if ($tabEpreuve['epr_sexe'] == 'm' || $tabEpreuve['epr_sexe'] == 'h') {
?>
<option value="h"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'h') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Homme<?php } else { ?>Male<?php } ?>
</option>
<?php
}
?>
<?php
break;
default:
if ($tabEpreuve['epr_sexe'] == 'm' || $tabEpreuve['epr_sexe'] == 'f') {
?>
<option value="f"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'f') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Femme<?php } else { ?>Female<?php } ?>
</option>
<?php
}
if ($tabEpreuve['epr_sexe'] == 'm' || $tabEpreuve['epr_sexe'] == 'h') {
?>
<option value="h"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'h') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Homme<?php } else { ?>Male<?php } ?>
</option>
<?php
}
?>
<option value="n"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'n') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Non-binaire<?php } else { ?>Genderfluid<?php } ?>
</option>
<option value="a"<?php if ($strAction == 'mod' && isset($tabParticipant[$intCtr]['par_sexe']) && $tabParticipant[$intCtr]['par_sexe'] == 'a') { ?> selected="selected"<?php } ?>>
<?php if ($strLangue == 'fr') { ?>Autre<?php } else { ?>Other<?php } ?>
</option>
<?php
break;
}
} elseif ($tabInfos[$intCtrInfos]['cha_nom'] == 'pro_id') {
if ($strAction != 'mod') {
for ($intCtr2 = 1; $intCtr2 <= count($tabProvinces); $intCtr2++) {
?>
<option value="<?php echo $tabProvinces[$intCtr2]['pro_id']; ?>"><?php echo $tabProvinces[$intCtr2]['pro_nom_' . $strLangue]; ?></option>
<?php
}
} else {
for ($i = 1; $i <= count($tabProvinces); $i++) {
?>
<option value="<?php echo $tabProvinces[$i]['pro_id']; ?>"<?php if (isset($tabParticipant[$intCtr]['pro_id']) && $tabProvinces[$i]['pro_id'] == $tabParticipant[$intCtr]['pro_id']) { ?> selected="selected"<?php } ?>><?php echo $tabProvinces[$i]['pro_nom_' . $strLangue]; ?></option>
<?php
}
}
} elseif ($tabInfos[$intCtrInfos]['cha_nom'] == 'pay_id') {
if ($strAction != 'mod') {
for ($intCtr2 = 1; $intCtr2 <= count($tabPays); $intCtr2++) {
?>
<option value="<?php echo $tabPays[$intCtr2]['pay_id']; ?>"><?php echo $tabPays[$intCtr2]['pay_nom_' . $strLangue]; ?></option>
<?php
}
} else {
for ($i = 1; $i <= count($tabPays); $i++) {
?>
<option value="<?php echo $tabPays[$i]['pay_id']; ?>"<?php if (isset($tabParticipant[$intCtr]['pay_id']) && $tabPays[$i]['pay_id'] == $tabParticipant[$intCtr]['pay_id']) { ?> selected="selected"<?php } ?>><?php echo $tabPays[$i]['pay_nom_' . $strLangue]; ?></option>
<?php
}
}
}
?>
</select>
<?php
break;
}
if ($tabInfos[$intCtrInfos]['cha_nom'] != 'par_naissance') {
?>
</div>
<?php
}
?>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix . $mem_hint; ?>
</div>
</div>
<?php
}
}
}
}
function fxShowQuestions(&$tabRules, &$tabMessages, $tabQuestions, $tabEpreuve, $tabModQuestions, $intCtr, $intNbParticipantsMin, $strAction, $strLangue, $intNbInscriptions = 0, $intPromoteur = 0, &$tabCodepostal, &$tabTelephones)
{
global $strHintModal, $vDomaine, $vRepertoireFichiers;
$mem_question_premier = $mem_last = $intNbQuestions = 0;
$strDisabledPrev = $strNoTransfert = '';
$arrWidth = array('mobile', 'desktop');
if (isset($_GET['t'])) {
$strNoTransfert = trim($_GET['t']);
}
if (trim($strAction) == 'auto')
$strAction = 'mod';
if ($tabQuestions != null) {
for ($intCtr3 = 1;
$intCtr3 <= count($tabQuestions);
$intCtr3++) {
$tabNoMore = array();
$strMessDisabled = "";
// modif MSIN-3922
if ($tabQuestions[$intCtr3]['que_validation'] == "clubtq") {
$liste = fxCheckNomclub($tabQuestions[$intCtr3]['que_id'], $strLangue);
$tabQuestions[$intCtr3]['que_choix_' . $strLangue] = $liste;
}
// if (trim($strAction) == 'add' || (trim($strAction) == 'mod' && intval($tabQuestions[$intCtr3]['que_modifiable']) != 0)) {
// MSIN-4007
if ((trim($strAction) == 'add' || (trim($strAction) == 'mod') && (intval($tabQuestions[$intCtr3]['que_modifiable']) != 0) || fxIsPromoteur($_SESSION['com_info']['com_id'], $tabEpreuve['eve_id']))) {
if ((intval($intCtr) == 1 && intval($tabQuestions[$intCtr3]['que_participant_1']) == 1) || intval($tabQuestions[$intCtr3]['que_participant_1']) == 0) {
if ((intval($tabEpreuve['tep_id']) == 2 && intval($tabQuestions[$intCtr3]['que_benevoles']) == 1) || in_array(intval($tabEpreuve['tep_id']), array(1, 3, 4))) {
$intNbQuestions++;
$mem_hint = $mem_hide = $mem_len_max = $strValue = $strPdf = $strAsterix = '';
$strField = 'que_' . $tabQuestions[$intCtr3]['que_id'];
$strFieldNext = 'que_' . $tabQuestions[$intCtr3 + 1]['que_id'];
$strDisabled = $strFieldDisabled = '';
$intEpreuveCommandee = $intParticipant = $intIndex = 0;
$arrHint = array();
if (intval($intCtr) != 0)
$strField .= '_' . $intCtr;
// MSIN-3913 MSIN-3828
// if (intval($intCtr) <= intval($intNbParticipantsMin) && intval($tabQuestions[$intCtr3]['que_required']) == 1) {
if (intval($tabQuestions[$intCtr3]['que_required']) == 1) {
$strRequired = 'true';
} else {
$strRequired = 'false';
}
if (intval($intCtr) > intval($intNbParticipantsMin) && intval($tabQuestions[$intCtr3]['que_required']) == 1) {
$strRequired = 'function(element){return $("#par_prenom_' . $intCtr . '").val().length + $("#par_nom_' . $intCtr . '").val().length > 0;
}
';
}
if (intval($tabQuestions[$intCtr3]['que_hidden']) == 1)
$mem_hide = 'style="display: none;"';
if (trim($tabQuestions[$intCtr3]['que_hint_' . $strLangue]) <> '') {
foreach ($arrWidth as $strWidth) {
$arrHint[$strWidth] = '
<button type="button" class="btn btn-sm rounded-circle" data-toggle="popover-x" data-target="#popover_' . $strField . '_' . $strWidth . '" data-placement="auto">
<i class="fa fa-question-circle fa-2x text-info" aria-hidden="true"></i>
</button>
';
$strHintModal .= '
<div id="popover_' . $strField . '_' . $strWidth . '" class="popover popover-x popover-info">
<div class="arrow"></div>
<div class="popover-header popover-title"><button class="close" data-dismiss="popover-x">&times;</button>info</div>
<div class="popover-body popover-content">
' . fxUpdateLiensInternes(trim($tabQuestions[$intCtr3]['que_hint_' . $strLangue])) . '
</div>
</div>
';
}
}
if (trim($tabQuestions[$intCtr3]['que_pdf_' . $strLangue]) <> '') {
if ($strLangue == 'fr')
$strTitle = 'Modèle / Charte des grandeurs';
else
$strTitle = 'Model / Size chart';
// $strPdf = '<a href="' . $vDomaine . '/pdf/questions/' . fxUnescape(trim($tabQuestions[$intCtr3]['que_pdf_' . $strLangue])) . '" target="_blank"><i class="fa fa-file-pdf-o tooltip ico-question" title="' . $strTitle . '"></i></a>';
$strPdf = '
<a href="' . $vDomaine . $vRepertoireFichiers . '/pdf/questions/' . fxUnescape(trim($tabQuestions[$intCtr3]['que_pdf_' . $strLangue])) . '" target="_blank">
<img data-toggle="tooltip" src="' . $vDomaine . '/images/ico-shirt.png" alt="" title="' . $strTitle . '">
</a>
';
}
if ($strRequired == 'true') {
$strAsterix = '
<small id="' . $strField . '_HelpInline" class="col text-muted">
*
</small>
';
}
switch ($tabQuestions[$intCtr3]['que_validation']) {
case 'date':
?>
<script type="text/javascript">
$(function () {
$('#cal-<?php echo $strField; ?>').datetimepicker({
format: 'YYYY-MM-DD',
locale: '<?php echo $strLangue; ?>-ca'
});
});
</script>
<?php
$arrRulesTempo = $arrMessageTempo = array();
$arrRulesTempo[] = 'required: ' . $strRequired;
$arrMessageTempo[] = 'required: "' . afficheTexte('validation_msg_date_required', 0) . '"';
$arrRulesTempo[] = 'dateCA: true';
$arrMessageTempo[] = 'dateCA: "' . afficheTexte('validation_msg_date_format', 0) . '"';
$tabRules[] = $strField . ': { ' . implode(',', $arrRulesTempo) . ' }';
$tabMessages[] = $strField . ': { ' . implode(',', $arrMessageTempo) . ' }';
break;
case 'depend':
case 'depend_last':
case 'triathlon':
$mem_hide = 'style="display: none;"';
?>
<script type="text/javascript">
$(function () {
var $last = $('#<?php echo $mem_last;?>');
var $last_option = $('#<?php echo $mem_last;?> option');
var $hidden = $('#quehide_<?php echo $strField; ?>');
var $field = $('#<?php echo $strField; ?>');
var $form = $("#frm_participant");
$last.bind('change', function (e) {
$field.val('');
<?php
if ($tabQuestions[$intCtr3]['que_validation'] == 'depend_last') {
?>
if ($last.val() == $last_option.length) {
$hidden.show();
} else {
$hidden.hide();
}
<?php
} else {
?>
if ($last.val() == 2) {
$hidden.show();
} else {
$hidden.hide();
}
<?php
}#
?>
$form.valid();
});
});
</script>
<?php
if ($tabQuestions[$intCtr3]['que_validation'] == 'triathlon') {
$tabRules[] = $strField . ': { required: ' . $strRequired . ', remote: { url: "' . $vDomaine . '/ajax_verif_triathlon2021.php", type: "post", data: { tq_no: function () { return $("#' . $strField . '").val(); }, tq_naissance: function () { return $("#par_naissance_' . $intCtr . '").val(); }, epr_date: "' . $tabEpreuve['epr_date'] . '" } } }';
if ($strLangue == 'fr')
$tabMessages[] = $strField . ': { required: "Veuillez entrer le numéro de Triathlon Québec", remote: "Le numéro TQ n\'est pas valide au jour de l\'épreuve ou ne correspond pas à celui de votre compte." }';
else
$tabMessages[] = $strField . ': { required: "Please enter the Triathlon Quebec number", remote: "The TQ number is not valid on the day of the event or does not correspond to the member of your account" }';
} else {
$tabRules[] = $strField . ': { required: ' . $strRequired . ' }';
$strDisabled = $strDisabledPrev;
if ($strDisabled != '') {
$strFieldDisabled = 'disabled_';
}
}
break;
case 'FNQ':
$mem_hide = 'style="display: none;"';
?>
<script type="text/javascript">
$(function () {
var $last = $('#<?php echo $mem_last;?>');
var $last_option = $('#<?php echo $mem_last;?> option');
var $hidden = $('#quehide_<?php echo $strField; ?>');
var $field = $('#<?php echo $strField; ?>');
var $form = $("#frm_participant");
$last.bind('change', function (e) {
$field.val('');
<?php
if ($tabQuestions[$intCtr3]['que_validation'] == 'depend_last') {
?>
if ($last.val() == $last_option.length) {
$hidden.show();
} else {
$hidden.hide();
}
<?php
} else {
?>
if ($last.val() == 2) {
$hidden.show();
} else {
$hidden.hide();
}
<?php
}#
?>
$form.valid();
});
});
</script>
<?php
if ($tabQuestions[$intCtr3]['que_validation'] == 'FNQ') {
$tabRules[] = $strField . ': { required: ' . $strRequired . ', remote: { url: "' . $vDomaine . '/ajax_verif_fnq.php", type: "post", data: { tq_no: function () { return $("#' . $strField . '").val(); }, tq_naissance: function () { return $("#par_naissance_' . $intCtr . '").val(); }, epr_date: "' . $tabEpreuve['epr_date'] . '" } } }';
if ($strLangue == 'fr')
$tabMessages[] = $strField . ': { required: "Veuillez entrer le numéro FNQ", remote: "Le numéro FNQ n\'est pas valide ou ne correspond pas à celui de votre compte." }';
else
$tabMessages[] = $strField . ': { required: "Please enter your affiliation number FNQ", remote: "The FNQ number is not valid or does not correspond to the member of your account" }';
} else {
$tabRules[] = $strField . ': { required: ' . $strRequired . ' }';
$strDisabled = $strDisabledPrev;
if ($strDisabled != '') {
$strFieldDisabled = 'disabled_';
}
}
break;
case 'TQ_numero':
$mem_tq = fxtypemembership($tabEpreuve['mt_id']);
$mem_tq_prefix = $mem_tq['mt_prefixe'];
$mem_tq_acien_min = $mem_tq['mt_acien_min'];
$mem_tq_acien_max = $mem_tq['mt_acien_max'];
$mem_hide = ' ';
$mem_hide_tq = 'style="display: none;"';
$tabRules[] = 'TQ_numero : { required:TQ_numero,integer:true,range:[' . $mem_tq_acien_min . ', ' . $mem_tq_acien_max . '] , remote: { url: "' . $vDomaine . '/ajax_verif_tq_numero.php", type: "post", data: { tq_numero: function () { return $("#TQ_numero").val(); },prefix_numero : "' . $mem_tq_prefix . '" , mt_id : "' . $tabEpreuve['mt_id'] . '" } } }';
if ($strLangue == 'fr')
$tabMessages[] = 'TQ_numero : { range:"Veuillez entrer votre numero entre ' . $mem_tq_acien_min . ' et ' . $mem_tq_acien_max . '", required: "Veuillez entrer votre numero tq", remote: "Ce numéro est déjà utilisé par un autre membre." }';
else
$tabMessages[] = 'TQ_numero : { required: "Please enter the team name", remote: "This name is already in use, please choose another one." }';
?>
<script type="text/javascript">
$(function () {
var $last = $('#<?php echo $strField; ?>');
var $last_option = $('#<?php echo $mem_last;?> option');
var $hidden = $('#quehide_TQ_numero');
var $field = $('#<?php echo $strField; ?>');
var $form = $("#frm_participant");
$last.bind('change', function (e) {
if ($last.val() == 2) {
$hidden.show();
} else {
$hidden.hide();
}
});
});
</script>
<?php
break;
case 'equipe':
$tabRules[] = $strField . ': { required: ' . $strRequired . ', remote: { url: "' . $vDomaine . '/ajax_verif_equipe.php", type: "post", data: { par_nom_equipe : function () { return $("#' . $strField . '").val(); }, epr_id: function () { return $("#epr_id").val(); }, pec_id: function () { return $("#pec_id").val(); } } } }';
if ($strLangue == 'fr')
$tabMessages[] = $strField . ': { required: "Veuillez entrer le nom de l\'équipe", remote: "Ce nom est déjà utilisé, veuillez en choisir un autre." }';
else
$tabMessages[] = $strField . ': { required: "Please enter the team name", remote: "This name is already in use, please choose another one." }';
break;
case 'image':
case 'pdf':
$arrRulesTempo = $arrMessageTempo = array();
$arrRulesTempo[] = 'required: ' . $strRequired;
$arrMessageTempo[] = 'required: "' . afficheTexte('validation_msg_upload_required', 0) . '"';
if ($tabQuestions[$intCtr3]['que_validation'] == 'image') {
$arrRulesTempo[] = 'accept: "image/*"';
$arrMessageTempo[] = 'required: "' . afficheTexte('validation_msg_upload_image', 0) . '"';
$arrMessageTempo[] = 'accept: "' . afficheTexte('validation_msg_mime_image', 0) . '"';
}
if ($tabQuestions[$intCtr3]['que_validation'] == 'pdf') {
$arrRulesTempo[] = 'accept: "application/pdf"';
$arrMessageTempo[] = 'required: "' . afficheTexte('validation_msg_upload_pdf', 0) . '"';
$arrMessageTempo[] = 'accept: "' . afficheTexte('validation_msg_mime_pdf', 0) . '"';
}
$tabRules[] = $strField . ': { ' . implode(',', $arrRulesTempo) . ' }';
$tabMessages[] = $strField . ': { ' . implode(',', $arrMessageTempo) . ' }';
break;
case 'url':
$arrRulesTempo = $arrMessageTempo = array();
$arrRulesTempo[] = 'required: ' . $strRequired;
$arrMessageTempo[] = 'required: "' . afficheTexte('validation_msg_url_required', 0) . '"';
$arrRulesTempo[] = 'url: true';
$arrMessageTempo[] = 'url: "' . afficheTexte('validation_msg_url_format', 0) . '"';
$tabRules[] = $strField . ': { ' . implode(',', $arrRulesTempo) . ' }';
$tabMessages[] = $strField . ': { ' . implode(',', $arrMessageTempo) . ' }';
break;
default:
//MSIN-4292
if (intval($tabQuestions[$intCtr3]['que_choix_multiple']) == 1)
$tabRules[] = '"'.$strField . '[]": { required: ' . $strRequired . ' }';
else
$tabRules[] = $strField . ': { required: ' . $strRequired . ' }';
}
if ($intNbQuestions === 1) {
?>
<div data-debug="<?php echo $mem_question_premier ?>" class="card-header">
<h2>
<?php
if (intval($tabQuestions[1]['que_epreuve']) == 1) {
if ($strLangue == 'fr') {
?>À propos de cette inscription<?php
} else {
?>About this registration<?php
}
} else {
?>Questions<?php
}
?>
</h2>
</div>
<div class="card-body">
<?php
}
// MSIN-1532 = $$ ($intNbInscriptions != 0 && $intCtr <= $intNbInscriptions)
if ($intCtr > 0 && $mem_question_premier == 0 && ($intNbInscriptions != 0 && $intCtr <= $intNbInscriptions)) {
if ($strAction == 'mod' || trim($strNoTransfert) != '') {
$tabModQuestions = $tabModQuestions[$intCtr];
}
}
$mem_question_premier = 1;
// MSIN-4173
$strMessDisabled = "";
if ($tabQuestions[$intCtr3]["que_date_limite"] != '0000-00-00' && date('Y-m-d') > $tabQuestions[$intCtr3]["que_date_limite"]) {
// On a dépassé la date limite
$strDisabled = "disabled";
$strMessDisabled = afficheTexte('plusmodifiable', 0);
}
?>
<div>
<div id="quehide_<?php echo $strField; ?>" class="form-group row" <?php echo $mem_hide; ?>>
<label class="control-label col-12 col-lg-3 text-lg-right">
<?php echo $tabQuestions[$intCtr3]['que_question_' . $strLangue]; ?>
<span class="d-inline-block d-lg-none">
<?php echo $strAsterix . $arrHint['mobile'] . $strPdf; ?>
</span>
<?php
if ($tabQuestions[$intCtr3]['que_validation'] == "categorie") {
?>
<br>(<?php if ($strLangue == 'fr') { ?>selon l'âge au<?php } else { ?>according to age by<?php } ?><?php echo fxShowDate($tabEpreuve['epr_date_age'], $strLangue); ?>)
<?php
}
?>
</label>
<div class="col-12 col-lg-7">
<?php
if ($tabQuestions[$intCtr3]['que_liste']) {
// $tabChoix = explode(',', $tabQuestions[$intCtr3]['que_choix_' . $strLangue]);
//MSIN-4296
$tabChoix = array_filter(
array_map('trim', explode(',', $tabQuestions[$intCtr3]['que_choix_' . $strLangue])),
'strlen'
);
$strProduits = $tabQuestions[$intCtr3]['que_choix_produit'];
$tabProduits = explode(',', $strProduits);
$tabChoixSelect = array();
if (isset($tabModQuestions[$tabQuestions[$intCtr3]['que_id']])) { // Si modification, trouver les réponses aux questions
if ($strAction == 'mod' || trim($strNoTransfert) != '') {
$intEpreuveCommandee = $tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['pec_id'];
$intParticipant = $tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['par_id'];
}
}
if (($strAction == 'mod' && $intPromoteur == 0 && !isset($_SESSION['no_panier'])) || trim($strNoTransfert) != '') {
if (trim($strProduits) != '') { // si la question génère un produit, vérifier s'il est toujours dispo
$intNbDiSponibles = $intNbNonDiSponibles = 0;
$tabProduitsUniques = array_unique($tabProduits);
if (($key = array_search(0, $tabProduitsUniques)) !== false) { // enlever le produit 0
unset($tabProduitsUniques[$key]);
}
if (!empty($tabProduitsUniques)) {
foreach ($tabProduitsUniques as $produit) {
$blnProduit = fxCheckStockProduits($produit, $intEpreuveCommandee, $intParticipant);
if ($blnProduit) {
$intNbDiSponibles++;
} else {
$intNbNonDiSponibles++;
}
}
if ($intNbNonDiSponibles == count($tabProduitsUniques)) {
$strDisabled = ' disabled';
$strFieldDisabled = 'disabled_';
}
}
}
}
for ($i = 1; $i <= count($tabChoix); $i++) {
$blnProduit = true;
$blnSelected = false;
if (isset($tabModQuestions[$tabQuestions[$intCtr3]['que_id']])) {
if ($strAction == 'mod' || trim($strNoTransfert) != '') { // avant != '' MSIN-4227
$arrModValues = explode(',', preg_replace("/\r|\n/", "", trim($tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['que_choix_' . $strLangue])));
if (in_array(trim($tabChoix[$i - 1]), $arrModValues)) {
$blnSelected = true;
$intIndex = $i;
$strValue = trim($tabChoix[$i - 1]);
}
}
}
if (count($tabChoix) == count($tabProduits)) {
if ($tabProduits[$i - 1] != 0) { // vérifier si le choix est disponible selon la quantité du produit
//MSIN-4344
$tabProduit = fxGetProduits($tabProduits[$i - 1],$intEvenement,"",0);
$prixfrais=$tabProduit['pro_prix']+$tabProduit['fra_total'];
$afficheprixfrais = '';
if ($tabProduit['fra_total'] > 0 && $tabProduit['pro_prix'] > 4.99) {
$afficheprixfrais = ' ('
. fxShowPrix($prixfrais, $strLangue)
. ' '
. afficheTexte('text_frais_inclus', 0)
. ')';
}
$tabChoix[$i - 1]=$tabChoix[$i - 1].$afficheprixfrais;
$blnProduit = fxCheckStockProduits($tabProduits[$i - 1], $intEpreuveCommandee, $intParticipant);
if ($blnProduit==1) {
if($tabProduit["echue"]==1){
$blnProduit=0;
}
}
}
}
if ($blnProduit) { // si produit toujours disponible ou si aucun produit rattaché
$tabChoixSelect[] = array('selected' => $blnSelected, 'value' => $i, 'text' => fxUnescape($tabChoix[$i - 1]));
} else {
if ($strAction == 'add' && trim($strNoTransfert) == '') { // si stock du produit épuisé
// obtenir les infos du produit épuisé
$tabProduit = fxGetProduits($tabProduits[$i - 1],$intEvenement,"",0);
// msin-3882 remmetre le message
if ($tabProduit != null) {
if ($strLangue == 'fr') { // FRANÇAIS
$tabNoMore[] = '<i class="fa fa-exclamation-circle" aria-hidden="true"></i> Non disponible pour <em>' . fxUnescape($tabProduit['pro_nom_fr']) . '</em>';
} else { // ANGLAIS
$tabNoMore[] = '<i class="fa fa-exclamation-circle" aria-hidden="true"></i> Not available <em>' . fxUnescape($tabProduit['pro_nom_en']) . '</em> ';
}
}
} else {
if ($blnSelected || $intPromoteur == 1) {
$tabChoixSelect[] = array('selected' => $blnSelected, 'value' => $i, 'text' => fxUnescape($tabChoix[$i - 1]));
}
}
}
}
if (!empty($tabChoixSelect)) {
if (intval($tabQuestions[$intCtr3]['que_choix_multiple']) == 1) {
$strSelect2 = 'select2-multi';
} else {
$strSelect2 = 'select2-single';
}
?>
<select class="form-control rounded-0 <?php echo $strSelect2; ?>"
id="<?php echo $strFieldDisabled . $strField; ?>"
name="<?php echo $strFieldDisabled . $strField; ?><?php if (intval($tabQuestions[$intCtr3]['que_choix_multiple']) == 1) { ?>[]<?php } ?>"<?php echo $strDisabled; ?><?php if (intval($tabQuestions[$intCtr3]['que_choix_multiple']) == 1) { ?> multiple<?php }
if (boolval($strRequired)) { ?> required <?php } ?>>
<?php
foreach ($tabChoixSelect as $tab) {
?>
<option<?php if ($tab['selected']) { ?> selected="selected" <?php } ?>
value="<?php if ($tab['value'] == 1) {
echo "";
} else {
echo $tab['value'];
} ?>"><?php echo $tab['text']; ?></option>
<?php
}
?>
</select>
<?php
echo($strMessDisabled);
} else {
unset($tabNoMore);
$tabNoMore = array();
if ($strLangue == 'fr') {
echo '<div class="alert alert-danger" role="alert"><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Ce produit n\'est plus disponible.</div>';
} else {
echo '<div class="alert alert-danger" role="alert"><i class="fa fa-exclamation-circle" aria-hidden="true"></i> This product is no longer available.</div>';
}
}
?>
<?php
if ($strAction == 'mod' || trim($strNoTransfert) != '') {
?>
<input type="hidden" id="old_<?php echo $strField; ?>"
name="old_<?php echo $strField; ?>"
value="<?php echo fxUnescape($intIndex); ?>">
<?php
if ($strDisabled != '') {
?>
<input type="hidden" id="<?php echo $strField; ?>"
name="<?php echo $strField; ?>"
value="<?php echo fxUnescape($intIndex); ?>">
<?php
}
}
} else {
if ($tabQuestions[$intCtr3]['que_validation'] == "image" || $tabQuestions[$intCtr3]['que_validation'] == "pdf") {
if (isset($tabModQuestions[$tabQuestions[$intCtr3]['que_id']])) { // trouver le fichier actuel, s'il en existe un
if ($strAction == 'mod' || trim($strNoTransfert) != '') {
$strValue = fxUnescape($tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['que_choix_' . $strLangue]);
}
}
if (trim($strAction) == 'add' || (trim($strAction) == 'mod' && isset($_SESSION['no_panier']) && trim($strValue) == '') || (trim($strAction) == 'mod' && !isset($_SESSION['no_panier']) && isset($_SESSION['com_info']) && fxIsPromoteur($_SESSION['com_info']['com_id'], $tabEpreuve['eve_id']) && trim($strValue) == '')) {
?>
<input autocomplete="off" class="form-control rounded-0" type="file"
id="<?php echo $strField; ?>"
name="<?php echo $strField; ?>"<?php echo $mem_len_max; ?>>
<?php
} elseif (trim($strAction) == 'mod' && isset($_SESSION['no_panier']) && trim($strValue) != '') {
?>
<a class="btn btn-primary mb-2 mr-2 rounded-pill"
href="<?php echo $vDomaine . '/upload/temp/' . fxUnescape($tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['no_panier']) . '/' . $strValue; ?>"
target="_blank"><?php echo $strValue; ?></a>
<button type="button" class="btn btn-danger btn-sm rounded-0 delete_fichier"
data-id="<?php echo $tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['pqu_id']; ?>"
data-file="<?php echo $strValue; ?>" data-panier="true"
data-no_panier="<?php echo $_SESSION['no_panier']; ?>"><i
class="fa fa-times mr-2"
aria-hidden="true"></i><?php afficheTexte('btn-effacer-fichier', 1); ?>
</button>
<?php
} elseif (trim($strAction) == 'mod' && !isset($_SESSION['no_panier']) && isset($_SESSION['com_info']) && fxIsPromoteur($_SESSION['com_info']['com_id'], $tabEpreuve['eve_id']) && trim($strValue) != '') {
?>
<a class="btn btn-primary mb-2 mr-2 rounded-pill"
href="<?php echo $vDomaine . '/upload/' . intval($tabEpreuve['eve_id']) . '/' . $strValue; ?>"
target="_blank"><?php echo $strValue; ?></a>
<button type="button" class="btn btn-danger btn-sm rounded-0 delete_fichier"
data-id="<?php echo $tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['pqu_id']; ?>"
data-file="<?php echo $strValue; ?>" data-panier="false"
data-no_panier="<?php echo $tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['no_panier']; ?>">
<i class="fa fa-times mr-2"
aria-hidden="true"></i><?php afficheTexte('btn-effacer-fichier', 1); ?>
</button>
<?php
} elseif (trim($strValue) != '') {
?>
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine . '/upload/' . intval($tabEpreuve['eve_id']) . '/' . $strValue; ?>"
target="_blank"><?php echo $strValue; ?></a>
<?php
}
} elseif ($tabQuestions[$intCtr3]['que_validation'] == "date") {
if (isset($tabModQuestions[$tabQuestions[$intCtr3]['que_id']])) {
if ($strAction == 'mod' || trim($strNoTransfert) != '') {
$strValue = fxUnescape($tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['que_choix_' . $strLangue]);
}
}
?>
<div class="input-group" id="cal-<?php echo $strField; ?>"
data-target-input="nearest">
<input autocomplete="off" class="form-control rounded-0" type="text"
id="<?php echo $strField; ?>" name="<?php echo $strField; ?>"
value="<?php echo $strValue; ?>"<?php echo $mem_len_max; ?>
placeholder="<?php afficheTexte('validation_placeholder_date_format'); ?>"
data-target="#cal-<?php echo $strField; ?>">
<div class="input-group-append rounded-0"
data-target="#cal-<?php echo $strField; ?>" data-toggle="datetimepicker">
<span class="input-group-text rounded-0">
<i class="fa fa-calendar"></i>
</span>
</div>
</div>
<?php
} else {
if ($tabQuestions[$intCtr3]['que_len_max'] != 0)
$mem_len_max = ' maxlength="' . $tabQuestions[$intCtr3]['que_len_max'] . '" ';
if (isset($tabModQuestions[$tabQuestions[$intCtr3]['que_id']])) {
if ($strAction == 'mod' || trim($strNoTransfert) != '') {
$strValue = fxUnescape($tabModQuestions[$tabQuestions[$intCtr3]['que_id']]['que_choix_' . $strLangue]);
}
}
?>
<input autocomplete="off" class="form-control rounded-0" autocomplete="off"
type="text"
id="<?php echo $strField; ?>" name="<?php echo $strField; ?>"
value="<?php echo $strValue; ?>"<?php echo $mem_len_max; ?>>
<?php
}
if ($strAction == 'mod' || trim($strNoTransfert) != '') {
?>
<input type="hidden" id="old_<?php echo $strField; ?>"
name="old_<?php echo $strField; ?>"
value="<?php echo fxUnescape($strValue); ?>">
<?php
}
}
?>
</div>
<div class="col-lg-2 d-none d-lg-inline-block">
<?php echo $strAsterix . $arrHint['desktop'] . $strPdf; ?>
</div>
<?php
if (count($tabNoMore) > 0) {
?>
<br>
<div class="alert alert-danger" role="alert">
<?php echo implode('<br>', $tabNoMore); ?>
</div>
<?php
}
?>
</div>
<?php if ($tabQuestions[$intCtr3]['que_validation'] == "TQ_numero") { ?>
<div id="quehide_TQ_numero" class="form-group row" <?php echo $mem_hide_tq; ?>>
<label class="control-label col-12 col-lg-3 text-lg-right">
<?php echo afficheTexte('question_TQ_numero', 0) ?>
<span class="d-inline-block d-lg-none">
</span>
</label>
<p><b><?php echo $mem_tq_prefix; ?> </b></p>
<div class="col-7 col-lg-7">
<input class="form-control rounded-0" autocomplete="off" type="number" size="5"
id="TQ_numero" name="TQ_numero" value="">
</div>
</div>
<?php } ?>
</div>
<?php
$mem_last = $strField;
$strDisabledPrev = $strDisabled;
}
}
}
}
if ($intNbQuestions > 0) {
?>
</div>
<?php
}
}
}
// valide si on doit afficher le choix de réponse par rapport à la quantité restante des produits (JSP) MSIN-747
// param: id du produit, ipd de l'épreuve commandée, id du participant
// retour : true/false
function fxCheckStockProduits($intProduit, $intEpreuveCommandee, $intParticipant)
{
global $objDatabase;
$strWhere = '';
if ($intEpreuveCommandee != 0) {
$strWhere .= " AND p.pec_id <> " . intval($intEpreuveCommandee);
}
if ($intParticipant != 0) {
$strWhere .= " AND p.par_id <> " . intval($intParticipant);
}
$sqlRestant = "
SELECT
(SELECT pro_qte FROM inscriptions_produits_new WHERE pro_id = " . intval($intProduit) . ") AS dispo,
(
(SELECT COUNT(p2.pro_id) FROM resultats_produits_new p2, resultats_epreuves_commandees c WHERE c.pec_id_original = p2.pec_id AND c.is_cancelled = 0 AND p2.pro_id = " . intval($intProduit) . ")
+
(SELECT COUNT(p.ppn_id)
FROM inscriptions_panier_produits_new p, inscriptions_panier_acheteurs a
WHERE a.no_panier = p.no_panier AND a.sta_id = 1 AND p.pro_id = " . intval($intProduit) . " $strWhere)
) AS vendu
FROM DUAL
";
$tabRestant = $objDatabase->fxGetRow($sqlRestant);
if ($tabRestant != null) {
if (intval($tabRestant['dispo']) > intval($tabRestant['vendu']))
return true;
else
return false;
} else
return false;
}
// modif MSIN-3922
function fxCheckNomclub($que_id, $strLangue)
{
global $objDatabase;
//$strWhere = "SELECT m.mem_numero,mr.mr_reponse FROM memberships m JOIN memberships_reponses mr on mr.mem_numero=m.mem_numero WHERE mt_id = '4' AND mem_actif = '1' and mr.mq_id =15 order by m.mem_numero";
$strWhere = "SELECT m.mem_numero,mr.mr_reponse FROM memberships m JOIN memberships_reponses mr on mr.mem_numero=m.mem_numero WHERE mt_id = '4' AND mem_actif = '1' and mr.mq_id =15 and mem_date_fin>now() order by mr.mr_reponse";
$result = $objDatabase->fxGetResults($strWhere);
//a faire corriger langue
$liste['fr'] = "--Veuillez choisir--";
$liste['en'] = "--Veuillez choisir--";
$liste['fr'] .= ",Je ne fais parti daucun club";
$liste['en'] .= ",I am not part of any club";
foreach ($result as $list) {
$club = str_replace(',', ' ', $list['mr_reponse']);
$liste['en'] = $liste['en'] . "," . $club . ' (' . $list['mem_numero'] . ')';
$liste['fr'] = $liste['fr'] . "," . $club . ' (' . $list['mem_numero'] . ')';
}
$sqlUpdate = "UPDATE inscriptions_questions SET que_choix_fr = '" . $objDatabase->fxEscape($liste['fr']) . "', que_choix_en = '" . $objDatabase->fxEscape($liste['en']) . "' WHERE que_id = " . $que_id;
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
return $liste[$strLangue];
}