diff --git a/php/inc_fx_promoteur_hub.php b/php/inc_fx_promoteur_hub.php index a0f1f2e..45251e9 100644 --- a/php/inc_fx_promoteur_hub.php +++ b/php/inc_fx_promoteur_hub.php @@ -245,6 +245,7 @@ function fxPromoteurHubGetEvents($intComId, $strLangue = 'fr') $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 @@ -289,6 +290,10 @@ function fxPromoteurHubGetEvents($intComId, $strLangue = 'fr') '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' => fxPromoteurHubCanAccessPromoteurWeb($intComId, $intEveId) ? fxPromoteurHubPromoteurTableUrl($intEveId, $strLang) : '', @@ -343,6 +348,159 @@ function fxPromoteurHubEsc($str) return htmlspecialchars((string)$str, ENT_QUOTES, 'UTF-8'); } +/** + * Liste des fonctions d'un evenement (groupes : rapports + gestion), + * fidele a inc_tableau_promoteur.php. + */ +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'; + + $arrRapports = array(); + $arrGestion = array(); + + // ---- Rapports ---- + if ($intTeId != 9) { + $arrRapports[] = array('label' => 'chrono + questions', 'url' => $strRapport . 'chrono&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank'); + } + + if ($intTeId == 13) { + $arrRapports[] = array('label' => 'Transactions-Finances-Tout', 'url' => $strRapport . 'finances-membership&e=' . $strE . '&lng=' . $strLangue . '&a-ach_maj_from=' . urlencode($strDateTq) . '&btn_search=', 'target' => '_blank'); + } else { + $arrRapports[] = array('label' => 'Transactions-Finances', 'url' => $strRapport . 'finances&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank'); + } + + if ($intTeId == 13) { + $arrRapports[] = array('label' => 'Transactions-Finances-Adhésions Seul', 'url' => $strRapport . 'finances-membership-tq&e=' . $strE . '&lng=' . $strLangue . '&a-ach_maj_from=' . urlencode($strDateTq) . '&btn_search=', 'target' => '_blank'); + $arrRapports[] = array('label' => 'Transactions-Finances-Événements Seul', 'url' => $strRapport . 'finances-membership-autre&e=' . $strE . '&lng=' . $strLangue . '&a-ach_maj_from=' . urlencode($strDateTq) . '&btn_search=', 'target' => '_blank'); + $arrRapports[] = array('label' => 'adhésions actives', 'url' => $strRapport . 'adhesions&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank'); + $arrRapports[] = array('label' => "liste d'adhésions annuelles", 'url' => $strRapport . 'adhesions-ventes&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank'); + } + + if (intval($arrItem['rapport_capitaines'] ?? 0) == 1) { + $arrRapports[] = array('label' => 'Transactions-Finances (capitaines seulement)', 'url' => $strRapport . 'finances-pnq&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank'); + } + + $arrRapports[] = array('label' => ($strLangue === 'fr' ? 'Paiements' : 'Payments'), 'url' => $strRapport . 'remboursements&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank'); + + if (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 ---- + if (!$blnDon) { + $arrGestion[] = array('label' => afficheTexte('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' => afficheTexte('tableau_promoteur_menuepreuves', 0), 'url' => $strCompte . 'inc_tableau_epreuves?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-pencil-square-o'); + } + + if (!empty($_SESSION['usa_id']) + || fxEveAccesHasAnyPermission($intComId, $intEveId, array('dossards.manage', 'epreuves.edit_qte'))) { + $strMenuQte = afficheTexte('tableau_promoteur_menu_gestion_qte_dossards', 0, 0); + if (strpos($strMenuQte, '*tableau_promoteur_menu_gestion_qte_dossards*') !== false) { + $strMenuQte = 'Gestion des quantités et dossards'; + } + $arrGestion[] = array('label' => $strMenuQte, 'url' => $strCompte . 'inc_tableau_gestion_epreuves?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-pencil-square-o'); + } + } + + $arrGestion[] = array('label' => afficheTexte('tableau_promoteur_menueinscription', 0), 'url' => $strCompte . 'inc_tableau_inscriptions?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-users'); + + if (function_exists('fxInscrMobileCanAccess') && fxInscrMobileCanAccess($intComId, $intEveId)) { + $arrGestion[] = array('label' => fxInscrMobilePromoteurMenuLabel(), 'url' => $strCompte . 'inc_tableau_inscriptions_mobile?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-users'); + } + + $arrGestion[] = array('label' => afficheTexte('tableau_promoteur_rabais', 0), 'url' => $strCompte . 'inc_tableau_rabais?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-money'); + + if ($intTeId == 13) { + $arrGestion[] = array('label' => afficheTexte('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 = ''; + + return $html; +} + +function fxPromoteurHubRenderEventModal($arrItem, $strLangue) +{ + $strModalId = 'hub-modal-' . intval($arrItem['eve_id']); + $arrLinks = fxPromoteurHubGetEventLinks($arrItem, $strLangue); + + $html = ''; + + return $html; +} + function fxPromoteurHubRenderEventCard($arrItem, $strLangue, $blnArchived = false) { $strCardClass = 'card box_participant mb-3' . ($blnArchived ? ' promoteur-hub-card-archived' : ''); @@ -369,15 +527,11 @@ function fxPromoteurHubRenderEventCard($arrItem, $strLangue, $blnArchived = fals $html .= '
'; if ($arrItem['url_promoteur'] !== '') { - $html .= ''; + $strModalId = 'hub-modal-' . intval($arrItem['eve_id']); + $html .= ''; + $html .= fxPromoteurHubRenderEventModal($arrItem, $strLangue); } $html .= '
'; diff --git a/sql/MSIN-promoteur-hub-phase1.sql b/sql/MSIN-promoteur-hub-phase1.sql index 2ba1b32..395c613 100644 --- a/sql/MSIN-promoteur-hub-phase1.sql +++ b/sql/MSIN-promoteur-hub-phase1.sql @@ -25,6 +25,7 @@ DELETE FROM info WHERE info_clef IN ( 'promoteur_hub_annonces_titre', 'promoteur_hub_section_highlight', 'promoteur_hub_section_archived', + 'promoteur_hub_section_gestion', 'promoteur_hub_btn_tableau', 'promoteur_hub_btn_mobile', 'promoteur_hub_empty' @@ -43,6 +44,8 @@ INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_ ('promoteur_hub_section_highlight', 'en', 'Highlights', '', 'compte.php', '', 0, 1, '', '', '', NOW()), ('promoteur_hub_section_archived', 'fr', 'Evenements passes', '', 'compte.php', '', 0, 1, '', '', '', NOW()), ('promoteur_hub_section_archived', 'en', 'Past events', '', 'compte.php', '', 0, 1, '', '', '', NOW()), +('promoteur_hub_section_gestion', 'fr', 'Gestion', '', 'compte.php', '', 0, 1, '', '', '', NOW()), +('promoteur_hub_section_gestion', 'en', 'Management', '', 'compte.php', '', 0, 1, '', '', '', NOW()), ('promoteur_hub_btn_tableau', 'fr', 'Tableau de bord', '', 'compte.php', '', 0, 1, '', '', '', NOW()), ('promoteur_hub_btn_tableau', 'en', 'Dashboard', '', 'compte.php', '', 0, 1, '', '', '', NOW()), ('promoteur_hub_btn_mobile', 'fr', 'Inscriptions mobile', '', 'compte.php', '', 0, 1, '', '', '', NOW()),