<?php
 if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])){exit();}
 global $config;
 require_once 'config/class/class.database.php';
 $db = new database();

 $annees = array(2016, 2017);
 for ($i=2019; $i <= $config['smib_annee_encours']; $i++) $annees[] = $i;
 if (!empty($_GET['b']) && in_array($_GET['b'], $annees)) $__a=$_GET['b']; else $__a=$config['smib_annee_encours'];
?>

<?php $_shouldextend[1]=1; ?>


<?php $this->startSection('wisra_basic_content'); ?>
 @parentXYZABC

<div class="body-content js-body-content blue-body">
 <main id="main">
 <div class="standings-background-hero">
 <picture class="standings-background-hero__pattern left js-lazy-picture loaded">
 <img src="<?php echo $config['app_url'] ?>sources/image/basic/stripes-left.png" data-image-src="<?php echo $config['app_url'] ?>sources/image/basic/stripes-left.png" alt="Standings Background Pattern">
 </picture>
 <picture class="standings-background-hero__pattern right js-lazy-picture loaded">
 <img src="<?php echo $config['app_url'] ?>sources/image/basic/stripes-right.png" data-image-src="<?php echo $config['app_url'] ?>sources/image/basic/stripes-right.png" alt="Standings Background Pattern">
 </picture>
 </div>
 <div class="u-main-gradient">
 <div class="wrapper">
 <div class="col-12">
 <section class="standings">
 <div class="standings__header">
 <div class="standings-header">
 <h1> Statistiques </h1>
 </div>
 </div>

 <div class="standings__content js-standings-content">
 <section class="standings-league js-standings-pane">

 <div class="standings-league__header standings-pane-header">
 <div class="standings-pane-header__spacer"></div>
 <div class="standings-pane-header__info">
 <img src="<?php echo $config['app_url'] ?>sources/image/basic/semi-marathon-bejaia-footer.png" alt="<?php echo $config['app_name'] ?> logo" class="standings-pane-header__competition-logo">
 </div>
 <span class="standings-pane-header__name visually-hidden"></span>
 <div class="standings-pane-header__time-info">
 <div class="standings-pane-header__last-updated"> 
 Statistiques
 </div>
 <div class="standings-pane-header__season-info-container">
 <span class="standings-pane-header__season-info js-season-info"> <?php echo $__a-2005 ?>ème  </span>
 <span class="standings-pane-header__match-week-info js-match-week-info"> Edition </span>
 </div>
 </div>
 </div>

