From 6bffbba726341133be8a9e16ec80f140cb3e918f Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 19 Jun 2026 09:59:10 -0400 Subject: [PATCH] Enhance mobile registration interface by adding profile details rendering functionality; update CSS for improved layout This commit introduces new functions to fetch and render participant profile details within the mobile registration interface, including role, name, email, birthdate, and custom questions. The CSS is updated to improve the layout of the profile section. The version code is incremented to 4.72.679 to reflect these changes, enhancing the overall user experience in mobile registrations. --- css/style.css | 9 ++ php/inc_fx_inscriptions_mobile.php | 126 +++++++++++++++++- php/inc_settings.php | 2 +- ...inscriptions-mobile-fiche-profile-i18n.sql | 12 ++ 4 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 sql/MSIN-inscriptions-mobile-fiche-profile-i18n.sql 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 '
'; + echo '
'; + + if ($blnHasRole) { + echo '
' . fxInscrMobileEsc($tabProfile['role']) . '
'; + echo '
' . fxInscrMobileEsc($tabProfile['name']) . '
'; + } + + if ($blnHasEmail) { + echo '
' . fxInscrMobileEsc(fxInscrMobileT('inscr_mobile_email')) . '
'; + echo '
' . fxInscrMobileEsc($tabProfile['email']) . '
'; + } + + if ($blnHasBirth) { + echo '
' . fxInscrMobileEsc(fxInscrMobileT('inscr_mobile_birthdate')) . '
'; + echo '
' . fxInscrMobileEsc($tabProfile['birth_gender']) . '
'; + } + + foreach ($tabProfile['questions'] as $tabQuestion) { + echo '
' . fxInscrMobileEsc($tabQuestion['label']) . '
'; + echo '
' . fxInscrMobileEsc($tabQuestion['value']) . '
'; + } + + echo '
'; +} + /** Code statut course par défaut (Confirmé). */ function fxInscrMobileParStatutCourseDefault() { return 'CONF'; @@ -704,7 +826,9 @@ function fxInscrMobileRenderFiche($intEveId, $strLangue, $strBaseUrl, $arrReq, $ echo '
' . fxInscrMobileEsc($strDetailsType) . '
'; echo '
' . fxInscrMobileEsc(fxInscrMobileT('inscr_mobile_modified')) . '
'; echo '
' . fxCheckMAJ($arrRow['pec_id_original'], $intParId, $strLangue) . '
'; - echo ''; + echo ''; + fxInscrMobileRenderFicheProfileDetails($arrRow, $strLangue); + echo ''; $strStyleEdit = $strStyleCancel = ''; $strStyleRetablir = ' d-none'; diff --git a/php/inc_settings.php b/php/inc_settings.php index 804fd74..35e3625 100644 --- a/php/inc_settings.php +++ b/php/inc_settings.php @@ -7,7 +7,7 @@ * Constantes * * **************/ -define('_VERSION_CODE', '4.72.678'); +define('_VERSION_CODE', '4.72.679'); define('_DATE_CODE', '2026-06-18'); //MSIN-4290 define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe'); diff --git a/sql/MSIN-inscriptions-mobile-fiche-profile-i18n.sql b/sql/MSIN-inscriptions-mobile-fiche-profile-i18n.sql new file mode 100644 index 0000000..fafb385 --- /dev/null +++ b/sql/MSIN-inscriptions-mobile-fiche-profile-i18n.sql @@ -0,0 +1,12 @@ +-- Inscriptions mobile — fiche participant (courriel, date de naissance) + +DELETE FROM info WHERE info_clef IN ( + 'inscr_mobile_email', + 'inscr_mobile_birthdate' +) AND info_prg = 'compte.php'; + +INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation) VALUES +('inscr_mobile_email', 'fr', 'Courriel', '', 'compte.php', '', 0, 1, '', '', '', NOW()), +('inscr_mobile_email', 'en', 'Email', '', 'compte.php', '', 0, 1, '', '', '', NOW()), +('inscr_mobile_birthdate', 'fr', 'Date de naissance', '', 'compte.php', '', 0, 1, '', '', '', NOW()), +('inscr_mobile_birthdate', 'en', 'Date of birth', '', 'compte.php', '', 0, 1, '', '', '', NOW());