$clef, "info_langue" => "fr", "info_texte" => $clef, "info_aide" => '', "info_prg" => $mem_page, "info_actif" => 1); fxSetInfo('add', $info1, '', $mem_id); $info1 = array("info_clef" => $clef, "info_langue" => "en", "info_texte" => $clef, "info_aide" => '', "info_prg" => $mem_page, "info_actif" => 1); fxSetInfo('add', $info1, '', $mem_id); } $strOut = $mem_texte . fxAdminTradMarker($clef, $mem_global); if ($mem_echo == 1) { echo $strOut; } return $strOut; } /** * Libellé info_texte en contexte HTML (crayon via afficheTexte en mode Textes). */ function afficheTextePage($clef, $mem_global = 0) { afficheTexte($clef, 1, 0, $mem_global); } /** * Texte d'aide long (pop-up Tippy sur le bouton ?) — colonne info_aide. * info_texte = libellé / tip court ; info_aide = contenu long éditable via traduction.php. * Créateur : stephan (refonte dossards v4) */ function afficheAide($clef, $mem_echo = 1, $mem_global = 0) { global $vtexte_page, $vPage; $mem_id = ""; if (isset($vtexte_page[$clef])) { $mem_aide = isset($vtexte_page[$clef]['info_aide']) ? $vtexte_page[$clef]['info_aide'] : ''; } else { $mem_aide = ''; if ($mem_global == 0) { $mem_page = $vPage; } else { $mem_page = "global"; } $info1 = array( "info_clef" => $clef, "info_langue" => "fr", "info_texte" => $clef, "info_aide" => '', "info_prg" => $mem_page, "info_actif" => 1 ); fxSetInfo('add', $info1, '', $mem_id); $info1['info_langue'] = 'en'; fxSetInfo('add', $info1, '', $mem_id); } if ($mem_echo == 1) { echo $mem_aide; } return $mem_aide; } /** * Description : lire le text dans la bd info * Parametres : 1 - page * 2 - langue A,F * optionelle 3- 1 va chercher bd client en premier et centrale en deuxiemme (default) * 2 jutse bd client * 3 juste bd centrale * Créateur : stephan * Date : 13-03-15 */ function obtenirTextepage() { global $objDatabase; $numargs = func_num_args(); $arg_list = func_get_args(); $page = $arg_list[0]; $Langue = $arg_list[1]; $centrale = $mem_corr = ""; $info = null; if (array_key_exists(2, $arg_list)) { $centrale = $arg_list[2]; } switch ($centrale) { case 3: $sql_info = "SELECT info_clef,info_texte,info_aide,pk_info,info_prg,'centrale' as bd FROM info where info_prg='" . $page . "' and info_langue='" . $Langue . "'"; $info = $GLOBALS['dbcentrale']->fxFetchArray(3, $sql_info); break; case 2: /* MSIN-4379 — info_aide : texte long pop-up bib v4 (Tippy). */ $sql_info = "SELECT info_clef,info_texte,info_aide,pk_info,info_prg,'client' as bd FROM info where (info_prg='" . $page . "' or info_prg='global') and info_langue='" . $Langue . "'"; $info = $objDatabase->fxFetchArray(3, $sql_info); break; case 1: $sql_info = "SELECT info_clef,info_texte,info_aide,pk_info,'client' as bd FROM info where info_prg='" . $page . "' and info_langue='" . $Langue . "'"; $info2 = $objDatabase->fxFetchArray(3, $sql_info); $sql_info = "SELECT info_clef,info_texte,info_aide,'centrale' as bd FROM info where info_prg='" . $page . "' and info_langue='" . $Langue . "'"; $info1 = $objDatabase->fxFetchArray(3, $sql_info); $info = array_merge($info1, $info2); break; } return $info; } /** * Description : affiche le bouton modi texte et hide les textclef * Parametres : * Créateur : stephan * Date : 13-03-22 */ function modif_texte_bt() { global $vadmin_texte; if ($vadmin_texte == true) echo ""; } /** * MSIN-4379 — Édition textes (crayons, traduction.php) : serveur dev + sous-domaine preprod seulement. * Pas la préprod client (preprod.ms1inscription.com) — même code, autre rôle (BD inscription test). * Superadm uniquement ; défaut = aperçu (crayons masqués). */ function fxAdminIsDevPreprod() { global $vblnEnvironementDev, $vblnEnvironementPreProd, $strHost; if (empty($vblnEnvironementDev) || empty($vblnEnvironementPreProd)) { return false; } return stripos((string)$strHost, 'ms1inscriptiondev') !== false; } function fxAdminCanUseTextEditTools() { return !empty($_SESSION['usa_id']) && fxAdminIsDevPreprod(); } /** Sync tables statiques (sync_static_db.php) — superadm, préprod dev seulement. */ function fxAdminStaticSyncAllowed() { return !empty($_SESSION['usa_id']) && fxAdminIsDevPreprod(); } function fxAdminTextEditModeActive() { return fxAdminCanUseTextEditTools() && !empty($_SESSION['ms1_text_edit_mode']); } /** Mode inspecteur droits v2 (cadenas) — super admin connecte uniquement. */ function fxAdminCanUsePermInspectTools() { return !empty($_SESSION['usa_id']); } function fxAdminPermInspectModeActive() { return fxAdminCanUsePermInspectTools() && !empty($_SESSION['ms1_perm_inspect_mode']); } function fxAdminPermInspectModeHandleRequest() { if (!fxAdminCanUsePermInspectTools() || !isset($_GET['ms1_perm_inspect'])) { return; } $_SESSION['ms1_perm_inspect_mode'] = ($_GET['ms1_perm_inspect'] === '1') ? 1 : 0; $strPath = strtok($_SERVER['REQUEST_URI'], '?'); $tabParams = $_GET; unset($tabParams['ms1_perm_inspect']); $strQuery = http_build_query($tabParams); header('Location: ' . $strPath . ($strQuery !== '' ? '?' . $strQuery : '')); exit; } function fxAdminPermInspectSwitchHtml() { $blnOn = fxAdminPermInspectModeActive(); return ' '; } /** Échappement HTML — outils admin traduction. */ function fxAdminEsc($str) { return htmlspecialchars((string)$str, ENT_QUOTES, 'UTF-8'); } /** info_prg pour traduction.php — depuis $vtexte_page ou repli page / global. */ function fxAdminTradInfoPrg($clef, $strDefaultPrg = '', $mem_global = 0) { global $vtexte_page, $vPage; if (!empty($vtexte_page[$clef]['info_prg'])) { return $vtexte_page[$clef]['info_prg']; } if ($strDefaultPrg !== '') { return $strDefaultPrg; } if ($mem_global == 1) { return 'global'; } return !empty($vPage) ? $vPage : 'compte.php'; } /** URL pop-up traduction.php — toute clé info (site entier). */ function fxAdminTradUrl($clef, $strInfoPrg = null, $mem_global = 0) { global $vDomaine, $vPage; if ($strInfoPrg === null || $strInfoPrg === '') { $strInfoPrg = fxAdminTradInfoPrg($clef, '', $mem_global); } $strPage = !empty($vPage) ? $vPage : $strInfoPrg; return $vDomaine . '/php/traduction.php?' . http_build_query(array( 'clef' => $clef, 'pk_prg' => $strInfoPrg, 'bd' => 'client', 'page' => $strPage, )); } /** * Marqueur invisible (ZWSP) — sûr dans le JS ; remplacé par un lien traduction.php au chargement. */ function fxAdminTradMarker($clef, $mem_global = 0) { if (!fxAdminTextEditModeActive() || trim($clef) === '') { return ''; } $strPayload = base64_encode(json_encode(array( 'k' => $clef, 'p' => fxAdminTradInfoPrg($clef, '', $mem_global), 'g' => (int)$mem_global, ), JSON_UNESCAPED_UNICODE)); return "\xE2\x80\x8B\xE2\x80\x8C" . $strPayload . "\xE2\x80\x8C\xE2\x80\x8B"; } /** Classes CSS crayon traduction (sans btn-admin-trad — évite le handler bib sur data-trad-url). */ function fxAdminTradLinkClass() { return 'btn-aide-bib btn-aide-trad ms1-trad-link'; } /** Lien crayon traduction.php — superadm dev/préprod + switch « Textes » ON. */ function fxAdminTradButton($clef, $strInfoPrg = null, $mem_global = 0) { if (!fxAdminTextEditModeActive() || trim($clef) === '') { return ''; } return '' . '' . ''; } /** Remplace les marqueurs afficheTexte() par des liens crayon (mode Textes). */ function fxAdminTradMarkerScriptHtml() { global $vDomaine, $vPage; static $blnRendered = false; if ($blnRendered || !fxAdminTextEditModeActive()) { return ''; } $blnRendered = true; return ' '; } function fxAdminTextEditModeHandleRequest() { if (!fxAdminCanUseTextEditTools() || !isset($_GET['ms1_text_edit'])) { return; } $_SESSION['ms1_text_edit_mode'] = ($_GET['ms1_text_edit'] === '1') ? 1 : 0; $strPath = strtok($_SERVER['REQUEST_URI'], '?'); $tabParams = $_GET; unset($tabParams['ms1_text_edit']); $strQuery = http_build_query($tabParams); header('Location: ' . $strPath . ($strQuery !== '' ? '?' . $strQuery : '')); exit; } function fxAdminTextEditSwitchHtml() { $blnEdit = fxAdminTextEditModeActive(); return ' '; } function fxRenderEnvNoticeBar() { global $vEnvNotice; $strExtraSwitches = ''; if (function_exists('fxAdminCanUsePermInspectTools') && fxAdminCanUsePermInspectTools()) { $strExtraSwitches .= fxAdminPermInspectSwitchHtml(); } if (trim($vEnvNotice) === '') { if ($strExtraSwitches !== '') { echo '
' . $strExtraSwitches . '
'; } return; } if (!fxAdminCanUseTextEditTools()) { echo $vEnvNotice; if ($strExtraSwitches !== '') { echo '
' . $strExtraSwitches . '
'; } return; } $strSwitch = fxAdminTextEditSwitchHtml() . $strExtraSwitches; $strHtml = preg_replace('/<\/strong>/', ' ' . $strSwitch, trim($vEnvNotice), 1); if ($strHtml === null || $strHtml === trim($vEnvNotice)) { echo $vEnvNotice; echo $strSwitch; echo fxAdminTradMarkerScriptHtml(); return; } echo $strHtml; echo fxAdminTradMarkerScriptHtml(); } /** * Description : Fonction pour ajouter le value dans une formes * Parametres : $mem_champ nom du champs ,$mem_defaut,$mem_type add ou mod ,$mem_infos tableau des info * Créateur : stephan * Date : 13-04-20 */ function fxFormFieldInfo($mem_champ, $mem_type, $mem_infos, $mem_defaut = "", $mem_array = 0) { if ($mem_array == 0) $mem_value = 'id="' . $mem_champ . '" name="' . $mem_champ . '"'; else $mem_value = 'id="info['.$mem_array.'][' . $mem_champ . ']" name="info['.$mem_array.'][' . $mem_champ . ']"'; switch ($mem_type) { // AJOUT case 'add': if (trim($mem_defaut != '')) $mem_value = $mem_value . ' value="' . $mem_defaut . '"'; break; case 'mod': case 'checkout': $mem_value = $mem_value . ' value="' . $mem_infos[$mem_champ] . '"'; break; } return $mem_value; } function fxFormFieldCheck($mem_champ, $mem_type, $mem_infos, $mem_valide, $mem_defaut = "",$mem_action="") { $mem_value = ''; switch ($mem_type) { // AJOUT case 'add': if (trim($mem_defaut != '')) $mem_value = 'checked="checked"'; break; case 'mod': case 'checkout': if($mem_action=="mod") { if ($mem_infos[$mem_champ] == $mem_valide) $mem_value = 'checked'; else $mem_value = 'disabled'; }else{ if ($mem_infos[$mem_champ] == $mem_valide) $mem_value = 'checked="checked"'; } break; } return $mem_value; } function fxFormFieldChecklist($mem_champ, $mem_type, $mem_infos, $mem_valide, $mem_defaut) { $mem_value = ''; switch ($mem_type) { // AJOUT case 'add': case 'addaffilie': if ($mem_defaut == $mem_valide) $mem_value = 'selected="selected"'; break; case 'mod': case 'checkout': if ($mem_infos[$mem_champ] == $mem_valide) $mem_value = 'selected="selected"'; break; } return $mem_value; } function fxSetInfo($strAction, $tabData, $strLangue, $id = 0) { global $objDatabase; $_SESSION['msg'] = ""; switch ($strAction) { // AJOUT case 'add': // former le INSERT $tabFieldsValues = fxListFieldsValues($tabData, 'pk_info', 'info', $GLOBALS['arrConDatabaseMain']['db']); // vérifie si le info existe $sqlValide = "SELECT COUNT(info_clef) from info where info_clef='" . $tabData['info_clef'] . "' and info_prg='" . $tabData['info_prg'] . "' and info_langue='".$tabData['info_langue']."'"; $nbValide = $objDatabase->fxGetVar($sqlValide); if ($nbValide > 0) { break; } // insérer les infos du participants $sqlInsert = "INSERT INTO info " . $tabFieldsValues['set'] . ',info_creation=now()'; $qryInsert = $objDatabase->fxQuery($sqlInsert); // récupérer le id ajouté $intCompte = $objDatabase->fxGetLastId(); // $_SESSION['com_id'] = $intCompte; break; // MODIFICATION case 'mod': $tabFieldsValues = fxListFieldsValues($tabData, 'pk_info', 'info', $GLOBALS['arrConDatabaseMain']['db']); // verification des champs obligatoire // update les infos $sqlUpdate = "UPDATE info " . $tabFieldsValues['set'] . ",info_maj=now() where ". $tabFieldsValues['key']; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); // définir le message à affiche break; // SUPPRESSION case 'del': /* PLUS TARD $sqlDelete = "DELETE FROM ".$bd." WHERE ".$memid." = " . intval($id); $qryDelete = $objDatabase->fxQuery($sqlDelete); */ } } function afficheTexteReplace($mem_tab_replace, $mem_texte) { foreach ($mem_tab_replace as $key => $value) $mem_texte=str_replace($key, $value, $mem_texte); return $mem_texte; } function tabhoraire_var($tabEvenement, $strLangue) { $strOutput = ' '; foreach ($tabEvenement['epreuves'] as $tabEpreuves) { if ($tabEpreuves['tep_id'] == 1) { $strOutput .= ' '; } } $strOutput .= '
' . afficheTexte('horaire_col_epreuve', 0) . ' Date ' . afficheTexte('horaire_col_heure', 0) . '
' . fxUnescape(ucfirst($tabEpreuves['epr_type_' . $strLangue])) . '
' . fxUnescape(ucfirst($tabEpreuves['epr_nom_' . $strLangue])) . '
' . fxShowDate($tabEpreuves['epr_date'], $strLangue) . ' ' . fxShowTime($tabEpreuves['epr_heure']) . '
'; return $strOutput; } function tabprix_var($tabEvenement, $strLangue, $code, $vDomaine) { if (isset($_SESSION['com_info']) && $_SESSION['com_info'] != '') $blnIsPromoteur = fxIsPromoteur($_SESSION['com_info']['com_id'], $tabEvenement['general']['eve_id']); else $blnIsPromoteur = false; $strOutput = '
'; $x = 1; foreach ($tabEvenement['dates_prix'] as $tabDate) { $strOutput .= ' '; $x++; } $mem_col = $x; $strOutput .= ' '; $strCategorie = ""; if ($tabEvenement['general']['eve_logged'] == 1 && !isset($_SESSION['com_info'])) { // MSIN-1113 $strOutput .= '

'; } foreach ($tabEvenement['epreuves'] as $tabEpreuves) { if (intval($tabEvenement['general']['te_id']) == 13) { if ($tabEpreuves['mst_id'] == 2) { $strLabel = 'btn-renew-text'; } else { $strLabel = 'btn-subscribe-text'; } } else { $strLabel = 'btn-book-text'; } $strDateLimite = $tabEpreuves['epr_date_limite'] . ' ' . $tabEpreuves['epr_heure_limite']; $strOuvertureInscription = $tabEpreuves['epr_date_limite_debut'] . " " . $tabEpreuves['epr_heure_limite_debut']; if ($blnIsPromoteur || $tabEpreuves['epr_hidden'] == 0) { if (fxUnescape($tabEpreuves['epr_categorie_' . $strLangue]) != $strCategorie) { if (trim($strCategorie) != '') { $strOutput .= ''; } $strOutput .= ' '; } $strCategorie = fxUnescape(ucfirst($tabEpreuves['epr_categorie_' . $strLangue])); } if ($blnIsPromoteur) { $strOutput .= ' '; } else { if ($tabEpreuves['epr_hidden'] == 0) { if ($strDateLimite >= fxGetDateTime() && $tabEpreuves['epr_non_reservable'] == 0) { $strDisabled = ''; $strSoldOut = ''; if ($tabEpreuves['epr_qte_limitee'] == 1 && $tabEpreuves['epr_qte'] <= 0) { $strDisabled = 'disabled="disabled"'; $strSoldOut = ' - ' . afficheTexte('epr_soldout', 0) . ''; } $strOutput .= ' '; } else { //MSIN-949 $strOutput .= ' '; } } } $mem_tabdateavant = ""; foreach ($tabEvenement['dates_prix'] as $tabDate) { if ($tabEpreuves['epr_hidden'] == 0) { // définir la class selon la date if ($tabDate >= fxGetDate() || $tabDate == $tabEvenement['general']['eve_date_debut']) $strClass = 'hilighted'; else $strClass = 'grayed text-muted'; $strOutput .= ''; $mem_tabdateavant = $tabDate; } } $strOutput .= ''; } $strOutput .= '
'; if (isset($tabEvenement['categorie_prix']) && $tabEvenement['categorie_prix']['cp_id'] != 1) $strOutput .= '(' . $tabEvenement['categorie_prix']['cp_details_' . $strLangue] . ')'; $strOutput .= ' '; if ($tabDate != $tabEvenement['general']['eve_date_debut']) { $strOutput .= afficheTexte('prix_jusqu', 0) . '
' . fxShowDate($tabDate, $strLangue); } else { if ($x != 1) // patch pour afficher la date de l'evenement pour classique Salomon 2015 if($tabEvenement['general']['eve_id'] == 183) $strOutput .= afficheTexte('prix_jusqu', 0) . '
' . strtolower(fxShowDate($tabEvenement['general']['eve_date_limite'], $strLangue)); else { $strOutput .= afficheTexte('prix_jour_evenement', 0); } } $strOutput .= '

' . fxUnescape($tabEpreuves['epr_categorie_' . $strLangue]) . '

' . fxUnescape(ucfirst($tabEpreuves['epr_type_' . $strLangue])) . '
' . fxUnescape(ucfirst($tabEpreuves['epr_nom_' . $strLangue])) . '
' . fxUnescape(ucfirst($tabEpreuves['epr_type_' . $strLangue])) . $strSoldOut . '
'; if ($tabEpreuves['epr_nom_' . $strLangue] != '') { $strOutput .= '
' . fxUnescape(ucfirst($tabEpreuves['epr_nom_' . $strLangue])) . '
'; } if (($tabEvenement['general']['eve_logged'] != 1 || isset($_SESSION['com_info'])) && $strOuvertureInscription <= fxGetDateTime()) { // MSIN-1113, MSIN-932 $strOutput .= ' '; } $strOutput .= '
'; if (strpos($tabEpreuves['epr_nom_' . $strLangue], trim($tabEpreuves['epr_type_' . $strLangue])) == 0) $strOutput .= fxUnescape(ucfirst($tabEpreuves['epr_type_' . $strLangue])); $strOutput .= '
' . fxUnescape(ucfirst($tabEpreuves['epr_nom_' . $strLangue])) . '
'; if ($tabEpreuves['epr_qte_limitee'] == 1 && $tabEpreuves['epr_qte'] < 1) { $strOutput .= '
' . afficheTexte('epr_soldout', 0) . '
'; } if ($tabEpreuves['epr_non_reservable'] == 1) { $strOutput .= '
' . afficheTexte('epr_non_reservable', 0) . '
'; } $strOutput .= '
'; if (isset($tabEvenement['prix'][$tabEpreuves['epr_id']][$tabDate])) { if (floatval($tabEvenement['prix'][$tabEpreuves['epr_id']][$tabDate]['ep_montant_affiche']) > 0) { $fltPrix = $tabEvenement['prix'][$tabEpreuves['epr_id']][$tabDate]['ep_montant_affiche']; } else { $fltPrix = $tabEvenement['prix'][$tabEpreuves['epr_id']][$tabDate]['ep_montant']; } // if ($mem_tabdateavant <= $tabEpreuves['epr_date_limite']) { if ($tabDate <= $tabEpreuves['epr_date_limite']) { if (floatval($fltPrix) != 0) $strOutput .= fxShowPrix($fltPrix, $strLangue, 1); else $strOutput .= afficheTexte('reserver_gratuit', 0); } elseif ($tabDate > $tabEpreuves['epr_date_limite']) { if (floatval($fltPrix) != 0) $strOutput .= fxShowPrix($fltPrix, $strLangue, 1); } if ($tabEpreuves['epr_taxes_incluses'] == 1 && $fltPrix != 0) $strOutput .= ' * '; } else { $strOutput .= '-'; } $strOutput .= '
'; return $strOutput; } function fxShowTabPrix($tabEvenement, $strLangue, $code, $vDomaine) { $blnIsPromoteur = false; $blnLogged = false; //$intQteWarning = 10; // 10% $intQteWarning = 5; $intQteAffichee = 0; $strCategorie = 'vide'; $strOutput = $strHeader = $strDisabled = ""; $strDateEvenement = $tabEvenement['general']['eve_date_debut']; if (isset($_SESSION['com_info']) && $_SESSION['com_info'] != '') { $blnIsPromoteur = fxIsPromoteur($_SESSION['com_info']['com_id'], $tabEvenement['general']['eve_id']); } if (intval($tabEvenement['general']['eve_logged']) == 1 && !isset($_SESSION['com_info'])) { // si l'événement exige d'être loggé et qu'on l'est pas, afficher un message $blnLogged = true; $strOutput .= '
' . afficheTexte('eve_logged', 0) . '
'; } if ($tabEvenement['epreuves'] != null) { foreach ($tabEvenement['epreuves'] as $tabEpreuves) { $strBadge = $strHeaderLabel = ''; $strLink = $vDomaine . '/' . afficheTexte('reserver_reserver', 0) . '/' . $code . '/' . fxUnescape($tabEpreuves['epr_id']); $strDateLimite = $tabEpreuves['epr_date_limite'] . ' ' . $tabEpreuves['epr_heure_limite']; $strOuvertureInscription = $tabEpreuves['epr_date_limite_debut'] . " " . $tabEpreuves['epr_heure_limite_debut']; $arrPrixFinal = fxGetEpreuvePrix($tabEpreuves['epr_id'], $strDateEvenement, $blnIsPromoteur, $strLangue); //$strlistePrix = '
' . print_r($arrPrixFinal, true) . '
'; $strlistePrix = fxShowListePrix($arrPrixFinal, $strLangue); if ($strOuvertureInscription > fxGetDateTime()) { $blnDisabled = true; $strBadge = '
' . afficheTexte('epr_header_pas_encore_ouvert', 0) . '
'; } elseif ($strDateLimite < fxGetDateTime()) { $blnDisabled = true; //$blnIsPromoteur = false; $strBadge = '
' . afficheTexte('epr_header_plus_reservable', 0) . '
'; } else { $blnDisabled = false; } if ($blnIsPromoteur || (/*$strDateLimite >= fxGetDateTime() &&*/ intval($tabEpreuves['epr_hidden']) == 0) && count($arrPrixFinal) > 0) { // si promoteur OU (date limite N'EST PAS passée ET épreuve N'EST PAS CACHÉE), afficher les épreuves if (intval($tabEvenement['general']['te_id']) == 13) { // si événement membership if ($tabEpreuves['mst_id'] == 2) { $strLabel = 'btn-renew-text'; } else { $strLabel = 'btn-subscribe-text'; } // entête par défaut $strHeader = '
' . afficheTexte($strLabel, 0) . '
'; } else { // si événement normal $strLabel = 'btn-book-text'; $strHeaderLabel = ($tabEvenement['general']['eve_date_debut'] == $tabEvenement['general']['eve_date_fin']) ? afficheTexte($strLabel, 0) : fxShowDate($tabEpreuves['epr_date'], $strLangue); $strHeaderLabel = (intval($tabEvenement['general']['eve_default_header']) == 1) ? afficheTexte($strLabel, 0) : fxShowDate($tabEpreuves['epr_date'], $strLangue); // entête par défaut $strHeader = '
' . $strHeaderLabel . '
'; } if (fxUnescape($tabEpreuves['epr_categorie_' . $strLangue]) != $strCategorie) { if (trim($strCategorie) != 'vide') { $strOutput .= ''; } $strOutput .= '

' . fxUnescape($tabEpreuves['epr_categorie_' . $strLangue]) . '

'; $intQteAffichee++; } $strCategorie = fxUnescape(ucfirst($tabEpreuves['epr_categorie_' . $strLangue])); // gestion des colonnes d'entête if ($blnIsPromoteur) { // si promoteur, afficher toutes les épreuves $strBadge = '
' . afficheTexte('epr_header_promoter', 0) . ' $$
' . $strBadge; } else { // si NON promoteur if (intval($tabEpreuves['epr_non_reservable']) == 1) { // si l'éppeuve N'EST PAS réservable $blnDisabled = true; // rendre le bouton résever inactif $strBadge = '
' . afficheTexte('epr_header_non_reservable', 0) . '
'; } else { // si l'éppeuve EST réservable if (intval($tabEpreuves['epr_qte_limitee']) == 1) { // si quantité limitée if (intval(fx_liste_attente_valideqte(intval($tabEpreuves['epr_id']))) > 0) { if (trim($strBadge) == '') { if (intval($tabEpreuves['epr_qte']) <= $intQteWarning) { // si quantité restante faible $strBadge = '
' . afficheTexte('epr_header_hurry', 0) . '
'; } } } elseif (fx_liste_attente_valideqte(intval($tabEpreuves['epr_id'])) <= 0) { // si tout vendu valide liste_attente avant intval($tabEpreuves['epr_qte']) <= 0 $blnDisabled = true; // rendre le bouton résever inactif $strBadge = '
' . afficheTexte('epr_header_soldout', 0) . '
'; $strBadge = $strBadge . fx_liste_attente_boutonajoute_listeactive($tabEpreuves["epr_id"]); } } } } $strOutput .= '
' . $strHeader . '
' . fxUnescape(ucfirst($tabEpreuves['epr_type_' . $strLangue])) . '
' . fxUnescape(ucfirst($tabEpreuves['epr_nom_' . $strLangue])) . '
'; $strOutput .= $strBadge; if ((!$blnDisabled && !$blnLogged) || $blnIsPromoteur) { // Afficher le bouton si on peut réserver $strOutput .= ' ' . afficheTexte($strLabel, 0) . ' '; } $strprix=fxShowEpreuvePrix($arrPrixFinal, $strLink, $blnDisabled, $blnLogged, $strLangue,$tabEvenement['general']['eve_affichage_frais'] ) ; $strprixOutput= $strprix["strOutput"]; ; if($tabEvenement['general']['eve_affichage_frais']==1){ $strprixfraisOutput = '
' .number_format(floatval( $strprix['fltPrixActuel']-$strprix['fltFraisActuel']), 2)."$ ". afficheTexte('text_frais', 0) . '
';}else{ $strprixfraisOutput=""; } $strOutput .= '
' . $strprixOutput . '
' . $strprixfraisOutput . '
'; } } if ($intQteAffichee > 0) { $strOutput .= '
'; } } return $strOutput; } function tabprix_var_benevoles($tabEvenement, $strLangue, $code, $vDomaine) { $strInfobulle = ''; $intCtr = 1; $blnIsPromoteur = false; if (isset($_SESSION['com_info']) && $_SESSION['com_info'] != '') $blnIsPromoteur = fxIsPromoteur($_SESSION['com_info']['com_id'], $tabEvenement['general']['eve_id']); $strOutput = '
'; $strCategorie = ""; if ($tabEvenement['general']['eve_logged'] == 1 && !isset($_SESSION['com_info'])) { // MSIN-1113 $strOutput .= '
'; } foreach ($tabEvenement['epreuves'] as $intKey => $tabEpreuves) { $strShow = ($intCtr == 1) ? ' show' : ''; $strShow = ''; $arrQte = fxGetQteBenevoles($tabEpreuves['epr_id']); $strDateLimite = $tabEpreuves['epr_date_limite'] . ' ' . $tabEpreuves['epr_heure_limite']; $strOuvertureInscription = $tabEpreuves['epr_date_limite_debut'] . " " . $tabEpreuves['epr_heure_limite_debut']; if ($strDateLimite >= fxGetDateTime()) { if (fxUnescape($tabEpreuves['epr_categorie_' . $strLangue]) != $strCategorie) { if (trim($strCategorie) != '') { $strOutput .= '
'; } $strOutput .= '

'; } $strCategorie = fxUnescape(ucfirst($tabEpreuves['epr_categorie_' . $strLangue])); if (trim($tabEpreuves['epr_description_' . $strLangue]) != '') { $strInfobulle = ' '; } else { $strInfobulle = ''; } $strOutput .= ' '; if ($blnIsPromoteur) { $strOutput .= ' '; } else { if ($tabEpreuves['epr_hidden'] == 0) { if ($strDateLimite >= fxGetDateTime() && $tabEpreuves['epr_non_reservable'] == 0) { $strOutput .= ' '; } else { //MSIN-949< $strOutput .= ''; } } } $strOutput .= ''; } $intCtr++; } $strOutput .= '
' . afficheTexte('benevoles_details_poste', 0) . ' ' . afficheTexte('benevoles_reserves-disponibles', 0) . ' ' . afficheTexte('benevoles_reserver', 0) . '
' . fxUnescape(ucfirst($tabEpreuves['epr_type_' . $strLangue])) . $strInfobulle . '
' . fxUnescape(ucfirst($tabEpreuves['epr_nom_' . $strLangue])) . '
' . $tabEpreuves['epr_qte'] . ' '; if ($tabEpreuves['epr_qte_limitee'] == 1 && $tabEpreuves['epr_qte'] <= 0) { $strOutput .= '
' . afficheTexte('epr_soldout', 0) . '
'; } else { if (($tabEvenement['general']['eve_logged'] != 1 || isset($_SESSION['com_info'])) && $strOuvertureInscription <= fxGetDateTime()) { // MSIN-1113, MSIN-932 $strOutput .= ' '; } } $strOutput .= '
' . afficheTexte('epr_terminee', 0) . '
'; // MSIN-931 if ($tabEpreuves['epr_qte_limitee'] == 1 && $tabEpreuves['epr_qte'] < 1) $strOutput .= '
' . afficheTexte('epr_soldout', 0) . '
'; if ($tabEpreuves['epr_non_reservable'] == 1) $strOutput .= '
' . afficheTexte('epr_non_reservable', 0) . '
'; $strOutput .= '
'; return $strOutput; } function fxGetEpreuvePrixfraisold($intEpreuve, $strDateEvenement, $blnIsPromoteur, $strLangue) { global $objDatabase; $strWhere = (!$blnIsPromoteur) ? ' AND p.ep_prive = 0' : ''; $arrFinal = array( 'actuel' => array(), 'fini' => array() ); $sqlPrix = " SELECT p.*, e.eve_frais, e.tt_id FROM inscriptions_epreuves_prix p JOIN inscriptions_epreuves ep ON ep.epr_id = p.epr_id JOIN inscriptions_panier_evenements e ON e.eve_id = ep.eve_id WHERE p.epr_id = " . intval($intEpreuve) . $strWhere . " ORDER BY p.ep_date_limite ASC "; $arrPrix = $objDatabase->fxGetResults($sqlPrix); if ($arrPrix != null) { $strToday = fxGetDate(); foreach ($arrPrix as $arr) { $fltMontant = (floatval($arr['ep_montant_affiche']) > 0) ? $arr['ep_montant_affiche'] : $arr['ep_montant']; $strKey = ($strToday <= $arr['ep_date_limite']) ? 'actuel' : 'fini'; /* ===== frais / taxes ===== */ $fltSousTotal = $fltMontant + $arr['ep_frais_montant'] + $arr['ep_frais_tps'] + $arr['ep_frais_tvq']; $fltFraisAvantTaxes = 0; $fltTotalTaxesFrais = 0; $fltPourcent = 0; if ($arr['eve_frais'] > 0) { $sqlFrais = " SELECT fra_avant_tx, fra_pourcent FROM inscriptions_frais WHERE fra_actif = 1 AND fra_montant_max >= " . floatval($fltSousTotal) . " AND fra_montant_min <= " . floatval($fltSousTotal) . " AND eve_frais = " . intval($arr['eve_frais']); $tabFrais = $objDatabase->fxGetRow($sqlFrais); if ($tabFrais) { if ($tabFrais['fra_pourcent'] > 0) { $fltFraisAvantTaxes = round($fltSousTotal * ($tabFrais['fra_pourcent'] / 100), 2); $fltPourcent = $tabFrais['fra_pourcent']; } else { $fltFraisAvantTaxes = $tabFrais['fra_avant_tx']; } if ($arr['tt_id'] > 1) { $sqlTaux = " SELECT t.tau_taux FROM inscriptions_taux t JOIN inscriptions_taux_types_taux ttt ON t.tau_id = ttt.tau_id WHERE ttt.tt_id = " . intval($arr['tt_id']); $tabTaux = $objDatabase->fxGetResults($sqlTaux); if ($tabTaux) { foreach ($tabTaux as $tx) { $fltTotalTaxesFrais += round($fltFraisAvantTaxes * ($tx['tau_taux'] / 100), 2); } } } } } $arrFinal[$strKey][] = array( 'date_limite' => ($strToday != $strDateEvenement) ? afficheTexte('prix_jusqu', 0) . ' ' . fxShowDate($arr['ep_date_limite'], $strLangue) : afficheTexte('prix_jour_evenement', 0), 'montant' => $fltMontant, 'prive' => $arr['ep_prive'], 'fra_avant_tx' => $fltFraisAvantTaxes, 'fra_total' => $fltFraisAvantTaxes + $fltTotalTaxesFrais, 'fra_pourcent' => $fltPourcent ); } } return $arrFinal; } function fxGetEpreuvePrix($intEpreuve, $strDateEvenement, $blnIsPromoteur, $strLangue) { global $objDatabase; $strWhere = (!$blnIsPromoteur) ? ' AND p.ep_prive = 0' : ''; $arrFinal = $arrKeys = array( 'actuel' => array(), 'fini' => array() ); $sqlPrix = " SELECT ep_montant, ep_montant_affiche, ep_date_limite, ep_prive FROM inscriptions_epreuves_prix WHERE epr_id = " . intval($intEpreuve) . $strWhere . " ORDER BY ep_date_limite ASC "; //MSIN-4296 $sqlPrix = " SELECT p.*, e.eve_frais, e.tt_id,ep.epr_taxes_incluses FROM inscriptions_epreuves_prix p left JOIN inscriptions_epreuves ep ON ep.epr_id = p.epr_id left JOIN inscriptions_evenements e ON e.eve_id = ep.eve_id WHERE p.epr_id = " . intval($intEpreuve) . $strWhere . " ORDER BY p.ep_date_limite ASC "; $arrPrix = $objDatabase->fxGetResults($sqlPrix); // echosl("sqlPrix"); // echosl($sqlPrix); $flttotal=0; if ($arrPrix != null) { $strToday = fxGetDate(); // trouver la date du jour $intCtr = 1; foreach ($arrPrix as $arr) { $fltMontant = (floatval($arr['ep_montant_affiche']) > 0) ? $arr['ep_montant_affiche'] : $arr['ep_montant']; $strDateLimite = ($strToday != $strDateEvenement) ? afficheTexte('prix_jusqu', 0) . ' ' . fxShowDate($arr['ep_date_limite'], $strLangue) : afficheTexte('prix_jour_evenement', 0); //MSIN-4344 /* ===== frais / taxes ===== */ $fltSousTotal = $fltMontant + $arr['ep_frais_montant'] + $arr['ep_frais_tps'] + $arr['ep_frais_tvq']; $fltFraisAvantTaxes = 0; $fltTotalTaxesFrais = 0; $fltPourcent = 0; if ($strToday <= $arr['ep_date_limite']) { $strKey = 'actuel'; } else { $strKey = 'fini'; } if ($arr['eve_frais'] > 0) { //MSIN-4344 /* ===== frais / taxes ===== */ $taxable=1-$arr['epr_taxes_incluses']; $result = fxCalculerFrais($objDatabase, $fltSousTotal, $arr['eve_frais'], $arr['tt_id'],$taxable); $fltFraisAvantTaxes = $result['frais_avant_taxes']; $flttotal = $result['frais_avant_taxes']; $fltPourcent = $result['frais_pourcentage']; $flttaxes=0; if (isset( $result['taxes_sur_frais'])){ $flttaxes = $result['taxes_sur_frais']; } // echosl("fxGetEpreuvePrix"); // print_rsl($result); } $arrFinal[$strKey][] = array( 'date_limite' => $strDateLimite, 'montant' => $fltMontant, 'prive' => $arr['ep_prive'], 'fra_avant_tx' => $fltFraisAvantTaxes, 'fra_total' => $flttotal, 'fra_pourcent' => $fltPourcent ); $intCtr++; } } // echosl("arrFinal"); return $arrFinal; } function fxShowEpreuvePrix($arrFinal, $strLink, $blnDisabled, $blnLogged, $strLangue,$eve_affichage_frais=0) { $strOutput = $strOff = $strDateLimite = ''; $fltPrixActuel = $fltPrixDernier =$fltFraisActuel= floatval(0); if (count($arrFinal) > 0) { $strOutput .= '
'; if (count($arrFinal['actuel']) > 1) { $fltFraisActuel = floatval(reset($arrFinal['actuel'])['fra_total']); $fltPrixActuel = floatval(reset($arrFinal['actuel'])['montant']); $fltPrixActuel =$fltPrixActuel +$fltFraisActuel; $fltFraisDernier = floatval(end($arrFinal['actuel'])['fra_total']); $fltPrixDernier = floatval(end($arrFinal['actuel'])['montant']); $fltPrixDernier =$fltPrixDernier +$fltFraisDernier; $strDateLimite = reset($arrFinal['actuel'])['date_limite']; } elseif (count($arrFinal['actuel']) == 1) { $fltFraisActuel = $fltFraisDernier = floatval(reset($arrFinal['actuel'])['fra_total']); $fltPrixActuel = $fltPrixDernier = floatval(reset($arrFinal['actuel'])['montant']); $fltPrixActuel=$fltPrixActuel+ $fltFraisActuel; $strDateLimite = reset($arrFinal['actuel'])['date_limite']; } elseif (count($arrFinal['fini']) > 0) { $fltFraisActuel = $fltFraisDernier = floatval(end($arrFinal['fini'])['fra_total']); $fltPrixActuel = $fltPrixDernier = floatval(end($arrFinal['fini'])['montant']); $fltPrixActuel=$fltPrixActuel+ $fltFraisActuel; $strDateLimite = end($arrFinal['fini'])['date_limite']; } if ($fltPrixDernier > $fltPrixActuel) { $arrPrixSplit = explode('.', number_format($fltPrixDernier, 2)); $strPrix = '$' . $arrPrixSplit[0] . '' . $arrPrixSplit[1] . ''; $strOff .= ' ' . $strPrix . ' '; } if ($fltPrixActuel > 0) { $arrPrixSplit = explode('.', number_format(floatval($fltPrixActuel), 2)); $strPrix = '$' . $arrPrixSplit[0] . '' . $arrPrixSplit[1] . ''; $strPrix.= ''.afficheTexte('text_frais_inclus', 0).''; } else { $strPrix = afficheTexte('reserver_gratuit', 0); } // MSIN-4296 old if($eve_affichage_frais==99){ $strOutput .= '
'. afficheTexte('text_frais', 0) .'$' .number_format(floatval($fltFraisActuel), 2). '
';} $strOutput .= '
'; if (!$blnDisabled && !$blnLogged) { // Afficher le bouton si on peut réserver $strOutput .= ''; } $strOutput .= $strPrix . $strOff; if (!$blnDisabled && !$blnLogged) { // Afficher le bouton si on peut réserver $strOutput .= ''; } $strOutput .= '
' . afficheTexte('tarifs_valides', 0) . '
' . $strDateLimite . '
'; } $strReturn['strOutput']=$strOutput; $strReturn['fltPrixActuel']=$fltPrixActuel; $strReturn['fltFraisActuel']=$fltFraisActuel; return $strReturn; } function fxShowListePrix($arrPrixFinal, $strLangue) { $strOutput = ''; if (count($arrPrixFinal) > 0) { $strOutput .= ''; if (count($arrPrixFinal['actuel']) > 0) { foreach($arrPrixFinal['actuel'] as $arr) { $strPrive = (intval($arr['prive']) == 1) ? 'privé' : 'public'; $strOutput .= ' '; } } if (count($arrPrixFinal['fini']) > 0) { foreach($arrPrixFinal['fini'] as $arr) { $strPrive = (intval($arr['prive']) == 1) ? 'privé' : 'public'; $strOutput .= ' '; } } $strOutput .= '
' . fxShowPrix($arr['montant'], $strLangue) . ' ' . $arr['date_limite'] . ' ' . $strPrive . '
' . fxShowPrix($arr['montant'], $strLangue) . ' ' . $arr['date_limite'] . ' ' . $strPrive . '
'; } return $strOutput; }