Add event management links and enhance SQL entries

This commit introduces a new function, `fxPromoteurHubGetEventLinks`, to generate management and report links for events, improving the event management interface. It also updates the SQL script to include new entries for the 'Gestion' section in both French and English, enhancing the localization of the promoteur hub. These changes aim to streamline event management and improve user navigation within the promoteur hub.
This commit is contained in:
2026-06-25 16:59:01 -04:00
parent 7cee99e8e0
commit d95f84bff7
2 changed files with 165 additions and 8 deletions

View File

@ -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 = '<ul class="list-unstyled mb-0">';
foreach ($arrLinks as $arrLink) {
$strIcon = !empty($arrLink['icon']) ? $arrLink['icon'] : $strDefaultIcon;
$strTarget = !empty($arrLink['target']) ? ' target="' . fxPromoteurHubEsc($arrLink['target']) . '"' : '';
$html .= '<li class="mb-2">';
$html .= '<a class="btn btn-outline-primary btn-block text-left rounded-0" href="' . fxPromoteurHubEsc($arrLink['url']) . '"' . $strTarget . '>';
$html .= '<i class="fa ' . fxPromoteurHubEsc($strIcon) . ' mr-2" aria-hidden="true"></i>' . fxPromoteurHubEsc($arrLink['label']);
$html .= '</a></li>';
}
$html .= '</ul>';
return $html;
}
function fxPromoteurHubRenderEventModal($arrItem, $strLangue)
{
$strModalId = 'hub-modal-' . intval($arrItem['eve_id']);
$arrLinks = fxPromoteurHubGetEventLinks($arrItem, $strLangue);
$html = '<div class="modal fade" id="' . fxPromoteurHubEsc($strModalId) . '" tabindex="-1" role="dialog" aria-labelledby="' . fxPromoteurHubEsc($strModalId) . '-title" aria-hidden="true">';
$html .= '<div class="modal-dialog modal-lg modal-dialog-scrollable" role="document">';
$html .= '<div class="modal-content">';
$html .= '<div class="modal-header">';
$html .= '<h5 class="modal-title" id="' . fxPromoteurHubEsc($strModalId) . '-title">' . fxPromoteurHubEsc($arrItem['nom']) . '</h5>';
$html .= '<button type="button" class="close" data-dismiss="modal" aria-label="' . fxPromoteurHubEsc(afficheTexte('modal_btn-close', 0)) . '"><span aria-hidden="true">&times;</span></button>';
$html .= '</div>';
$html .= '<div class="modal-body">';
$html .= '<div class="row">';
$html .= '<div class="col-12 col-md-6 mb-3">';
$html .= '<h6 class="text-uppercase text-muted mb-3"><i class="fa fa-file mr-2" aria-hidden="true"></i>' . fxPromoteurHubEsc(afficheTexte('tableau_promoteur_menurapports', 0)) . '</h6>';
$html .= fxPromoteurHubRenderLinkList($arrLinks['rapports'], 'fa-bar-chart');
$html .= '</div>';
$html .= '<div class="col-12 col-md-6 mb-3">';
$html .= '<h6 class="text-uppercase text-muted mb-3"><i class="fa fa-cogs mr-2" aria-hidden="true"></i>' . fxPromoteurHubEsc(afficheTexte('promoteur_hub_section_gestion', 0)) . '</h6>';
$html .= fxPromoteurHubRenderLinkList($arrLinks['gestion'], 'fa-list');
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="modal-footer">';
$html .= '<button type="button" class="btn btn-secondary rounded-0" data-dismiss="modal">' . fxPromoteurHubEsc(afficheTexte('modal_btn-close', 0)) . '</button>';
$html .= '</div>';
$html .= '</div></div></div>';
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 .= '<div class="card-body">';
if ($arrItem['url_promoteur'] !== '') {
$html .= '<a class="btn btn-primary rounded-pill mr-2 mb-2" href="' . fxPromoteurHubEsc($arrItem['url_promoteur']) . '">';
$strModalId = 'hub-modal-' . intval($arrItem['eve_id']);
$html .= '<button type="button" class="btn btn-primary rounded-pill mr-2 mb-2" data-toggle="modal" data-target="#' . fxPromoteurHubEsc($strModalId) . '">';
$html .= '<i class="fa fa-tachometer mr-2" aria-hidden="true"></i>' . fxPromoteurHubEsc(afficheTexte('promoteur_hub_btn_tableau', 0));
$html .= '</a>';
}
if ($arrItem['url_mobile'] !== '') {
$html .= '<a class="btn btn-outline-primary rounded-pill mr-2 mb-2" href="' . fxPromoteurHubEsc($arrItem['url_mobile']) . '">';
$html .= '<i class="fa fa-mobile mr-2" aria-hidden="true"></i>' . fxPromoteurHubEsc(afficheTexte('promoteur_hub_btn_mobile', 0));
$html .= '</a>';
$html .= '</button>';
$html .= fxPromoteurHubRenderEventModal($arrItem, $strLangue);
}
$html .= '</div></div>';

View File

@ -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()),