diff --git a/css/style.css b/css/style.css index f77c141..6ac0aca 100644 --- a/css/style.css +++ b/css/style.css @@ -2746,6 +2746,15 @@ a.ms1-trad-link.btn-aide-trad{ font-size:14px; } +.inscr-mobile-fiche-profile{ + border-top:1px solid #eee; + margin-top:4px; +} + +.inscr-mobile-dl--profile{ + padding-top:8px; +} + .inscr-mobile-bib-row{ display:flex; gap:8px; diff --git a/php/inc_fx_inscriptions_mobile.php b/php/inc_fx_inscriptions_mobile.php index a3e3de9..8cbb287 100644 --- a/php/inc_fx_inscriptions_mobile.php +++ b/php/inc_fx_inscriptions_mobile.php @@ -209,6 +209,128 @@ function fxInscrMobileBibDisplay($arrRow) { return fxShowBibNumber($arrRow['no_bib'], $arrRow['epr_id'], 'participant'); } +function fxInscrMobileFetchFicheProfile($arrRow, $strLangue) { + global $objDatabase; + + $intParId = (int)$arrRow['par_id']; + $intPecId = (int)$arrRow['pec_id_original']; + $intEveId = (int)$arrRow['eve_id']; + $strLangCol = ($strLangue === 'en') ? 'en' : 'fr'; + + $tabProfile = $objDatabase->fxGetRow( + 'SELECT p.par_courriel, p.par_naissance, p.par_sexe, p.par_nom, p.par_prenom, p.par_id_original,' + . ' r.rol_nom_' . $strLangCol . ' AS rol_nom' + . ' FROM resultats_participants p' + . ' LEFT JOIN inscriptions_roles r ON r.rol_id = p.rol_id' + . ' WHERE p.par_id = ' . $intParId + . ' LIMIT 1' + ); + + if ($tabProfile === null) { + return array( + 'role' => '', + 'name' => '', + 'email' => '', + 'birth_gender' => '', + 'questions' => array(), + ); + } + + $strRole = trim((string)$tabProfile['rol_nom']); + $strName = trim(fxUnescape($tabProfile['par_nom']) . ', ' . fxUnescape($tabProfile['par_prenom']), ', '); + $strEmail = trim((string)$tabProfile['par_courriel']); + + $strBirthGender = ''; + $strNaissance = trim((string)$tabProfile['par_naissance']); + if ($strNaissance !== '' && $strNaissance !== '0000-00-00') { + $strBirthGender = fxShowDate($strNaissance, $strLangue) + . ' - ' + . fxGetGender($tabProfile['par_sexe'], $strLangue); + } + + $intParIdOriginal = (int)$tabProfile['par_id_original']; + $sqlQuestions = 'SELECT rq.que_choix_' . $strLangCol . ' AS que_choix,' + . ' iq.que_cart_label_' . $strLangCol . ' AS que_label,' + . ' rq.que_question_' . $strLangCol . ' AS que_question,' + . ' iq.que_tri, iq.que_id' + . ' FROM resultats_questions rq' + . ' INNER JOIN inscriptions_questions iq ON iq.que_id = rq.que_id' + . ' WHERE iq.que_cart_show = 1' + . ' AND iq.eve_id = ' . $intEveId + . ' AND rq.pec_id = ' . $intPecId + . ' AND (rq.par_id = ' . $intParId . ' OR rq.par_id = ' . $intParIdOriginal . ')' + . ' AND rq.que_actif = 1' + . " AND TRIM(COALESCE(rq.que_choix_" . $strLangCol . ", '')) <> ''" + . ' ORDER BY iq.que_tri, iq.que_id'; + + $tabQuestionsRaw = $objDatabase->fxGetResults($sqlQuestions); + $tabQuestions = array(); + + if ($tabQuestionsRaw !== null) { + for ($i = 1; $i <= count($tabQuestionsRaw); $i++) { + $tabQ = $tabQuestionsRaw[$i]; + $strLabel = trim(fxUnescape($tabQ['que_label'])); + if ($strLabel === '') { + $strLabel = trim(fxUnescape($tabQ['que_question'])); + } + $strValue = trim(fxUnescape($tabQ['que_choix'])); + if ($strLabel === '' || $strValue === '') { + continue; + } + $tabQuestions[] = array( + 'label' => $strLabel, + 'value' => $strValue, + ); + } + } + + return array( + 'role' => $strRole, + 'name' => $strName, + 'email' => $strEmail, + 'birth_gender' => $strBirthGender, + 'questions' => $tabQuestions, + ); +} + +function fxInscrMobileRenderFicheProfileDetails($arrRow, $strLangue) { + $tabProfile = fxInscrMobileFetchFicheProfile($arrRow, $strLangue); + + $blnHasRole = ($tabProfile['role'] !== '' && $tabProfile['name'] !== ''); + $blnHasEmail = ($tabProfile['email'] !== ''); + $blnHasBirth = ($tabProfile['birth_gender'] !== ''); + $blnHasQuestions = (count($tabProfile['questions']) > 0); + + if (!$blnHasRole && !$blnHasEmail && !$blnHasBirth && !$blnHasQuestions) { + return; + } + + echo '