3690 lines
160 KiB
PHP
3690 lines
160 KiB
PHP
<?php
|
||
/**
|
||
* Created by PhpStorm.
|
||
* User: AlexL
|
||
* Date: 19/05/2015
|
||
* Time: 9:29 AM
|
||
*/
|
||
|
||
// MSIN-1152 : fonction qui affiche un formulaire de recherche.
|
||
/*
|
||
* param $str_code : le code (URL) du "action" du formulaire
|
||
* param $int_promoteur_id : le no. de l'evenement pour lequel l'usager est promoteur
|
||
* param $str_code : un code pour definir les champs de recherche selon le contexte
|
||
* */
|
||
function fxShowRecherche($str_code, $int_promoteur_id, $blnDon, $strLangue, $intEveId,$abonnement=0) {
|
||
global $objDatabase, $vDomaine;
|
||
$strRechercheForm = $strRechercheResultats = $strRetour = $strSelected = $strRecherchePrenom = $strRechercheNom = $strNoCommande = $strNomParticipant = $strNomEquipe = $strPrenomParticipant = $strRecherchePagination = $chk_bib = '';
|
||
$intEpreuve = 0;
|
||
$intPage = $intStart = 1;
|
||
$intNbItemsParPage = $intEnd = 100;
|
||
|
||
// si apres recherche
|
||
if (isset($_GET['rech_prenom'])) {
|
||
$strRecherchePrenom = $_GET['rech_prenom'];
|
||
}
|
||
if (isset($_GET['rech_nom'])) {
|
||
$strRechercheNom = $_GET['rech_nom'];
|
||
}
|
||
if (isset($_GET['rech_no_commande'])) {
|
||
$strNoCommande = $_GET['rech_no_commande'];
|
||
}
|
||
if (isset($_GET['rech_nom_equipe'])) {
|
||
$strNomEquipe = $_GET['rech_nom_equipe'];
|
||
}
|
||
if (isset($_GET['rech_nom_participant'])) {
|
||
$strNomParticipant = $_GET['rech_nom_participant'];
|
||
}
|
||
if (isset($_GET['rech_prenom_participant'])) {
|
||
$strPrenomParticipant = $_GET['rech_prenom_participant'];
|
||
}
|
||
if (isset($_GET['sel_rech_epreuve'])) {
|
||
$intEpreuve = base64_decode(urldecode($_GET['sel_rech_epreuve']));
|
||
}
|
||
if (isset($_GET['chk_bib'])) {
|
||
$chk_bib = 1;
|
||
}
|
||
if (isset($_GET['chk_cancelled'])) {
|
||
$chk_cancelled = 1;
|
||
}
|
||
if (isset($_GET['pg'])) {
|
||
$intPage = $_GET['pg'];
|
||
}
|
||
|
||
if (intval($intPage) > 1) { // calculer le début et la fin de la boucle
|
||
$intStart = ($intPage - 1) * $intNbItemsParPage + 1;
|
||
$intEnd = $intStart + $intNbItemsParPage - 1;
|
||
}
|
||
|
||
if ($blnDon) {
|
||
$strPrenom = 'rech_prenom_don';
|
||
$strNom = 'rech_nom_don';
|
||
$strEquipe = 'rech_equipe_don';
|
||
} else {
|
||
$strPrenom = 'rech_prenom';
|
||
$strNom = 'rech_nom';
|
||
$strEquipe = 'rech_equipe';
|
||
}
|
||
|
||
$strRechercheForm .= '
|
||
<form action="' . $vDomaine . '/' . $str_code . '" id="frm_search" name="frm_search" method="get">
|
||
<input type="hidden" name="promoteur_eve_id" value="' . urlencode(base64_encode($int_promoteur_id)) . '">
|
||
<div class="form-group row">
|
||
<label for="rech_prenom" class="control-label col-sm-3 text-sm-right">' . afficheTexte($strPrenom, 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_prenom" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="rech_nom" class="control-label col-sm-3 text-sm-right">' . afficheTexte($strNom, 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_nom" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="rech_no_commande" class="control-label col-sm-3 text-sm-right">' . afficheTexte('rech_no_commande', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_no_commande" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="rech_nom_equipe" class="control-label col-sm-3 text-sm-right">' . afficheTexte($strEquipe, 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_nom_equipe" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="chk_bib" class="form-label col-sm-3 text-sm-right">' . afficheTexte('chk_bib', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control0" type="checkbox" name="chk_bib" value="1">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="chk_cancelled" class="form-label col-sm-3 text-sm-right">' . afficheTexte('chk_cancelled', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control0" type="checkbox" name="chk_cancelled" value="1">
|
||
</div>
|
||
</div>
|
||
';
|
||
|
||
if ($blnDon) {
|
||
$strRechercheForm .= '
|
||
<div class="form-group row">
|
||
<label for="rech_prenom_participant" class="control-label col-sm-3 text-sm-right">' . afficheTexte('rech_prenom_participant', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_prenom_participant" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="rech_nom_participant" class="control-label col-sm-3 text-sm-right">' . afficheTexte('rech_nom_participant', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_nom_participant" value="">
|
||
</div>
|
||
</div>
|
||
';
|
||
}
|
||
|
||
if (!$blnDon) { // un champ pour chercher par nom d'equipe
|
||
$sqlEpreuves = "SELECT * FROM inscriptions_epreuves e WHERE e.eve_id = " . intval($int_promoteur_id) . " AND ((SELECT COUNT(*) from resultats_participants p where p.epr_id = e.epr_id > 0))";
|
||
$tabEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
||
|
||
$strRechercheForm .= '
|
||
<div class="form-group row">
|
||
<label for="sel_rech_epreuve" class="control-label col-sm-3 text-sm-right">' . afficheTexte('sel_rech_epreuve', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<select class="form-control rounded-0" id="sel_rech_epreuve" name="sel_rech_epreuve">
|
||
<option value="0" data-comment="Pour champ recherche vide">--</option>
|
||
';
|
||
|
||
for ($i = 1; $i <= count($tabEpreuves); $i++) {
|
||
$strEpreuve = '';
|
||
|
||
if (trim($tabEpreuves[$i]['epr_categorie_' . $strLangue]) != '') {
|
||
$strEpreuve .= $tabEpreuves[$i]['epr_categorie_' . $strLangue] . " - ";
|
||
}
|
||
|
||
$strEpreuve .= $tabEpreuves[$i]['epr_type_' . $strLangue];
|
||
|
||
if (trim($tabEpreuves[$i]['epr_nom_' . $strLangue]) != '') {
|
||
$strEpreuve .= " - " . $tabEpreuves[$i]['epr_nom_' . $strLangue];
|
||
}
|
||
|
||
if (isset($_GET['sel_rech_epreuve']) && $tabEpreuves[$i]['epr_id'] == $_GET['sel_rech_epreuve']) {
|
||
$strSelected = ' selected';
|
||
}
|
||
|
||
$strRechercheForm .= '<option' . $strSelected . ' value="' . urlencode(base64_encode($tabEpreuves[$i]['epr_id'])) . '">' . $strEpreuve . '</option>';
|
||
}
|
||
|
||
$strRechercheForm .= '
|
||
</select>
|
||
</div>
|
||
</div>
|
||
';
|
||
}
|
||
|
||
$strRechercheForm .= '
|
||
<div class="form-group row">
|
||
<div class="offset-sm-3 col-sm-9 col-lg-7">
|
||
<button class="btn btn-primary rounded-0" type="submit" id="btn_recherche" name="btn_recherche">' . afficheTexte('txt_recherche', 0) . '</button>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
';
|
||
|
||
if ($blnDon) {
|
||
$strWhere2 = " a.eve_id = " . intval($intEveId) . " AND a.sta_id = 3 AND a.no_panier = d.no_panier AND e.pec_id_original = d.pec_id ";
|
||
$strWhere = '1 = 1';
|
||
|
||
if ($strRechercheNom != '')
|
||
$strWhere .= ' AND com_nom LIKE "%' . $strRechercheNom . '%"';
|
||
if ($strRecherchePrenom != '')
|
||
$strWhere .= ' AND com_prenom LIKE "%' . $strRecherchePrenom . '%"';
|
||
|
||
if ($strNomParticipant!= '')
|
||
$strWhere .= ' AND par_nom LIKE "%' . $strNomParticipant. '%"';
|
||
if ($strPrenomParticipant != '')
|
||
$strWhere .= ' AND par_prenom LIKE "%' . $strPrenomParticipant. '%"';
|
||
|
||
if ($strNoCommande != '')
|
||
$strWhere .= ' AND no_commande LIKE "%' . $objDatabase->fxEscape($strNoCommande) . '%"';
|
||
|
||
if ($strNomEquipe != '')
|
||
$strWhere .= ' AND pec_nom_equipe LIKE "%' . $objDatabase->fxEscape($strNomEquipe) . '%"';
|
||
|
||
$sqlTableTemp = "CREATE TEMPORARY TABLE dons_temp AS (SELECT a.com_nom, a.com_prenom, a.eve_id, a.no_panier, a.no_commande, d.pd_montant, d.pd_recu, d.pd_recu_pdf, d.pd_recu_numero, d.pec_id, d.par_id, e.pec_nom_equipe, e.pec_equipe, e.epr_id, IF(d.par_id <> 0, (SELECT p.par_nom FROM resultats_participants p WHERE d.par_id = p.par_id_original), '') AS par_nom, IF(d.par_id <> 0, (SELECT p.par_prenom FROM resultats_participants p WHERE d.par_id = p.par_id_original), '') AS par_prenom FROM inscriptions_panier_acheteurs a, resultats_epreuves_commandees e, inscriptions_panier_dons d WHERE " . $strWhere2 . ")";
|
||
$qryTableTemp = $objDatabase->fxQuery($sqlTableTemp);
|
||
|
||
$sqlInscriptionsParPage = "SELECT * FROM dons_temp WHERE " . $strWhere;
|
||
$tabInscriptionsParPage = $objDatabase->fxGetResults($sqlInscriptionsParPage);
|
||
|
||
$sqlDelete = "DROP TABLE IF EXISTS dons_temp";
|
||
$qryDelete = $objDatabase->fxQuery($sqlDelete);
|
||
} else {
|
||
$strWhere = ' e.eve_id = ' . intval($intEveId);
|
||
//MSIN-4009
|
||
//$strWhere .= ' AND e.pec_actif = 1'; // MSIN-3524
|
||
|
||
if ($strRechercheNom != '') {
|
||
$strWhere .= ' AND p.par_nom LIKE "%' . $strRechercheNom . '%"';
|
||
}
|
||
if ($strRecherchePrenom != '') {
|
||
$strWhere .= ' AND p.par_prenom LIKE "%' . $strRecherchePrenom . '%"';
|
||
}
|
||
if ($strNoCommande != '') {
|
||
$strWhere .= ' AND p.no_commande LIKE "%' . $objDatabase->fxEscape($strNoCommande) . '%"';
|
||
}
|
||
if ($strNomEquipe != '') {
|
||
$strWhere .= ' AND p.par_nom_equipe LIKE "%' . $objDatabase->fxEscape($strNomEquipe) . '%"';
|
||
}
|
||
if ($intEpreuve != 0) {
|
||
$strWhere .= " AND p.epr_id = " . intval($intEpreuve) . " AND p.epr_id = e.epr_id";
|
||
}
|
||
if (intval($chk_bib) == 1) {
|
||
$strWhere .= " AND TRIM(p.no_bib) = ''";
|
||
}
|
||
if (intval($chk_cancelled) == 1) {
|
||
$strWhere .= ' AND e.is_cancelled IN(0,1)'; // MSIN-3522
|
||
} else {
|
||
$strWhere .= ' AND e.is_cancelled = 0 AND e.pec_actif = 1'; // MSIN-3522
|
||
}
|
||
|
||
$sqlInscriptionsParPage = 'select p.no_bib,p.no_bib_remis,p.no_bib_remis_date,p.no_bib_remis_par, p.par_id, p.par_equipe, p.par_prenom, p.par_nom, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id, e.no_commande, e.no_panier, e.no_equipe, e.pec_equipe from resultats_epreuves_commandees e, resultats_participants p where ' . $strWhere . ' and p.pec_id = e.pec_id_original group by e.pec_id_original';
|
||
$tabInscriptionsParPage = $objDatabase->fxGetResults($sqlInscriptionsParPage);
|
||
}
|
||
|
||
if ($tabInscriptionsParPage != null) {
|
||
$arrColonnes = fxGetchampsPromoteur($blnDon, $strLangue);
|
||
|
||
$strRechercheResultats .= '
|
||
<div class="card-header mb-3">
|
||
<h2>' . afficheTexte('promoteur_liste_inscrits', 0) . '</h2>
|
||
</div>
|
||
<div class="table-responsive-sm">
|
||
<table class="table">
|
||
<thead>
|
||
<tr>
|
||
';
|
||
|
||
foreach ($arrColonnes as $intIndex => $arrValues) {
|
||
$strRechercheResultats .= '
|
||
<th class="text-' . fxUnescape($arrValues['align']) . '">' . fxUnescape($arrValues['label_' . $strLangue]) . '</th>
|
||
';
|
||
}
|
||
|
||
$strRechercheResultats .= '
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
';
|
||
|
||
$intNbInscriptions = count($tabInscriptionsParPage);
|
||
|
||
if ($intEnd > $intNbInscriptions) {
|
||
$intEnd = $intNbInscriptions;
|
||
}
|
||
|
||
for ($j = $intStart; $j <= $intEnd; $j++) {
|
||
$tabEpreuve = fxGetEpreuve($tabInscriptionsParPage[$j]['epr_id']);
|
||
$strClasse = ($j & 1) ? '' : 'table-secondary';
|
||
|
||
if ($tabInscriptionsParPage[$j]['is_cancelled'] == '1') {
|
||
$strClasse .= ' table-danger';
|
||
}
|
||
|
||
$strRechercheResultats .= '
|
||
<tr class="' . $strClasse . '">
|
||
';
|
||
|
||
$strRechercheResultats .= fxShowColumnPromoteur($arrColonnes, $tabInscriptionsParPage, $j, $strLangue, $tabInscriptionsParPage[$j]['pec_equipe'],$abonnement);
|
||
|
||
$strRechercheResultats .= '
|
||
</tr>
|
||
';
|
||
}
|
||
|
||
$intNbPagesTotal = ceil($intNbInscriptions / $intNbItemsParPage); // calculer le nb de pages
|
||
$intNbItemsAffiches = $intEnd - ($intStart - 1);
|
||
|
||
if ($strLangue == 'fr') {
|
||
$strStatut = $intNbItemsAffiches . ' de ' . $intNbInscriptions . '<br>page ' . $intPage . ' de ' . $intNbPagesTotal;
|
||
} else {
|
||
$strStatut = $intNbItemsAffiches . ' of ' . $intNbInscriptions . '<br>page ' . $intPage . ' of ' . $intNbPagesTotal;
|
||
}
|
||
|
||
$strRechercheResultats .= '
|
||
</tbody>
|
||
<tfoot>
|
||
<tr>
|
||
<th class="text-center" colspan="' . count($arrColonnes) . '">' . $strStatut . '</th>
|
||
</tr>
|
||
</tfoot>
|
||
</table>
|
||
</div>
|
||
';
|
||
|
||
// afficher pagination
|
||
$tabQuery = $_GET;
|
||
unset($tabQuery['pg']);
|
||
unset($tabQuery['code']);
|
||
unset($tabQuery['lang']);
|
||
$strQuery = http_build_query($tabQuery, '', '&');
|
||
|
||
$strRecherchePagination = fxGetPagination($vDomaine . '/' . $str_code . '?' . $strQuery, $intNbInscriptions, $intNbItemsParPage, $intPage);
|
||
} else {
|
||
$strRechercheResultats = '
|
||
<div class="alert alert-danger" role="alert">
|
||
' . afficheTexte('txt_recherche_no_result', 0) . '
|
||
</div>
|
||
';
|
||
}
|
||
|
||
$strDisplay = (!isset($_GET['pg']) && !isset($_GET['btn_recherche'])) ? '' : ' show';
|
||
$strIcon = "'" . $vDomaine . "/images/search-icon.png'";
|
||
|
||
$strRetour .= '
|
||
<div class="card-header">
|
||
<h2>' . afficheTexte('txt_recherche', 0) . '</h2>
|
||
</div>
|
||
<div class="card-body">
|
||
<a class="button-promoteur" style="background: url(' . $strIcon . ') no-repeat center" data-toggle="collapse" href="#collapseSearch" role="button" aria-expanded="false" aria-controls="collapseSearch">
|
||
<span class="d-inline-block h-100 w-100" data-toggle="tooltip" title="' . afficheTexte('promoteur_div_tooltip', 0) . '"></span>
|
||
</a>
|
||
</div>
|
||
<div class="animate__animated animate__fadeIn collapse' . $strDisplay . '" id="collapseSearch">
|
||
<div class="card-body text-left">
|
||
' . $strRechercheForm . '
|
||
</div>
|
||
' . $strRechercheResultats . '
|
||
' . $strRecherchePagination . '
|
||
</div>
|
||
';
|
||
|
||
return $strRetour;
|
||
}
|
||
function fxShowRechercheinscription($str_code, $int_promoteur_id, $blnDon, $strLangue, $intEveId,$abonnement=0) {
|
||
global $objDatabase, $vDomaine;
|
||
$strRechercheForm = $strRechercheResultats = $strRetour = $strSelected = $strRecherchePrenom = $strRechercheNom = $strNoCommande = $strNomParticipant = $strNomEquipe = $strPrenomParticipant = $strRecherchePagination = $chk_bib = '';
|
||
$intEpreuve = 0;
|
||
$intPage = $intStart = 1;
|
||
$intNbItemsParPage = $intEnd = 100;
|
||
|
||
// si apres recherche
|
||
if (isset($_GET['rech_prenom'])) {
|
||
$strRecherchePrenom = $_GET['rech_prenom'];
|
||
}
|
||
if (isset($_GET['rech_nom'])) {
|
||
$strRechercheNom = $_GET['rech_nom'];
|
||
}
|
||
if (isset($_GET['rech_no_commande'])) {
|
||
$strNoCommande = $_GET['rech_no_commande'];
|
||
}
|
||
if (isset($_GET['rech_nom_equipe'])) {
|
||
$strNomEquipe = $_GET['rech_nom_equipe'];
|
||
}
|
||
if (isset($_GET['rech_nom_participant'])) {
|
||
$strNomParticipant = $_GET['rech_nom_participant'];
|
||
}
|
||
if (isset($_GET['rech_prenom_participant'])) {
|
||
$strPrenomParticipant = $_GET['rech_prenom_participant'];
|
||
}
|
||
if (isset($_GET['sel_rech_epreuve'])) {
|
||
$intEpreuve = base64_decode(urldecode($_GET['sel_rech_epreuve']));
|
||
}
|
||
if (isset($_GET['chk_bib'])) {
|
||
$chk_bib = 1;
|
||
}
|
||
if (isset($_GET['chk_cancelled'])) {
|
||
$chk_cancelled = 1;
|
||
}else{ $chk_cancelled = 0;}
|
||
if (isset($_GET['pg'])) {
|
||
$intPage = $_GET['pg'];
|
||
}
|
||
|
||
if (intval($intPage) > 1) { // calculer le début et la fin de la boucle
|
||
$intStart = ($intPage - 1) * $intNbItemsParPage + 1;
|
||
$intEnd = $intStart + $intNbItemsParPage - 1;
|
||
}
|
||
|
||
if ($blnDon) {
|
||
$strPrenom = 'rech_prenom_don';
|
||
$strNom = 'rech_nom_don';
|
||
$strEquipe = 'rech_equipe_don';
|
||
} else {
|
||
$strPrenom = 'rech_prenom';
|
||
$strNom = 'rech_nom';
|
||
$strEquipe = 'rech_equipe';
|
||
}
|
||
|
||
$strRechercheForm .= '
|
||
<form action="' . $vDomaine . '/' . $str_code . '" id="frm_search" name="frm_search" method="get">
|
||
<input type="hidden" name="promoteur_eve_id" value="' . urlencode(base64_encode($int_promoteur_id)) . '">
|
||
<div class="form-group row">
|
||
<label for="rech_prenom" class="control-label col-sm-3 text-sm-right">' . afficheTexte($strPrenom, 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_prenom" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="rech_nom" class="control-label col-sm-3 text-sm-right">' . afficheTexte($strNom, 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_nom" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="rech_no_commande" class="control-label col-sm-3 text-sm-right">' . afficheTexte('rech_no_commande', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_no_commande" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="rech_nom_equipe" class="control-label col-sm-3 text-sm-right">' . afficheTexte($strEquipe, 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_nom_equipe" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="chk_bib" class="form-label col-sm-3 text-sm-right">' . afficheTexte('chk_bib', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control0" type="checkbox" name="chk_bib" value="1">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="chk_cancelled" class="form-label col-sm-3 text-sm-right">' . afficheTexte('chk_cancelled', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control0" type="checkbox" name="chk_cancelled" value="1">
|
||
</div>
|
||
</div>
|
||
';
|
||
|
||
if ($blnDon) {
|
||
$strRechercheForm .= '
|
||
<div class="form-group row">
|
||
<label for="rech_prenom_participant" class="control-label col-sm-3 text-sm-right">' . afficheTexte('rech_prenom_participant', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_prenom_participant" value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group row">
|
||
<label for="rech_nom_participant" class="control-label col-sm-3 text-sm-right">' . afficheTexte('rech_nom_participant', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<input class="form-control rounded-0" type="text" name="rech_nom_participant" value="">
|
||
</div>
|
||
</div>
|
||
';
|
||
}
|
||
|
||
if (!$blnDon) { // un champ pour chercher par nom d'equipe
|
||
$sqlEpreuves = "SELECT * FROM inscriptions_epreuves e WHERE e.eve_id = " . intval($int_promoteur_id) . " AND ((SELECT COUNT(*) from resultats_participants p where p.epr_id = e.epr_id > 0))";
|
||
$tabEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
||
|
||
$strRechercheForm .= '
|
||
<div class="form-group row">
|
||
<label for="sel_rech_epreuve" class="control-label col-sm-3 text-sm-right">' . afficheTexte('sel_rech_epreuve', 0) . ' :</label>
|
||
<div class="col-sm-9 col-lg-7">
|
||
<select class="form-control rounded-0" id="sel_rech_epreuve" name="sel_rech_epreuve">
|
||
<option value="0" data-comment="Pour champ recherche vide">--</option>
|
||
';
|
||
|
||
for ($i = 1; $i <= count($tabEpreuves); $i++) {
|
||
$strEpreuve = '';
|
||
|
||
if (trim($tabEpreuves[$i]['epr_categorie_' . $strLangue]) != '') {
|
||
$strEpreuve .= $tabEpreuves[$i]['epr_categorie_' . $strLangue] . " - ";
|
||
}
|
||
|
||
$strEpreuve .= $tabEpreuves[$i]['epr_type_' . $strLangue];
|
||
|
||
if (trim($tabEpreuves[$i]['epr_nom_' . $strLangue]) != '') {
|
||
$strEpreuve .= " - " . $tabEpreuves[$i]['epr_nom_' . $strLangue];
|
||
}
|
||
|
||
if (isset($_GET['sel_rech_epreuve']) && $tabEpreuves[$i]['epr_id'] == $_GET['sel_rech_epreuve']) {
|
||
$strSelected = ' selected';
|
||
}
|
||
|
||
$strRechercheForm .= '<option' . $strSelected . ' value="' . urlencode(base64_encode($tabEpreuves[$i]['epr_id'])) . '">' . $strEpreuve . '</option>';
|
||
}
|
||
|
||
$strRechercheForm .= '
|
||
</select>
|
||
</div>
|
||
</div>
|
||
';
|
||
}
|
||
|
||
$strRechercheForm .= '
|
||
<div class="form-group row">
|
||
<div class="offset-sm-3 col-sm-9 col-lg-7">
|
||
<button class="btn btn-primary rounded-0" type="submit" id="btn_recherche" name="btn_recherche">' . afficheTexte('txt_recherche', 0) . '</button>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
';
|
||
|
||
if ($blnDon) {
|
||
$strWhere2 = " a.eve_id = " . intval($intEveId) . " AND a.sta_id = 3 AND a.no_panier = d.no_panier AND e.pec_id_original = d.pec_id ";
|
||
$strWhere = '1 = 1';
|
||
|
||
if ($strRechercheNom != '')
|
||
$strWhere .= ' AND com_nom LIKE "%' . $strRechercheNom . '%"';
|
||
if ($strRecherchePrenom != '')
|
||
$strWhere .= ' AND com_prenom LIKE "%' . $strRecherchePrenom . '%"';
|
||
|
||
if ($strNomParticipant!= '')
|
||
$strWhere .= ' AND par_nom LIKE "%' . $strNomParticipant. '%"';
|
||
if ($strPrenomParticipant != '')
|
||
$strWhere .= ' AND par_prenom LIKE "%' . $strPrenomParticipant. '%"';
|
||
|
||
if ($strNoCommande != '')
|
||
$strWhere .= ' AND no_commande LIKE "%' . $objDatabase->fxEscape($strNoCommande) . '%"';
|
||
|
||
if ($strNomEquipe != '')
|
||
$strWhere .= ' AND pec_nom_equipe LIKE "%' . $objDatabase->fxEscape($strNomEquipe) . '%"';
|
||
|
||
$sqlTableTemp = "CREATE TEMPORARY TABLE dons_temp AS (SELECT a.com_nom, a.com_prenom, a.eve_id, a.no_panier, a.no_commande, d.pd_montant, d.pd_recu, d.pd_recu_pdf, d.pd_recu_numero, d.pec_id, d.par_id, e.pec_nom_equipe, e.pec_equipe, e.epr_id, IF(d.par_id <> 0, (SELECT p.par_nom FROM resultats_participants p WHERE d.par_id = p.par_id_original), '') AS par_nom, IF(d.par_id <> 0, (SELECT p.par_prenom FROM resultats_participants p WHERE d.par_id = p.par_id_original), '') AS par_prenom FROM inscriptions_panier_acheteurs a, resultats_epreuves_commandees e, inscriptions_panier_dons d WHERE " . $strWhere2 . ")";
|
||
$qryTableTemp = $objDatabase->fxQuery($sqlTableTemp);
|
||
|
||
$sqlInscriptionsParPage = "SELECT * FROM dons_temp WHERE " . $strWhere;
|
||
$tabInscriptionsParPage = $objDatabase->fxGetResults($sqlInscriptionsParPage);
|
||
|
||
$sqlDelete = "DROP TABLE IF EXISTS dons_temp";
|
||
$qryDelete = $objDatabase->fxQuery($sqlDelete);
|
||
} else {
|
||
$strWhere = ' e.eve_id = ' . intval($intEveId);
|
||
//$strWhere .= ' AND e.pec_actif = 1'; // MSIN-3524
|
||
|
||
if ($strRechercheNom != '') {
|
||
$strWhere .= ' AND p.par_nom LIKE "%' . $strRechercheNom . '%"';
|
||
}
|
||
if ($strRecherchePrenom != '') {
|
||
$strWhere .= ' AND p.par_prenom LIKE "%' . $strRecherchePrenom . '%"';
|
||
}
|
||
if ($strNoCommande != '') {
|
||
$strWhere .= ' AND p.no_commande LIKE "%' . $objDatabase->fxEscape($strNoCommande) . '%"';
|
||
}
|
||
if ($strNomEquipe != '') {
|
||
$strWhere .= ' AND p.par_nom_equipe LIKE "%' . $objDatabase->fxEscape($strNomEquipe) . '%"';
|
||
}
|
||
if ($intEpreuve != 0) {
|
||
$strWhere .= " AND p.epr_id = " . intval($intEpreuve) . " AND p.epr_id = e.epr_id";
|
||
}
|
||
if (intval($chk_bib) == 1) {
|
||
$strWhere .= " AND TRIM(p.no_bib) = ''";
|
||
}
|
||
if (intval($chk_cancelled) == 1) {
|
||
$strWhere .= ' AND e.is_cancelled = 1'; // MSIN-3522 //MSIN-4010
|
||
} else {
|
||
$strWhere .= ' AND e.is_cancelled = 0 AND e.pec_actif = 1'; // MSIN-3522
|
||
}
|
||
|
||
$sqlInscriptionsParPage = 'select p.no_bib,p.no_bib_remis,p.no_bib_remis_date,p.no_bib_remis_par, p.par_id, p.par_equipe, p.par_prenom, p.par_nom, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id, e.no_commande, e.no_panier, e.no_equipe, e.pec_equipe from resultats_epreuves_commandees e, resultats_participants p where ' . $strWhere . ' and p.pec_id = e.pec_id_original group by e.pec_id_original';
|
||
$tabInscriptionsParPage = $objDatabase->fxGetResults($sqlInscriptionsParPage);
|
||
}
|
||
|
||
if ($tabInscriptionsParPage != null) {
|
||
$arrColonnes = fxGetchampsPromoteur($blnDon, $strLangue);
|
||
|
||
$strRechercheResultats .= '
|
||
<div class="card-header mb-3">
|
||
<h2>' . afficheTexte('promoteur_liste_inscrits', 0) . '</h2>
|
||
</div>
|
||
<div class="table-responsive-sm">
|
||
<table class="table">
|
||
<thead>
|
||
<tr>
|
||
';
|
||
|
||
foreach ($arrColonnes as $intIndex => $arrValues) {
|
||
$strRechercheResultats .= '
|
||
<th class="text-' . fxUnescape($arrValues['align']) . '">' . fxUnescape($arrValues['label_' . $strLangue]) . '</th>
|
||
';
|
||
}
|
||
|
||
$strRechercheResultats .= '
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
';
|
||
|
||
$intNbInscriptions = count($tabInscriptionsParPage);
|
||
|
||
if ($intEnd > $intNbInscriptions) {
|
||
$intEnd = $intNbInscriptions;
|
||
}
|
||
|
||
for ($j = $intStart; $j <= $intEnd; $j++) {
|
||
$tabEpreuve = fxGetEpreuve($tabInscriptionsParPage[$j]['epr_id']);
|
||
$strClasse = ($j & 1) ? '' : 'table-secondary';
|
||
|
||
if ($tabInscriptionsParPage[$j]['is_cancelled'] == '1') {
|
||
$strClasse .= ' table-danger';
|
||
}
|
||
|
||
$strRechercheResultats .= '
|
||
<tr class="' . $strClasse . '">
|
||
';
|
||
|
||
$strRechercheResultats .= fxShowColumnPromoteur($arrColonnes, $tabInscriptionsParPage, $j, $strLangue, $tabInscriptionsParPage[$j]['pec_equipe'],$abonnement);
|
||
|
||
$strRechercheResultats .= '
|
||
</tr>
|
||
';
|
||
}
|
||
|
||
$intNbPagesTotal = ceil($intNbInscriptions / $intNbItemsParPage); // calculer le nb de pages
|
||
$intNbItemsAffiches = $intEnd - ($intStart - 1);
|
||
|
||
if ($strLangue == 'fr') {
|
||
$strStatut = $intNbItemsAffiches . ' de ' . $intNbInscriptions . '<br>page ' . $intPage . ' de ' . $intNbPagesTotal;
|
||
} else {
|
||
$strStatut = $intNbItemsAffiches . ' of ' . $intNbInscriptions . '<br>page ' . $intPage . ' of ' . $intNbPagesTotal;
|
||
}
|
||
|
||
$strRechercheResultats .= '
|
||
</tbody>
|
||
<tfoot>
|
||
<tr>
|
||
<th class="text-center" colspan="' . count($arrColonnes) . '">' . $strStatut . '</th>
|
||
</tr>
|
||
</tfoot>
|
||
</table>
|
||
</div>
|
||
';
|
||
|
||
// afficher pagination
|
||
$tabQuery = $_GET;
|
||
unset($tabQuery['pg']);
|
||
unset($tabQuery['code']);
|
||
unset($tabQuery['lang']);
|
||
$strQuery = http_build_query($tabQuery, '', '&');
|
||
|
||
$strRecherchePagination = fxGetPagination($vDomaine . '/' . $str_code . '?' . $strQuery, $intNbInscriptions, $intNbItemsParPage, $intPage);
|
||
} else {
|
||
$strRechercheResultats = '
|
||
<div class="alert alert-danger" role="alert">
|
||
' . afficheTexte('txt_recherche_no_result', 0) . '
|
||
</div>
|
||
';
|
||
}
|
||
|
||
$strDisplay = (!isset($_GET['pg']) && !isset($_GET['btn_recherche'])) ? '' : ' show';
|
||
$strIcon = "'" . $vDomaine . "/images/search-icon.png'";
|
||
|
||
$strRetour .= '
|
||
<div class="card-header">
|
||
<h2>' . afficheTexte('txt_recherche', 0) . '</h2>
|
||
</div>
|
||
|
||
<div>
|
||
<div class="card-body text-left">
|
||
' . $strRechercheForm . '
|
||
</div>
|
||
' . $strRechercheResultats . '
|
||
' . $strRecherchePagination . '
|
||
</div>
|
||
';
|
||
|
||
return $strRetour;
|
||
}
|
||
/*/*
|
||
* param $int_eve_id : le no. de l'evenement de l'epreuve a ajuster.
|
||
* param $strLangue : langue d'affichage
|
||
* */
|
||
function fxShowQuantites($int_eve_id, $strLangue) {
|
||
global $objDatabase, $vDomaine;
|
||
$tabEvenement = fxGetEvenements(fxGetEvenementsUrl($int_eve_id), $strLangue);
|
||
// MSIN-1328
|
||
$sqlEpreuves = "SELECT * FROM inscriptions_epreuves where eve_id = " . intval($int_eve_id) . " AND epr_actif = 1";
|
||
$tabEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
||
?>
|
||
<div class="card-header">
|
||
<h2><?php afficheTexte('promoteur_qte_mgr')?></h2>
|
||
</div>
|
||
<div class="card-body text-center">
|
||
<a class="button-promoteur" style="background: url('<?php echo $vDomaine; ?>/images/plus-minus.png') no-repeat center" data-toggle="collapse" href="#collapseQuantites" role="button" aria-expanded="false" aria-controls="collapseQuantites">
|
||
<span class="d-inline-block h-100 w-100" data-toggle="tooltip" title="<?php afficheTexte('promoteur_div_tooltip')?>"></span>
|
||
</a>
|
||
</div>
|
||
<div class="animate__animated animate__fadeIn collapse" id="collapseQuantites">
|
||
<div class="table-responsive-sm">
|
||
<table class="table" id="table_qtes">
|
||
<thead>
|
||
<tr>
|
||
<th><?php afficheTexte('promoteur_qte_epr_id')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_type')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_original_qte')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_ajustement')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_qte_total')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_qte_ordered')?></th>
|
||
<th style="width:100px"><?php afficheTexte('promoteur_qte_epr_qte')?></th>
|
||
<th style="width:10px"><?php afficheTexte('promoteur_qte_checkin')?></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
$intTotalOriginal = $intTotalAvailable = $intTotalBooked = $intTotalCurrent = $intTotalAjustement = 0;
|
||
|
||
for ($i = 1; $i <= count($tabEpreuves); $i++){
|
||
$strClass = ($i & 1) ? '' : 'table-secondary';
|
||
$tabEpreuve = fxGetEpreuve($tabEpreuves[$i]['epr_id']);
|
||
$arrQuantites = fxGetQuantites($tabEpreuve['epr_id']);
|
||
$QCheckin = fxGetCheckinqte($tabEpreuve['epr_id']);
|
||
$intTotalOriginal += $arrQuantites['qte_origine'];
|
||
$intTotalAvailable += $arrQuantites['qte_restante'];
|
||
$intTotalBooked += $arrQuantites['qte_inscrits'];
|
||
$intTotalCurrent += $arrQuantites['qte_courante'];
|
||
$intTotalAjustement += $arrQuantites['qte_ajustement'];
|
||
$intTotalCheckin+=$QCheckin;
|
||
?>
|
||
<tr class="<?php echo $strClass; ?>">
|
||
<td><?php echo $tabEpreuve['epr_id']; ?></td>
|
||
<td><?php
|
||
if (trim($tabEpreuve['epr_categorie_' . $strLangue]) != '') {
|
||
echo $tabEpreuve['epr_categorie_' . $strLangue] . "<br>";
|
||
}
|
||
|
||
echo $tabEpreuve['epr_type_' . $strLangue];
|
||
|
||
if (trim($tabEpreuve['epr_nom_' . $strLangue]) != '') {
|
||
echo "<br>" . $tabEpreuve['epr_nom_' . $strLangue];
|
||
}
|
||
?>
|
||
</td>
|
||
<td id="qte_origine_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $arrQuantites['qte_origine']; ?>
|
||
</td>
|
||
<td id="qte_ajustement_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $arrQuantites['qte_ajustement']; ?>
|
||
</td>
|
||
<td id="qte_courante_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $arrQuantites['qte_courante']; ?>
|
||
</td>
|
||
<td id="qte_inscrits_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $arrQuantites['qte_inscrits']; ?>
|
||
</td>
|
||
<td>
|
||
<?php fxShowAjouterQuantite($tabEpreuve['epr_id'], $arrQuantites['qte_restante'], $strLangue); ?>
|
||
</td>
|
||
<td id="qte_checkin_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $QCheckin; ?>
|
||
</td>
|
||
</tr>
|
||
<?php
|
||
}
|
||
?>
|
||
</tbody>
|
||
<tfoot>
|
||
<tr>
|
||
<th> </th>
|
||
<th> </th>
|
||
<th id="qte_origine_total">
|
||
<?php echo $intTotalOriginal; ?>
|
||
</th>
|
||
<th id="qte_ajustement_total">
|
||
<?php echo $intTotalAjustement; ?>
|
||
</th>
|
||
<th id="qte_courante_total">
|
||
<?php echo $intTotalCurrent; ?>
|
||
</th>
|
||
<th id="qte_inscrits_total">
|
||
<?php echo $intTotalBooked; ?></th>
|
||
<th id="qte_restante_total">
|
||
<?php echo $intTotalAvailable; ?></th>
|
||
<th id="qte_checkin_total">
|
||
<?php echo $intTotalCheckin; ?></th>
|
||
</tr>
|
||
</tfoot>
|
||
<?php
|
||
?>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
}
|
||
function fxShowQuantitesv2($int_eve_id, $strLangue) {
|
||
global $objDatabase, $vDomaine;
|
||
$tabEvenement = fxGetEvenements(fxGetEvenementsUrl($int_eve_id), $strLangue);
|
||
// MSIN-1328
|
||
$sqlEpreuves = "SELECT * FROM inscriptions_epreuves where eve_id = " . intval($int_eve_id) . " AND epr_actif = 1";
|
||
$tabEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
||
?>
|
||
<div class="card-header">
|
||
<h2><?php afficheTexte('promoteur_qte_mgr')?></h2>
|
||
</div>
|
||
|
||
<div >
|
||
<div class="table-responsive-sm">
|
||
<table class="table" id="table_qtes">
|
||
<thead>
|
||
<tr>
|
||
<th><?php afficheTexte('promoteur_qte_epr_id')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_type')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_original_qte')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_ajustement')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_qte_total')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_qte_ordered')?></th>
|
||
<th style="width:100px"><?php afficheTexte('promoteur_qte_epr_qte')?></th>
|
||
<th style="width:10px"><?php afficheTexte('promoteur_qte_checkin')?></th>
|
||
<th style="width:10px"><?php afficheTexte('promoteur_lattente_actif_colonne')?></th>
|
||
<th style="width:10px"><?php afficheTexte('promoteur_lattente_nb')?></th>
|
||
<th style="width:10px"><?php afficheTexte('promoteur_lattente_nbtotal')?></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
$intTotalOriginal =$intTotalnbSurListea = $intTotalnbSurListe =$intTotalAvailable = $intTotalBooked = $intTotalCurrent = $intTotalAjustement = 0;
|
||
$intTotalCheckin=0;
|
||
for ($i = 1; $i <= count($tabEpreuves); $i++){
|
||
$strClass = ($i & 1) ? '' : 'table-secondary';
|
||
$tabEpreuve = fxGetEpreuve($tabEpreuves[$i]['epr_id']);
|
||
$arrQuantites = fxGetQuantites($tabEpreuve['epr_id']);
|
||
$QCheckin = fxGetCheckinqte($tabEpreuve['epr_id']);
|
||
$intTotalOriginal += $arrQuantites['qte_origine'];
|
||
$intTotalAvailable += $arrQuantites['qte_restante'];
|
||
$intTotalBooked += $arrQuantites['qte_inscrits'];
|
||
$intTotalCurrent += $arrQuantites['qte_courante'];
|
||
$intTotalAjustement += $arrQuantites['qte_ajustement'];
|
||
$intTotalCheckin+=$QCheckin;
|
||
?>
|
||
<tr class="<?php echo $strClass; ?>">
|
||
<td><?php echo $tabEpreuve['epr_id']; ?></td>
|
||
<td><?php
|
||
if (trim($tabEpreuve['epr_categorie_' . $strLangue]) != '') {
|
||
echo $tabEpreuve['epr_categorie_' . $strLangue] . "<br>";
|
||
}
|
||
|
||
echo $tabEpreuve['epr_type_' . $strLangue];
|
||
|
||
if (trim($tabEpreuve['epr_nom_' . $strLangue]) != '') {
|
||
echo "<br>" . $tabEpreuve['epr_nom_' . $strLangue];
|
||
}
|
||
?>
|
||
</td>
|
||
<td id="qte_origine_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $arrQuantites['qte_origine']; ?>
|
||
</td>
|
||
<td id="qte_ajustement_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $arrQuantites['qte_ajustement']; ?>
|
||
</td>
|
||
<td id="qte_courante_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $arrQuantites['qte_courante']; ?>
|
||
</td>
|
||
<td id="qte_inscrits_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $arrQuantites['qte_inscrits']; ?>
|
||
</td>
|
||
<td>
|
||
<?php fxShowAjouterQuantite($tabEpreuve['epr_id'], $arrQuantites['qte_restante'], $strLangue); ?>
|
||
</td>
|
||
<td id="qte_checkin_<?php echo $tabEpreuve['epr_id']; ?>">
|
||
<?php echo $QCheckin; ?>
|
||
</td>
|
||
<td >
|
||
<?php fx_liste_attente_btactiver($int_eve_id,$tabEpreuve['epr_id'])?><br>
|
||
</td>
|
||
<td >
|
||
<?php
|
||
$intTotalnbSurListea+=fx_liste_attente_nombre_surliste($tabEpreuve['epr_id'],1);
|
||
echo ($nbSurListe = fx_liste_attente_nombre_surliste($tabEpreuve['epr_id'],1)) > 0 ? $nbSurListe : '';?>
|
||
|
||
|
||
</td>
|
||
<td >
|
||
<?php
|
||
$intTotalnbSurListe+=fx_liste_attente_nombre_surliste($tabEpreuve['epr_id']);
|
||
echo ($nbSurListe = fx_liste_attente_nombre_surliste($tabEpreuve['epr_id'])) > 0 ? $nbSurListe : '';?>
|
||
|
||
|
||
</td>
|
||
</tr>
|
||
<?php
|
||
}
|
||
?>
|
||
</tbody>
|
||
<tfoot>
|
||
<tr>
|
||
<th> </th>
|
||
<th> </th>
|
||
<th id="qte_origine_total">
|
||
<?php echo $intTotalOriginal; ?>
|
||
</th>
|
||
<th id="qte_ajustement_total">
|
||
<?php echo $intTotalAjustement; ?>
|
||
</th>
|
||
<th id="qte_courante_total">
|
||
<?php echo $intTotalCurrent; ?>
|
||
</th>
|
||
<th id="qte_inscrits_total">
|
||
<?php echo $intTotalBooked; ?></th>
|
||
<th id="qte_restante_total">
|
||
<?php echo $intTotalAvailable; ?></th>
|
||
<th id="qte_checkin_total">
|
||
<?php echo $intTotalCheckin; ?></th>
|
||
<th>
|
||
</th>
|
||
<th id="qte_intTotalnbSurListe">
|
||
<?php echo $intTotalnbSurListea; ?>
|
||
</th>
|
||
|
||
<th id="qte_intTotalnbSurListea">
|
||
<?php echo $intTotalnbSurListe; ?>
|
||
</th>
|
||
|
||
|
||
|
||
</tr>
|
||
|
||
</tfoot>
|
||
<?php
|
||
?>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
}
|
||
function fxShowreglesniveau($int_eve_id, $strLangue) {
|
||
global $objDatabase, $vDomaine;
|
||
$tabEvenement = fxGetEvenements(fxGetEvenementsUrl($int_eve_id), $strLangue);
|
||
// MSIN-1328
|
||
$sqlEpreuves = "SELECT * FROM inscriptions_epreuves where eve_id = " . intval($int_eve_id) . " AND epr_actif = 1";
|
||
$tabEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
||
?>
|
||
<div class="card-header">
|
||
<h2><?php afficheTexte('promoteur_reglesniveau')?></h2>
|
||
</div>
|
||
<div class="card-body text-center">
|
||
<a class="button-promoteur mb-2" style="background: url('<?php echo $vDomaine; ?>/images/plus-minus.png') no-repeat center" data-toggle="collapse" href="#collapseReglesNiveau" role="button" aria-expanded="false" aria-controls="collapseReglesNiveau">
|
||
<span class="d-inline-block h-100 w-100" data-toggle="tooltip" title="<?php afficheTexte('promoteur_div_tooltip')?>"></span>
|
||
</a>
|
||
<a class="btn btn-primary rounded-pill mb-2" href="<?php echo $vDomaine; ?>/inc_tableau_promoteur?promoteur_eve_id=<?php echo urlencode(base64_encode($int_eve_id)); ?>&resetcategorie=true">
|
||
recalculer les catégorie
|
||
</a>
|
||
</div>
|
||
<div class="animate__animated animate__fadeIn collapse" id="collapseReglesNiveau">
|
||
<div class="table-responsive-sm">
|
||
<table class="resultats" id="table_reglesniveau" style="width:100%;display: none">
|
||
<thead>
|
||
<tr class="HeaderRow" style="font-size:0.95em">
|
||
<td><?php afficheTexte('promoteur_qte_epr_id')?></td>
|
||
<td><?php afficheTexte('promoteur_qte_epr_type')?></td>
|
||
<td> </td>
|
||
|
||
<td> </td>
|
||
<td> </td> <td> </td> <td> </td> <td> </td>
|
||
<td> </td>
|
||
<td> </td> <td> </td>
|
||
<td> </td>
|
||
<td> </td><td> </td><td> </td>
|
||
|
||
|
||
|
||
|
||
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
$intTotalOriginal = $intTotalAvailable = $intTotalBooked = $intTotalCurrent = $intTotalAjustement = 0;
|
||
|
||
for ($i = 1; $i <= count($tabEpreuves); $i++){
|
||
$tabEpreuve = fxGetEpreuve($tabEpreuves[$i]['epr_id']);
|
||
|
||
?>
|
||
<tr style="text-align: left;" class="<?php if ($i % 2) { ?>OddRow<?php } else { ?>EvenRow<?php } ?>">
|
||
<td> <?php echo $tabEpreuve['epr_id']?></td>
|
||
<td colspan="15"><?php
|
||
if (trim($tabEpreuve['epr_categorie_' . $strLangue]) != '') {
|
||
echo $tabEpreuve['epr_categorie_' . $strLangue] . " - ";
|
||
}
|
||
|
||
echo $tabEpreuve['epr_type_' . $strLangue];
|
||
|
||
if (trim($tabEpreuve['epr_nom_' . $strLangue]) != '') {
|
||
echo " - " . $tabEpreuve['epr_nom_' . $strLangue];
|
||
}
|
||
?>
|
||
</td>
|
||
|
||
</tr>
|
||
<?php
|
||
$sqlRegles = "SELECT * FROM regles_niveau WHERE eve_id=".$int_eve_id." and epr_id=".$tabEpreuves[$i]['epr_id']." ORDER BY reg_niv,reg_trie";
|
||
$arrRegles = $objDatabase->fxGetResults($sqlRegles);
|
||
if ($arrRegles){
|
||
?> <tr style="background-color: #003580;color: white"><td></td><td colspan="15"> <?php if($tabEpreuve['epr_type_' . $strLangue] != '')
|
||
echo $tabEpreuve['epr_type_' . $strLangue];
|
||
if($tabEpreuve['epr_nom_' . $strLangue] != '')
|
||
echo $tabEpreuve['epr_nom_' . $strLangue]; ?></td> </tr> <?php
|
||
|
||
foreach ($arrRegles as $key => $value){
|
||
?>
|
||
|
||
<tr>
|
||
<td></td>
|
||
<td><?php echo $value['reg_niv']; ?></td>
|
||
<td><?php echo $value['reg_type']; ?></td>
|
||
<td><?php echo $value['reg_nom_'.$strLangue]; ?></td>
|
||
<td><?php echo $value['reg_param1']; ?></td>
|
||
<td><?php echo $value['reg_param2']; ?></td>
|
||
<td><?php echo $value['reg_param3']; ?></td>
|
||
<td><?php echo $value['reg_param4']; ?></td>
|
||
<td colspan="4"> </td>
|
||
</tr>
|
||
<?php
|
||
}
|
||
?> <tr style="background-color: #003580;color: white"><td colspan="16"> </td> </tr><?php
|
||
}
|
||
?>
|
||
|
||
|
||
|
||
<?php
|
||
}
|
||
?>
|
||
</tbody>
|
||
|
||
<?php
|
||
?>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
}
|
||
/*
|
||
* param $int_epr_id : le no. de l'epreuve a ajuster.
|
||
* param $strLangue : langue d'affichage
|
||
* */
|
||
function fxShowAjouterQuantite($int_epr_id, $intQte, $strLangue) {
|
||
global$vDomaine;
|
||
?>
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<input class="form-control form-control-sm rounded-0" type="number" min="0" maxlength="7" id="qte_restante_<?php echo $int_epr_id; ?>" value="<?php echo $intQte; ?>">
|
||
</div>
|
||
<div class="col-2">
|
||
<button class="btn_qte btn btn-primary btn-sm rounded-0" type="button" data-epr_id="<?php echo $int_epr_id; ?>" data-qte_initiale="<?php echo $intQte; ?>">OK</button>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
}
|
||
|
||
function fxShowBibTool2($str_code, $int_eve_id, $strLangue){
|
||
global $objDatabase, $vDomaine;
|
||
|
||
$sqlEpreuves = "SELECT * FROM inscriptions_epreuves e WHERE e.eve_id = " . intval($int_eve_id) . " AND epr_actif = 1 ORDER BY epr_id";
|
||
$tabEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
||
$sqlBibAssignments = "SELECT * FROM bib_assignements WHERE ba_actif = 1 ORDER BY ba_tri";
|
||
$tabBibAssignments = $objDatabase->fxGetResults($sqlBibAssignments);
|
||
?>
|
||
<div class="card-header">
|
||
<h2><?php afficheTexte('promoteur_bib_tool')?></h2>
|
||
</div>
|
||
<div class="card-body row text-center">
|
||
<div class="col-6 text-center">
|
||
<a class="button-promoteur" style="background: url('<?php echo $vDomaine; ?>/images/bib-icon.png') no-repeat center" data-toggle="collapse" href="#collapseBibTool" role="button" aria-expanded="false" aria-controls="collapseBibTool">
|
||
<span class="d-inline-block h-100 w-100" data-toggle="tooltip" title="<?php afficheTexte('promoteur_div_tooltip')?>"></span>
|
||
</a>
|
||
</div>
|
||
<div class="col-6 text-center">
|
||
<a class="button-promoteur" style="background: url('<?php echo $vDomaine; ?>/images/dupes.png') no-repeat center" href="<?php echo $vDomaine . "/" . $str_code; ?>bib_assignment?a=show_bib_dupes&eve_id=<?php echo urlencode(base64_encode($int_eve_id)); ?>" target="_blank">
|
||
<span class="d-inline-block h-100 w-100" data-toggle="tooltip" title="<?php afficheTexte('promoteur_div_tooltip')?>"></span>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
<div class="collapse animate__animated animate__fadeIn" id="collapseBibTool">
|
||
<div class="table-responsive-sm">
|
||
<table class="table">
|
||
<thead>
|
||
<tr>
|
||
<th><?php afficheTexte('promoteur_bib_race')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_range_start')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_range_end')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_current')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_qte_ordered')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_assignment_type')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_actions')?></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
for($i = 1; $i <= count($tabEpreuves); $i++){
|
||
$strClass = ($i & 1) ? '' : 'table-secondary';
|
||
|
||
if($tabEpreuves[$i]['epr_bib_start'] != 0)
|
||
$intBibStart = $tabEpreuves[$i]['epr_bib_start'];
|
||
else
|
||
$intBibStart = '';
|
||
|
||
if($tabEpreuves[$i]['epr_bib_finish'] != 0) {
|
||
$intToto = $tabEpreuves[$i]['epr_bib_finish'];
|
||
$sqlLastBib = "select max( cast(no_bib as unsigned) )from resultats_participants where epr_id = " . intval($tabEpreuves[$i]['epr_id']);
|
||
$intBibFinish = $objDatabase->fxGetVar($sqlLastBib);
|
||
}
|
||
else
|
||
$intBibFinish = '';
|
||
|
||
$sqlCommandees = "SELECT COUNT(*) FROM inscriptions_panier_epreuves_commandees e, inscriptions_panier_acheteurs a WHERE e.epr_id = " . intval($tabEpreuves[$i]['epr_id']) . " AND e.no_panier = a.no_panier AND a.sta_id = 3";
|
||
$intQteCommandees = $objDatabase->fxGetVar($sqlCommandees);
|
||
|
||
$sqlInscriptions = 'select p.no_bib, p.par_id, p.par_prenom, p.par_nom, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id, e.no_commande, e.no_panier, e.no_equipe from resultats_epreuves_commandees e, resultats_participants p where p.is_cancelled = 0 AND p.epr_id = ' . intval($tabEpreuves[$i]['epr_id']) . ' AND p.epr_id = e.epr_id and p.pec_id = e.pec_id_original group by e.pec_id_original';
|
||
$tabInscriptions = $objDatabase->fxGetResults($sqlInscriptions);
|
||
$intNbInscriptions = count($tabInscriptions);
|
||
|
||
// nb bibs used
|
||
$sqlCount = "SELECT count(*) FROM resultats_participants WHERE epr_id = " . intval($tabEpreuves[$i]['epr_id']) . " AND (no_bib <> '' AND no_bib <> 0)";
|
||
$intNbBibs = $objDatabase->fxGetVar($sqlCount);
|
||
|
||
|
||
|
||
// new calcul de num_bibs_left
|
||
if($tabEpreuves[$i]['epr_bib_finish'] == 0){
|
||
$intNbBibsLeft = ($intQteCommandees + $tabEpreuves[$i]['epr_qte']) - $intNbBibs;
|
||
} else {
|
||
$intNbBibsLeft = (($intBibStart + $intNbBibs) - $intBibStart) - $intNbBibs;
|
||
}
|
||
?>
|
||
<tr class="<?php echo $strClass ?>" style="text-align: center; font-size:1em">
|
||
<td>
|
||
<form name="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" id="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']?>" method="post" action="bib_assignment">
|
||
<input type="hidden" name="epr_id" value="<?php echo $tabEpreuves[$i]['epr_id']?>">
|
||
<input type="hidden" name="promoteur_eve_id" value="<?php echo $int_eve_id?>">
|
||
<input type="hidden" id="row_action_<?php echo $tabEpreuves[$i]['epr_id']?>" name="row_action_<?php echo $tabEpreuves[$i]['epr_id']?>" value="-">
|
||
</form>
|
||
<br>
|
||
<?php
|
||
if (trim($tabEpreuves[$i]['epr_categorie_' . $strLangue]) != '') {
|
||
echo $tabEpreuves[$i]['epr_categorie_' . $strLangue] . "<br>";
|
||
}
|
||
|
||
echo $tabEpreuves[$i]['epr_type_' . $strLangue];
|
||
|
||
if (trim($tabEpreuves[$i]['epr_nom_' . $strLangue]) != '') {
|
||
echo "<br>" . $tabEpreuves[$i]['epr_nom_' . $strLangue];
|
||
}
|
||
?>
|
||
<br>
|
||
<div style="color:#ffa200; font-weight: bold">
|
||
<?php if($tabEpreuves[$i]['epr_equipe'] == 1)
|
||
afficheTexte('promoteur_epr_equipe');
|
||
else
|
||
afficheTexte('promoteur_epr_solo')?>
|
||
</div>
|
||
<br>
|
||
</td>
|
||
<td>
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-control form-control-sm rounded-0" min="0" type="number" id="num_bib_range_start_<?php echo $tabEpreuves[$i]['epr_id']?>" name="num_bib_range_start_<?php echo $tabEpreuves[$i]['epr_id']?>" value="<?php echo $intBibStart ?>" disabled>
|
||
</td>
|
||
<td>
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-control form-control-sm rounded-0" min="0" type="number" id="epr_bib_range_finish_dispo_<?php echo $tabEpreuves[$i]['epr_id']?>" name="num_bib_range_start_<?php echo $tabEpreuves[$i]['epr_id']?>" value="<?php echo $intBibFinishdispo ?>" disabled>
|
||
</td>
|
||
<td>
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-control form-control-sm rounded-0" min="0" type="number" id="num_dernier_dossard_<?php echo $tabEpreuves[$i]['epr_id']?>" name="num_dernier_dossard_<?php echo $tabEpreuves[$i]['epr_id']?>" value="<?php echo $intBibFinish?>" disabled>
|
||
</td>
|
||
<td id="used_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>"><?php echo $intNbBibs?></td>
|
||
<td id="qty_booked_<?php echo $tabEpreuves[$i]['epr_id']; ?>">
|
||
<?php echo $intNbInscriptions?>
|
||
</td>
|
||
<td class="text-left">
|
||
<input type="hidden" name="epr_id" value="<?php echo $tabEpreuves[$i]['epr_id']?>"/>
|
||
|
||
<select form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-control form-control-sm rounded-0" id="sel_assignment_type_<?php echo $tabEpreuves[$i]['epr_id']?>" name="sel_assignment_type_<?php echo $tabEpreuves[$i]['epr_id']; ?>" disabled>
|
||
<?php
|
||
for($j = 1; $j <= count($tabBibAssignments); $j++){
|
||
?>
|
||
<option <?php if($tabEpreuves[$i]['ba_id'] != 0 && $tabEpreuves[$i]['ba_id'] == $tabBibAssignments[$j]['ba_id']) echo 'selected="selected"'?> value="<?php echo $tabBibAssignments[$j]['ba_id']?>"><?php echo $tabBibAssignments[$j]['ba_nom_' . $strLangue]?></option>
|
||
<?php } ?>
|
||
</select>
|
||
<br>
|
||
<br>
|
||
<?php
|
||
if($tabEpreuves[$i]['epr_equipe'] == 1) {
|
||
?>
|
||
<div id="bib_options_bibandteam_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']?>" style="display: none;">
|
||
<div class="form-check">
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-check-input" type="checkbox" value="1" id="chk_bib_and_team_<?php echo $tabEpreuves[$i]['epr_id']; ?>" name="chk_bib_and_team"<?php if ($tabEpreuves[$i]['epr_bib_mode'] == 1) { ?> checked<?php } ?>>
|
||
<label class="form-check-label" for="chk_bib_and_team_<?php echo $tabEpreuves[$i]['epr_id']; ?>">
|
||
<?php afficheTexte('promoteur_bib_and_team_switch'); ?>
|
||
<button class="btn btn-sm rounded-circle" type="button" data-toggle="popover" data-content="<?php afficheTexte('promoteur_bib_bibandteam'); ?>">
|
||
<i class="fa fa-info-circle fa-2x text-info" aria-hidden="true"></i>
|
||
</button>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
}
|
||
if($tabEpreuves[$i]['epr_bib_finish'] != 0) {
|
||
?>
|
||
<div id="bib_options_fromlast_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']?>" style="display: none;">
|
||
<div class="form-check">
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-check-input" type="checkbox" value="1" id="chk_from_last_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" name="chk_from_last_bib">
|
||
<label class="form-check-label" for="chk_from_last_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>">
|
||
<?php afficheTexte('promoteur_bib_from_last'); ?>
|
||
<button class="btn btn-sm rounded-circle" type="button" data-toggle="popover" data-content="<?php afficheTexte('promoteur_bib_fromlastbib_tip'); ?>">
|
||
<i class="fa fa-info-circle fa-2x text-info" aria-hidden="true"></i>
|
||
</button>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
<?php } ?>
|
||
</td>
|
||
<td>
|
||
<?php
|
||
if ($intNbBibs != 0) {
|
||
?>
|
||
<button class="btn btn-sm btn_bib btn-secondary mb-1 rounded-0" data-action="view" data-bib_type="<?php echo $tabEpreuves[$i]['ba_id']; ?>" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-toggle="tooltip" id="btn_bib_view_<?php echo $tabEpreuves[$i]['epr_id']?>" title="<?php afficheTexte('promoteur_bib_view'); ?>" type="button">
|
||
<i class="fa fa-eye" aria-hidden="true"></i>
|
||
</button>
|
||
<?php } ?>
|
||
<button class="btn btn-sm btn_bib btn-secondary mb-2 rounded-0" data-action="edit" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']; ?>" id="btn_bib_edit_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-toggle="tooltip" title="<?php afficheTexte('promoteur_bib_edit'); ?>" type="button">
|
||
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
|
||
</button>
|
||
<br>
|
||
<button class="btn btn-sm btn_bib btn-success mb-1 rounded-0" data-action="assign" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']; ?>" id="btn_bib_assign_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-eve_id="<?php echo $int_eve_id; ?>" data-toggle="tooltip" title="<?php afficheTexte('promoteur_bib_assign'); ?>" style="display: none;" type="button">
|
||
<i class="fa fa-plus-circle" aria-hidden="true"></i>
|
||
</button>
|
||
<br>
|
||
<button class="btn btn-sm btn_bib btn-danger mb-1 rounded-0" data-action="delete" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']; ?>" id="btn_bib_delete_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-toggle="tooltip" title="<?php afficheTexte('promoteur_bib_delete'); ?>" style="display: none;" type="button">
|
||
<i class="fa fa-minus-circle" aria-hidden="true"></i>
|
||
</button>
|
||
</td>
|
||
</tr>
|
||
<?php } ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
}
|
||
function fxShowBibTool3($str_code, $int_eve_id, $strLangue){
|
||
global $objDatabase, $vDomaine;
|
||
|
||
$sqlEpreuves = "SELECT * FROM inscriptions_epreuves e WHERE e.eve_id = " . intval($int_eve_id) . " AND epr_actif = 1 ORDER BY epr_id";
|
||
$tabEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
||
$sqlBibAssignments = "SELECT * FROM bib_assignements WHERE ba_actif = 1 ORDER BY ba_tri";
|
||
$tabBibAssignments = $objDatabase->fxGetResults($sqlBibAssignments);
|
||
|
||
|
||
?>
|
||
<div class="card-header">
|
||
<h2><?php afficheTexte('promoteur_bib_tool')?></h2>
|
||
</div>
|
||
<div class="card-body row text-center">
|
||
|
||
|
||
</div>
|
||
<div >
|
||
<div class="table-responsive-sm">
|
||
<table class="table">
|
||
<thead>
|
||
<tr>
|
||
<th><?php afficheTexte('promoteur_bib_race')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_range_start')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_range_end_dispo')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_range_end')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_current')?></th>
|
||
<th><?php afficheTexte('promoteur_qte_epr_qte_ordered')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_assignment_type')?></th>
|
||
<th><?php afficheTexte('promoteur_bib_actions')?></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
for($i = 1; $i <= count($tabEpreuves); $i++){
|
||
$strClass = ($i & 1) ? '' : 'table-secondary';
|
||
|
||
if($tabEpreuves[$i]['epr_bib_start'] != 0)
|
||
$intBibStart = $tabEpreuves[$i]['epr_bib_start'];
|
||
else
|
||
$intBibStart = '';
|
||
|
||
if($tabEpreuves[$i]['epr_bib_finish_dispo'] != 0)
|
||
$intBibFinishdispo= $tabEpreuves[$i]['epr_bib_finish_dispo'];
|
||
else
|
||
$intBibFinishdispo = '';
|
||
|
||
if($tabEpreuves[$i]['epr_bib_finish'] != 0) {
|
||
$intToto = $tabEpreuves[$i]['epr_bib_finish'];
|
||
$sqlLastBib = "select max( cast(no_bib as unsigned) )from resultats_participants where epr_id = " . intval($tabEpreuves[$i]['epr_id']);
|
||
$intBibFinish = $objDatabase->fxGetVar($sqlLastBib);
|
||
}
|
||
else
|
||
$intBibFinish = '';
|
||
|
||
$sqlCommandees = "SELECT COUNT(*) FROM inscriptions_panier_epreuves_commandees e, inscriptions_panier_acheteurs a WHERE e.epr_id = " . intval($tabEpreuves[$i]['epr_id']) . " AND e.no_panier = a.no_panier AND a.sta_id = 3";
|
||
$intQteCommandees = $objDatabase->fxGetVar($sqlCommandees);
|
||
|
||
$sqlInscriptions = 'select p.no_bib, p.par_id, p.par_prenom, p.par_nom, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id, e.no_commande, e.no_panier, e.no_equipe from resultats_epreuves_commandees e, resultats_participants p where p.is_cancelled = 0 AND p.epr_id = ' . intval($tabEpreuves[$i]['epr_id']) . ' AND p.epr_id = e.epr_id and p.pec_id = e.pec_id_original group by e.pec_id_original';
|
||
$tabInscriptions = $objDatabase->fxGetResults($sqlInscriptions);
|
||
$intNbInscriptions = count($tabInscriptions);
|
||
|
||
// nb bibs used
|
||
$sqlCount = "SELECT count(*) FROM resultats_participants WHERE epr_id = " . intval($tabEpreuves[$i]['epr_id']) . " AND (no_bib <> '' AND no_bib <> 0)";
|
||
$intNbBibs = $objDatabase->fxGetVar($sqlCount);
|
||
|
||
// new calcul de num_bibs_left
|
||
if($tabEpreuves[$i]['epr_bib_finish'] == 0){
|
||
$intNbBibsLeft = ($intQteCommandees + $tabEpreuves[$i]['epr_qte']) - $intNbBibs;
|
||
} else {
|
||
$intNbBibsLeft = (($intBibStart + $intNbBibs) - $intBibStart) - $intNbBibs;
|
||
}
|
||
?>
|
||
<tr class="<?php echo $strClass ?>" style="text-align: center; font-size:1em">
|
||
<td>
|
||
<form name="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" id="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']?>" method="post" action="bib_assignment">
|
||
<input type="hidden" name="epr_id" value="<?php echo $tabEpreuves[$i]['epr_id']?>">
|
||
<input type="hidden" name="promoteur_eve_id" value="<?php echo $int_eve_id?>">
|
||
<input type="hidden" id="row_action_<?php echo $tabEpreuves[$i]['epr_id']?>" name="row_action_<?php echo $tabEpreuves[$i]['epr_id']?>" value="-">
|
||
</form>
|
||
<br>
|
||
<?php
|
||
if (trim($tabEpreuves[$i]['epr_categorie_' . $strLangue]) != '') {
|
||
echo $tabEpreuves[$i]['epr_categorie_' . $strLangue] . "<br>";
|
||
}
|
||
|
||
echo $tabEpreuves[$i]['epr_type_' . $strLangue];
|
||
|
||
if (trim($tabEpreuves[$i]['epr_nom_' . $strLangue]) != '') {
|
||
echo "<br>" . $tabEpreuves[$i]['epr_nom_' . $strLangue];
|
||
}
|
||
?>
|
||
<br>
|
||
<div style="color:#ffa200; font-weight: bold">
|
||
<?php
|
||
|
||
|
||
if($tabEpreuves[$i]['epr_equipe'] == 1)
|
||
afficheTexte('promoteur_epr_equipe');
|
||
else
|
||
afficheTexte('promoteur_epr_solo')?>
|
||
</div>
|
||
<br>
|
||
</td>
|
||
<td>
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-control form-control-sm rounded-0" min="0" type="number" id="num_bib_range_start_<?php echo $tabEpreuves[$i]['epr_id']?>" name="num_bib_range_start_<?php echo $tabEpreuves[$i]['epr_id']?>" value="<?php echo $intBibStart ?>" disabled>
|
||
</td>
|
||
<td>
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-control form-control-sm rounded-0" min="0" type="number" id="num_bib_range_finish_dispo_<?php echo $tabEpreuves[$i]['epr_id']?>" name="num_bib_range_finish_dispo_<?php echo $tabEpreuves[$i]['epr_id']?>" value="<?php echo $intBibFinishdispo ?>" disabled>
|
||
</td>
|
||
<td>
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-control form-control-sm rounded-0" min="0" type="number" id="num_dernier_dossard_<?php echo $tabEpreuves[$i]['epr_id']?>" name="num_dernier_dossard_<?php echo $tabEpreuves[$i]['epr_id']?>" value="<?php echo $intBibFinish?>" disabled>
|
||
</td>
|
||
<td id="used_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>"><?php echo $intNbBibs?></td>
|
||
<td id="qty_booked_<?php echo $tabEpreuves[$i]['epr_id']; ?>">
|
||
<?php echo $intNbInscriptions?>
|
||
</td>
|
||
<td class="text-left">
|
||
<input type="hidden" name="epr_id" value="<?php echo $tabEpreuves[$i]['epr_id']?>"/>
|
||
<select form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-control form-control-sm rounded-0" id="sel_assignment_type_<?php echo $tabEpreuves[$i]['epr_id']?>" name="sel_assignment_type_<?php echo $tabEpreuves[$i]['epr_id']; ?>" disabled>
|
||
<?php
|
||
for($j = 1; $j <= count($tabBibAssignments); $j++){
|
||
?>
|
||
<option <?php if($tabEpreuves[$i]['ba_id'] != 0 && $tabEpreuves[$i]['ba_id'] == $tabBibAssignments[$j]['ba_id']) echo 'selected="selected"'?> value="<?php echo $tabBibAssignments[$j]['ba_id']?>"><?php echo $tabBibAssignments[$j]['ba_nom_' . $strLangue]?></option>
|
||
<?php } ?>
|
||
</select>
|
||
<br>
|
||
<br>
|
||
<?php
|
||
if($tabEpreuves[$i]['epr_equipe'] == 1) {
|
||
?>
|
||
<div id="bib_options_bibandteam_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']?>" style="display: none;">
|
||
<div class="form-check">
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-check-input" type="checkbox" value="1" id="chk_bib_and_team_<?php echo $tabEpreuves[$i]['epr_id']; ?>" name="chk_bib_and_team"<?php if ($tabEpreuves[$i]['epr_bib_mode'] == 1) { ?> checked<?php } ?>>
|
||
<label class="form-check-label" for="chk_bib_and_team_<?php echo $tabEpreuves[$i]['epr_id']; ?>">
|
||
<?php afficheTexte('promoteur_bib_and_team_switch'); ?>
|
||
<button class="btn btn-sm rounded-circle" type="button" data-toggle="popover" data-content="<?php afficheTexte('promoteur_bib_bibandteam'); ?>">
|
||
<i class="fa fa-info-circle fa-2x text-info" aria-hidden="true"></i>
|
||
</button>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
}
|
||
if($tabEpreuves[$i]['epr_bib_finish'] != 0) {
|
||
?>
|
||
<div id="bib_options_fromlast_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']?>" style="display: none;">
|
||
<div class="form-check">
|
||
<input form="frm_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" class="form-check-input" type="checkbox" value="1" id="chk_from_last_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>" name="chk_from_last_bib">
|
||
<label class="form-check-label" for="chk_from_last_bib_<?php echo $tabEpreuves[$i]['epr_id']; ?>">
|
||
<?php afficheTexte('promoteur_bib_from_last'); ?>
|
||
<button class="btn btn-sm rounded-circle" type="button" data-toggle="popover" data-content="<?php afficheTexte('promoteur_bib_fromlastbib_tip'); ?>">
|
||
<i class="fa fa-info-circle fa-2x text-info" aria-hidden="true"></i>
|
||
</button>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
<?php } ?>
|
||
</td>
|
||
<td>
|
||
<?php
|
||
if ($intNbBibs != 0) {
|
||
?>
|
||
<button class="btn btn-sm btn_bib btn-secondary mb-1 rounded-0" data-action="view" data-bib_type="<?php echo $tabEpreuves[$i]['ba_id']; ?>" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-toggle="tooltip" id="btn_bib_view_<?php echo $tabEpreuves[$i]['epr_id']?>" title="<?php afficheTexte('promoteur_bib_view'); ?>" type="button">
|
||
<i class="fa fa-eye" aria-hidden="true"></i>
|
||
</button>
|
||
<?php } ?>
|
||
<button class="btn btn-sm btn_bib btn-secondary mb-2 rounded-0" data-action="edit" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']; ?>" id="btn_bib_edit_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-toggle="tooltip" title="<?php afficheTexte('promoteur_bib_edit'); ?>" type="button">
|
||
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
|
||
</button>
|
||
<br>
|
||
<button class="btn btn-sm btn_bib btn-success mb-1 rounded-0" data-action="assign" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']; ?>" id="btn_bib_assign_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-toggle="tooltip" data-eve_id="<?php echo $int_eve_id; ?>" title="<?php afficheTexte('promoteur_bib_assign'); ?>" style="display: none;" type="button">
|
||
<i class="fa fa-plus-circle" aria-hidden="true"></i>
|
||
</button>
|
||
<br>
|
||
<button class="btn btn-sm btn_bib btn-danger mb-1 rounded-0" data-action="delete" data-epr_id="<?php echo $tabEpreuves[$i]['epr_id']; ?>" id="btn_bib_delete_<?php echo $tabEpreuves[$i]['epr_id']; ?>" data-toggle="tooltip" data-eve_id="<?php echo urlencode(base64_encode($int_eve_id)); ?>" title="<?php afficheTexte('promoteur_bib_delete'); ?>" style="display: none;" type="button">
|
||
<i class="fa fa-minus-circle" aria-hidden="true"></i>
|
||
</button>
|
||
</td>
|
||
</tr>
|
||
<?php } ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
}
|
||
|
||
|
||
function fxGetAssignmentName($int_ba_id, $strLangue) {
|
||
global $objDatabase;
|
||
$sql = "SELECT ba_nom_" . $strLangue . " FROM bib_assignements WHERE ba_id = " . intval($int_ba_id);
|
||
return $objDatabase->fxGetVar($sql);
|
||
}
|
||
|
||
function fxShowBibNumber($str_bib, $int_epr_id, $type){
|
||
// enlever no. epr du no bib
|
||
$str_return = str_replace($int_epr_id . "-", "", $str_bib);
|
||
switch($type){
|
||
case 'equipe':
|
||
break;
|
||
case 'participant':
|
||
$str_return = str_replace("-", "", $str_return);
|
||
break;
|
||
}
|
||
return $str_return;
|
||
}
|
||
|
||
function fxShowRapports($tabRapports, $strLangue, $intEvenement) {
|
||
global $vDomaine;
|
||
$arrEvenement = fxGetEvenementsId($intEvenement);
|
||
?>
|
||
<div class="card-header">
|
||
<h2><?php afficheTexte('promoteur_reports_titre')?></h2>
|
||
</div>
|
||
<div class="card-body text-center">
|
||
<a class="button-promoteur" style="background: url('<?php echo $vDomaine; ?>/images/reports-icon.png') no-repeat center" data-toggle="collapse" href="#collapseRapports" role="button" aria-expanded="false" aria-controls="collapseRapports">
|
||
<span class="d-inline-block h-100 w-100" data-toggle="tooltip" title="<?php afficheTexte('promoteur_div_tooltip')?>"></span>
|
||
</a>
|
||
</div>
|
||
<div class="animate__animated animate__fadeIn collapse" id="collapseRapports">
|
||
<div class="card-body">
|
||
<ul class="list-unstyled">
|
||
<?php
|
||
if ($arrEvenement['te_id'] != 9) {
|
||
?>
|
||
<li class="mb-2">
|
||
<a class="btn btn-primary rounded-pill" href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=chrono&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>" target="_blank">
|
||
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>chrono + questions
|
||
</a>
|
||
</li>
|
||
<?php
|
||
}
|
||
if ($arrEvenement['te_id'] == 13) {
|
||
?>
|
||
<li class="mb-2">
|
||
<a class="btn btn-primary rounded-pill" href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=adhesions&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>" target="_blank">
|
||
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>adhésions actives
|
||
</a>
|
||
</li>
|
||
<li class="mb-2">
|
||
<a class="btn btn-primary rounded-pill" href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=adhesions-ventes&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>" target="_blank">
|
||
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>liste d'adhésions annuelles
|
||
</a>
|
||
</li>
|
||
<?php
|
||
}
|
||
if ($arrEvenement['eve_rapport_finances_capitaines'] == 1) {
|
||
?>
|
||
<li class="mb-2">
|
||
<a class="btn btn-primary rounded-pill" href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=finances-pnq&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>" target="_blank">
|
||
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>Transactions-Finances (capitaines seulement)
|
||
</a>
|
||
</li>
|
||
<?php
|
||
}
|
||
?>
|
||
<li class="mb-2">
|
||
<a class="btn btn-primary rounded-pill" href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=finances<?php if ($arrEvenement['te_id'] == 13) { ?>-membership<?php } ?>&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>" target="_blank">
|
||
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i>Transactions-Finances
|
||
</a>
|
||
</li>
|
||
<li class="mb-2">
|
||
<a class="btn btn-primary rounded-pill" href="<?php echo $vDomaine; ?>/superadm/rapport_new.php?r=remboursements&e=<?php echo urlencode(base64_encode($arrEvenement['eve_id'])); ?>&lng=<?php echo $strLangue; ?>" target="_blank">
|
||
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i><?php if($strLangue == 'fr') echo "Paiements"; else echo "Payments"?>
|
||
</a>
|
||
</li>
|
||
<?php
|
||
for ($intCtr = 1; $intCtr <= count($tabRapports); $intCtr++) {
|
||
?>
|
||
<li class="mb-2">
|
||
<a class="btn btn-primary rounded-pill" href="<?php echo $vDomaine; ?>/superadm/index.php?t=<?php echo urlencode(base64_encode(fxUnescape($tabRapports[$intCtr]['men_id']))); ?>&a=report&lng=<?php echo $strLangue; ?>" data-toto="<?php echo $intCtr; ?>" target="_blank">
|
||
<i class="fa fa-bar-chart mr-2" aria-hidden="true"></i><?php echo fxUnescape($tabRapports[$intCtr]['men_nom']); ?>
|
||
</a>
|
||
</li>
|
||
<?php
|
||
}
|
||
?>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
}
|
||
|
||
function fxShowDupes($int_eve_id) {
|
||
global $strLangue, $objDatabase, $vDomaine;
|
||
|
||
if ($strLangue == 'fr') {
|
||
$strPage = '/compte';
|
||
} else {
|
||
$strPage = '/account';
|
||
}
|
||
|
||
$sqlNoBib = "SELECT no_bib, epr_id, COUNT(*) c FROM resultats_participants where eve_id = " . intval($int_eve_id) . " AND no_bib <> '' GROUP BY no_bib HAVING c > 1";
|
||
$tabNoBib = $objDatabase->fxGetResults($sqlNoBib);
|
||
?>
|
||
<div class="box_participant card mb-3">
|
||
|
||
<div class="card-body">
|
||
<div class="card-header">
|
||
<h2><?php afficheTexte('promoteur_bib_dupes'); ?></h2>
|
||
</div>
|
||
<div class="card-body">
|
||
<table class="table table-striped" id="table_dupes">
|
||
<thead>
|
||
<tr>
|
||
<th><?php afficheTexte('promoteur_bib_number'); ?></th>
|
||
<th><?php afficheTexte('promoteur_bib_participant'); ?></th>
|
||
<th><?php afficheTexte("promoteur_bib_race"); ?></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
if ($tabNoBib != null) {
|
||
$intCtr = 1;
|
||
|
||
foreach ($tabNoBib as $tab) {
|
||
$sqlDupes = "select par_prenom, par_nom, epr_id from resultats_participants where eve_id = " . intval($int_eve_id) . " and no_bib = " . intval($tab['no_bib']);
|
||
$tabDupes = $objDatabase->fxGetResults($sqlDupes);
|
||
|
||
if ($tabDupes != null) {
|
||
foreach ($tabDupes as $dupe) {
|
||
$tabEpreuve = fxGetEpreuve($dupe['epr_id']);
|
||
?>
|
||
<tr>
|
||
<td><?php echo $tab['no_bib']; ?></td>
|
||
<td><?php echo $dupe['par_prenom'] . " " . $dupe['par_nom']; ?></td>
|
||
<td>
|
||
<?php
|
||
if (trim($tabEpreuve['epr_categorie_' . $strLangue]) != '') {
|
||
echo $tabEpreuve['epr_categorie_' . $strLangue] . "<br>";
|
||
}
|
||
|
||
echo $tabEpreuve['epr_type_' . $strLangue];
|
||
|
||
if (trim($tabEpreuve['epr_nom_' . $strLangue]) != '') {
|
||
echo "<br>" . $tabEpreuve['epr_nom_' . $strLangue];
|
||
}
|
||
|
||
echo " (" . $tabEpreuve['epr_id'] . ")";
|
||
|
||
?>
|
||
</td>
|
||
</tr>
|
||
<?php
|
||
}
|
||
$intCtr++;
|
||
}
|
||
}
|
||
} else {
|
||
?>
|
||
<td colspan="3"><?php afficheTexte('promoteur_no_dupes'); ?></td>
|
||
<?php
|
||
}
|
||
?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="card-body">
|
||
</div>
|
||
|
||
<?php
|
||
}
|
||
|
||
function fxShowBibNumbersTable($tab_epreuve, $strLangue, $intEveId = 0) {
|
||
global $objDatabase, $vDomaine;
|
||
|
||
if ($strLangue == 'fr') {
|
||
$strPage = '/compte';
|
||
} else {
|
||
$strPage = '/account';
|
||
}
|
||
|
||
$sqlTri = "SELECT * FROM bib_assignements WHERE ba_id = " . intval($tab_epreuve['ba_id']);
|
||
$intTri = $objDatabase->fxQuery($sqlTri);
|
||
|
||
$strOrderBy = '';
|
||
// set ORDER By
|
||
switch($tab_epreuve['ba_id']){
|
||
case 1:
|
||
$strOrderBy = " ORDER BY TRIM(p.par_prenom)";
|
||
break;
|
||
case 2:
|
||
$strOrderBy = " ORDER BY TRIM(p.par_nom), TRIM(p.par_prenom)";
|
||
break;
|
||
case 3:
|
||
$strOrderBy = " ORDER BY p.par_maj";
|
||
break;
|
||
case 4:
|
||
$strOrderBy = " ORDER BY p.par_naissance DESC";
|
||
break;
|
||
}
|
||
//get inscriptions
|
||
$sqlInscriptions = "SELECT * FROM resultats_participants p WHERE p.is_cancelled = 0 AND p.epr_id = " . intval($tab_epreuve['epr_id']) . $strOrderBy;
|
||
$tabInscriptions = $objDatabase->fxGetResults($sqlInscriptions);
|
||
|
||
// get epreuves_commandees (pour les equipes)
|
||
$sqlEpreuvesCommandees = "select * from resultats_epreuves_commandees c, resultats_participants p where c.epr_id = " . intval($tab_epreuve['epr_id']) . " and c.pec_actif = 1 and c.pec_id_original = p.pec_id GROUP BY pec_id_original" . $strOrderBy;
|
||
$tabEpreuvesCommandees = $objDatabase->fxGetResults($sqlEpreuvesCommandees);
|
||
?>
|
||
<div class="box_participant card mb-3">
|
||
<div class="card-header">
|
||
<h2>
|
||
<?php afficheTexte('promoteur_bib_resultats'); ?>
|
||
<br>
|
||
<small>
|
||
<?php echo "(" . fxGetAssignmentName($tab_epreuve['ba_id'], $strLangue) . ")"; ?>
|
||
</small>
|
||
</h2>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="card-body">
|
||
<table class="table table-striped" id="table_bibs">
|
||
<thead>
|
||
<tr>
|
||
<th class="text-left"><?php afficheTexte("promoteur_bib_race"); ?></th>
|
||
<th class="text-left">
|
||
<?php
|
||
if ($tab_epreuve['epr_equipe'] == 1) {
|
||
afficheTexte('promoteur_bib_equipe');
|
||
} else {
|
||
afficheTexte('promoteur_bib_participant');
|
||
}
|
||
?>
|
||
</th>
|
||
<th class="text-left">
|
||
<?php
|
||
if ($tab_epreuve['epr_equipe'] == 1) {
|
||
afficheTexte('promoteur_bib_no_equipe');
|
||
} else {
|
||
afficheTexte('promoteur_bib_no_participants');
|
||
}
|
||
?>
|
||
</th>
|
||
<?php if ($tab_epreuve['epr_equipe'] == 1) { ?>
|
||
<th class="text-left"><?php afficheTexte('promoteur_bib_no_teammates'); ?></th>
|
||
<?php } ?>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
if ($tab_epreuve['epr_equipe'] == 0) {
|
||
if ($tabInscriptions != null) {
|
||
for ($i = 1;$i <= count($tabInscriptions);$i++){
|
||
// ne pas afficher les volunteers/pit managers
|
||
if ($tabInscriptions[$i]['rol_id'] != 3 && $tabInscriptions[$i]['rol_id'] != 4){
|
||
?>
|
||
<tr class="<?php if ($i % 2) echo "EvenRow"; else echo "OddRow";?>">
|
||
<td>
|
||
<?php
|
||
if ($tab_epreuve['epr_nom_' . $strLangue] != '')
|
||
echo $tab_epreuve['epr_nom_' . $strLangue];
|
||
echo "<br>";
|
||
if ($tab_epreuve['epr_type_' . $strLangue] != '')
|
||
echo $tab_epreuve['epr_type_' . $strLangue];
|
||
|
||
echo " (" . $tab_epreuve['epr_id'] . ")";
|
||
?>
|
||
</td>
|
||
<td><?php echo $tabInscriptions[$i]['par_prenom'] . " " . $tabInscriptions[$i]['par_nom']?></td>
|
||
<td><?php echo $tabInscriptions[$i]['no_bib']?></td>
|
||
</tr>
|
||
<?php }
|
||
}?>
|
||
|
||
<?php
|
||
}
|
||
}
|
||
elseif($tab_epreuve['epr_equipe'] == 1){
|
||
for ($i = 1; $i <= count($tabEpreuvesCommandees); $i++){
|
||
?>
|
||
<tr class="<?php if ($i % 2) echo "EvenRow"; else echo "OddRow";?>">
|
||
<td>
|
||
<?php
|
||
if ($tab_epreuve['epr_nom_' . $strLangue] != '')
|
||
echo $tab_epreuve['epr_nom_' . $strLangue];
|
||
echo "<br>";
|
||
if ($tab_epreuve['epr_type_' . $strLangue] != '')
|
||
echo $tab_epreuve['epr_type_' . $strLangue];
|
||
|
||
echo " (" . $tab_epreuve['epr_id'] . ")";
|
||
?>
|
||
</td>
|
||
<td><?php echo $tabEpreuvesCommandees[$i]['pec_nom_equipe']?></td>
|
||
<td><?php echo $tabEpreuvesCommandees[$i]['no_equipe']?></td>
|
||
<td>
|
||
<ul><?php
|
||
// get team members
|
||
$sqlEquipe = "SELECT * FROM resultats_participants p WHERE pec_id = " . intval($tabEpreuvesCommandees[$i]['pec_id_original']) . " ORDER BY no_bib";
|
||
$tabEquipe = $objDatabase->fxGetResults($sqlEquipe);
|
||
for($j = 1; $j <= count($tabEquipe); $j++){
|
||
if($tabEquipe[$j]['rol_id'] != 3 && $tabEquipe[$j]['rol_id'] != 4) {
|
||
?>
|
||
<li><?php echo $tabEquipe[$j]['no_bib'] . " - " . $tabEquipe[$j]['par_prenom'] . " " . $tabEquipe[$j]['par_nom'];?></li>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
</ul></td></tr>
|
||
<?php
|
||
}
|
||
} else {
|
||
echo "Nothing found.";
|
||
}
|
||
?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
// sl ($intEveId != 0)
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
function fxSetBibNumbers($tab_data, $int_epr_id, $int_start, $int_finish, $int_type, $int_par_equipe, $str_action = '', $int_mode,$int_finish_dispo=999999) {
|
||
global $strLangue, $objDatabase, $vDomaine;
|
||
|
||
if ($strLangue == 'fr') {
|
||
$strPage = '/compte';
|
||
} else {
|
||
$strPage = '/account';
|
||
}
|
||
|
||
if ($str_action == 'reset') {
|
||
$blnError = false;
|
||
// reset tables
|
||
// inscriptions_epreuves
|
||
$sqlUpdate = "UPDATE inscriptions_epreuves SET epr_bib_start = 0, epr_bib_finish = 0, epr_bib_mode = 0, ba_id = 2 WHERE epr_id = " . intval($int_epr_id);
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
|
||
if (!$qryUpdate) {
|
||
$blnError = true;
|
||
fxcreer_log('Erreur lors de la reinitialisation des infos de dossards de l\'epreuve.');
|
||
}
|
||
|
||
// resultats_epreuves_commandees
|
||
$sqlUpdate = "UPDATE resultats_epreuves_commandees SET no_equipe = null WHERE epr_id = " . intval($int_epr_id);
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
|
||
if (!$qryUpdate) {
|
||
$blnError = true;
|
||
fxcreer_log('Erreur lors de la reinitialisation des infos de dossards de la commande.');
|
||
}
|
||
|
||
// resultats_participants
|
||
$sqlUpdate = "UPDATE resultats_participants SET no_bib = null, par_date_bib = null WHERE epr_id = " . intval($int_epr_id);
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
|
||
if (!$qryUpdate) {
|
||
$blnError = true;
|
||
fxcreer_log('Erreur lors de la reinitialisation des numeros de dossards des participants.');
|
||
}
|
||
|
||
if ($blnError) {
|
||
?>
|
||
<div class="error">Reset Problems - Try again</div>
|
||
<?php
|
||
} else {
|
||
?>
|
||
<div class="box_participant card mb-3">
|
||
<div class="card-header">
|
||
<h2>
|
||
<?php
|
||
if ($tab_data['epr_nom_' . $strLangue] != '')
|
||
echo $tab_data['epr_nom_' . $strLangue];
|
||
?>
|
||
<br>
|
||
<small>
|
||
<?php
|
||
if ($tab_data['epr_type_' . $strLangue] != '')
|
||
echo $tab_data['epr_type_' . $strLangue];
|
||
|
||
echo " (" . $tab_data['epr_id'] . ")";
|
||
?>
|
||
</small>
|
||
</h2>
|
||
</div>
|
||
|
||
<div class="card-body">
|
||
<?php afficheTexte('promoteur_bib_reset_result'); ?>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<?php
|
||
}
|
||
} else {
|
||
if(isset($_POST['chk_from_last_bib'])) {
|
||
$intNoBib = $_POST['num_dernier_dossard_' . $_POST['epr_id']] + 1;
|
||
// set where (pour MSIN-1563 et al.)
|
||
$strWhere = " AND p.no_bib = ''";
|
||
} else {
|
||
$intNoBib = $int_start;
|
||
$strWhere = '';
|
||
}
|
||
$intCtr = 0;
|
||
|
||
// set ORDER By
|
||
switch ($int_type) {
|
||
case 1:
|
||
$strOrderBy = " ORDER BY TRIM(p.par_prenom)";
|
||
break;
|
||
case 2:
|
||
$strOrderBy = " ORDER BY TRIM(p.par_nom), TRIM(p.par_prenom)";
|
||
break;
|
||
case 3:
|
||
$strOrderBy = " ORDER BY p.par_maj";
|
||
break;
|
||
case 4:
|
||
$strOrderBy = " ORDER BY p.par_naissance DESC";
|
||
break;
|
||
}
|
||
|
||
//get inscriptions
|
||
$sqlInscriptions = "SELECT * FROM resultats_participants p WHERE p.is_cancelled = 0 AND p.epr_id = " . intval($int_epr_id) . $strWhere . $strOrderBy;
|
||
|
||
// $sqlInscriptions = "SELECT * FROM resultats_participants p WHERE p.is_cancelled = 0 AND p.epr_id = " . intval($int_epr_id) . $strOrderBy;
|
||
$tabInscriptions = $objDatabase->fxGetResults($sqlInscriptions);
|
||
$sqlEpreuves = "SELECT * FROM inscriptions_epreuves WHERE epr_id = " . intval($int_epr_id);
|
||
$tabEpreuves = $objDatabase->fxGetRow($sqlEpreuves);
|
||
|
||
|
||
if ($int_par_equipe == 0) {
|
||
if ($int_finish == 0)
|
||
$int_finish = $int_start + count($tabInscriptions);
|
||
|
||
for ($i = 1; $i <= count($tabInscriptions); $i++) {
|
||
|
||
if ($tabInscriptions[$i]['rol_id'] != 3 && $tabInscriptions[$i]['rol_id'] != 4) {
|
||
$sqlUpdate = "UPDATE resultats_participants ";
|
||
if ($str_action == 'reset') {
|
||
$sqlUpdate .= "SET no_bib = '', par_date_bib = null";
|
||
// $sqlUpdate .= "SET no_bib = ''";
|
||
} else {
|
||
if($tabInscriptions[$i]['par_date_bib'] == null){
|
||
$sqlUpdate .= "SET par_date_bib = '" . fxGetDateTime() . "', no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "'";
|
||
} else{
|
||
$sqlUpdate .= "SET no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "'";
|
||
// $sqlUpdate .= "SET no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "', par_maj = '" . fxGetDateTime() . "'";
|
||
// $sqlUpdate .= "SET no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "', par_modification_promoteur = 1, par_maj = '" . fxGetDateTime() . "'";
|
||
}
|
||
}
|
||
|
||
$sqlUpdate .= " WHERE par_id = " . $tabInscriptions[$i]['par_id'] . " AND is_cancelled = 0";
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
|
||
if (!$qryUpdate)
|
||
fxcreer_log('Erreur lors de mise a jour du numero de dossard du participant ' . $tabInscriptions[$i]['par_id']);
|
||
|
||
$sqlUpdate = "UPDATE resultats_epreuves_commandees SET no_equipe = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "' WHERE epr_id = " . intval($tabInscriptions[$i]['epr_id']) . " AND pec_id_original = " . $tabInscriptions[$i]['pec_id'];
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
|
||
if (!$qryUpdate)
|
||
fxcreer_log('Erreur lors de mise a jour du numero de dossard de l\'equipe." ' . $int_epr_id);
|
||
|
||
$intCtr++;
|
||
}
|
||
|
||
if( $intNoBib + $intCtr>$int_finish_dispo){
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// assigner no_equipe (+ no_bib)
|
||
if ($int_par_equipe == 1) {
|
||
if ($int_finish == 0) {
|
||
$int_finish = count($tab_data);
|
||
}
|
||
$intNumeroEquipe= $int_start;
|
||
for ($i = 1; $i <= count($tab_data); $i++) {
|
||
$strNumeroEquipe = $objDatabase->fxEscape($intNumeroEquipe+ $intCtr);
|
||
$sqlUpdate = "UPDATE resultats_epreuves_commandees SET no_equipe = '" . $strNumeroEquipe. "' WHERE epr_id = " . intval($tab_data[$i]['epr_id']) . " AND pec_id_original = " . $tab_data[$i]['pec_id'];
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
if (!$qryUpdate)
|
||
fxcreer_log('Erreur lors de mise a jour du numero de dossard de l\'equipe." ' . $int_epr_id);
|
||
|
||
$intCtrBib = 1;
|
||
// assigner no_bib aux membres de lequipe
|
||
// get membres de lequipe
|
||
$sqlEquipe = "SELECT * FROM resultats_participants p WHERE pec_id = " . $tab_data[$i]['pec_id_original'] . $strOrderBy;
|
||
$tabEquipe = $objDatabase->fxGetResults($sqlEquipe);
|
||
for ($j = 1; $j <= count($tabEquipe); $j++) {
|
||
if ($tabEquipe[$j]['rol_id'] != 3 && $tabEquipe[$j]['rol_id'] != 4) {
|
||
if($int_mode == 0) {
|
||
if ($tabEquipe[$j]['rol_id'] == 1) {
|
||
$intNoBib = $strNumeroEquipe . "0";
|
||
} else {
|
||
$intNoBib = $objDatabase->fxEscape($strNumeroEquipe . $intCtrBib);// "1234";
|
||
$intCtrBib++;
|
||
}
|
||
} else{
|
||
$intNoBib = $strNumeroEquipe;
|
||
}
|
||
if($tabInscriptions[$i]['par_date_bib'] == null){
|
||
$sqlUpdatePart = "UPDATE resultats_participants SET par_date_bib = '" . fxGetDateTime() . "', no_bib = '" . $objDatabase->fxEscape($intNoBib). "' WHERE par_id = " . intval($tabEquipe[$j]['par_id']);
|
||
} else{
|
||
$sqlUpdatePart = "UPDATE resultats_participants SET no_bib = '" . $objDatabase->fxEscape($intNoBib) . "' WHERE par_id = " . intval($tabEquipe[$j]['par_id']);
|
||
// $sqlUpdatePart = "UPDATE resultats_participants SET par_maj = '" . fxGetDateTime() . "', no_bib = '" . $objDatabase->fxEscape($intNoBib) . "' WHERE par_id = " . intval($tabEquipe[$j]['par_id']);
|
||
// $sqlUpdatePart = "UPDATE resultats_participants SET par_maj = '" . fxGetDateTime() . "', par_modification_promoteur = 1, no_bib = '" . $objDatabase->fxEscape($intNoBib) . "' WHERE par_id = " . intval($tabEquipe[$j]['par_id']);
|
||
}
|
||
$qryUpdatePart = $objDatabase->fxQuery($sqlUpdatePart);
|
||
if (!$qryUpdatePart)
|
||
fxcreer_log('Erreur lors de mise a jour du numero de dossard du participant ' . $tabInscriptions[$i]['par_id']);
|
||
}
|
||
}
|
||
$intCtr++;
|
||
}
|
||
}
|
||
|
||
// update epreuve
|
||
$sqlUpdate = "UPDATE inscriptions_epreuves SET epr_bib_finish_dispo=".$int_finish_dispo.", epr_bib_start = " . intval($int_start) . ", epr_bib_finish = " . intval($int_finish) . ", epr_bib_mode = " . intval($int_mode) . ", ba_id = " . intval($int_type) . " WHERE epr_id = " . intval($int_epr_id);
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
|
||
if (!$qryUpdate)
|
||
fxcreer_log('Erreur lors de mise a jour information dossard" ' . $int_epr_id);
|
||
|
||
// fxShowBibNumbersTable($tab_data, $strLangue);
|
||
}
|
||
}
|
||
function fxShowColumnPromoteur($arrColonnes, $arrListeParticipants, $x, $strLangue, $intEquipe = 0,$abonnement=0) {
|
||
global $vDomaine ;
|
||
$strResults = '';
|
||
|
||
foreach ($arrColonnes as $arrCol) {
|
||
$arrFields = explode(',', $arrCol['field']);
|
||
$strAffichage = $arrCol['mask'];
|
||
|
||
switch ($arrCol['format']) { // vérifier le format d'affichage
|
||
case 'bib':
|
||
if ($abonnement){
|
||
|
||
$membre=fxGetAbonnement(0,0,0,$arrListeParticipants[$x]['pec_id_original']);
|
||
isset($membre['mem_numero'])? $m_membre=$membre['mem_numero'] :$m_membre="";
|
||
|
||
$strAffichage = '
|
||
<div class="row">
|
||
<div class="col-10">
|
||
' . $m_membre . '
|
||
</div>
|
||
<div class="col-2">
|
||
|
||
</div>
|
||
</div>
|
||
';
|
||
} else {
|
||
$intValue = (intval($arrListeParticipants[$x]['pec_equipe']) == 1) ? fxShowBibNumber($arrListeParticipants[$x]['no_equipe'], $arrListeParticipants[$x]['epr_id'], 'equipe') : fxShowBibNumber($arrListeParticipants[$x]['no_bib'], $arrListeParticipants[$x]['epr_id'], 'participant');
|
||
$strAffichage = '
|
||
<div class="row">
|
||
<div class="col-12 lbl_hint">
|
||
';
|
||
if (intval($intEquipe) == 1) {
|
||
$strAffichage .= afficheTexte('promoteur_bib_no_equipe', 0);
|
||
$strAction = 'no_equipe';
|
||
$strId = 'txt_no_bib_e';
|
||
} else {
|
||
$strAffichage .= afficheTexte('promoteur_bib_no_participants', 0);
|
||
$strAction = 'no_bib';
|
||
$strId = 'txt_no_bib_p';
|
||
}
|
||
|
||
$strAffichage .= '
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row">
|
||
<div class="col-10">
|
||
<input class="form-control form-control-sm rounded-0" type="number" id="' . $strId . $arrListeParticipants[$x]['par_id'] . '" name="txt_no_bib_' . $arrListeParticipants[$x]['par_id'] . '" min="0" required value="' . $intValue . '">
|
||
</div>
|
||
<div class="col-2">
|
||
<button class="btn btn_bib btn-sm btn-primary rounded-0" type="button" data-action="' . $strAction . '" data-eve_id="' . urlencode(base64_encode($arrListeParticipants[$x]['eve_id'])) . '" data-epr_id="' . $arrListeParticipants[$x]['epr_id'] . '" data-par_id="' . $arrListeParticipants[$x]['par_id'] . '" data-pec_id="' . $arrListeParticipants[$x]['pec_id_original'] . '" id="btn_no_bib_' . $arrListeParticipants[$x]['par_id'] . '" name="btn_no_bib_' . $arrListeParticipants[$x]['par_id'] . '" data-toggle0="tooltip" title="' . afficheTexte('promoteur_bib_tip', 0) . '">OK</button>
|
||
</div>
|
||
</div>
|
||
';
|
||
|
||
}
|
||
break;
|
||
case 'management':
|
||
$strCode = fxGetEvenementsUrl($arrListeParticipants[$x]['eve_id']);
|
||
|
||
if ($arrListeParticipants[$x]['is_cancelled'] == '' || $arrListeParticipants[$x]['is_cancelled'] == '0') {
|
||
$strStyleEdit = $strStyleCancel = '';
|
||
$strStyleRetablir = ' d-none';
|
||
} else {
|
||
$strStyleEdit = $strStyleCancel = ' d-none';
|
||
$strStyleRetablir = '';
|
||
}
|
||
|
||
$strAffichage = '
|
||
<button class="btn btn-primary btn-sm btn-block rounded-0 btn_edit_event_promo' . $strStyleEdit . '" id="modifier_' . $x . '" data-eve_code="' . $strCode . '" data-epr_id="' . $arrListeParticipants[$x]['epr_id'] . '" data-eve_id="' . $arrListeParticipants[$x]['eve_id'] . '" value="' . $arrListeParticipants[$x]['pec_id_original'] . '">' . afficheTexte('btn_modifierinscriptions', 0) . '</button>
|
||
<button class="btn btn-secondary btn-sm btn-block rounded-0 btn_cancel_event_promo' . $strStyleCancel . '" id="annuler_' . $x . '" type="button" data-eve_code="' . $strCode . '" data-epr_id="' . $arrListeParticipants[$x]['epr_id'] . '" data-eve_id="' . $arrListeParticipants[$x]['eve_id'] . '" value="' . $arrListeParticipants[$x]['pec_id_original'] . '">' . afficheTexte('btn_annulerinscriptions', 0) . '</button>
|
||
<button class="btn btn-secondary btn-sm btn-block rounded-0 btn_retablir_event_promo' . $strStyleRetablir . '" id="retablir_' . $x . '" type="button" data-eve_code="' . $strCode . '" data-epr_id="' . $arrListeParticipants[$x]['epr_id'] . '" data-eve_id="' . $arrListeParticipants[$x]['eve_id'] . '" value="' . $arrListeParticipants[$x]['pec_id_original'] . '">' . afficheTexte('btn_retablirinscriptions', 0) . '</button>
|
||
';
|
||
|
||
|
||
|
||
|
||
break;
|
||
case 'details':
|
||
|
||
// bib reception sl affichage check box
|
||
// print_r($arrListeParticipants[$x]);
|
||
$intValeur = 0;
|
||
|
||
|
||
if ($arrListeParticipants[$x]['no_bib_remis'] == 1) {
|
||
$strChecked = ' checked';
|
||
$intValeur = 0;
|
||
$strClass = 'btn-success';
|
||
$strImage = '<i class="fa fa-check" aria-hidden="true"></i>';
|
||
} else {
|
||
$strChecked = "";
|
||
$intValeur = 1;
|
||
$strClass = 'btn-primary';
|
||
$strImage = '<i class="fa fa-sharp fa-regular fa-square fa-2xs" aria-hidden="true"></i>';
|
||
}
|
||
|
||
|
||
|
||
if ($intEquipe == 1 && fxIsParEquipe($arrListeParticipants[$x]['pec_id_original'], $arrListeParticipants[$x]['epr_id'])) {
|
||
$strAffichage .= '
|
||
<button class="btn btn-secondary btn-sm btn_teammates rounded-0" type="button" data-eve_id="' . $arrListeParticipants[$x]['eve_id'] . '" data-epr_id="' . $arrListeParticipants[$x]['epr_id'] . '" data-pec_id="' . $arrListeParticipants[$x]['pec_id'] . '" data-toggle="modal" data-target="#modal_teammates">
|
||
' . afficheTexte('promoteur_bib_show_teamates', 0) . '
|
||
</button>
|
||
';
|
||
} else {
|
||
$strAffichage .= afficheTexte('epreuve_individuelle', 0);
|
||
}
|
||
break;
|
||
case 'edit':
|
||
$strAffichage = fxCheckMAJ($arrListeParticipants[$x]['pec_id_original'], $arrListeParticipants[$x]['par_id'], $strLangue);
|
||
// a faire sl mettre les deux langues
|
||
|
||
|
||
$strAffichage .='</br><hr>'.afficheTexte('promoteur_bib_enregistre', 0).'</br><span id="'.$arrListeParticipants[$x]['par_id'].'"><a class="btn btn-sm rounded-0 btn_remis '.$strClass.' " href="#" data-action="remis" data-table="'.urlencode(base64_encode('resultats_participants')).'" data-field="no_bib_remis" data-key="par_id" data-valeur="'.$intValeur.'" data-id="'.$arrListeParticipants[$x]['par_id'] .'">'. $strImage.' </a>
|
||
</span>';
|
||
$strAffichage .='</div>';
|
||
$strAffichage .=' </br> </div>';
|
||
$strAffichage .='<div id="date_'.$arrListeParticipants[$x]['par_id'].'" class="col-12 lbl_hint row">';
|
||
$strAffichage .=$arrListeParticipants[$x]['no_bib_remis_date'];
|
||
$strAffichage .='</br></div>';
|
||
$strAffichage .='<div id="par_'.$arrListeParticipants[$x]['par_id'].'" class="col-12 lbl_hint row">';
|
||
$strAffichage .=$arrListeParticipants[$x]['no_bib_remis_par'];
|
||
|
||
|
||
|
||
break;
|
||
case 'factures':
|
||
case 'confirmm':
|
||
$arrFactures = fxGetFactures($arrListeParticipants[$x]['pec_id_original']); // trouver toutes les factures pour cette épreuve
|
||
|
||
if ($arrFactures != null) {
|
||
$strAffichageTemp = '';
|
||
|
||
for ($intCtr2 = 1; $intCtr2 <= count($arrFactures); $intCtr2++) {
|
||
$strAffichageTemp .= $strAffichage;
|
||
|
||
if ($intCtr2 > 1) {
|
||
$strAffichageTemp .= '<br>';
|
||
}
|
||
|
||
foreach ($arrFields as $intIndex => $strField) { // remplacer {x} dans le mask de la colonne
|
||
$strAffichageTemp = str_replace('{' . $intIndex . '}', $arrListeParticipants[$x][fxchecklanguePromoteur($strField, $arrCol['multilingue'], $strLangue)], $strAffichageTemp);
|
||
}
|
||
}
|
||
|
||
$strAffichage = $strAffichageTemp;
|
||
}
|
||
break;
|
||
case 'race':
|
||
foreach ($arrFields as $intIndex => $strField) { // remplacer {x} dans le mask de la colonne
|
||
$strReplace = fxGetTabInscription(fxchecklanguePromoteur($strField, $arrCol['multilingue'], $strLangue), $arrListeParticipants[$x]['epr_id'], 'epreuves', 'epr');
|
||
|
||
if (trim($strReplace) != '') {
|
||
$strReplace .= '<br>';
|
||
}
|
||
|
||
$strAffichage = str_replace('{' . $intIndex . '}', $strReplace, $strAffichage);
|
||
}
|
||
break;
|
||
case 'money': //format dollar
|
||
foreach ($arrFields as $intIndex => $strField) { // remplacer {x} dans le mask de la colonne
|
||
$strAffichage = str_replace('{' . $intIndex . '}', fxShowPrix($arrListeParticipants[$x][fxchecklanguePromoteur($strField, $arrCol['multilingue'], $strLangue)], $strLangue), $strAffichage);
|
||
}
|
||
break;
|
||
default:
|
||
if ($arrCol['format'] == 'participant') {
|
||
if (fxIsParEquipe($arrListeParticipants[$x]['pec_id_original'], $arrListeParticipants[$x]['epr_id'])) {
|
||
$tabCapitaine = fxGetCapitaine($arrListeParticipants[$x]['pec_id'], $arrListeParticipants[$x]['epr_id']);
|
||
|
||
if ($tabCapitaine != null) {
|
||
$arrListeParticipants[$x]['par_prenom'] = $tabCapitaine['par_prenom'];
|
||
$arrListeParticipants[$x]['par_nom'] = $tabCapitaine['par_nom'];
|
||
}
|
||
/* else
|
||
afficheTexte('promoteur_no_captain'); */
|
||
}
|
||
}
|
||
|
||
foreach ($arrFields as $intIndex => $strField) { // remplacer {x} dans le mask de la colonne
|
||
// $strField ici {}on change par la valeur du champ le champ
|
||
$strAffichage = str_replace('{' . $intIndex . '}', $arrListeParticipants[$x][fxchecklanguePromoteur($strField, $arrCol['multilingue'], $strLangue)], $strAffichage);
|
||
}
|
||
// MSIN-3679 patch eve_id
|
||
$eve_idcode=urlencode(base64_encode($arrListeParticipants[$x]['eve_id'])) ;
|
||
$strAffichage = str_replace('{99}',$eve_idcode, $strAffichage);
|
||
|
||
}
|
||
|
||
if ($arrCol['format'] == 'team') { //si épreuve solo, ne pas afficher lev nom d'équipe
|
||
if ($intEquipe != 1) {
|
||
$strAffichage = '';
|
||
}
|
||
}
|
||
|
||
/* if (count($arrFields) == 1 && trim($arrListeParticipants[$x][fxchecklanguePromoteur($arrFields[0], $arrCol['multilingue'], $strLangue)]) == '') { // si la valeur est vide, ne rien afficher
|
||
$strAffichage = '';
|
||
} */
|
||
|
||
$strResults .= '<td class="text-' . $arrCol['align'] . '">' . $strAffichage . '</td>';
|
||
}
|
||
|
||
return $strResults;
|
||
}
|
||
function fxchecklanguePromoteur($strField, $intMultilingue, $langues) {
|
||
if (intval($intMultilingue) == 1)
|
||
return $strField . "_" . $langues;
|
||
else
|
||
return $strField;
|
||
}
|
||
function fxGetchampsPromoteur($blnDon, $strLangue) {
|
||
global $vDomaine, $vRepertoireFichiers;
|
||
|
||
if ($blnDon) {
|
||
$arrColonnes = array(
|
||
1 => array(
|
||
'field' => 'com_nom,com_prenom',
|
||
'align' => 'left',
|
||
'format' => 'string',
|
||
'mask' => '{0}, {1}',
|
||
'multilingue' => 0,
|
||
'label_fr' => 'Donateur',
|
||
'label_en' => 'Donator'
|
||
),
|
||
2 => array(
|
||
'field' => 'epr_categorie,epr_type,epr_nom',
|
||
'align' => 'left',
|
||
'format' => 'race',
|
||
'mask' => '<strong>{0}</strong>{1}{2}',
|
||
'multilingue' => 1,
|
||
'label_fr' => 'Épreuve',
|
||
'label_en' => 'Race'
|
||
),
|
||
3 => array(
|
||
'field' => 'pec_nom_equipe',
|
||
'align' => 'left',
|
||
'format' => 'team',
|
||
'mask' => '{0}',
|
||
'multilingue' => 0,
|
||
'label_fr' => ' Équipe',
|
||
'label_en' => 'Team'
|
||
),
|
||
4 => array(
|
||
'field' => 'par_nom,par_prenom',
|
||
'align' => 'left',
|
||
'format' => 'string',
|
||
'mask' => '{0}, {1}',
|
||
'multilingue' => 0,
|
||
'label_fr' => 'Participant',
|
||
'label_en' => 'Participant'
|
||
),
|
||
5 => array(
|
||
'field' => 'pd_montant',
|
||
'align' => 'right',
|
||
'format' => 'money',
|
||
'mask' => '{0}',
|
||
'multilingue' => 0,
|
||
'label_fr' => 'Montant',
|
||
'label_en' => 'Amount'
|
||
),
|
||
6 => array(
|
||
'field' => 'no_panier,no_commande',
|
||
'align' => 'left',
|
||
'format' => ' factures',
|
||
'mask' => '<a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/facture.php?no_panier={0}&lang=' . $strLangue . '" target="_blank">{1}</a>',
|
||
'multilingue' => 0,
|
||
'label_fr' => '# commande',
|
||
'label_en' => 'Order #'
|
||
),
|
||
7 => array(
|
||
'field' => 'pd_recu_pdf',
|
||
'align' => 'left',
|
||
'format' => 'string',
|
||
'mask' => '<a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . $vRepertoireFichiers . '/pdf/dons/{0}" target="_blank">PDF</a>',
|
||
'multilingue' => 0,
|
||
'label_fr' => 'Reçu',
|
||
'label_en' => 'Receipt'
|
||
)
|
||
);
|
||
} else {
|
||
$strRenvoi = ($strLangue == 'fr') ? "RENVOI" : "RESEND";
|
||
|
||
$arrColonnes = array(
|
||
1 => array(
|
||
'field' => 'epr_categorie,epr_type,epr_nom',
|
||
'align' => 'left',
|
||
'format' => 'race',
|
||
'mask' => '<strong>{0}</strong>{1}{2}',
|
||
'multilingue' => 1,
|
||
'label_fr' => 'Épreuve',
|
||
'label_en' => 'Race'
|
||
),
|
||
2 => array(
|
||
'field' => 'par_nom,par_prenom',
|
||
'align' => 'left',
|
||
'format' => '^particpant',
|
||
'mask' => '{0}, {1}',
|
||
'multilingue' => 0,
|
||
'label_fr' => 'Nom du participant',
|
||
'label_en' => 'Participant\'s name'
|
||
),
|
||
3 => array(
|
||
'field' => '',
|
||
'align' => 'left',
|
||
'format' => 'bib',
|
||
'mask' => '',
|
||
'multilingue' => 0,
|
||
'label_fr' => afficheTexte('promoteur_bib_number', 0),
|
||
'label_en' => afficheTexte('promoteur_bib_number', 0)
|
||
),
|
||
|
||
4 => array(
|
||
'field' => '',
|
||
'align' => 'left',
|
||
'format' => 'details',
|
||
'mask' => '',
|
||
'multilingue' => 0,
|
||
'label_fr' => 'Détails',
|
||
'label_en' => 'Details'
|
||
),5 => array(
|
||
'field' => '',
|
||
'align' => 'left',
|
||
'format' => 'management',
|
||
'mask' => '',
|
||
'multilingue' => 0,
|
||
'label_fr' => 'Gestion',
|
||
'label_en' => 'Management'
|
||
),
|
||
6 => array(
|
||
'field' => '',
|
||
'align' => 'left',
|
||
'format' => 'edit',
|
||
'mask' => '',
|
||
'multilingue' => 0,
|
||
'label_fr' => 'Modifiée',
|
||
'label_en' => 'Modified'
|
||
),
|
||
7 => array(
|
||
'field' => 'no_panier,no_commande',
|
||
'align' => 'left',
|
||
'format' => 'string',// MSIN-3679
|
||
'mask' => '<a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/facture.php?no_panier={0}&lang=' . $strLangue . '" target="_blank">{1}</a><br>',
|
||
'multilingue' => 0,
|
||
'label_fr' => '# commande',
|
||
'label_en' => 'Order #'
|
||
),
|
||
8 => array(
|
||
'field' => 'no_panier,no_commande',
|
||
'align' => 'left',
|
||
'format' => 'confirm',
|
||
'mask' => '<button class="btn btn-primary rounded-0 btn-sm link_confirmation" data-no_panier="{0}" data-no_commande="{1}" data-lng="' . $strLangue . '">' . $strRenvoi . '</button>',
|
||
'multilingue' => 0,
|
||
'label_fr' => 'Confirmation',
|
||
'label_en' => 'Confirmation'
|
||
)
|
||
);
|
||
}
|
||
|
||
return $arrColonnes;
|
||
}
|
||
|
||
function fxSetBibManuel($strAction, $intEvenement, $intNewNoBib, $intEpreuveCommandee, $intEpreuve, $intPartipcipant, $strLangue = 'fr') {
|
||
global $objDatabase;
|
||
$arrRetour = array('state' => 'error');
|
||
|
||
$intEveId = base64_decode(urldecode($intEvenement));
|
||
$_SESSION['promoteur_eve_id'] = base64_decode(urldecode($intEvenement));
|
||
|
||
$sqlEpreuve = "SELECT * FROM inscriptions_epreuves WHERE epr_id = " . intval($intEpreuve);
|
||
$tabEpreuve = $objDatabase->fxGetRow($sqlEpreuve);
|
||
|
||
$strBib = $intNewNoBib;
|
||
$sqlTeam = "SELECT * FROM resultats_participants WHERE pec_id = " . intval($intEpreuveCommandee) . " ORDER BY no_bib";
|
||
$tabTeam = $objDatabase->fxGetResults($sqlTeam);
|
||
|
||
switch($strAction) {
|
||
case 'no_bib':
|
||
if ($tabEpreuve['epr_equipe'] == 0 || ($tabEpreuve['epr_equipe'] == 1 && $tabEpreuve['epr_bib_mode'] == 1)) {
|
||
// verifier si new_no_bib existe
|
||
$sqlNoBib = "SELECT no_bib FROM resultats_participants WHERE no_bib LIKE '%" . "-" . $intNewNoBib . "' AND eve_id = " . intval($intEveId);
|
||
$qryNoBib = $objDatabase->fxGetResults($sqlNoBib);
|
||
|
||
if ($qryNoBib != null) {
|
||
if ($strLangue == 'fr')
|
||
$_SESSION['msg'] = 'p155';
|
||
else
|
||
$_SESSION['msg'] = 'p555';
|
||
}
|
||
|
||
$sqlUpdate = "UPDATE resultats_participants SET par_modification_promoteur = 1, no_bib = '" . fxUnescape($strBib) . "', par_maj = '" . fxGetDateTime() . "' WHERE epr_id = " . intval($intEpreuve) . " AND par_id = " . intval($intPartipcipant);
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
|
||
if (!$qryUpdate) {
|
||
fxcreer_log("Erreur durant assignation manuelle du numero de dossard (" . $intPartipcipant . ")");
|
||
} else {
|
||
$arrRetour['state'] = 'success';
|
||
}
|
||
} elseif($tabEpreuve['epr_equipe'] == 1 && $tabEpreuve['epr_bib_mode'] == 0) {
|
||
$sqlUpdateTeamPart = "UPDATE resultats_participants SET par_modification_promoteur = 1, no_bib = '" . $intNewNoBib . "', par_maj = '" . fxGetDateTime() . "' WHERE par_id = " . intval($intPartipcipant);
|
||
$qryUpdateTeam = $objDatabase->fxQuery($sqlUpdateTeamPart);
|
||
|
||
if (!$qryUpdateTeam) {
|
||
fxcreer_log("Erreur durant assignation manuelle du numero de dossard (" . $intPartipcipant . ")");
|
||
} else {
|
||
$arrRetour['state'] = 'success';
|
||
}
|
||
}
|
||
break;
|
||
case 'no_equipe':
|
||
if ($tabEpreuve['epr_equipe'] == 1 && $strAction == 'no_equipe') {
|
||
// verifier si new_no_bib existe
|
||
$sqlNoBib = "SELECT no_equipe FROM resultats_epreuves_commandees WHERE no_equipe LIKE '%" . $intNewNoBib . "' AND eve_id = " . intval($intEveId);
|
||
$qryNoBib = $objDatabase->fxGetResults($sqlNoBib);
|
||
|
||
if ($qryNoBib != null) {
|
||
if ($strLangue == 'fr')
|
||
$_SESSION['msg'] = 'p156';
|
||
else
|
||
$_SESSION['msg'] = 'p556';
|
||
}
|
||
|
||
if ($strAction == 'no_equipe') {
|
||
// update no_equipe
|
||
$sqlUpdate = "UPDATE resultats_epreuves_commandees SET no_equipe = '" . fxUnescape($strBib) . "' WHERE pec_id_original = " . intval($intEpreuveCommandee);
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
}
|
||
|
||
$intCtr = 1;
|
||
for ($i = 1; $i <= count($tabTeam); $i++) {
|
||
if ($strAction == 'no_equipe' && $tabEpreuve['epr_bib_mode'] == 0) {
|
||
if (intval($tabTeam[$i]['rol_id']) == 1) {
|
||
$sqlUpdatePart = "UPDATE resultats_participants SET par_modification_promoteur = 1, no_bib = " . intval($strBib) * 10 . ", par_maj = '" . fxGetDateTime() . "' WHERE par_id = " . intval($tabTeam[$i]['par_id']);
|
||
} else {
|
||
$sqlUpdatePart = "UPDATE resultats_participants SET par_modification_promoteur = 1, no_bib = '" . $strBib . $intCtr . "', par_maj = '" . fxGetDateTime() . "' WHERE par_id = " . intval($tabTeam[$i]['par_id']);
|
||
$intCtr++;
|
||
}
|
||
|
||
$qryUpdatePart = $objDatabase->fxQuery($sqlUpdatePart);
|
||
|
||
if (!$qryUpdate) {
|
||
fxcreer_log("Erreur durant assignation manuelle du numero d'équipe (" . $intEpreuveCommandee . ")");
|
||
}
|
||
} else {
|
||
$sqlUpdatePart = "UPDATE resultats_participants SET par_modification_promoteur = 1, no_bib = '" . $strBib . "', par_maj = '" . fxGetDateTime() . "' WHERE par_id = " . intval($tabTeam[$i]['par_id']);
|
||
$qryUpdatePart = $objDatabase->fxQuery($sqlUpdatePart);
|
||
|
||
if (!$qryUpdatePart) {
|
||
fxcreer_log("Erreur durant assignation manuelle du numero de dossard (" . $intPartipcipant . ")");
|
||
}
|
||
}
|
||
}
|
||
|
||
if (!$qryUpdate) {
|
||
fxcreer_log("Erreur durant assignation manuelle du numero d'équipe (" . $intEpreuveCommandee . ")");
|
||
} else {
|
||
$arrRetour['state'] = 'success';
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
|
||
return $arrRetour;
|
||
}
|
||
|
||
function fxShowTeammates($intEvenement, $intEpreuve, $intEpreuveCommandee) {
|
||
$arrRetour = array('state' => 'error');
|
||
|
||
$tabEquipe = fxGetMembresEquipe($intEvenement, $intEpreuveCommandee, $intEpreuve, 0, 1);
|
||
|
||
if ($tabEquipe != null) {
|
||
$arrRetour['state'] = 'success';
|
||
$arrRetour['team'] = fxUnescape($tabEquipe[1]['pec_nom_equipe']);
|
||
$strMembers = '';
|
||
|
||
for ($i = 1; $i <= count($tabEquipe); $i++) {
|
||
$strMembers .= '
|
||
<div class="form-group row">
|
||
<label for="txt_no_bib_tm_' . $tabEquipe[$i]['par_id'] . '" class="col-md-4 col-form-label">
|
||
' . fxUnescape($tabEquipe[$i]['par_prenom']) . ' ' . fxUnescape($tabEquipe[$i]['par_nom']) . '
|
||
</label>
|
||
<div class="col-10 col-md-6">
|
||
<input class="form-control form-control-sm rounded-0" type="number" id="txt_no_bib_p' . $tabEquipe[$i]['par_id'] . '" name="txt_no_bib_' . $tabEquipe[$i]['par_id'] . '" min="0" required value="' . $tabEquipe[$i]["no_bib"] . '">
|
||
</div>
|
||
<div class="col-2">
|
||
<button class="btn btn_bib btn-sm btn-primary rounded-0" type="button" data-action="no_bib" data-eve_id="' . urlencode(base64_encode($tabEquipe[$i]['eve_id'])) . '" data-epr_id="' . $tabEquipe[$i]['epr_id'] . '" data-par_id="' . $tabEquipe[$i]['par_id'] . '" data-pec_id="' . $tabEquipe[$i]['pec_id_original'] . '" id="btn_no_bib_' . $tabEquipe[$i]['par_id'] . '" name="btn_no_bib_' . $tabEquipe[$i]['par_id'] . '" data-toggle="tooltip" title="' . afficheTexte('promoteur_bib_tip', 0) . '">OK</button>
|
||
</div>
|
||
</div>
|
||
';
|
||
}
|
||
|
||
$arrRetour['members'] = $strMembers;
|
||
}
|
||
|
||
return $arrRetour;
|
||
}
|
||
function fxGetQuantitesEvenement($intEpreuve) {
|
||
global $objDatabase;
|
||
$arrRetour = array();
|
||
$intTotalOriginal = $intTotalAvailable = $intTotalBooked = $intTotalCurrent = $intTotalAjustement = 0;
|
||
|
||
// récupérer toutes les épreuves de l'événement de $intEpreuve
|
||
$sqlEpreuves = "SELECT epr_id FROM inscriptions_epreuves WHERE eve_id = (SELECT DISTINCT eve_id FROM inscriptions_epreuves WHERE epr_id = " . intval($intEpreuve) . ") AND epr_actif = 1";
|
||
$arrEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
||
|
||
if ($arrEpreuves != null) {
|
||
for ($intCtr = 1; $intCtr <= count($arrEpreuves); $intCtr++) {
|
||
$tabEpreuve = fxGetEpreuve($arrEpreuves[$intCtr]['epr_id']);
|
||
|
||
$sqlInscriptions = 'select p.no_bib, p.par_id, p.par_prenom, p.par_nom, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id, e.no_commande, e.no_panier, e.no_equipe from resultats_epreuves_commandees e, resultats_participants p where p.is_cancelled = 0 AND p.epr_id = ' . intval($tabEpreuve['epr_id']) . ' AND p.epr_id = e.epr_id and p.pec_id = e.pec_id_original group by e.pec_id_original';
|
||
$tabInscriptions = $objDatabase->fxGetResults($sqlInscriptions);
|
||
$intNbInscriptions = count($tabInscriptions);
|
||
|
||
$intTotalOriginal += $tabEpreuve['epr_qte_origine'];
|
||
$intTotalAvailable += $tabEpreuve['epr_qte'];
|
||
$intTotalBooked += $intNbInscriptions;
|
||
$intTotalCurrent += intval($intNbInscriptions) + intval($tabEpreuve['epr_qte']);
|
||
$intTotalAjustement += intval($intNbInscriptions) + intval($tabEpreuve['epr_qte']) - intval($tabEpreuve['epr_qte_origine']);
|
||
$checkin=fxGetCheckinqte($arrEpreuves[$intCtr]['epr_id']);
|
||
$arrRetour[$arrEpreuves[$intCtr]['epr_id']] = array(
|
||
'qte_origine' => intval($tabEpreuve['epr_qte_origine']),
|
||
'qte_restante' => intval($tabEpreuve['epr_qte']),
|
||
'qte_inscrits' => intval($intNbInscriptions),
|
||
'qte_courante' => intval($intNbInscriptions) + intval($tabEpreuve['epr_qte']),
|
||
'qte_ajustement' => intval($intNbInscriptions) + intval($tabEpreuve['epr_qte']) - intval($tabEpreuve['epr_qte_origine']),
|
||
'qte_checkin' => intval($checkin)
|
||
);
|
||
}
|
||
|
||
|
||
$arrRetour['total'] = array(
|
||
'qte_origine_total' => $intTotalOriginal,
|
||
'qte_restante_total' => $intTotalAvailable,
|
||
'qte_inscrits_total' => $intTotalBooked,
|
||
'qte_courante_total' => $intTotalCurrent,
|
||
'qte_ajustement_total' => $intTotalAjustement
|
||
);
|
||
}
|
||
|
||
return $arrRetour;
|
||
}
|
||
function fxGetQuantites($intEpreuve) {
|
||
global $objDatabase;
|
||
|
||
$tabEpreuve = fxGetEpreuve($intEpreuve);
|
||
|
||
$sqlCommandees = "SELECT COUNT(*) FROM inscriptions_panier_epreuves_commandees e, inscriptions_panier_acheteurs a WHERE e.epr_id = " . intval($tabEpreuve['epr_id']) . " AND e.no_panier = a.no_panier AND a.sta_id = 3";
|
||
$intQteCommandees = $objDatabase->fxGetVar($sqlCommandees);
|
||
|
||
$sqlInscriptions = 'select p.no_bib, p.par_id, p.par_prenom, p.par_nom, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id, e.no_commande, e.no_panier, e.no_equipe from resultats_epreuves_commandees e, resultats_participants p where p.is_cancelled = 0 AND p.epr_id = ' . intval($intEpreuve) . ' AND p.epr_id = e.epr_id and p.pec_id = e.pec_id_original group by e.pec_id_original';
|
||
$tabInscriptions = $objDatabase->fxGetResults($sqlInscriptions);
|
||
$intNbInscriptions = count($tabInscriptions);
|
||
|
||
$arrRetour = array(
|
||
'qte_origine' => intval($tabEpreuve['epr_qte_origine']),
|
||
'qte_restante' => intval($tabEpreuve['epr_qte']),
|
||
'qte_inscrits' => intval($intNbInscriptions),
|
||
'qte_courante' => intval($intNbInscriptions) + intval($tabEpreuve['epr_qte']),
|
||
'qte_ajustement' => intval($intNbInscriptions) + intval($tabEpreuve['epr_qte']) - intval($tabEpreuve['epr_qte_origine'])
|
||
);
|
||
|
||
return $arrRetour;
|
||
}
|
||
function fxUpdateQuantites($intEpreuve, $intQuantite, $strLangue) {
|
||
global $objDatabase;
|
||
$arrRetour = array('state' => 'error');
|
||
|
||
if ($intQuantite >= 0) {
|
||
$tabEpreuve = fxGetEpreuve($intEpreuve);
|
||
$intDifference = $intQuantite - $tabEpreuve['epr_qte'];
|
||
|
||
$sqlUpdate = "UPDATE inscriptions_epreuves SET epr_qte_ajoutee = epr_qte_ajoutee + " . intval($intDifference) . ", epr_qte = epr_qte + " . intval($intDifference) . " WHERE epr_id = " . intval($intEpreuve);
|
||
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
||
|
||
if ($qryUpdate) {
|
||
if($strLangue == 'fr')
|
||
$_SESSION['msg'] = 'p154';
|
||
else
|
||
$_SESSION['msg'] = 'p554';
|
||
}
|
||
|
||
$arrRetour['data'] = fxGetQuantitesEvenement($intEpreuve);
|
||
$arrRetour['state'] = 'success';
|
||
}
|
||
|
||
return $arrRetour;
|
||
}
|
||
|
||
|
||
// v2
|
||
function renderBatchConfig($tabBibAssignments, $strLangue = 'fr') {
|
||
|
||
ob_start();
|
||
?>
|
||
|
||
<div class="batch-config">
|
||
|
||
<!-- ORDRE -->
|
||
<div class="mb-2">
|
||
<label>Ordre d’assignation</label>
|
||
<select class="form-control form-control-sm batch-order">
|
||
<?php for ($j = 1; $j < count($tabBibAssignments)+1; $j++) { ?>
|
||
<option value="<?php echo $tabBibAssignments[$j]['ba_id']; ?>">
|
||
<?php echo $tabBibAssignments[$j]['ba_nom_' . $strLangue]; ?>
|
||
</option>
|
||
<?php } ?>
|
||
</select>
|
||
</div>
|
||
|
||
<!-- OPTION -->
|
||
<div class="mb-2">
|
||
<?php /* OPTION LAST TEMPORAIREMENT DÉSACTIVÉE
|
||
<label>
|
||
<input type="checkbox" class="batch-last">
|
||
Commencer à partir de la dernière assignation
|
||
</label>
|
||
*/ ?>
|
||
</div>
|
||
|
||
<!-- ANALYSE -->
|
||
<div class="batch-info text-muted small">
|
||
Analyse à venir...
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<?php
|
||
|
||
return ob_get_clean();
|
||
}
|
||
|
||
function fxShowBibTool4($str_code, $int_eve_id, $strLangue){
|
||
global $objDatabase, $vDomaine;
|
||
|
||
$sqlEpreuves = "SELECT * FROM inscriptions_epreuves e WHERE e.eve_id = " . intval($int_eve_id) . " AND epr_actif = 1 ORDER BY epr_id";
|
||
$tabEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
||
|
||
$sqlBibAssignments = "SELECT * FROM bib_assignements WHERE ba_actif = 1 ORDER BY ba_tri";
|
||
$tabBibAssignments = $objDatabase->fxGetResults($sqlBibAssignments);
|
||
|
||
?>
|
||
|
||
<div class="card-header">
|
||
<h2><?php afficheTexte('promoteur_bib_tool')?></h2>
|
||
</div>
|
||
|
||
<div id="module-bib" class="epr-wrapper">
|
||
|
||
<?php for($i = 1; $i <= count($tabEpreuves); $i++){ ?>
|
||
|
||
<?php
|
||
$strClass = ($i & 1) ? '' : 'bg-light';
|
||
|
||
// $sqlBibRanges = "SELECT *
|
||
// FROM inscriptions_epreuves_bib
|
||
// WHERE epr_id = " . intval($tabEpreuves[$i]['epr_id']) . "
|
||
// ORDER BY epr_bib_start";
|
||
|
||
// $tabBibRanges = $objDatabase->fxGetResults($sqlBibRanges);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
$tabBibStats=fxInfosBibRange(intval($tabEpreuves[$i]['epr_id']));
|
||
$infoBib = fxInfosBibEpreuve(intval($tabEpreuves[$i]['epr_id']));
|
||
|
||
|
||
|
||
|
||
?>
|
||
|
||
<div class="epr-row <?php echo $strClass ?>"
|
||
data-epr-id="<?php echo (int)$tabEpreuves[$i]['epr_id']; ?>">
|
||
<!-- GAUCHE -->
|
||
<div class="epr-block">
|
||
<div class="epr-header">Épreuve</div>
|
||
<div class="epr-content">
|
||
|
||
<?php
|
||
if (trim($tabEpreuves[$i]['epr_categorie_' . $strLangue]) != '') {
|
||
echo $tabEpreuves[$i]['epr_categorie_' . $strLangue] . "<br>";
|
||
}
|
||
|
||
echo $tabEpreuves[$i]['epr_type_' . $strLangue];
|
||
|
||
if (trim($tabEpreuves[$i]['epr_nom_' . $strLangue]) != '') {
|
||
echo "<br>" . $tabEpreuves[$i]['epr_nom_' . $strLangue];
|
||
}
|
||
?>
|
||
|
||
<br>
|
||
|
||
<div style="color:#ffa200; font-weight: bold">
|
||
<?php
|
||
|
||
|
||
if($tabEpreuves[$i]['epr_equipe'] == 1)
|
||
afficheTexte('promoteur_epr_equipe');
|
||
else
|
||
afficheTexte('promoteur_epr_solo')?>
|
||
|
||
|
||
<?php if ((int)$tabEpreuves[$i]['epr_equipe'] === 1) {
|
||
|
||
$teamMode = (int)$tabEpreuves[$i]['epr_bib_team_mode'];
|
||
$lockTeamMode = ((int)$infoBib['avec_bib'] > 0);
|
||
if ($teamMode <= 0) {
|
||
$teamMode = 1;
|
||
}
|
||
|
||
|
||
|
||
?>
|
||
|
||
<div class="team-mode-box"
|
||
data-epr-id="<?php echo (int)$tabEpreuves[$i]['epr_id']; ?>">
|
||
|
||
<div class="team-mode-title">
|
||
Méthode d’assignation
|
||
</div>
|
||
|
||
<label class="team-mode-option">
|
||
<input type="radio"
|
||
name="team_mode_<?php echo (int)$tabEpreuves[$i]['epr_id']; ?>"
|
||
value="1"
|
||
<?php echo ($lockTeamMode ? 'disabled' : ''); ?>
|
||
<?php echo ($teamMode === 1 ? 'checked' : ''); ?>>
|
||
|
||
<span>Dossards individuels</span>
|
||
</label>
|
||
|
||
<label class="team-mode-option">
|
||
<input type="radio"
|
||
name="team_mode_<?php echo (int)$tabEpreuves[$i]['epr_id']; ?>"
|
||
value="3"
|
||
<?php echo ($lockTeamMode ? 'disabled' : ''); ?>
|
||
<?php echo ($teamMode === 3 ? 'checked' : ''); ?>>
|
||
|
||
<span>1 équipe = 1 dossard</span>
|
||
</label>
|
||
|
||
<label class="team-mode-option disabled">
|
||
<input type="radio" disabled>
|
||
<span>Dossards individuels par équipe<br>(bientôt)</span>
|
||
</label>
|
||
|
||
</div>
|
||
|
||
<?php } ?>
|
||
</div>
|
||
<div>
|
||
<span class="bib-total"><?php echo $infoBib['total'] ?></span>
|
||
<?php afficheTexte('promoteur_qte_epr_qte_ordered')?>
|
||
</div>
|
||
|
||
<div>
|
||
<span class="bib-avec"><?php echo $infoBib['avec_bib'] ?></span>
|
||
<?php afficheTexte('promoteur_qte_epr_qte_orderedavec_bib')?>
|
||
</div>
|
||
</div>
|
||
|
||
<button type="button"
|
||
class="btn btn-sm btn-secondary btn-view-range"
|
||
data-epr-id="<?php echo (int)$tabEpreuves[$i]["epr_id"]; ?>"
|
||
data-range-id="0">
|
||
<i class="fa fa-eye"></i>
|
||
</button>
|
||
</div>
|
||
|
||
<!-- CENTRE -->
|
||
<div class="epr-block">
|
||
<div class="epr-header">Séquences de dossard</div>
|
||
|
||
<?php if (count($tabBibStats) == 0) { ?>
|
||
|
||
<div class="epr-content bib-container">
|
||
<button type="button"
|
||
class="btn btn-success btn-sm btn-add-range"
|
||
data-epr-id="<?php echo $tabEpreuves[$i]['epr_id']; ?>">
|
||
+
|
||
</button>
|
||
</div>
|
||
|
||
<?php } else { ?>
|
||
<div class="epr-content">
|
||
|
||
<div class="epr-line">
|
||
<div>Début</div>
|
||
<div>Fin</div>
|
||
<div>OK</div>
|
||
<div>Suppr</div>
|
||
<div>Last</div>
|
||
<div>Utilisé</div>
|
||
<div>Dispo</div>
|
||
<div></div>
|
||
</div>
|
||
|
||
<?php echo renderBibRanges($tabBibStats, $tabEpreuves[$i]['epr_id']); ?>
|
||
|
||
</div>
|
||
|
||
|
||
<?php } ?>
|
||
|
||
</div>
|
||
|
||
<!-- DROITE -->
|
||
<!-- DROITE -->
|
||
<div class="epr-block">
|
||
<div class="epr-header">Actions</div>
|
||
<div class="epr-content epr-actions">
|
||
|
||
<button type="button" class="btn btn-sm btn-secondary btn-assign-batch">Assigner batch</button>
|
||
<button type="button"
|
||
class="btn btn-sm btn-danger btn-reset"
|
||
style="<?php echo ((int)$infoBib['avec_bib'] > 0 ? '' : 'display:none;'); ?>">
|
||
Réinitialiser
|
||
</button>
|
||
<button type="button" class="btn btn-sm btn-secondary btn-auto">Activer automatique</button>
|
||
|
||
|
||
<div class="batch-config-container" style="display:none;">
|
||
<?php echo renderBatchConfig($tabBibAssignments, $strLangue); ?>
|
||
|
||
<button type="button" class="btn btn-sm btn-secondary btn-simuler-batch" style="display:none;">
|
||
Simuler
|
||
</button>
|
||
|
||
<button type="button" class="btn btn-sm btn-success btn-go-batch" style="display:none;">
|
||
GO
|
||
</button>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<?php } ?>
|
||
|
||
</div>
|
||
|
||
<?php
|
||
}
|
||
function fxInfosBibRange($epr_id = 0, $epr_bib_id = 0){
|
||
global $objDatabase, $vDomaine;
|
||
|
||
$where = [];
|
||
|
||
if ((int)$epr_id > 0) {
|
||
$where[] = "b.epr_id = " . intval($epr_id);
|
||
}
|
||
|
||
if ((int)$epr_bib_id > 0) {
|
||
$where[] = "b.epr_bib_id = " . intval($epr_bib_id);
|
||
}
|
||
|
||
if (empty($where)) {
|
||
return [];
|
||
}
|
||
|
||
$where_sql = implode(' AND ', $where);
|
||
|
||
$sqlBibStats = "
|
||
SELECT
|
||
b.epr_bib_id,
|
||
b.epr_id,
|
||
b.epr_bib_start,
|
||
b.epr_bib_finish,
|
||
|
||
COUNT(p.no_bib) AS nb_utilises,
|
||
MAX(p.no_bib) AS dernier_bib,
|
||
|
||
(b.epr_bib_finish - b.epr_bib_start + 1) AS nb_total_range,
|
||
|
||
(
|
||
SELECT COUNT(*)
|
||
FROM (
|
||
SELECT
|
||
(n1.N + n2.N * 10 + n3.N * 100 + n4.N * 1000) AS num
|
||
FROM
|
||
(SELECT 0 N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
|
||
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) n1
|
||
CROSS JOIN
|
||
(SELECT 0 N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
|
||
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) n2
|
||
CROSS JOIN
|
||
(SELECT 0 N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
|
||
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) n3
|
||
CROSS JOIN
|
||
(SELECT 0 N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
|
||
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) n4
|
||
) t
|
||
WHERE t.num BETWEEN b.epr_bib_start AND IFNULL((
|
||
SELECT MAX(rp.no_bib)
|
||
FROM resultats_participants rp
|
||
WHERE rp.epr_id = b.epr_id
|
||
AND rp.no_bib BETWEEN b.epr_bib_start AND b.epr_bib_finish
|
||
), b.epr_bib_start - 1)
|
||
AND t.num NOT IN (
|
||
SELECT rp.no_bib
|
||
FROM resultats_participants rp
|
||
WHERE rp.epr_id = b.epr_id
|
||
)
|
||
) AS nb_trous,
|
||
|
||
(
|
||
SELECT GROUP_CONCAT(t.num ORDER BY t.num SEPARATOR ',')
|
||
FROM (
|
||
SELECT
|
||
(n1.N + n2.N * 10 + n3.N * 100 + n4.N * 1000) AS num
|
||
FROM
|
||
(SELECT 0 N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
|
||
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) n1
|
||
CROSS JOIN
|
||
(SELECT 0 N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
|
||
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) n2
|
||
CROSS JOIN
|
||
(SELECT 0 N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
|
||
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) n3
|
||
CROSS JOIN
|
||
(SELECT 0 N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
|
||
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) n4
|
||
) t
|
||
WHERE t.num BETWEEN b.epr_bib_start AND IFNULL((
|
||
SELECT MAX(rp.no_bib)
|
||
FROM resultats_participants rp
|
||
WHERE rp.epr_id = b.epr_id
|
||
AND rp.no_bib BETWEEN b.epr_bib_start AND b.epr_bib_finish
|
||
), b.epr_bib_start - 1)
|
||
AND t.num NOT IN (
|
||
SELECT rp.no_bib
|
||
FROM resultats_participants rp
|
||
WHERE rp.epr_id = b.epr_id
|
||
)
|
||
) AS liste_trous,
|
||
|
||
(
|
||
SELECT GROUP_CONCAT(DISTINCT rp.no_bib ORDER BY rp.no_bib SEPARATOR ',')
|
||
FROM resultats_participants rp
|
||
WHERE rp.epr_id = b.epr_id
|
||
AND rp.no_bib BETWEEN b.epr_bib_start AND b.epr_bib_finish
|
||
AND (
|
||
SELECT COUNT(*)
|
||
FROM resultats_participants rp2
|
||
WHERE rp2.epr_id = rp.epr_id
|
||
AND rp2.no_bib = rp.no_bib
|
||
) > 1
|
||
) AS liste_doublons
|
||
|
||
FROM inscriptions_epreuves_bib b
|
||
|
||
LEFT JOIN resultats_participants p
|
||
ON p.epr_id = b.epr_id
|
||
AND p.no_bib BETWEEN b.epr_bib_start AND b.epr_bib_finish
|
||
|
||
WHERE $where_sql
|
||
AND b.epr_bib_start IS NOT NULL
|
||
AND b.epr_bib_finish IS NOT NULL
|
||
|
||
GROUP BY
|
||
b.epr_bib_id,
|
||
b.epr_id,
|
||
b.epr_bib_start,
|
||
b.epr_bib_finish
|
||
|
||
ORDER BY b.epr_bib_start
|
||
";
|
||
|
||
return $objDatabase->fxGetResults($sqlBibStats);
|
||
}
|
||
function fxInfosBibEpreuve($epr_id){
|
||
global $objDatabase;
|
||
|
||
$epr_id = intval($epr_id);
|
||
|
||
if ($epr_id <= 0) {
|
||
return [
|
||
'total' => 0,
|
||
'avec_bib' => 0,
|
||
'sans_bib' => 0
|
||
];
|
||
}
|
||
|
||
$sql = "
|
||
SELECT
|
||
COUNT(*) AS total,
|
||
SUM(CASE WHEN no_bib IS NOT NULL AND no_bib > 0 THEN 1 ELSE 0 END) AS avec_bib,
|
||
SUM(CASE WHEN no_bib IS NULL OR no_bib = 0 THEN 1 ELSE 0 END) AS sans_bib
|
||
FROM resultats_participants
|
||
WHERE epr_id = $epr_id
|
||
AND is_cancelled = 0
|
||
";
|
||
|
||
$row = $objDatabase->fxGetRow($sql);
|
||
|
||
return [
|
||
'total' => (int)($row['total'] ?? 0),
|
||
'avec_bib' => (int)($row['avec_bib'] ?? 0),
|
||
'sans_bib' => (int)($row['sans_bib'] ?? 0)
|
||
];
|
||
}
|
||
function renderBibRanges($tabBibRanges, $epr_id = 0, $mode = 'assign') {
|
||
//print_rsl($tabBibRanges);
|
||
if (!is_array($tabBibRanges)) {
|
||
$tabBibRanges = [];
|
||
}
|
||
|
||
if ((int)$epr_id <= 0 && !empty($tabBibRanges[0]['epr_id'])) {
|
||
$epr_id = (int)$tabBibRanges[0]['epr_id'];
|
||
}
|
||
|
||
ob_start();
|
||
?>
|
||
|
||
|
||
|
||
<!-- HEADER -->
|
||
|
||
|
||
<div class="epr-table bib-container">
|
||
|
||
<?php
|
||
|
||
|
||
foreach ($tabBibRanges as $range) {
|
||
|
||
$start = (int)($range['epr_bib_start'] ?? 0);
|
||
$end = (int)($range['epr_bib_finish'] ?? 0);
|
||
|
||
$last = (isset($range['dernier_bib']) && is_numeric($range['dernier_bib']))
|
||
? (int)$range['dernier_bib']
|
||
: 0;
|
||
|
||
// =====================
|
||
// DISPO POUR ASSIGNATION (SANS TROUS AVANT)
|
||
// =====================
|
||
$nb_total = (int)($range['nb_total_range'] ?? 0);
|
||
$nb_utilises = (int)($range['nb_utilises'] ?? 0);
|
||
|
||
$mem_dispo = max(0, $nb_total - $nb_utilises);
|
||
|
||
|
||
?>
|
||
|
||
<div class="bib-range epr-line" data-id="<?php echo $range['epr_bib_id']; ?>">
|
||
|
||
<input type="number"
|
||
class="form-control form-control-sm bib-start"
|
||
value="<?php echo $range['epr_bib_start']; ?>">
|
||
|
||
<input type="number"
|
||
class="form-control form-control-sm bib-end"
|
||
value="<?php echo $range['epr_bib_finish']; ?>">
|
||
|
||
<button type="button"
|
||
class="btn btn-sm btn-primary btn-save-range"
|
||
data-id="<?php echo $range['epr_bib_id']; ?>"
|
||
data-epr-id="<?php echo (int)$epr_id; ?>">
|
||
OK
|
||
</button>
|
||
<?php if ((int)$range['epr_bib_id'] > 0) { ?>
|
||
<button type="button"
|
||
class="btn btn-sm btn-danger btn-delete-range"
|
||
data-id="<?php echo $range['epr_bib_id']; ?>">
|
||
<i class="fa fa-trash"></i>
|
||
</button>
|
||
<?php } else { ?>
|
||
<div></div>
|
||
<?php } ?>
|
||
<div style="text-align:center;"><?php echo $range['dernier_bib']; ?></div>
|
||
|
||
<div style="text-align:center;"><?php echo $range['nb_utilises']; ?></div>
|
||
<div class="bib-dispo" data-dispo="<?php echo $mem_dispo; ?>" style="text-align:center;">
|
||
<?php echo $mem_dispo; ?>
|
||
</div>
|
||
|
||
|
||
<div class="batch-checkbox" style="text-align:center;">
|
||
|
||
<?php
|
||
|
||
$showCheckbox = false;
|
||
|
||
if (
|
||
$mode === 'assign'
|
||
&& $mem_dispo > 0
|
||
&& (int)$range['epr_bib_id'] > 0
|
||
) {
|
||
$showCheckbox = true;
|
||
}
|
||
|
||
if (
|
||
$mode === 'reset'
|
||
&& (int)$range['nb_utilises'] > 0
|
||
&& (int)$range['epr_bib_id'] > 0
|
||
) {
|
||
$showCheckbox = true;
|
||
}
|
||
|
||
?>
|
||
|
||
<?php if ($showCheckbox) { ?>
|
||
<input type="checkbox"
|
||
class="batch-select-range"
|
||
data-range-id="<?php echo (int)$range['epr_bib_id']; ?>">
|
||
<?php } ?>
|
||
|
||
</div>
|
||
|
||
|
||
<?php if ((int)$range['epr_bib_id'] > 0) { ?>
|
||
<button type="button"
|
||
class="btn btn-sm btn-secondary btn-view-range"
|
||
data-epr-id="<?php echo (int)$epr_id; ?>"
|
||
data-range-id="<?php echo (int)$range['epr_bib_id']; ?>">
|
||
<i class="fa fa-eye"></i>
|
||
</button>
|
||
<?php } else { ?>
|
||
<div></div>
|
||
<?php } ?>
|
||
</div>
|
||
|
||
<div class="bib-error text-danger small mb-2" style="<?php echo (!empty($range['liste_trous']) || !empty($range['liste_doublons'])) ? 'display:block;' : 'display:none;'; ?>">
|
||
<?php if (!empty($range['liste_trous'])) { ?>
|
||
<div>Dossards non utilisés : <?php echo $range['liste_trous']; ?></div>
|
||
<?php } ?>
|
||
|
||
<?php if (!empty($range['liste_doublons'])) { ?>
|
||
<div>Dossards en double : <?php echo $range['liste_doublons']; ?></div>
|
||
<?php } ?>
|
||
</div>
|
||
|
||
<?php } ?>
|
||
|
||
<div class="bib-error-global text-danger small mb-2" style="display:none;"></div>
|
||
|
||
<div class="epr-line">
|
||
<button type="button"
|
||
class="btn btn-success btn-sm btn-add-range"
|
||
style="grid-column:1 / 3;"
|
||
data-epr-id="<?php echo (int)$epr_id; ?>">
|
||
+
|
||
</button>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<?php
|
||
return ob_get_clean();
|
||
}
|
||
|
||
function renderBibView(
|
||
$epr_id,
|
||
$range_id = 0,
|
||
$strLangue = 'fr', // ✔️ on garde
|
||
$mode = 'db',
|
||
$data = [],
|
||
$title = '',
|
||
$info_text = '',
|
||
$status = 'default' // ← AJOUT
|
||
) {
|
||
global $objDatabase;
|
||
|
||
// =====================
|
||
// 1. GET RANGE
|
||
// =====================
|
||
$hasRange = intval($range_id) > 0;
|
||
|
||
if ($hasRange) {
|
||
|
||
$sqlRange = "
|
||
SELECT *
|
||
FROM inscriptions_epreuves_bib
|
||
WHERE epr_bib_id = " . intval($range_id);
|
||
|
||
$range = $objDatabase->fxGetRow($sqlRange);
|
||
|
||
if (!$range) {
|
||
return '<div class="epr-row-view">Range introuvable</div>';
|
||
}
|
||
|
||
$start = (int)$range['epr_bib_start'];
|
||
$end = (int)$range['epr_bib_finish'];
|
||
}
|
||
|
||
|
||
// =====================
|
||
// 2. GET EPREUVE
|
||
// =====================
|
||
$sqlEpreuve = "
|
||
SELECT *
|
||
FROM inscriptions_epreuves
|
||
WHERE epr_id = " . intval($epr_id);
|
||
|
||
$tabEpreuve = $objDatabase->fxGetRow($sqlEpreuve);
|
||
|
||
if (!$tabEpreuve) {
|
||
return '<div class="epr-row-view">Épreuve introuvable</div>';
|
||
}
|
||
|
||
// =====================
|
||
// 3. GET PARTICIPANTS (DB ou SIMULATION)
|
||
// =====================
|
||
|
||
if (!empty($data)) {
|
||
|
||
$tabParticipants = $data;
|
||
|
||
} else {
|
||
|
||
// DB
|
||
|
||
// 👉 mode normal (DB)
|
||
$sqlParticipants = "
|
||
SELECT
|
||
p.*,
|
||
c.pec_nom_equipe,
|
||
c.no_equipe
|
||
FROM resultats_participants p
|
||
LEFT JOIN resultats_epreuves_commandees c
|
||
ON c.pec_id_original = p.pec_id
|
||
AND c.epr_id = p.epr_id
|
||
WHERE p.is_cancelled = 0
|
||
AND p.epr_id = " . intval($epr_id) . "
|
||
" . ($hasRange ? "AND p.no_bib BETWEEN $start AND $end" : "") . "
|
||
ORDER BY p.no_bib";
|
||
|
||
$tabParticipants = $objDatabase->fxGetResults($sqlParticipants);
|
||
}
|
||
|
||
ob_start();
|
||
?>
|
||
|
||
<div class="epr-row-view" style="width:100%; background:#f8f9fa; padding:15px;">
|
||
|
||
<div class="bib-view <?php echo ((int)$tabEpreuve['epr_equipe'] === 1 ? 'team-mode' : ''); ?>">
|
||
<div class="bib-view-range">
|
||
|
||
<?php
|
||
// =====================
|
||
// TITRE DYNAMIQUE
|
||
// =====================
|
||
if ($title != '') {
|
||
|
||
echo $title;
|
||
|
||
} else {
|
||
|
||
if ($hasRange) {
|
||
echo 'Séquence de dossards : <strong>' . $start . ' à ' . $end . '</strong>';
|
||
} else {
|
||
echo 'Tous les inscriptions pour cette épreuve';
|
||
}
|
||
}
|
||
?>
|
||
|
||
</div>
|
||
|
||
<?php if ($info_text != '') { ?>
|
||
<div class="bib-view-info info-<?php echo $status; ?>">
|
||
<?php echo $info_text; ?>
|
||
</div>
|
||
<?php } ?>
|
||
<!-- HEADER -->
|
||
<div class="bib-view-header">
|
||
|
||
<div>Épreuve</div>
|
||
|
||
<div>Participant</div>
|
||
|
||
<?php if ((int)$tabEpreuve['epr_equipe'] === 1) { ?>
|
||
<div>Équipe</div>
|
||
<?php } ?>
|
||
|
||
<div>Numéro du participant</div>
|
||
|
||
</div>
|
||
|
||
<?php if (!empty($tabParticipants)) { ?>
|
||
|
||
<?php foreach ($tabParticipants as $p) {
|
||
|
||
if ($p['rol_id'] == 3 || $p['rol_id'] == 4) {
|
||
continue;
|
||
}
|
||
?>
|
||
|
||
<div class="bib-view-row">
|
||
|
||
<!-- Épreuve -->
|
||
<div class="bib-view-race">
|
||
<?php
|
||
if ($tabEpreuve['epr_nom_' . $strLangue] != '')
|
||
echo $tabEpreuve['epr_nom_' . $strLangue] . "<br>";
|
||
|
||
if ($tabEpreuve['epr_type_' . $strLangue] != '')
|
||
echo $tabEpreuve['epr_type_' . $strLangue];
|
||
|
||
echo " (" . $tabEpreuve['epr_id'] . ")";
|
||
?>
|
||
</div>
|
||
|
||
<!-- Participant -->
|
||
<div class="bib-view-name">
|
||
<?php echo $p['par_prenom'] . ' ' . $p['par_nom'] ?>
|
||
</div>
|
||
<?php if ((int)$tabEpreuve['epr_equipe'] === 1) { ?>
|
||
|
||
<div class="bib-view-team">
|
||
|
||
<?php
|
||
echo $p['pec_nom_equipe'];
|
||
|
||
if ((int)$p['rol_id'] === 1) {
|
||
echo ' (C)';
|
||
}
|
||
?>
|
||
|
||
</div>
|
||
|
||
<?php } ?>
|
||
<!-- Numéro -->
|
||
<div class="bib-view-number">
|
||
<?php echo $p['no_bib']; ?>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<?php } ?>
|
||
|
||
<?php } else { ?>
|
||
|
||
<div class="bib-view-empty">
|
||
Aucun participant dans ce range
|
||
</div>
|
||
|
||
<?php } ?>
|
||
|
||
<!-- FOOTER -->
|
||
<div class="bib-view-footer">
|
||
<button type="button" class="btn btn-sm btn-secondary btn-close-view">
|
||
Fermer
|
||
</button>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<?php
|
||
return ob_get_clean();
|
||
}
|
||
function fxGetParticipantsForBatchAssign($epr_id, $ba_id) {
|
||
global $objDatabase;
|
||
|
||
$epr_id = intval($epr_id);
|
||
$ba_id = intval($ba_id);
|
||
|
||
// =====================
|
||
// VALIDATION DE BASE
|
||
// =====================
|
||
if ($epr_id <= 0 || $ba_id <= 0) {
|
||
return [];
|
||
}
|
||
|
||
// =====================
|
||
// RÉCUPÉRER L'ORDER BY DYNAMIQUE
|
||
// Source : table bib_assignements
|
||
// =====================
|
||
$sqlOrder = "
|
||
SELECT ba_sql_order
|
||
FROM bib_assignements
|
||
WHERE ba_id = $ba_id
|
||
AND ba_actif = 1
|
||
LIMIT 1
|
||
";
|
||
|
||
$orderBy = trim((string)$objDatabase->fxGetVar($sqlOrder));
|
||
|
||
// =====================
|
||
// SÉCURITÉ / FALLBACK
|
||
// Si aucun ordre valide, on garde un ordre stable.
|
||
// =====================
|
||
if ($orderBy == '') {
|
||
$orderBy = "p.par_nom, p.par_prenom";
|
||
}
|
||
|
||
// =====================
|
||
// PARTICIPANTS SOLO À ASSIGNER
|
||
// Important :
|
||
// - on ne prend que ceux sans no_bib
|
||
// - on exclut rol_id 3 et 4 comme dans l'ancien code
|
||
// - aucune écriture DB ici
|
||
// =====================
|
||
$sql = "
|
||
SELECT
|
||
p.*,
|
||
c.pec_nom_equipe,
|
||
c.no_equipe
|
||
FROM resultats_participants p
|
||
|
||
LEFT JOIN resultats_epreuves_commandees c
|
||
ON c.pec_id_original = p.pec_id
|
||
AND c.epr_id = p.epr_id
|
||
|
||
WHERE p.epr_id = $epr_id
|
||
AND p.is_cancelled = 0
|
||
AND (p.no_bib IS NULL OR p.no_bib = '' OR p.no_bib = 0)
|
||
AND p.rol_id NOT IN (3, 4)
|
||
|
||
ORDER BY $orderBy
|
||
";
|
||
|
||
return $objDatabase->fxGetResults($sql);
|
||
}
|
||
function fxGetRangesForBatchAssign($epr_id, $ranges) {
|
||
global $objDatabase;
|
||
|
||
// =====================
|
||
// VALIDATION
|
||
// =====================
|
||
$epr_id = intval($epr_id);
|
||
|
||
if ($epr_id <= 0 || empty($ranges) || !is_array($ranges)) {
|
||
return [];
|
||
}
|
||
|
||
// Nettoyage des IDs (sécurité)
|
||
$ids = array_map('intval', $ranges);
|
||
$ids = array_filter($ids);
|
||
|
||
if (empty($ids)) {
|
||
return [];
|
||
}
|
||
|
||
// =====================
|
||
// QUERY LÉGÈRE
|
||
// =====================
|
||
$strIds = implode(',', $ids);
|
||
|
||
$sql = "
|
||
SELECT
|
||
epr_bib_id,
|
||
epr_bib_start,
|
||
epr_bib_finish
|
||
FROM inscriptions_epreuves_bib
|
||
WHERE epr_id = $epr_id
|
||
AND epr_bib_id IN ($strIds)
|
||
AND epr_bib_start IS NOT NULL
|
||
AND epr_bib_finish IS NOT NULL
|
||
ORDER BY epr_bib_start
|
||
";
|
||
|
||
$rows = $objDatabase->fxGetResults($sql);
|
||
|
||
// =====================
|
||
// NORMALISATION
|
||
// =====================
|
||
$out = [];
|
||
|
||
foreach ($rows as $r) {
|
||
|
||
$start = (int)$r['epr_bib_start'];
|
||
$end = (int)$r['epr_bib_finish'];
|
||
|
||
// sécurité
|
||
if ($start > 0 && $end >= $start) {
|
||
$out[] = [
|
||
'id' => (int)$r['epr_bib_id'],
|
||
'start' => $start,
|
||
'end' => $end
|
||
];
|
||
}
|
||
}
|
||
|
||
return $out;
|
||
}
|
||
function fxGetNextAvailableBib($epr_id, $tabRanges) {
|
||
global $objDatabase;
|
||
|
||
$epr_id = intval($epr_id);
|
||
|
||
if ($epr_id <= 0 || empty($tabRanges)) {
|
||
return null;
|
||
}
|
||
|
||
// =====================
|
||
// PARCOURIR LES RANGES
|
||
// =====================
|
||
foreach ($tabRanges as $range) {
|
||
|
||
$start = (int)$range['start'];
|
||
$end = (int)$range['end'];
|
||
|
||
if ($start <= 0 || $end < $start) {
|
||
continue;
|
||
}
|
||
|
||
// =====================
|
||
// CHERCHER UN BIB LIBRE DANS CE RANGE
|
||
// =====================
|
||
for ($i = $start; $i <= $end; $i++) {
|
||
|
||
$sql = "
|
||
SELECT COUNT(*)
|
||
FROM resultats_participants
|
||
WHERE epr_id = $epr_id
|
||
AND no_bib = $i
|
||
";
|
||
|
||
$exists = (int)$objDatabase->fxGetVar($sql);
|
||
|
||
// 👉 trouvé un BIB libre
|
||
if ($exists === 0) {
|
||
return $i;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 👉 aucun BIB disponible
|
||
return null;
|
||
}
|
||
function fxProcessBatchAssignments($epr_id, $participants, $tabRanges, $mode = 'simulation') {
|
||
global $objDatabase;
|
||
|
||
$assignments = [];
|
||
|
||
if (empty($participants) || empty($tabRanges)) {
|
||
return $assignments;
|
||
}
|
||
|
||
$epr_id = intval($epr_id);
|
||
|
||
// =====================
|
||
// MODE SIMULATION → cache en mémoire
|
||
// MODE EXECUTE → on ne fait PAS confiance au cache
|
||
// =====================
|
||
$usedBib = [];
|
||
|
||
if ($mode === 'simulation') {
|
||
|
||
// Charger les BIB déjà utilisés (1 seule fois)
|
||
$sql = "
|
||
SELECT no_bib
|
||
FROM resultats_participants
|
||
WHERE epr_id = $epr_id
|
||
AND no_bib IS NOT NULL
|
||
AND no_bib != ''
|
||
";
|
||
|
||
$rows = $objDatabase->fxGetResults($sql);
|
||
|
||
foreach ($rows as $r) {
|
||
$usedBib[(int)$r['no_bib']] = true;
|
||
}
|
||
}
|
||
|
||
// =====================
|
||
// BOUCLE PRINCIPALE
|
||
// =====================
|
||
foreach ($participants as $p) {
|
||
|
||
$par_id = (int)$p['par_id'];
|
||
$foundBib = null;
|
||
|
||
// =====================
|
||
// CHERCHER BIB LIBRE
|
||
// =====================
|
||
foreach ($tabRanges as $range) {
|
||
|
||
$start = (int)$range['start'];
|
||
$end = (int)$range['end'];
|
||
|
||
for ($i = $start; $i <= $end; $i++) {
|
||
|
||
// =====================
|
||
// SIMULATION
|
||
// =====================
|
||
if ($mode === 'simulation') {
|
||
|
||
if (!isset($usedBib[$i])) {
|
||
$foundBib = $i;
|
||
$usedBib[$i] = true; // réserver
|
||
break 2;
|
||
}
|
||
|
||
} else {
|
||
// =====================
|
||
// EXECUTE (sécurisé DB)
|
||
// =====================
|
||
$sqlCheck = "
|
||
SELECT COUNT(*)
|
||
FROM resultats_participants
|
||
WHERE epr_id = $epr_id
|
||
AND no_bib = $i
|
||
";
|
||
|
||
$exists = (int)$objDatabase->fxGetVar($sqlCheck);
|
||
|
||
if ($exists === 0) {
|
||
$foundBib = $i;
|
||
|
||
// ÉCRITURE RÉELLE
|
||
$sqlUpdate = "
|
||
UPDATE resultats_participants
|
||
SET no_bib = $i,
|
||
par_date_bib = IFNULL(par_date_bib, NOW())
|
||
WHERE par_id = $par_id
|
||
AND is_cancelled = 0
|
||
AND (no_bib IS NULL OR no_bib = '' OR no_bib = 0)
|
||
";
|
||
|
||
$objDatabase->fxQuery($sqlUpdate);
|
||
|
||
break 2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// =====================
|
||
// PLUS DE PLACE → STOP
|
||
// =====================
|
||
if ($foundBib === null) {
|
||
break;
|
||
}
|
||
|
||
// =====================
|
||
// STOCKER LE RÉSULTAT
|
||
// =====================
|
||
$assignments[] = [
|
||
'par_id' => $par_id,
|
||
'par_prenom' => $p['par_prenom'],
|
||
'par_nom' => $p['par_nom'],
|
||
'no_bib' => $foundBib,
|
||
'pec_nom_equipe' => $p['pec_nom_equipe'] ?? '',
|
||
'no_equipe' => $p['no_equipe'] ?? ''
|
||
];
|
||
}
|
||
|
||
return $assignments;
|
||
}
|
||
function fxBuildBatchSummaryFromRanges($tabRangesInfos, $participants) {
|
||
|
||
$nbParticipants = count($participants);
|
||
$nbDispo = 0;
|
||
|
||
if (!empty($tabRangesInfos)) {
|
||
foreach ($tabRangesInfos as $r) {
|
||
|
||
$total = (int)($r['nb_total_range'] ?? 0);
|
||
$used = (int)($r['nb_utilises'] ?? 0);
|
||
|
||
$nbDispo += max(0, $total - $used);
|
||
}
|
||
}
|
||
|
||
$nbAssignable = min($nbParticipants, $nbDispo);
|
||
$nbManque = max(0, $nbParticipants - $nbDispo);
|
||
|
||
return [
|
||
'nb_dispo' => $nbDispo,
|
||
'nb_participants' => $nbParticipants,
|
||
'nb_assignable' => $nbAssignable,
|
||
'nb_manque' => $nbManque
|
||
];
|
||
}
|
||
function fxGetParticipantsForBatchReset($epr_id, $ranges) {
|
||
|
||
global $objDatabase;
|
||
|
||
$epr_id = intval($epr_id);
|
||
|
||
if ($epr_id <= 0 || empty($ranges) || !is_array($ranges)) {
|
||
return [];
|
||
}
|
||
|
||
$ids = array_map('intval', $ranges);
|
||
$ids = array_filter($ids);
|
||
|
||
if (empty($ids)) {
|
||
return [];
|
||
}
|
||
|
||
$tabRanges = fxGetRangesForBatchAssign($epr_id, $ids);
|
||
|
||
if (empty($tabRanges)) {
|
||
return [];
|
||
}
|
||
|
||
$where = [];
|
||
|
||
foreach ($tabRanges as $r) {
|
||
|
||
$start = (int)$r['start'];
|
||
$end = (int)$r['end'];
|
||
|
||
$where[] = "(p.no_bib BETWEEN $start AND $end)";
|
||
}
|
||
|
||
if (empty($where)) {
|
||
return [];
|
||
}
|
||
|
||
$sql = "
|
||
SELECT p.*
|
||
FROM resultats_participants p
|
||
WHERE p.epr_id = $epr_id
|
||
AND p.is_cancelled = 0
|
||
AND p.no_bib IS NOT NULL
|
||
AND p.no_bib > 0
|
||
AND (
|
||
" . implode(' OR ', $where) . "
|
||
)
|
||
ORDER BY p.no_bib
|
||
";
|
||
|
||
return $objDatabase->fxGetResults($sql);
|
||
}
|
||
|