Refactor promoteur back URL logic to prioritize new hub structure, enabling event focus functionality. Introduce fxPromoteurHubOrLegacyBackUrl for streamlined navigation based on event ID availability. Update related functions for consistency and clarity. This change enhances user experience by ensuring proper redirection based on session and event context.
This commit is contained in:
@ -19,10 +19,13 @@ if (isset($_GET['promoteur_eve_id'])) {
|
||||
|
||||
$strLangue = ($strLangue === 'en') ? 'en' : 'fr';
|
||||
$strBasePath = ($strLangue === 'en') ? '/account' : '/compte';
|
||||
$strRedirect = $vDomaine . $strBasePath;
|
||||
if (!empty($_GET['promoteur_eve_id'])) {
|
||||
$strRedirect .= '/inc_tableau_promoteur?promoteur_eve_id=' . urlencode($_GET['promoteur_eve_id']);
|
||||
// MSIN-4399 — deny : hub + focus si dispo, sinon ancien tableau.
|
||||
if (!function_exists('fxPromoteurHubOrLegacyBackUrl')) {
|
||||
require_once __DIR__ . '/php/inc_fx_promoteur_hub.php';
|
||||
}
|
||||
$strRedirect = ($intEveId > 0)
|
||||
? fxPromoteurHubOrLegacyBackUrl($intEveId, $strLangue)
|
||||
: ($vDomaine . $strBasePath);
|
||||
|
||||
$intActor = intval($_SESSION['com_id'] ?? 0);
|
||||
if (!empty($_SESSION['usa_id'])) {
|
||||
|
||||
@ -32,10 +32,8 @@ if (isset($_GET['promoteur_eve_id'])) {
|
||||
if ($intEveId <= 0 || (empty($_SESSION['com_id']) && empty($_SESSION['usa_id']))
|
||||
|| (empty($_SESSION['usa_id'])
|
||||
&& !fxEveAccesHasAnyPermission($_SESSION['com_id'] ?? 0, $intEveId, array('dossards.manage', 'epreuves.edit_qte')))) {
|
||||
$strRedirect = $vDomaine . '/compte/inc_tableau_promoteur';
|
||||
if (!empty($_GET['promoteur_eve_id'])) {
|
||||
$strRedirect .= '?promoteur_eve_id=' . urlencode($_GET['promoteur_eve_id']);
|
||||
}
|
||||
// MSIN-4399 — même retour que le bouton back (hub + focus si dispo).
|
||||
$strRedirect = fxGetPromoteurBackUrl($intEveId > 0 ? $intEveId : 0, $strPage);
|
||||
header('Location: ' . $strRedirect);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -608,21 +608,13 @@ function fxInscrGestionListBackLabel($strLangue) {
|
||||
* hub promoteur si dispo (avec focus sur l'événement), sinon ancien tableau promoteur.
|
||||
*/
|
||||
function fxInscrGestionListBackUrl($intEveId, $strLangue) {
|
||||
global $vDomaine;
|
||||
|
||||
$strLangue = ($strLangue === 'en') ? 'en' : 'fr';
|
||||
$intComId = intval($_SESSION['com_id'] ?? 0);
|
||||
|
||||
if (!function_exists('fxPromoteurHubIsAvailable')) {
|
||||
if (!function_exists('fxPromoteurHubOrLegacyBackUrl')) {
|
||||
require_once __DIR__ . '/inc_fx_promoteur_hub.php';
|
||||
}
|
||||
|
||||
if ($intComId > 0 && fxPromoteurHubIsAvailable($intComId)) {
|
||||
return fxPromoteurHubUrl($strLangue, $intEveId);
|
||||
}
|
||||
|
||||
return $vDomaine . ($strLangue === 'fr' ? '/compte/inc_tableau_promoteur' : '/account/inc_tableau_promoteur')
|
||||
. '?promoteur_eve_id=' . rawurlencode(base64_encode((string)$intEveId));
|
||||
return fxPromoteurHubOrLegacyBackUrl($intEveId, $strLangue);
|
||||
}
|
||||
|
||||
function fxInscrGestionShouldShowListBack($intComId) {
|
||||
|
||||
@ -3028,6 +3028,7 @@ function renderBatchConfig($epr_id, $eve_id, $strLangue = 'fr', $isTeamEpreuve =
|
||||
/**
|
||||
* URL de retour promoteur selon ?from= (whitelist).
|
||||
* $strDefault si from absent — ex. liste_attente : epreuves, gestion_epreuves : promoteur.
|
||||
* MSIN-4399 — from=promoteur → hub V2 + focus événement si le hub est disponible.
|
||||
*/
|
||||
function fxGetPromoteurBackUrl($intEveId, $strPage = '/compte', $strDefault = 'promoteur') {
|
||||
global $vDomaine;
|
||||
@ -3044,6 +3045,15 @@ function fxGetPromoteurBackUrl($intEveId, $strPage = '/compte', $strDefault = 'p
|
||||
$strFrom = $strDefault;
|
||||
}
|
||||
|
||||
if ($strFrom === 'promoteur') {
|
||||
if (!function_exists('fxPromoteurHubOrLegacyBackUrl')) {
|
||||
require_once __DIR__ . '/inc_fx_promoteur_hub.php';
|
||||
}
|
||||
$strLangue = ($strPage === '/account') ? 'en' : 'fr';
|
||||
|
||||
return fxPromoteurHubOrLegacyBackUrl($intEveId, $strLangue);
|
||||
}
|
||||
|
||||
$strEveParam = 'promoteur_eve_id=' . urlencode(base64_encode($intEveId));
|
||||
return $vDomaine . $strPage . '/' . $arrAllowed[$strFrom] . '?' . $strEveParam;
|
||||
}
|
||||
|
||||
@ -74,6 +74,28 @@ function fxPromoteurHubUrl($strLangue = 'fr', $intEveId = 0)
|
||||
return $strUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* MSIN-4399 — Retour « tableau promoteur » depuis un menu V2 :
|
||||
* hub + focus eve si dispo, sinon ancien inc_tableau_promoteur.
|
||||
*/
|
||||
function fxPromoteurHubOrLegacyBackUrl($intEveId, $strLangue = 'fr')
|
||||
{
|
||||
global $vDomaine;
|
||||
|
||||
$strLangue = ($strLangue === 'en') ? 'en' : 'fr';
|
||||
$intEveId = intval($intEveId);
|
||||
$intComId = intval($_SESSION['com_id'] ?? 0);
|
||||
|
||||
if ($intComId > 0 && fxPromoteurHubIsAvailable($intComId)) {
|
||||
return fxPromoteurHubUrl($strLangue, $intEveId);
|
||||
}
|
||||
|
||||
$strPage = ($strLangue === 'en') ? '/account' : '/compte';
|
||||
|
||||
return $vDomaine . $strPage . '/inc_tableau_promoteur'
|
||||
. '?promoteur_eve_id=' . urlencode(base64_encode((string)$intEveId));
|
||||
}
|
||||
|
||||
/**
|
||||
* MSIN-4399 — eve_id à ouvrir automatiquement sur le hub (?hub_eve= ou promoteur_eve_id).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user