' . $mem_affiche . ''; } return $strResults; } function fxchecklangue($strField, $intMultilingue, $langues) { if (intval($intMultilingue) == 1) return $strField . "_" . $langues; else return $strField; } function fxGetchamps($eve_id, $intEpreuveRecherche, $intNbEquipes) { global $objDatabase; $arrColonnes = array(); $arrColonnes[20] = array( 'field' => 'epr_type,epr_nom', 'align' => 'left', 'label_fr' => 'Épreuve', 'label_en' => 'Race', 'multilingue' => 1, 'format' => 'string' ); $arrColonnes[30] = array( 'field' => 'par_prenom,par_nom', 'align' => 'left', 'label_fr' => 'Nom', 'label_en' => 'Name', 'multilingue' => 0, 'format' => 'string' ); $sqlLogFields = "SELECT DISTINCT c.* FROM logs_questions_epreuves e, logs_questions_champs c WHERE c.lqc_id = e.lqc_id AND e.lqe_actif = 1 AND e.eve_id = " . intval($eve_id) . " ORDER BY e.lqe_tri"; $arrLogFields = $objDatabase->fxGetResults($sqlLogFields); if ($arrLogFields != null) { for ($intCtr = 1; $intCtr <= count($arrLogFields); $intCtr++) { switch ($arrLogFields[$intCtr]['lqc_nom']) { case 'rlq_distance': $arrColonnes[$arrLogFields[$intCtr]['lqc_tri'] . 0] = array( 'field' => 'tot_objectif_distance', 'align' => 'right', 'label_fr' => 'Objectif', 'label_en' => 'Goal', 'multilingue' => 0, 'format' => 'float' ); $arrColonnes[$arrLogFields[$intCtr]['lqc_tri'] . 1] = array( 'field' => 'tot_distance', 'align' => 'right', 'label_fr' => 'Distance total', 'label_en' => 'Total distance', 'multilingue' => 0, 'format' => 'float' ); break; case 'rlq_temps': /*$arrColonnes[$arrLogFields[$intCtr]['lqc_tri'] . 0] = array( 'field' => 'tot_objectif_temps', 'align' => 'left', 'label_fr' => 'Objectif', 'label_en' => 'Goal', 'multilingue' => 0, 'format' => 'time' );*/ $arrColonnes[$arrLogFields[$intCtr]['lqc_tri'] . 1] = array( 'field' => 'tot_temps', 'align' => 'left', 'label_fr' => 'Temps total', 'label_en' => 'Total time', 'multilingue' => 0, 'format' => 'time' ); break; } } } if (intval($intNbEquipes) > 0) { $arrColonnes[10] = array( 'field' => 'pec_nom_equipe', 'align' => 'left', 'label_fr' => 'Équipe', 'label_en' => 'Team', 'multilingue' => 0, 'format' => 'string' ); } return $arrColonnes; } function fxGetListeParticipants($eve_id, $strWhere, $strOrder, $pec_id = 0) { global $objDatabase; if (intval($pec_id) != 0) { // trouver les participants d'une équipe précise $sql = " (SELECT rec.pec_equipe, rec.pec_nom_equipe, rp.*, rp.epr_objectif_distance AS tot_objectif_distance, ( SELECT COALESCE(SUM(rlq.rlq_distance), 0) AS tot_distance FROM resultats_logs_questions rlq WHERE rlq.pec_id = rec.pec_id_original AND rlq.par_id = rp.par_id_original ) AS tot_distance, ( SELECT COALESCE(SUM(TIME_TO_SEC(rlq.rlq_temps)), 0) AS tot_temps FROM resultats_logs_questions rlq WHERE rlq.pec_id = rec.pec_id_original AND rlq.par_id = rp.par_id_original ) AS tot_temps, pe.epr_categorie_fr, pe.epr_categorie_en, pe.epr_type_fr, pe.epr_type_en, pe.epr_nom_fr, pe.epr_nom_en, rec.pec_id_original FROM resultats_epreuves_commandees rec, resultats_participants rp, inscriptions_panier_epreuves pe WHERE rp.pec_id = rec.pec_id_original AND rp.is_cancelled = 0 AND pe.epr_id = rec.epr_id AND rec.eve_id = " . intval($eve_id) . " AND rec.pec_equipe = 1 AND rec.pec_id_original = " . intval($pec_id) . ") " . $strOrder . " "; } else { // trouver TOUS les participants et équipes d'un événement $sql = " (SELECT rec.pec_equipe, rec.pec_nom_equipe, rp.*, rp.epr_objectif_distance AS tot_objectif_distance, ( SELECT COALESCE(SUM(rlq.rlq_distance), 0) AS tot_distance FROM resultats_logs_questions rlq WHERE rlq.pec_id = rec.pec_id_original AND rlq.par_id = rp.par_id_original ) AS tot_distance, ( SELECT COALESCE(SUM(TIME_TO_SEC(rlq.rlq_temps)), 0) AS tot_temps FROM resultats_logs_questions rlq WHERE rlq.pec_id = rec.pec_id_original AND rlq.par_id = rp.par_id_original ) AS tot_temps, pe.epr_categorie_fr, pe.epr_categorie_en, pe.epr_type_fr, pe.epr_type_en, pe.epr_nom_fr, pe.epr_nom_en, rec.pec_id_original FROM resultats_epreuves_commandees rec, resultats_participants rp, inscriptions_panier_epreuves pe WHERE rp.pec_id = rec.pec_id_original AND rp.is_cancelled = 0 AND pe.epr_id = rec.epr_id AND rec.eve_id = " . intval($eve_id) . " AND rec.pec_equipe = 0 " . $strWhere . ") UNION (SELECT rec.pec_equipe, rec.pec_nom_equipe, rp.*, ( SELECT COALESCE(SUM(rp.epr_objectif_distance), 0) AS tot_objectif_distance_equipe FROM resultats_participants rp WHERE rp.pec_id = rec.pec_id_original ) AS tot_objectif_distance, ( SELECT COALESCE(SUM(rlq.rlq_distance), 0) AS tot_distance FROM resultats_logs_questions rlq WHERE rlq.pec_id = rec.pec_id_original ) AS tot_distance, ( SELECT COALESCE(SUM(TIME_TO_SEC(rlq.rlq_temps)), 0) AS tot_temps FROM resultats_logs_questions rlq WHERE rlq.pec_id = rec.pec_id_original ) AS tot_temps, pe.epr_categorie_fr, pe.epr_categorie_en, pe.epr_type_fr, pe.epr_type_en, pe.epr_nom_fr, pe.epr_nom_en, rec.pec_id_original FROM resultats_epreuves_commandees rec, resultats_participants rp, inscriptions_panier_epreuves pe WHERE rp.pec_id = rec.pec_id_original AND rp.is_cancelled = 0 AND pe.epr_id = rec.epr_id AND rec.eve_id = " . intval($eve_id) . " AND rec.pec_equipe = 1 " . $strWhere . " GROUP BY rec.pec_id_original) " . $strOrder . " "; } $rec = $objDatabase->fxGetResults($sql); return $rec; } function fxGetObjectifEpreuve($intEpreuve) { global $objDatabase; $sqlObjectif = " SELECT COALESCE(SUM(rp.epr_objectif_distance), 0) AS tot_objectif_distance, ie.epr_objectif_distance_global, ie.epr_montant_distance_offline, COALESCE(SUM(TIME_TO_SEC(rp.epr_objectif_temps)), 0) AS tot_objectif_temps, COALESCE(TIME_TO_SEC(ie.epr_objectif_temps_global), 0) AS epr_objectif_temps_global, COALESCE(TIME_TO_SEC(ie.epr_montant_temps_offline), 0) AS epr_montant_temps_offline FROM resultats_epreuves_commandees rec, resultats_participants rp, inscriptions_epreuves ie WHERE rec.epr_id = ie.epr_id AND rp.is_cancelled = 0 AND rec.tep_id = 3 AND rp.pec_id = rec.pec_id_original AND rec.epr_id = " . intval($intEpreuve) . " "; $arrObjectif = $objDatabase->fxGetRow($sqlObjectif); return $arrObjectif; } function fxGetTotalEpreuve($intEpreuve) { global $objDatabase; $sqlTotal = " SELECT COALESCE(SUM(rlq.rlq_distance), 0) AS tot_distance, COALESCE(SUM(TIME_TO_SEC(rlq.rlq_temps)), 0) AS tot_temps FROM resultats_epreuves_commandees rec, resultats_logs_questions rlq, resultats_participants rp WHERE rlq.pec_id = rec.pec_id_original AND rlq.par_id = rp.par_id_original AND rp.is_cancelled = 0 AND rec.pec_id_original = rp.pec_id AND rec.epr_id = " . intval($intEpreuve) . " "; $arrTotal = $objDatabase->fxGetRow($sqlTotal); return $arrTotal; } function fxListEpreuves($evenement, $strLangue, $intEpreuveRecherche) { global $objDatabase; $arrRetour = array(); $strWhere = ''; if (trim($intEpreuveRecherche) != '') { $strWhere = " AND ipe.epr_id = " . intval($intEpreuveRecherche); } $sqlEpreuves = " SELECT ipe.epr_id, ipe.epr_type_$strLangue, ipe.epr_nom_$strLangue, ipe.epr_categorie_$strLangue, ipe.epr_equipe FROM inscriptions_panier_epreuves_commandees rec, inscriptions_panier_epreuves ipe WHERE ipe.epr_id = rec.epr_id AND rec.eve_id = " . intval($evenement) . " AND ipe.tep_id = 3 $strWhere GROUP BY ipe.epr_id ORDER BY epr_type_" . $strLangue ; $arrEpreuves = $objDatabase->fxGetResults($sqlEpreuves); if ($arrEpreuves != null) { $arrRetour['epreuves'] = $arrEpreuves; $intNbEpreuves = 0; foreach ($arrEpreuves as $item) { $intNbEpreuves += $item['epr_equipe']; } $arrRetour['equipe'] = $intNbEpreuves; } return $arrRetour; } $strEpreuve = afficheTexte('toutlesepreuves',0); $strWhere = $intEpreuveRecherche = $strNomRecherche = $strOrderGet = ''; $strOrderBy = " ORDER BY epr_categorie_" . $strLangue . ", epr_type_" . $strLangue . ", epr_nom_" . $strLangue . ", tot_temps DESC, tot_distance DESC, tot_objectif_distance DESC, par_nom, par_prenom"; // v?rifier les form POST if (isset($_GET['order'])) { $strOrderGet = $objDatabase->fxEscape($_GET['order']); $strOrderBy = " ORDER BY " . $strOrderGet; } if (isset($_GET['rech_epreuve'])) { if ($_GET['rech_epreuve'] != '') { $intEpreuveRecherche = intval($_GET['rech_epreuve']); $strWhere .= ' AND rec.epr_id = ' . $_GET['rech_epreuve']; $intEpreuveRecherche = $_GET['rech_epreuve']; $intEpreuve = $_GET['rech_epreuve']; // trouver le nom de l'?preuve foreach ($tabEvenement['epreuves'] as $tabEpreuves) { if ($tabEpreuves['epr_id'] == $intEpreuve) { $strEpreuve = fxUnescape($tabEpreuves['epr_type_' . $strLangue]); if (trim($tabEpreuves['epr_nom_' . $strLangue]) != '') $strEpreuve .= ' - ' . fxUnescape($tabEpreuves['epr_nom_' . $strLangue]); } } } } $arrEpreuves = fxListEpreuves($tabEvenement['general']['eve_id'], $strLangue, $intEpreuveRecherche); $arrEpreuvesSelect = fxListEpreuves($tabEvenement['general']['eve_id'], $strLangue, ''); $intNbEquipes = $arrEpreuvesSelect['equipe']; if (!empty($_GET['rech_nom'])) { if (trim($_GET['rech_nom']) != '') { if ($intNbEquipes == 0){ $strWhere .= " AND CONCAT(par_prenom,' ',par_nom) LIKE '%" . $_GET['rech_nom'] . "%'" ; $strNomRecherche = $_GET['rech_nom']; } else { $strWhere .= " AND (CONCAT(par_prenom,' ',par_nom) LIKE '%" . $_GET['rech_nom'] . "%' OR pec_nom_equipe LIKE '%" . $_GET['rech_nom'] . "%')" ; $strNomRecherche = $_GET['rech_nom']; } } } ?>

$value){ $arrTotalEpreuve = fxGetTotalEpreuve($value['epr_id']); // amassé total $arrObjectifEpreuve = fxGetObjectifEpreuve($value['epr_id']); // objectif total $fltDistanceParcourue = $arrTotalEpreuve['tot_distance']; $intTempsParcourue = $arrTotalEpreuve['tot_temps']; $fltObjectifDistance = $arrObjectifEpreuve['tot_objectif_distance']; $fltObjectifDistanceGlobal = $arrObjectifEpreuve['epr_objectif_distance_global']; $intObjectifTemps = $intObjectifTempsGlobal = $arrObjectifEpreuve['epr_objectif_temps_global']; $fltDistanceOffline = $arrObjectifEpreuve['epr_montant_distance_offline']; $intTempsOffline = $arrObjectifEpreuve['epr_montant_temps_offline']; if (floatval($fltObjectifDistanceGlobal) > 0) { $fltObjectifDistance = $fltObjectifDistanceGlobal; } if (floatval($fltDistanceOffline) > 0) { $fltDistanceParcourue += $fltDistanceOffline; } if (intval($intTempsOffline) > 0) { $intTempsParcourue += $intTempsOffline; } // comptabiliser les totaux $fltDistanceParcourueTotal += floatval($fltDistanceParcourue); $fltObjectifDistanceTotal += floatval($fltObjectifDistance); $intTempsParcourueTotal += intval($intTempsParcourue); $intObjectifTempsTotal += intval($intObjectifTemps); } if (floatval($fltObjectifDistanceTotal) > 0) { if ($strLangue == 'fr') { $strAmountLabel = ' Distance parcourue'; $strGoalLabel = 'Objectif'; } else { $strAmountLabel = ' Distance traveled'; $strGoalLabel = 'Goal'; } $objThermometer = new \clsThermometer\clsThermometer($fltObjectifDistanceTotal, $fltDistanceParcourueTotal); echo $objThermometer->fxShow('h', 2, 'distance', ' km', $strAmountLabel, $strGoalLabel, $strLangue); } if (intval($intObjectifTempsTotal) > 0) { if ($strLangue == 'fr') { $strAmountLabel = ' Temps parcourue'; $strGoalLabel = 'Objectif'; } else { $strAmountLabel = ' Time traveled'; $strGoalLabel = 'Goal'; } $objThermometer = new \clsThermometer\clsThermometer($intObjectifTempsTotal, $intTempsParcourueTotal); echo $objThermometer->fxShow('h', 0, 'time', '', $strAmountLabel, $strGoalLabel, $strLangue); } ?>

Recherche :Search :

' . $strEpreuve . '

'; if ($stradm!="") echo '

' . afficheTexte('nombreinscription', 0) . ' ' . count($arrListeParticipants) . '


'; if ($arrListeParticipants != null) { $strResults = ' '; //entete pour le tableau foreach ($arrChamps as $arrCol) { $strResults .= ' '; } $strResults .= ' '; // contenue le tableau $strCategorie = $strNom = $strType = $strCategoriePrec = $strNomPrec = $strTypePrec = ''; for ($intCtrParticipant = 1; $intCtrParticipant <= count($arrListeParticipants); $intCtrParticipant++) { $strClass = ($intCtrParticipant & 1) ? '' : 'table-secondary'; $strCategorie = $arrListeParticipants[$intCtrParticipant]['epr_categorie_' . $strLangue]; if ($strCategorie != $strCategoriePrec) { // afficher la catégorie $strResults .= ' '; } if (intval($arrListeParticipants[$intCtrParticipant]['pec_equipe']) == 1) { // afficher les équipes $strResults .= ' '; $strResults .= fxShowColumn($arrChamps, $arrListeParticipants, $intCtrParticipant, $strLangue, 1); $strResults .= ' '; // afficher les participants de cette équipe $arrListeParticipantsEquipe = fxGetListeParticipants($tabEvenement['general']['eve_id'], $strWhere, $strOrderBy, $arrListeParticipants[$intCtrParticipant]['pec_id_original']); if ($arrListeParticipantsEquipe != null) { for ($x2 = 1; $x2 <= count($arrListeParticipantsEquipe); $x2++) { $strResults .= ' '; $strResults .= fxShowColumn($arrChamps, $arrListeParticipantsEquipe, $x2, $strLangue, 2); $strResults .= ' '; } } } else { // afficher les solos $strResults .= ' '; $strResults .= fxShowColumn($arrChamps, $arrListeParticipants, $intCtrParticipant, $strLangue); $strResults .= ' '; } $strCategoriePrec = $strCategorie; } $strResults .= '
' . $arrCol['label_' . $strLangue] . '

' . fxUnescape($strCategorie) . '

' . count($arrListeParticipants) . ' participants
'; } else { $strResults = ''; } echo $strResults;