<?php
 if ($__a==2016 || $__a==2017) {
/*========================
// Old one
==============================*/
 // 21km Tout
 $req = "SELECT
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND sexxxx=1 AND course=1 AND catego=1 AND handis=0) AS hca_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND sexxxx=1 AND course=1 AND catego=2 AND handis=0) AS hcb_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND sexxxx=1 AND course=1 AND catego=3 AND handis=0) AS hcc_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND sexxxx=1 AND course=1 AND catego=4 AND handis=0) AS hcd_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND sexxxx=1 AND course=1 AND catego=5 AND handis=0) AS hce_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND sexxxx=1 AND course=1 AND catego=6 AND handis=0) AS hcf_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND sexxxx=1 AND course=1 AND handis=1) AS hhs_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND sexxxx=1 AND course=1) AS htl_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND (sexxxx=0 OR sexxxx=2) AND course=1 AND catego=1 AND handis=0) AS fca_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND (sexxxx=0 OR sexxxx=2) AND course=1 AND catego=2 AND handis=0) AS fcb_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND (sexxxx=0 OR sexxxx=2) AND course=1 AND catego=3 AND handis=0) AS fcc_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND (sexxxx=0 OR sexxxx=2) AND course=1 AND handis=1) AS fhs_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND (sexxxx=0 OR sexxxx=2) AND course=1) AS ftl_nbr;
 ";
 $arg = array('an'=>$__a);
 $donnee = $db->select($req, $arg, false);
 if (!empty($donnee)) {?>

 <br/>
 <div class="widget__header">
 <h3 class="widget__title">Semi Marathon (21km)</h3>
 </div>
 <table class="standings-league__table standings-table">
 <thead class="standings-table__head">
 <tr>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Catégorie Hommes</span>
 <span class="table-head__heading--short">Cat H</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Catégorie Dames</span>
 <span class="table-head__heading--short">Cat F</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 </tr>
 </thead>
 <tbody class="standings-table__body">
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 1 (18 - 26 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hca_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 1 (18 - 26 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fca_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 2 (27 - 34 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcb_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 2 (27 - 34 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fcb_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 3, V1 (35 - 42 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcc_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 3 (35 ans et +) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fcc_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 4, V2 (43 - 50ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcd_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> / </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> 0 </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 5, V3 (51 - 59 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hce_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> / </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> 0 </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 6, V4 (60 ans et +) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcf_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> / </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> 0 </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Handisport </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hhs_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Handisport </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fhs_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Total </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['htl_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Total </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['ftl_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
 </tbody>
 </table>

<?php
 }
 // Autres courses
 $req = "SELECT
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND sexxxx=1 AND course=2) AS hcs_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND enfant=1) AS hcf_nbr, 
 (SELECT COUNT(*) FROM participant WHERE annee=:an AND (sexxxx=0 OR sexxxx=2) AND course=2) AS fcs_nbr;
 ";
 $arg = array('an'=>$__a);
 $donnee = $db->select($req, $arg, false);
 if (!empty($donnee)) {?>

 <br/>
 <div class="widget__header">
 <h3 class="widget__title">Autres Courses</h3>
 </div>
 <table class="standings-league__table standings-table">
 <thead class="standings-table__head">
 <tr>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Hommes</span>
 <span class="table-head__heading--short">Cmn</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 <th class="table-head colhiddenmobile" scope="col">
 <span class="table-head__heading">Dames</span>
 <span class="table-head__heading--short">Cmn</span>
 </th>
 <th class="table-head colhiddenmobile" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 </tr>
 </thead>
//  colhiddedesktop  //  colhiddenmobile  //
 <tbody class="standings-table__body">
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Course Populaire 7km (Hommes) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcs_nbr'] ?> </td>
 <td class="team-row colhiddenmobile" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Course Populaire 7km (Dames) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points colhiddenmobile"> <?php echo $donnee['fcs_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row colhiddedesktop">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Course Populaire 7km (Dames) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fcs_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Course Enfants 3km (Tout) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcf_nbr'] ?> </td>
 <td class="team-row colhiddenmobile" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> / </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points colhiddenmobile"> 0 </td>
 <td class="standings-table__gap-filler"></td>
 <td class="standings-table__gap-filler"></td>
</tr>
 </tbody>
 </table>

<?php
 }
 // Par Pays
 $req = "
 SELECT COUNT(*) AS nbr, B.nom AS pais FROM participant A 
 LEFT JOIN adex_pays B ON B.id=A.payspy 
 WHERE A.annee=:an GROUP BY A.payspy ORDER BY COUNT(*) DESC;
 ";
 $nbr = 0;
 $arg = array('an'=>$__a);
 $donnees = $db->select($req, $arg, true);
 if (!empty($donnees)) {
?>

 <br/>
 <div class="widget__header">
 <h3 class="widget__title">Par Pays</h3>
 </div>
 <table class="standings-league__table standings-table">
 <thead class="standings-table__head">
 <tr>
 <th class="table-head" scope="col">
 <span class="table-head__heading"></span>
 <span class="table-head__heading--short"></span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Pays</span>
 <span class="table-head__heading--short">Pys</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 </tr>
 </thead>
 <tbody class="standings-table__body">
<?php
 $all_pays = 0;
 foreach ($donnees as $donnee) {
 if (!empty($donnee['pais']) && !empty($donnee['nbr'])) {
 $all_pays += $donnee['nbr'];
?>
<tr class="table-standings-row">
 <td class="badge-row" scope="row">
 <span class="badge-row__badge"></span>
 </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> <?php echo utf8_encode($donnee['pais']);?> </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['nbr'];?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<?php }}?>

<tr class="table-standings-row">
 <td class="badge-row" scope="row">
 <span class="badge-row__badge"></span>
 </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Total </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $all_pays;?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>

 </tbody>
 </table>

<?php
 }
 // Wilaya d'algérie
 $req = "
 SELECT COUNT(*) AS nbr, B.nom AS pais FROM participant A 
 LEFT JOIN ad_ville B ON B.id=A.wilaya 
 WHERE A.payspy=4 AND A.annee=:an GROUP BY A.wilaya ORDER BY COUNT(*) DESC;
 ";
 $nbr = 0;
 $arg = array('an'=>$__a);
 $donnees = $db->select($req, $arg, true);
 if (!empty($donnees)) {
?>

 <br/>
 <div class="widget__header">
 <h3 class="widget__title">Wilaya d'Algérie</h3>
 </div>

 <table class="standings-league__table standings-table">
 <thead class="standings-table__head">
 <tr>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Wilaya</span>
 <span class="table-head__heading--short">Wly</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 </tr>
 </thead>
 <tbody class="standings-table__body">

<?php
 $all_pays = 0;
 foreach ($donnees as $donnee) {
 if (!empty($donnee['pais']) && !empty($donnee['nbr'])) {
 $all_pays += $donnee['nbr'];
?>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> <?php echo utf8_encode($donnee['pais']);?> </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['nbr'];?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<?php }}?>

<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Total </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $all_pays;?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>

 </tbody>
 </table>

<?php
 }
 } else {
/*========================
// 2019 Dassawen
==============================*/
 // 21km Tout
 $req = "SELECT
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=1 AND B.course=1 AND B.catego=1 AND B.handis=0 AND B.removed=0 AND A.removed=0) AS hca_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=1 AND B.course=1 AND B.catego=2 AND B.handis=0 AND B.removed=0 AND A.removed=0) AS hcb_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=1 AND B.course=1 AND B.catego=3 AND B.handis=0 AND B.removed=0 AND A.removed=0) AS hcc_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=1 AND B.course=1 AND B.catego=4 AND B.handis=0 AND B.removed=0 AND A.removed=0) AS hcd_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=1 AND B.course=1 AND B.catego=5 AND B.handis=0 AND B.removed=0 AND A.removed=0) AS hce_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=1 AND B.course=1 AND B.catego=6 AND B.handis=0 AND B.removed=0 AND A.removed=0) AS hcf_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=1 AND B.course=1 AND B.handis=1 AND B.removed=0 AND A.removed=0) AS hhs_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=1 AND B.course=1 AND B.removed=0 AND A.removed=0) AS htl_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=0 AND B.course=1 AND B.catego=1 AND B.handis=0 AND B.removed=0 AND A.removed=0) AS fca_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=0 AND B.course=1 AND B.catego=2 AND B.handis=0 AND B.removed=0 AND A.removed=0) AS fcb_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=0 AND B.course=1 AND B.catego=3 AND B.handis=0 AND B.removed=0 AND A.removed=0) AS fcc_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=0 AND B.course=1 AND B.handis=1 AND B.removed=0 AND A.removed=0) AS fhs_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=0 AND B.course=1 AND B.removed=0 AND A.removed=0) AS ftl_nbr;
 ";
 $arg = array('an'=>$__a);
 $donnee = $db->select($req, $arg, false);
 if (!empty($donnee)) {?>

 <br/>
 <div class="widget__header">
 <h3 class="widget__title">Semi Marathon (21km)</h3>
 </div>
 <table class="standings-league__table standings-table">
 <thead class="standings-table__head">
 <tr>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Catégorie Hommes</span>
 <span class="table-head__heading--short">Cat H</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Catégorie Dames</span>
 <span class="table-head__heading--short">Cat F</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 </tr>
 </thead>
 <tbody class="standings-table__body">
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 1 (18 - 26 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hca_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 1 (18 - 26 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fca_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 2 (27 - 34 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcb_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 2 (27 - 34 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fcb_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 3, V1 (35 - 42 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcc_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 3 (35 ans et +) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fcc_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 4, V2 (43 - 50ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcd_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> / </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> 0 </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 5, V3 (51 - 59 ans) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hce_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> / </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> 0 </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Catégorie 6, V4 (60 ans et +) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcf_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> / </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> 0 </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Handisport </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hhs_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Handisport </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fhs_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Total </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['htl_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Total </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['ftl_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
 </tbody>
 </table>

<?php
 }
 // Autres courses
 $req = "SELECT
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=1 AND B.course=2 AND B.removed=0 AND A.removed=0) AS hcs_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.enfant=1 AND B.removed=0 AND A.removed=0) AS hcf_nbr, 
 (SELECT COUNT(*) FROM member A INNER JOIN member_particip B ON B.membre=A.id WHERE B.annee=:an AND A.sex=0 AND B.course=2 AND B.removed=0 AND A.removed=0) AS fcs_nbr;
 ";
 $arg = array('an'=>$__a);
 $donnee = $db->select($req, $arg, false);
 if (!empty($donnee)) {?>

 <br/>
 <div class="widget__header">
 <h3 class="widget__title">Autres Courses</h3>
 </div>
 <table class="standings-league__table standings-table">
 <thead class="standings-table__head">
 <tr>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Hommes</span>
 <span class="table-head__heading--short">Cmn</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Dames</span>
 <span class="table-head__heading--short">Cmn</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 </tr>
 </thead>
 <tbody class="standings-table__body">
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Course Populaire 7km (Hommes) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcs_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Course Populaire 7km (Dames) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['fcs_nbr'] ?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Course Enfants 3km (Tout) </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['hcf_nbr'] ?> </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> / </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> 0 </td>
 <td class="standings-table__gap-filler"></td>
 <td class="standings-table__gap-filler"></td>
</tr>
 </tbody>
 </table>

<?php
 }
 // Par Pays
 $req = "
 SELECT COUNT(*) AS nbr, C.nom_fr_fr AS pais, C.alpha2 FROM member A 
 INNER JOIN member_particip B ON B.membre=A.id 
 LEFT JOIN ad_pays C ON C.id=A.payspy 
 WHERE B.annee=:an GROUP BY A.payspy ORDER BY COUNT(*) DESC;
 ";
 $nbr = 0;
 $arg = array('an'=>$__a);
 $donnees = $db->select($req, $arg, true);
 if (!empty($donnees)) {
?>

 <br/>
 <div class="widget__header">
 <h3 class="widget__title">Par Pays</h3>
 </div>

 <table class="standings-league__table standings-table">
 <thead class="standings-table__head">
 <tr>
 <th class="table-head" scope="col">
 <span class="table-head__heading"></span>
 <span class="table-head__heading--short"></span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Pays</span>
 <span class="table-head__heading--short">Pys</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 </tr>
 </thead>
 <tbody class="standings-table__body">
<?php
 $all_pays = 0;
 foreach ($donnees as $donnee) {
 if (!empty($donnee['pais']) && !empty($donnee['nbr'])) {
 $all_pays += $donnee['nbr'];
?>
<tr class="table-standings-row">
 <td class="badge-row" scope="row">
 <span class="badge-row__badge" title="<?php echo utf8_encode($donnee['pais']);?>">
 <span class="visually-hidden"><?php echo utf8_encode($donnee['pais']);?></span>
 <img src="<?php echo $config['app_url'] ?>sources/image/svg/flags/<?php echo strtolower($donnee['alpha2']);?>.svg" width="30" height="30" alt="<?php echo utf8_encode($donnee['pais']);?>">
 </span>
 </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> <?php echo utf8_encode($donnee['pais']);?> </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['nbr'];?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<?php }}?>

<tr class="table-standings-row">
 <td class="badge-row" scope="row">
 <span class="badge-row__badge"></span>
 </td>
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Total </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $all_pays;?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>

 </tbody>
 </table>

<?php
 }
 // Wilaya d'algérie
 $req = "
 SELECT COUNT(*) AS nbr, C.nom AS pais FROM member A 
 INNER JOIN member_particip B ON B.membre=A.id 
 LEFT JOIN ad_ville C ON C.id=A.wilaya 
 WHERE B.annee=:an AND A.payspy=4 GROUP BY A.wilaya ORDER BY COUNT(*) DESC;
 ";
 $nbr = 0;
 $arg = array('an'=>$__a);
 $donnees = $db->select($req, $arg, true);
 if (!empty($donnees)) {
?>
 <br/>
 <div class="widget__header">
 <h3 class="widget__title">Wilaya d'Algérie</h3>
 </div>

 <table class="standings-league__table standings-table">
 <thead class="standings-table__head">
 <tr>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Wilaya</span>
 <span class="table-head__heading--short">Wly</span>
 </th>
 <th class="table-head" scope="col">
 <span class="table-head__heading">Nombre de participants</span>
 <span class="table-head__heading--short">nbr</span>
 </th>
 </tr>
 </thead>
 <tbody class="standings-table__body">

<?php
 $all_pays = 0;
 foreach ($donnees as $donnee) {
 if (!empty($donnee['pais']) && !empty($donnee['nbr'])) {
 $all_pays += $donnee['nbr'];
?>
<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> <?php echo utf8_encode($donnee['pais']);?> </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $donnee['nbr'];?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>
<?php }}?>

<tr class="table-standings-row">
 <td class="team-row" scope="row">
 <div class="team-row__name-container">
 <span class="team-row__name"> Total </span>
 <span class="team-row__name--short"></span>
 </div>
 </td>
 <td class="table-stat-row table-stat-row--points"> <?php echo $all_pays;?> </td>
 <td class="standings-table__gap-filler"></td>
</tr>

 </tbody>
 </table>

<?php
 }
 }
?>

 </section>
 </div>
 </section>
 </div>
 </div>
 </div>
 </main>
</div>

<?php include_once("sources/include/sponsors.php");?> 

<?php $this->stopSection(); ?>

<?php /*-------------------------------------- Put here your additional CSS files for this page --------------------------------------*/ ?>
<?php $this->startSection('wisra_css_content'); ?>
 
<?php $this->stopSection(); ?>

<?php /*-------------------------------------- Put here your additional JS files  for this page --------------------------------------*/ ?>
<?php $this->startSection('wisra_js_content'); ?>
 
<?php $this->stopSection(); ?>
<?php if (@$_shouldextend[1]) { echo $this->runChild('layout', ['page_data' => array(
 'plugins' => array(), 
 'title' => "Statistiques | Semi Marathon International de Béjaia", 
 'description' => "Statistiques, Semi Marathon International de la ville de Béjaia: course 21km, 7km et 3km pour enfants, handisports. organisé par l'Athlétic Méditerranéen Club Béjaia AMCB chaque année, a la vile de Béjaia - Algérie", 
 'keywords' => array("Statistiques", "Statistiques Semi Marathon Bejaia", "Semi Marathon International de la ville de Béjaia", "Semi Marathon International de Béjaia", "Semi Marathon Béjaia", "SemiMarathon Béjaia", "Demi Marathon Béjaia", "Semi Marathon International Bejaia", "Semi", "Marathon", "Semi-Marathon", "International", "Semi-Marathon International", "Béjaia", "Semi-Marathon International Béjaia", "course 21km", "course 7km", "course 3km", "course enfants", "course handisports", "Athlétic Méditerranéen Club Béjaia", "Athlétic Club", "Athlétic Club Béjaia",  "Athlétic Méditerranéen Club Béjaia", "AMCB", "la vile de Béjaia", "Algérie", "Béjaia Algérie"), 
 'facebook_integration' => false, 
 'google_maps_callback' => '', 
 'filters_header' => 1, 
 'filter_year' => $__a, 
 'filter_link' => 'statistiques'
)]); } ?>