fxGetVar( "SELECT COUNT(*) FROM inscriptions_pages WHERE pag_code = 'compte_promoteur_hub' AND pag_actif = 1" ); $blnExists = ($intNb !== null && intval($intNb) > 0); return $blnExists; } /** Hub v2 disponible (acces v2 + page CMS) — pour lien menu, pas pour forcer /compte. */ function fxPromoteurHubIsAvailable($intComId) { return fxPromoteurHubComUsesV2(intval($intComId)) && fxPromoteurHubPageExists(); } /** * Atterrissage par défaut sur le hub v2 (/compte, redirect après login public). * Compte avec accès v2 + page hub installée → tableau de bord promoteur. * Le toggle promoteur_legacy_actif ne s'applique qu'aux droits com_eve_promoteur (fxIsPromoteur), pas ici. */ function fxPromoteurHubShouldUse($intComId) { return fxPromoteurHubIsAvailable($intComId); } function fxPromoteurHubUrl($strLangue = 'fr', $intEveId = 0) { global $vDomaine; $strUrl = $vDomaine . ($strLangue === 'fr' ? '/compte/promoteur_hub' : '/account/promoteur_hub'); // MSIN-4399 — Deep-link : hub_eve=id pour rouvrir la carte / menu de l'événement. $intEveId = intval($intEveId); if ($intEveId > 0) { $strUrl .= '?hub_eve=' . $intEveId; } 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). */ function fxPromoteurHubParseFocusEveId() { if (!empty($_GET['hub_eve'])) { return max(0, intval($_GET['hub_eve'])); } if (!empty($_GET['promoteur_eve_id'])) { $mix = $_GET['promoteur_eve_id']; $decoded = base64_decode(urldecode((string)$mix), true); if ($decoded !== false && $decoded !== '' && ctype_digit((string)$decoded)) { return intval($decoded); } if (ctype_digit((string)$mix)) { return intval($mix); } } return 0; } function fxPromoteurHubParticipantUrl($strLangue = 'fr') { global $vDomaine; return $vDomaine . ($strLangue === 'fr' ? '/compte/accueil' : '/account/accueil'); } function fxPromoteurHubPromoteurTableUrl($intEveId, $strLangue = 'fr') { global $vDomaine; $strBase = ($strLangue === 'fr') ? '/compte/inc_tableau_promoteur' : '/account/inc_tableau_promoteur'; return $vDomaine . $strBase . '?promoteur_eve_id=' . urlencode(base64_encode(intval($intEveId))); } function fxPromoteurHubPermKeysWeb() { // MSIN-4401 — pages hub + détails V2 (plus d'anciennes clés API) return array( 'hub.dashboard', 'inscriptions_gestion.view', 'inscriptions_gestion.qr_scan', 'inscriptions_gestion.statut_edit', 'inscriptions_gestion.bib_edit', 'inscriptions_gestion.bib_remis', 'inscriptions_gestion.edit', 'inscriptions_gestion.cancel', 'inscriptions_gestion.restore', 'inscriptions_gestion.refund', 'inscriptions.view', 'inscriptions.edit', 'dossards.view', 'dossards.manage', 'epreuves.view', 'epreuves.edit_qte', 'rabais.view', 'rabais.manage', 'emails.send', 'reports.chrono', 'reports.finances', 'reports.finances_membership', 'reports.finances_events', 'reports.payments', 'reports.adhesions', 'reports.adhesions_sales', 'reports.finances_captains', 'reports.custom', 'team.view', 'team.invite', 'team.manage', ); } /** * Accès web promoteur pour un événement : Legacy (com_eve_promoteur) OU permissions V2. * Utilisé hors hub (ex. modes paiement promoteur). Le hub lui-même ne passe plus par Legacy. */ function fxPromoteurHubCanAccessPromoteurWeb($intComId, $intEveId, $arrLegacyFlip = null) { if (is_array($arrLegacyFlip) && isset($arrLegacyFlip[intval($intEveId)])) { return true; } if (!function_exists('fxIsPromoteur')) { require_once __DIR__ . '/inc_fonctions.php'; } if (fxIsPromoteur(intval($intComId), intval($intEveId))) { return true; } if (!fxEveAccesComHasV2ForEvent(intval($intComId), intval($intEveId))) { return false; } return fxEveAccesHasAnyPermission(intval($intComId), intval($intEveId), fxPromoteurHubPermKeysWeb()); } /** * MSIN-4401 — Accès menu fonctionnalités hub : V2 uniquement (pas de bypass Legacy). * Prérequis : $arrV2EventFlip, $arrWebPermFlip préchargés. */ function fxPromoteurHubCanAccessPromoteurWebBatch($intComId, $intEveId, $arrV2EventFlip, $arrWebPermFlip) { $intEveId = intval($intEveId); if (!isset($arrV2EventFlip[$intEveId])) { return false; } return isset($arrWebPermFlip[$intEveId]); } function fxPromoteurHubParseDateTs($strDate) { $strDate = trim((string)$strDate); if ($strDate === '' || strpos($strDate, '0000-00-00') === 0) { return 0; } return strtotime(substr($strDate, 0, 10)); } function fxPromoteurHubHighlightUntilTs($strDateDebut, $strDateFin) { $intDebut = fxPromoteurHubParseDateTs($strDateDebut); $intFin = fxPromoteurHubParseDateTs($strDateFin); $intRef = ($intFin > 0) ? max($intDebut, $intFin) : $intDebut; if ($intRef <= 0) { return 0; } return strtotime('+14 days', $intRef); } function fxPromoteurHubFormatEventDate($arrEvent, $strLangue) { $strDebut = trim($arrEvent['eve_date_debut'] ?? ''); $strFin = trim($arrEvent['eve_date_fin'] ?? ''); if ($strDebut === '' || strpos($strDebut, '0000-00-00') === 0) { return ''; } $strFmtDebut = date('Y-m-d', fxPromoteurHubParseDateTs($strDebut)); $intFin = fxPromoteurHubParseDateTs($strFin); if ($intFin <= 0 || $strFmtDebut === date('Y-m-d', $intFin)) { return $strFmtDebut; } return $strFmtDebut . ' — ' . date('Y-m-d', $intFin); } function fxPromoteurHubGetRoleLabelsByEvent($intComId) { global $objDatabase; $arrByEve = array(); $tabRows = fxEveAccesListByComId(intval($intComId)); if (!is_array($tabRows)) { return $arrByEve; } for ($i = 1; $i <= count($tabRows); $i++) { $row = $tabRows[$i]; if (($row['ea_statut'] ?? '') !== 'actif') { continue; } $intEveId = intval($row['eve_id'] ?? 0); if ($intEveId <= 0) { continue; } $strLabel = trim($row['role_label_fr'] ?? ''); if ($strLabel === '') { $strLabel = trim($row['role_code'] ?? ''); } if ($strLabel === '') { continue; } if (!isset($arrByEve[$intEveId])) { $arrByEve[$intEveId] = array(); } if (!in_array($strLabel, $arrByEve[$intEveId], true)) { $arrByEve[$intEveId][] = $strLabel; } } return $arrByEve; } /** Evenements promoteur legacy (com_eve_promoteur) pour ce compte. */ function fxPromoteurHubGetLegacyEventIds($intComId) { if (!function_exists('fxPromoteurLegacySiteEnabled')) { require_once __DIR__ . '/inc_fonctions.php'; } if (!fxPromoteurLegacySiteEnabled()) { return array(); } global $objDatabase; $row = $objDatabase->fxGetRow( 'SELECT com_eve_promoteur FROM inscriptions_comptes WHERE com_id = ' . intval($intComId) ); if ($row === null || trim((string)$row['com_eve_promoteur']) === '') { return array(); } return array_map('trim', explode(',', $row['com_eve_promoteur'])); } function fxPromoteurHubGetEvents($intComId, $strLangue = 'fr') { global $objDatabase, $vDomaine, $vRepertoireFichiers; $arrHighlight = array(); $arrArchived = array(); // MSIN-4401 — Hub V2 : uniquement les événements avec accès V2 (pas de fantômes Legacy). $arrV2EventIds = fxEveAccesGetEventIds(intval($intComId)); $arrIds = array_values(array_unique(array_filter(array_map('intval', $arrV2EventIds), function ($v) { return $v > 0; }))); if (empty($arrIds)) { return array('highlight' => $arrHighlight, 'archived' => $arrArchived); } $strLang = in_array($strLangue, array('fr', 'en'), true) ? $strLangue : 'fr'; $strAlt = ($strLang === 'fr') ? 'en' : 'fr'; $arrRoles = fxPromoteurHubGetRoleLabelsByEvent(intval($intComId)); $intToday = strtotime(date('Y-m-d')); $arrV2EventFlip = array_flip($arrIds); $arrWebPermFlip = array_flip(fxEveAccesGetEventIdsWithAnyPermission(intval($intComId), fxPromoteurHubPermKeysWeb())); if (!function_exists('fxInscrGestionGetPromoteurEveIds')) { require_once __DIR__ . '/inc_fx_inscriptions_gestion.php'; } $arrInscrGestionFlip = array_flip(array_map('intval', fxInscrGestionGetPromoteurEveIds(intval($intComId)))); $sql = " SELECT e.eve_id, e.eve_nom_fr, e.eve_nom_en, e.eve_date_debut, e.eve_date_fin, e.eve_lieu_fr, e.eve_lieu_en, e.eve_photo_fr, e.eve_photo_en, e.te_id, e.eve_qte_modifiable, e.eve_rapport_finances_capitaines, t.te_icone FROM inscriptions_evenements e JOIN inscriptions_types_evenements t ON t.te_id = e.te_id WHERE e.eve_actif = 1 AND e.eve_id IN (" . implode(',', $arrIds) . ") ORDER BY e.eve_date_debut ASC, e.eve_nom_fr ASC "; $tabEvents = $objDatabase->fxGetResults($sql); if (!is_array($tabEvents)) { return array('highlight' => $arrHighlight, 'archived' => $arrArchived); } for ($i = 1; $i <= count($tabEvents); $i++) { $row = $tabEvents[$i]; $intEveId = intval($row['eve_id']); $strNom = trim($row['eve_nom_' . $strLang] ?? ''); if ($strNom === '') { $strNom = trim($row['eve_nom_' . $strAlt] ?? ''); } $strLieu = trim($row['eve_lieu_' . $strLang] ?? ''); if ($strLieu === '') { $strLieu = trim($row['eve_lieu_' . $strAlt] ?? ''); } if (intval($row['eve_id']) === 175 && trim($row['eve_photo_' . $strLang] ?? '') !== '') { $strIcon = $vDomaine . $vRepertoireFichiers . '/images/evenements/' . $row['eve_photo_' . $strLang]; } else { $strIcon = $vDomaine . '/images/' . ($row['te_icone'] ?? ''); } $intHighlightUntil = fxPromoteurHubHighlightUntilTs($row['eve_date_debut'] ?? '', $row['eve_date_fin'] ?? ''); $blnHighlight = ($intHighlightUntil <= 0) || ($intToday <= $intHighlightUntil); $arrItem = array( 'eve_id' => $intEveId, 'nom' => $strNom, 'lieu' => $strLieu, 'date_label' => fxPromoteurHubFormatEventDate($row, $strLang), 'ts_debut' => fxPromoteurHubParseDateTs($row['eve_date_debut'] ?? ''), 'icon' => $strIcon, 'roles' => $arrRoles[$intEveId] ?? array(), 'te_id' => intval($row['te_id'] ?? 0), 'qte_modifiable' => intval($row['eve_qte_modifiable'] ?? 0), 'rapport_capitaines' => intval($row['eve_rapport_finances_capitaines'] ?? 0), 'com_id' => intval($intComId), 'url_promoteur' => fxPromoteurHubCanAccessPromoteurWebBatch($intComId, $intEveId, $arrV2EventFlip, $arrWebPermFlip) ? fxPromoteurHubPromoteurTableUrl($intEveId, $strLang) : '', 'url_mobile' => '', ); if (isset($arrInscrGestionFlip[$intEveId])) { $arrItem['url_mobile'] = fxInscrGestionBaseUrl($strLang, false) . '?promoteur_eve_id=' . urlencode(base64_encode($intEveId)); } if ($blnHighlight) { $arrHighlight[] = $arrItem; } else { $arrArchived[] = $arrItem; } } usort($arrHighlight, function ($a, $b) { $ta = intval($a['ts_debut'] ?? 0); $tb = intval($b['ts_debut'] ?? 0); if ($ta === $tb) { return strcasecmp($a['nom'], $b['nom']); } if ($ta <= 0) { return 1; } if ($tb <= 0) { return -1; } return $ta <=> $tb; }); usort($arrArchived, function ($a, $b) { $ta = intval($a['ts_debut'] ?? 0); $tb = intval($b['ts_debut'] ?? 0); if ($ta === $tb) { return strcasecmp($b['nom'], $a['nom']); } return $tb <=> $ta; }); return array('highlight' => $arrHighlight, 'archived' => $arrArchived); } function fxPromoteurHubEsc($str) { return htmlspecialchars((string)$str, ENT_QUOTES, 'UTF-8'); } /** Page info / i18n hub promoteur — toujours compte.php (y compris AJAX). */ function fxPromoteurHubInfoPage() { return 'compte.php'; } /** * Lit info_texte depuis $vtexte_page ou la BD (compte.php / global). * N'écrit jamais dans info — évite les doublons info_prg=ajax_promoteur_hub.php. */ function fxPromoteurHubGetInfoRow($clef) { global $vtexte_page, $objDatabase, $strLangue; if (!empty($vtexte_page[$clef])) { return $vtexte_page[$clef]; } static $hubInfoCache = array(); if (array_key_exists($clef, $hubInfoCache)) { return $hubInfoCache[$clef]; } if (!isset($objDatabase)) { $hubInfoCache[$clef] = array(); return $hubInfoCache[$clef]; } $strLang = !empty($strLangue) ? $strLangue : 'fr'; $strPage = fxPromoteurHubInfoPage(); $sql = "SELECT info_texte, info_aide, info_prg FROM info WHERE info_actif = 1 AND info_clef = '" . $objDatabase->fxEscape($clef) . "' AND info_langue = '" . $objDatabase->fxEscape($strLang) . "' AND info_prg IN ('" . $strPage . "', 'global') ORDER BY FIELD(info_prg, '" . $strPage . "', 'global') LIMIT 1"; $row = $objDatabase->fxGetRow($sql); if (!is_array($row) || empty($row)) { // Entrées legacy créées par erreur sous ajax_promoteur_hub.php — lecture seule. $sqlLegacy = "SELECT info_texte, info_aide, info_prg FROM info WHERE info_actif = 1 AND info_clef = '" . $objDatabase->fxEscape($clef) . "' AND info_langue = '" . $objDatabase->fxEscape($strLang) . "' AND info_prg = 'ajax_promoteur_hub.php' LIMIT 1"; $row = $objDatabase->fxGetRow($sqlLegacy); } $hubInfoCache[$clef] = is_array($row) ? $row : array(); return $hubInfoCache[$clef]; } /** Repli FR/EN si clé absente ou mal saisie en BD (menu fonctionnalités AJAX). */ function fxPromoteurHubStaticFallback($clef, $strLangParam = '') { if ($strLangParam === '') { global $strLangue; $strLangParam = !empty($strLangue) ? $strLangue : 'fr'; } $lng = ($strLangParam === 'en') ? 'en' : 'fr'; // MSIN-4401 — filet si Info absente (jamais la source de vérité). $tab = array( 'promoteur_hub_section_gestion' => array('fr' => 'Gestion', 'en' => 'Management'), 'promoteur_hub_link_dashboard' => array('fr' => 'Tableau de bord V2', 'en' => 'V2 dashboard'), 'promoteur_hub_no_features' => array( 'fr' => 'Aucune fonctionnalité disponible avec vos droits actuels.', 'en' => 'No features available with your current permissions.', ), 'promoteur_hub_menu' => array('fr' => 'Tableau de bord V2', 'en' => 'V2 dashboard'), 'tableau_promoteur_menurapports' => array('fr' => 'Rapports', 'en' => 'Reports'), 'tableau_promoteur_menudossard' => array('fr' => 'Dossards', 'en' => 'Bibs'), 'tableau_promoteur_menuepreuves' => array('fr' => 'Épreuves', 'en' => 'Races'), 'tableau_promoteur_menu_gestion_qte_dossards' => array('fr' => 'Gestion des quantités et dossards', 'en' => 'Quantities and bib management'), 'tableau_promoteur_menueinscription' => array('fr' => 'Inscriptions', 'en' => 'Registrations'), 'tableau_promoteur_rabais' => array('fr' => 'Rabais', 'en' => 'Discounts'), 'tableau_promoteur_envoie_email_questions' => array('fr' => 'Envoi courriel questions', 'en' => 'Send question emails'), 'promoteur_hub_load_menu' => array('fr' => 'Chargement du menu…', 'en' => 'Loading menu…'), 'promoteur_hub_load_dashboard' => array('fr' => 'Chargement du tableau de bord…', 'en' => 'Loading dashboard…'), 'promoteur_hub_epreuves_title' => array('fr' => 'Épreuves en vente', 'en' => 'Events for sale'), 'promoteur_hub_produits_title' => array('fr' => 'Produits en vente', 'en' => 'Products for sale'), 'promoteur_hub_bibs_sold' => array('fr' => 'dossards vendus', 'en' => 'bibs sold'), 'promoteur_hub_restant' => array('fr' => 'restant', 'en' => 'left'), 'promoteur_hub_unlimited' => array('fr' => 'illimité', 'en' => 'unlimited'), // Hotfix hub qte=0 — filet si Info absente (épuisé même si « illimitée »). 'promoteur_hub_plus_disponible' => array('fr' => 'Plus disponible', 'en' => 'No longer available'), 'promoteur_hub_prix_courant' => array('fr' => 'Prix courant', 'en' => 'Current price'), 'promoteur_hub_prochain_prix' => array('fr' => 'Prochain prix', 'en' => 'Next price'), 'promoteur_hub_des' => array('fr' => 'dès', 'en' => 'on'), 'promoteur_hub_dossards_remis' => array('fr' => 'Dossards remis', 'en' => 'Bibs handed out'), 'promoteur_hub_liste_active' => array('fr' => 'liste active', 'en' => 'list active'), 'promoteur_hub_waiting_n' => array('fr' => 'en attente', 'en' => 'waiting'), 'promoteur_hub_waiting_list' => array('fr' => 'Liste d\'attente', 'en' => 'Waiting list'), 'promoteur_hub_disponible' => array('fr' => 'disponible(s)', 'en' => 'available'), 'promoteur_hub_vendus_title' => array('fr' => 'Vendus', 'en' => 'Sold'), 'promoteur_hub_vendus_lbl' => array('fr' => 'vendu(s)', 'en' => 'sold'), 'promoteur_hub_paniers_title' => array('fr' => 'Dans des paniers incomplets', 'en' => 'In incomplete carts'), 'promoteur_hub_paniers_lbl' => array('fr' => 'panier(s)', 'en' => 'cart(s)'), 'promoteur_hub_menu_features' => array('fr' => 'Menu des fonctionnalités', 'en' => 'Features menu'), // MSIN-4451 — total = somme des inscriptions par épreuve (pas d'humains uniques) 'promoteur_hub_flash_inscrits' => array('fr' => 'épreuves vendues', 'en' => 'entries sold'), 'promoteur_hub_flash_participants' => array('fr' => 'participants', 'en' => 'participants'), 'promoteur_hub_flash_rempli' => array('fr' => 'rempli', 'en' => 'filled'), 'promoteur_hub_flash_places' => array('fr' => 'places restantes', 'en' => 'spots left'), 'promoteur_hub_flash_revenus' => array('fr' => 'revenus est.', 'en' => 'est. revenue'), 'promoteur_hub_badge_completes' => array('fr' => 'complète(s)', 'en' => 'sold out'), 'promoteur_hub_badge_presque' => array('fr' => 'presque pleine(s)', 'en' => 'almost full'), 'promoteur_hub_badge_attente' => array('fr' => 'en attente', 'en' => 'waiting'), 'promoteur_hub_badge_limite' => array('fr' => 'limite', 'en' => 'deadline'), 'promoteur_hub_ajax_session' => array('fr' => 'Session expirée', 'en' => 'Session expired'), 'promoteur_hub_ajax_invalid' => array('fr' => 'Requête invalide', 'en' => 'Invalid request'), 'promoteur_hub_ajax_denied' => array('fr' => 'Accès refusé', 'en' => 'Access denied'), 'promoteur_hub_ajax_not_found' => array('fr' => 'Événement introuvable', 'en' => 'Event not found'), 'promoteur_hub_ajax_error' => array('fr' => 'Erreur', 'en' => 'Error'), 'promoteur_hub_rapport_chrono' => array('fr' => 'chrono + questions', 'en' => 'chrono + questions'), 'promoteur_hub_rapport_finances' => array('fr' => 'Transactions-Finances', 'en' => 'Transactions-Finances'), 'promoteur_hub_rapport_finances_all' => array('fr' => 'Transactions-Finances-Tout', 'en' => 'Transactions-Finances-All'), 'promoteur_hub_rapport_finances_adh' => array('fr' => 'Transactions-Finances-Adhésions Seul', 'en' => 'Transactions-Finances-Memberships only'), 'promoteur_hub_rapport_finances_eve' => array('fr' => 'Transactions-Finances-Événements Seul', 'en' => 'Transactions-Finances-Events only'), 'promoteur_hub_rapport_adhesions' => array('fr' => 'adhésions actives', 'en' => 'active memberships'), 'promoteur_hub_rapport_adhesions_annuelles' => array('fr' => 'liste d\'adhésions annuelles', 'en' => 'annual memberships list'), 'promoteur_hub_rapport_finances_capitaines' => array('fr' => 'Transactions-Finances (capitaines seulement)', 'en' => 'Transactions-Finances (captains only)'), 'promoteur_hub_rapport_paiements' => array('fr' => 'Paiements', 'en' => 'Payments'), ); return $tab[$clef][$lng] ?? ''; } /** * Libellé hub — sur compte.php délègue à afficheTexte ; en AJAX, lecture seule. */ function fxPromoteurHubTexte($clef, $mem_echo = 0) { if (!defined('MS1_PROMOTEUR_HUB_AJAX') || !MS1_PROMOTEUR_HUB_AJAX) { return afficheTexte($clef, $mem_echo); } $row = fxPromoteurHubGetInfoRow($clef); $str = trim($row['info_texte'] ?? ''); if ($str === '' || $str === $clef || $str === '*' . $clef . '*') { $str = fxPromoteurHubStaticFallback($clef); if ($str === '') { $str = $clef; } } if ($mem_echo == 1) { echo $str; } return $str; } /** * Liste des fonctions d'un evenement (groupes : rapports + gestion), * fidele a inc_tableau_promoteur.php. */ /** * MSIN-4401 — liens hub : * - Super admin / kit total (grants_all) → tout * - Accès V2 présent → menus selon les pages du kit (prioritaire sur legacy) * - Legacy seul (com_eve_promoteur, sans V2) → menus complets comme avant */ function fxPromoteurHubGetEventLinks($arrItem, $strLangue) { global $vDomaine, $objDatabase; $intEveId = intval($arrItem['eve_id']); $intComId = intval($arrItem['com_id'] ?? ($_SESSION['com_id'] ?? 0)); $intTeId = intval($arrItem['te_id'] ?? 0); $blnDon = ($intTeId == 9); $strE = urlencode(base64_encode($intEveId)); $strRapport = $vDomaine . '/superadm/rapport_new.php?r='; $strCompte = $vDomaine . ($strLangue === 'fr' ? '/compte/' : '/account/'); $year = date('Y'); $strDateTq = $year . '-04-01 00:00:00'; if (!function_exists('fxEveAccesHasAnyPermission')) { require_once __DIR__ . '/inc_fx_eve_acces.php'; } if (!function_exists('fxIsPromoteur')) { require_once __DIR__ . '/inc_fonctions.php'; } $blnSuper = !empty($_SESSION['usa_id']); $blnHasV2 = fxEveAccesComHasV2ForEvent($intComId, $intEveId); $blnLegacyPromoteur = fxIsPromoteur($intComId, $intEveId); // Menus « tout ouvert » legacy seulement si PAS de kit V2 sur cet événement $blnLegacyMenus = $blnLegacyPromoteur && !$blnHasV2; // MSIN-4484 — kit total (role_grants_all) : menus hors $fnCan (rapports custom, mail questions…) $blnGrantsAll = fxEveAccesComEventHasGrantsAllKit($intComId, $intEveId); // MSIN-4484 — kit total : passer par HasAnyPermission (exclut perm_grants_all = 0). $fnCan = function ($arrKeys) use ($intComId, $intEveId, $blnSuper, $blnLegacyMenus) { if ($blnSuper || $blnLegacyMenus) { return true; } return fxEveAccesHasAnyPermission($intComId, $intEveId, $arrKeys); }; $arrRapports = array(); $arrGestion = array(); // MSIN-4482 — hub promoteur : pas de section Rapports si « Sans inscription en ligne » (pour l’instant) if (!function_exists('fxImportResultatsTeIdSansInscriptionEnLigne')) { require_once __DIR__ . '/inc_fx_import_resultats.php'; } $intTeSansInscr = intval(fxImportResultatsTeIdSansInscriptionEnLigne()); $blnSansInscrEnLigne = ($intTeSansInscr > 0 && $intTeId === $intTeSansInscr); // ---- Rapports (niveau 1 V2 : chrono / finances / paiements) ---- if (!$blnSansInscrEnLigne && $intTeId != 9 && $fnCan(array('reports.chrono'))) { $arrRapports[] = array( 'label' => fxPromoteurHubTexte('promoteur_hub_rapport_chrono', 0), 'url' => $strRapport . 'chrono&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank', ); } if (!$blnSansInscrEnLigne && $fnCan(array('reports.finances', 'reports.finances_membership', 'reports.finances_events'))) { if ($intTeId == 13) { $arrRapports[] = array( 'label' => fxPromoteurHubTexte('promoteur_hub_rapport_finances_all', 0), 'url' => $strRapport . 'finances-membership&e=' . $strE . '&lng=' . $strLangue . '&a-ach_maj_from=' . urlencode($strDateTq) . '&btn_search=', 'target' => '_blank', ); } else { $arrRapports[] = array( 'label' => fxPromoteurHubTexte('promoteur_hub_rapport_finances', 0), 'url' => $strRapport . 'finances&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank', ); } } if (!$blnSansInscrEnLigne && $intTeId == 13 && $fnCan(array('reports.finances_membership', 'reports.finances_events', 'reports.adhesions', 'reports.adhesions_sales'))) { if ($fnCan(array('reports.finances_membership'))) { $arrRapports[] = array( 'label' => fxPromoteurHubTexte('promoteur_hub_rapport_finances_adh', 0), 'url' => $strRapport . 'finances-membership-tq&e=' . $strE . '&lng=' . $strLangue . '&a-ach_maj_from=' . urlencode($strDateTq) . '&btn_search=', 'target' => '_blank', ); } if ($fnCan(array('reports.finances_events'))) { $arrRapports[] = array( 'label' => fxPromoteurHubTexte('promoteur_hub_rapport_finances_eve', 0), 'url' => $strRapport . 'finances-membership-autre&e=' . $strE . '&lng=' . $strLangue . '&a-ach_maj_from=' . urlencode($strDateTq) . '&btn_search=', 'target' => '_blank', ); } if ($fnCan(array('reports.adhesions'))) { $arrRapports[] = array( 'label' => fxPromoteurHubTexte('promoteur_hub_rapport_adhesions', 0), 'url' => $strRapport . 'adhesions&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank', ); } if ($fnCan(array('reports.adhesions_sales'))) { $arrRapports[] = array( 'label' => fxPromoteurHubTexte('promoteur_hub_rapport_adhesions_annuelles', 0), 'url' => $strRapport . 'adhesions-ventes&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank', ); } } if (!$blnSansInscrEnLigne && intval($arrItem['rapport_capitaines'] ?? 0) == 1 && $fnCan(array('reports.finances_captains'))) { $arrRapports[] = array( 'label' => fxPromoteurHubTexte('promoteur_hub_rapport_finances_capitaines', 0), 'url' => $strRapport . 'finances-pnq&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank', ); } if (!$blnSansInscrEnLigne && $fnCan(array('reports.payments'))) { $arrRapports[] = array( 'label' => fxPromoteurHubTexte('promoteur_hub_rapport_paiements', 0), 'url' => $strRapport . 'remboursements&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank', ); } if (!$blnSansInscrEnLigne && ($blnLegacyMenus || $blnGrantsAll || $blnSuper || $fnCan(array('reports.custom'))) && function_exists('fxGetMenussuperadm')) { $tabRapports = fxGetMenussuperadm(0, 0, 1, $intEveId); if (is_array($tabRapports)) { for ($intCtr = 1; $intCtr <= count($tabRapports); $intCtr++) { $arrRapports[] = array( 'label' => fxUnescape($tabRapports[$intCtr]['men_nom']), 'url' => $vDomaine . '/superadm/index.php?t=' . urlencode(base64_encode(fxUnescape($tabRapports[$intCtr]['men_id']))) . '&a=report&lng=' . $strLangue, 'target' => '_blank', ); } } } // ---- Gestion ---- // MSIN-4399 — Entrées V2 en tête de liste, puis legacy / autres. if (!$blnDon && $fnCan(array('dossards.manage', 'epreuves.edit_qte'))) { $strMenuQte = fxPromoteurHubTexte('tableau_promoteur_menu_gestion_qte_dossards', 0); $arrGestion[] = array('label' => $strMenuQte, 'url' => $strCompte . 'inc_tableau_gestion_epreuves?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-pencil-square-o'); } if (!function_exists('fxInscrGestionCanAccess')) { require_once __DIR__ . '/inc_fx_inscriptions_gestion.php'; } if (fxInscrGestionCanAccess($intComId, $intEveId)) { $arrGestion[] = array('label' => fxInscrGestionPromoteurMenuLabel(), 'url' => $strCompte . 'inc_tableau_inscriptions_gestion?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-users'); } if (!function_exists('fxEveAccesCanTeamInvite')) { require_once __DIR__ . '/inc_fx_eve_acces.php'; } if (!function_exists('fxEveAccesPromoteurMenuLabel')) { require_once __DIR__ . '/inc_fx_eve_acces_promoteur.php'; } if (fxEveAccesCanTeamInvite($intComId, $intEveId)) { $arrGestion[] = array( 'label' => fxEveAccesPromoteurMenuLabel($strLangue), 'url' => $strCompte . 'inc_tableau_eve_acces?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-key', ); } /* * MSIN-4465 — Menus hub legacy masqués (pages PHP toujours là). * Pour réactiver : décommenter le bloc ci-dessous. * - Dossards → inc_tableau_dossards * - Quantités → inc_tableau_epreuves (si qte_modifiable) * - Inscriptions V1 → inc_tableau_inscriptions * if (!$blnDon) { if ($blnLegacyMenus || $blnSuper || $blnGrantsAll) { $arrGestion[] = array('label' => fxPromoteurHubTexte('tableau_promoteur_menudossard', 0), 'url' => $strCompte . 'inc_tableau_dossards?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-id-card-o'); if (intval($arrItem['qte_modifiable'] ?? 0) == 1) { $arrGestion[] = array('label' => fxPromoteurHubTexte('tableau_promoteur_menuepreuves', 0), 'url' => $strCompte . 'inc_tableau_epreuves?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-pencil-square-o'); } } } if ($blnLegacyMenus || $blnSuper || $blnGrantsAll) { $arrGestion[] = array('label' => fxPromoteurHubTexte('tableau_promoteur_menueinscription', 0), 'url' => $strCompte . 'inc_tableau_inscriptions?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-users'); } */ // MSIN-4540 — pas de rabais sans inscription / paiement en ligne. if (!$blnSansInscrEnLigne && $fnCan(array('rabais.view', 'rabais.manage'))) { $arrGestion[] = array('label' => fxPromoteurHubTexte('tableau_promoteur_rabais', 0), 'url' => $strCompte . 'inc_tableau_rabais?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-money'); } if ($intTeId == 13 && ($blnLegacyMenus || $blnSuper || $blnGrantsAll)) { $arrGestion[] = array('label' => fxPromoteurHubTexte('tableau_promoteur_envoie_email_questions', 0), 'url' => $strCompte . 'inc_tableau_mail_questions?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-paper-plane'); } return array('rapports' => $arrRapports, 'gestion' => $arrGestion); } function fxPromoteurHubRenderLinkList($arrLinks, $strDefaultIcon) { if (empty($arrLinks)) { return ''; } $html = '
' . fxPromoteurHubEsc(fxPromoteurHubTexte('promoteur_hub_no_features', 0)) . '
'; } $html = '