882 lines
60 KiB
PHP
882 lines
60 KiB
PHP
<?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) {
|
|
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 ($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) {
|
|
$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) {
|
|
if ($strAction == 'auto')
|
|
$strAction = 'mod';
|
|
|
|
|
|
if ($tabInfos != null) {
|
|
for ($intCtrInfos = 1; $intCtrInfos <= count($tabInfos); $intCtrInfos++) {
|
|
$strDisabled0 = $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':
|
|
if ($strAction == 'mod' && !isset($_SESSION ['no_panier']) && $intPromoteur == 0 && $intCtr == 1) {
|
|
$strDisabled = "disabled='disabled'";
|
|
} else {
|
|
$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':
|
|
$tabTelephones[] = $strField;
|
|
|
|
$tabRules[] = $strField . ': { required: ' . $strRequired . ' }';
|
|
|
|
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
|
|
}
|
|
|
|
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) {
|
|
$strDisabled = "disabled='disabled'";
|
|
$strFieldDisabled = 'disabled_';
|
|
?>
|
|
<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 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 $strReadonly . $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') {
|
|
if (($strAction == 'mod' && !isset($_SESSION ['no_panier']) && $intPromoteur == 0 && $intCtr == 1) || (trim($strDisabled) != '')) {
|
|
$strDisabled = "disabled='disabled'";
|
|
$strFieldDisabled = 'disabled_';
|
|
}
|
|
$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') {
|
|
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
|
|
} 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 $vDomaine, $vRepertoireFichiers;
|
|
$mem_question_premier = $mem_last = $intNbQuestions = 0;
|
|
$strDisabledPrev = $strNoTransfert = '';
|
|
|
|
if (isset($_GET['t'])) {
|
|
$strNoTransfert = $_GET['t'];
|
|
}
|
|
|
|
if ($strAction == 'auto')
|
|
$strAction = 'mod';
|
|
|
|
if ($tabQuestions != null) {
|
|
for ($intCtr3 = 1; $intCtr3 <= count($tabQuestions); $intCtr3++) {
|
|
$tabNoMore = array();
|
|
|
|
if ($strAction == 'add' || ($strAction == 'mod' && $tabQuestions[$intCtr3]['que_modifiable'] != 0)) {
|
|
if (($intCtr == 1 && $tabQuestions[$intCtr3]['que_participant_1'] == 1) || $tabQuestions[$intCtr3]['que_participant_1'] == 0) {
|
|
if (($tabEpreuve['tep_id'] == 2 && $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;
|
|
|
|
if ($intCtr != 0)
|
|
$strField .= '_' . $intCtr;
|
|
|
|
if ($intCtr <= $intNbParticipantsMin && $tabQuestions[$intCtr3]['que_required'] == 1)
|
|
$strRequired = 'true';
|
|
else
|
|
$strRequired = 'false';
|
|
|
|
if ($tabQuestions[$intCtr3]['que_hidden'] == 1)
|
|
$mem_hide = 'style="display: none;"';
|
|
|
|
if (trim($tabQuestions[$intCtr3]['que_hint_' . $strLangue]) <> '') {
|
|
$mem_hint = '
|
|
<a class="btn btn-sm rounded-circle" tabindex="0" role="button" data-toggle="popover" data-content="' . htmlspecialchars(fxUnescape(trim($tabQuestions[$intCtr3]['que_hint_' . $strLangue]))) . '">
|
|
<i class="fa fa-question-circle fa-2x text-info" aria-hidden="true"></i>
|
|
</a>
|
|
';
|
|
}
|
|
|
|
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_triathlon.php", type: "post", data: { tq_no: function () { return $("#' . $strField . '").val(); }, tq_naissance: function () { return $("#par_naissance_' . $intCtr . '").val(); } } } }';
|
|
|
|
if ($strLangue == 'fr')
|
|
$tabMessages[] = $strField . ': { required: "Veuillez entrer le numéro de Triathlon Québec", remote: "Le numéro TQ n\'est pas valide et ou la date de naissance entrée ne correspond pas à la date de naissance du profil du membre de Triathlon Québec" }';
|
|
else
|
|
$tabMessages[] = $strField . ': { required: "Please enter the Triathlon Quebec number", remote: "The TQ number is not valid and or the date of birth entered does not correspond to the member profile of Triathlon Québec" }';
|
|
} else {
|
|
$tabRules[] = $strField . ': { required: ' . $strRequired . ' }';
|
|
|
|
if ($tabQuestions[$intCtr3]['que_liste']) {
|
|
if ($strLangue == 'fr')
|
|
$tabMessages[] = $strField . ': { required: "Veuillez faire un choix" }';
|
|
else
|
|
$tabMessages[] = $strField . ': { required: "Please make a choice" }';
|
|
} else {
|
|
if ($strLangue == 'fr')
|
|
$tabMessages[] = $strField . ': { required: "Veuillez entrer une valeur" }';
|
|
else
|
|
$tabMessages[] = $strField . ': { required: "Please enter a value" }';
|
|
}
|
|
|
|
$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;"';
|
|
?>
|
|
<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) {
|
|
// alert($last.val());
|
|
|
|
|
|
if ($last.val() == 2) {
|
|
$hidden.show();
|
|
} else {
|
|
$hidden.hide();
|
|
}
|
|
<?php
|
|
$tabRules[] = 'TQ_numero : { required:TQ_numero, 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 : { 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>
|
|
<?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:
|
|
$tabRules[] = $strField . ': { required: ' . $strRequired . ' }';
|
|
|
|
if ($tabQuestions[$intCtr3]['que_liste']) {
|
|
if ($strLangue == 'fr')
|
|
$tabMessages[] = $strField . ': { required: "Veuillez faire un choix" }';
|
|
else
|
|
$tabMessages[] = $strField . ': { required: "Please make a choice" }';
|
|
} else {
|
|
if ($strLangue == 'fr')
|
|
$tabMessages[] = $strField . ': { required: "Veuillez entrer une valeur" }';
|
|
else
|
|
$tabMessages[] = $strField . ': { required: "Please enter a value" }';
|
|
}
|
|
}
|
|
|
|
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;
|
|
?>
|
|
<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 . $mem_hint . $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]);
|
|
$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) != '') {
|
|
$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
|
|
$blnProduit = fxCheckStockProduits($tabProduits[$i - 1], $intEpreuveCommandee, $intParticipant);
|
|
}
|
|
}
|
|
|
|
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]);
|
|
|
|
if ($tabProduit != null) {
|
|
if ($strLangue == 'fr') { // FRANÇAIS
|
|
$tabNoMore[] = '<i class="fa fa-exclamation-circle" aria-hidden="true"></i> Il ne reste plus de quantité pour <em>' . fxUnescape($tabProduit['pro_nom_fr']) . '</em> (valeur <em>' . fxUnescape($tabChoix[$i - 1]) . '</em>)';
|
|
} else { // ANGLAIS
|
|
$tabNoMore[] = '<i class="fa fa-exclamation-circle" aria-hidden="true"></i> There is no more stock for <em>' . fxUnescape($tabProduit['pro_nom_en']) . '</em> (value <em>' . fxUnescape($tabChoix[$i - 1]) . '</em>)';
|
|
}
|
|
}
|
|
} else {
|
|
if ($blnSelected || $intPromoteur == 1) {
|
|
$tabChoixSelect[] = array('selected' => $blnSelected, 'value' => $i, 'text' => fxUnescape($tabChoix[$i - 1]));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!empty($tabChoixSelect)) {
|
|
?>
|
|
<select class="form-control rounded-0 selectpicker show-tick" 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 data-selected-text-format="count" data-actions-box="true"<?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
|
|
} 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") {
|
|
?>
|
|
<input class="form-control rounded-0" type="file" id="<?php echo $strField; ?>" name="<?php echo $strField; ?>"<?php echo $mem_len_max; ?>>
|
|
<?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 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 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 . $mem_hint . $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>
|
|
<div class="text-lg-right">ff<?php echo $mem_tq_prefix; ?></div>
|
|
<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" min="<?php echo $mem_tq_acien_min; ?>" max="<?php echo $mem_tq_acien_max; ?>" value="">
|
|
|
|
|
|
</div>
|
|
<div class="col-lg-2 d-none d-lg-inline-block">
|
|
<?php echo $strAsterix . $mem_hint . $strPdf; ?>
|
|
</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(ppn_id) FROM resultats_produits_new WHERE 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;
|
|
}
|