Files
ms1inscription-v5/php/inc_fx_promoteur_hub.php
stephan 683e2d69d0 Update promoteur hub styles and enhance event section rendering
This commit modifies the CSS for the promoteur hub, introducing new styles for card elements, including updated colors, borders, and shadows for improved aesthetics. It also enhances the event section rendering by adding a specific class to the event title, ensuring consistent styling across the promoteur hub. Additionally, the version code is incremented to reflect these changes.
2026-06-25 17:15:37 -04:00

611 lines
23 KiB
PHP

<?php
/**
* Hub promoteur — comptes migres acces evenement v2 uniquement.
* Legacy (com_eve_promoteur) : comportement inchange, pas de hub.
*/
require_once __DIR__ . '/inc_fx_eve_acces.php';
function fxPromoteurHubComUsesV2($intComId)
{
return fxEveAccesComHasV2(intval($intComId));
}
/** La page compte_promoteur_hub est-elle installee (SQL applique) ? */
function fxPromoteurHubPageExists()
{
global $objDatabase;
static $blnExists = null;
if ($blnExists !== null) {
return $blnExists;
}
if (!isset($objDatabase)) {
$blnExists = false;
return $blnExists;
}
$intNb = $objDatabase->fxGetVar(
"SELECT COUNT(*) FROM inscriptions_pages WHERE pag_code = 'compte_promoteur_hub' AND pag_actif = 1"
);
$blnExists = ($intNb !== null && intval($intNb) > 0);
return $blnExists;
}
/** Le compte doit-il atterrir sur le hub v2 ? (acces v2 + page installee) */
function fxPromoteurHubShouldUse($intComId)
{
return fxPromoteurHubComUsesV2(intval($intComId)) && fxPromoteurHubPageExists();
}
function fxPromoteurHubUrl($strLangue = 'fr')
{
global $vDomaine;
return $vDomaine . ($strLangue === 'fr' ? '/compte/promoteur_hub' : '/account/promoteur_hub');
}
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()
{
return array(
'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',
);
}
function fxPromoteurHubCanAccessPromoteurWeb($intComId, $intEveId)
{
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());
}
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)
{
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();
// Union : evenements legacy (com_eve_promoteur) + acces v2
$arrEventIds = array_merge(
fxPromoteurHubGetLegacyEventIds(intval($intComId)),
fxEveAccesGetEventIds(intval($intComId))
);
if (empty($arrEventIds)) {
return array('highlight' => $arrHighlight, 'archived' => $arrArchived);
}
$arrIds = array_values(array_unique(array_filter(array_map('intval', $arrEventIds), 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'));
$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' => fxPromoteurHubCanAccessPromoteurWeb($intComId, $intEveId)
? fxPromoteurHubPromoteurTableUrl($intEveId, $strLang)
: '',
'url_mobile' => '',
);
if (!function_exists('fxInscrMobileCanAccess')) {
require_once __DIR__ . '/inc_fx_inscriptions_mobile.php';
}
if (fxInscrMobileCanAccess(intval($intComId), $intEveId)) {
$arrItem['url_mobile'] = fxInscrMobileBaseUrl($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');
}
/**
* 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 fxPromoteurHubRenderEventPanel($arrItem, $strLangue)
{
$strPanelId = 'hub-fn-' . intval($arrItem['eve_id']);
$arrLinks = fxPromoteurHubGetEventLinks($arrItem, $strLangue);
$html = '<div class="collapse promoteur-hub-functions mt-3" id="' . fxPromoteurHubEsc($strPanelId) . '">';
$html .= '<div class="row">';
$html .= '<div class="col-12 col-lg-6 mb-3">';
$html .= '<h6 class="text-uppercase text-muted mb-2"><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-lg-6 mb-3">';
$html .= '<h6 class="text-uppercase text-muted mb-2"><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>';
return $html;
}
function fxPromoteurHubRenderEventCard($arrItem, $strLangue, $blnArchived = false)
{
$strCardClass = 'card promoteur-hub-card mb-3' . ($blnArchived ? ' promoteur-hub-card-archived' : '');
$html = '<div class="' . fxPromoteurHubEsc($strCardClass) . '">';
$html .= '<div class="card-body">';
$html .= '<div class="d-flex align-items-center flex-wrap mb-2">';
$html .= '<div class="promoteur-hub-card-icon mr-3"><img src="' . fxPromoteurHubEsc($arrItem['icon']) . '" width="64" alt=""></div>';
$html .= '<div class="flex-grow-1">';
$html .= '<h2 class="h5 mb-1 promoteur-hub-event-title">' . fxPromoteurHubEsc($arrItem['nom']) . '</h2>';
if ($arrItem['date_label'] !== '') {
$html .= '<div class="text-muted small"><i class="fa fa-calendar-o mr-1" aria-hidden="true"></i>' . fxPromoteurHubEsc($arrItem['date_label']) . '</div>';
}
if ($arrItem['lieu'] !== '') {
$html .= '<div class="text-muted small"><i class="fa fa-map-marker mr-1" aria-hidden="true"></i>' . fxPromoteurHubEsc($arrItem['lieu']) . '</div>';
}
if (!empty($arrItem['roles'])) {
$html .= '<div class="small mt-1 text-muted">' . fxPromoteurHubEsc(implode(' · ', $arrItem['roles'])) . '</div>';
}
$html .= '</div></div>';
if ($arrItem['url_promoteur'] !== '') {
$strPanelId = 'hub-fn-' . intval($arrItem['eve_id']);
$html .= '<button type="button" class="btn btn-primary rounded-pill mb-2 promoteur-hub-toggle collapsed" data-toggle="collapse" data-target="#' . fxPromoteurHubEsc($strPanelId) . '" aria-expanded="false" aria-controls="' . fxPromoteurHubEsc($strPanelId) . '">';
$html .= '<i class="fa fa-tachometer mr-2" aria-hidden="true"></i>' . fxPromoteurHubEsc(afficheTexte('promoteur_hub_btn_tableau', 0));
$html .= '<i class="fa fa-chevron-down ml-2 promoteur-hub-toggle-caret" aria-hidden="true"></i>';
$html .= '</button>';
$html .= fxPromoteurHubRenderEventPanel($arrItem, $strLangue);
}
$html .= '</div></div>';
return $html;
}
function fxPromoteurHubRenderEventSection($arrItems, $strTitleClef, $strLangue, $blnArchived = false)
{
if (empty($arrItems)) {
return '';
}
$html = '<h2 class="h4 mt-4 mb-3 promoteur-hub-section-title">' . fxPromoteurHubEsc(afficheTexte($strTitleClef, 0)) . '</h2>';
$html .= '<div class="promoteur promoteur-hub-events">';
foreach ($arrItems as $arrItem) {
$html .= fxPromoteurHubRenderEventCard($arrItem, $strLangue, $blnArchived);
}
$html .= '</div>';
return $html;
}
function fxShowPromoteurHub($intComId, $strLangue = 'fr')
{
$arrBuckets = fxPromoteurHubGetEvents(intval($intComId), $strLangue);
$html = '';
$html .= '<div class="promoteur-hub-toolbar mb-4 d-flex flex-wrap align-items-center justify-content-between">';
$html .= '<p class="mb-2 mb-md-0 text-muted">' . fxPromoteurHubEsc(afficheTexte('promoteur_hub_intro', 0)) . '</p>';
$html .= '<a class="btn btn-outline-secondary rounded-pill" href="' . fxPromoteurHubEsc(fxPromoteurHubParticipantUrl($strLangue)) . '">';
$html .= '<i class="fa fa-user mr-2" aria-hidden="true"></i>' . fxPromoteurHubEsc(afficheTexte('promoteur_hub_link_participant', 0));
$html .= '</a>';
$html .= '</div>';
// Annonces : uniquement si le module doc a reellement des pages (sinon pas de "?" mort)
if (function_exists('fxDocRenderModule')) {
$strDocModule = fxDocRenderModule('promoteur_hub_annonces');
if ($strDocModule !== '') {
$html .= '<div class="promoteur-hub-annonces alert alert-info d-flex align-items-center mb-4">';
$html .= '<div class="flex-grow-1 mr-2">' . fxPromoteurHubEsc(afficheTexte('promoteur_hub_annonces_titre', 0)) . '</div>';
$html .= fxDocRenderTrigger('promoteur_hub_annonces');
$html .= $strDocModule;
$html .= '</div>';
}
}
$html .= fxPromoteurHubRenderEventSection($arrBuckets['highlight'], 'promoteur_hub_section_highlight', $strLangue, false);
$html .= fxPromoteurHubRenderEventSection($arrBuckets['archived'], 'promoteur_hub_section_archived', $strLangue, true);
if (empty($arrBuckets['highlight']) && empty($arrBuckets['archived'])) {
$html .= '<div class="alert alert-warning">' . fxPromoteurHubEsc(afficheTexte('promoteur_hub_empty', 0)) . '</div>';
}
return $html;
}
function fxShowPromoteurHubMenuLink($arrCompteClient, $strLangue)
{
global $vDomaine;
if (!fxPromoteurHubShouldUse(intval($arrCompteClient['com_id'] ?? 0))) {
return '';
}
$arrIds = array_unique(array_filter(array_map('intval', array_merge(
fxPromoteurHubGetLegacyEventIds(intval($arrCompteClient['com_id'])),
fxEveAccesGetEventIds(intval($arrCompteClient['com_id']))
)), function ($v) {
return $v > 0;
}));
$intNb = count($arrIds);
$strNb = '';
if ($intNb > 0) {
$strNb = '<small>(' . $intNb . ' ';
$strNb .= ($intNb > 1) ? afficheTexte('compte_evenement_pluriel', 0) : afficheTexte('compte_evenement_singulier', 0);
$strNb .= ')</small>';
}
return '
<li class="nav-item">
<a class="nav-list" href="' . fxPromoteurHubEsc(fxPromoteurHubUrl($strLangue)) . '">
<i class="fa fa-tachometer" aria-hidden="true"></i> ' . fxPromoteurHubEsc(afficheTexte('promoteur_hub_menu', 0)) . $strNb . '
</a>
</li>
';
}