Subversion Repositories Sites.obs-saisons.fr

Rev

Rev 331 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

  function mb_ucfirst($str) {
    $fc = mb_strtoupper(mb_substr($str, 0, 1));
    return $fc.mb_substr($str, 1);
  }

  $config = parse_ini_file('config.ini');
  $url_jrest = $config['url_jrest'];

  $url_infos_especes = $url_jrest.'OdsEspece/ToutesEspeces';
  $especes = json_decode(file_get_contents($url_infos_especes), true);

  $url_infos_stades = $url_jrest.'OdsEvenement/TousEvenements';
  $stades = json_decode(file_get_contents($url_infos_stades), true);

  $url_annee_min_obs = $url_jrest.'OdsObservation/AnneeMinimumObservation';
  $annee_min_obs = json_decode(file_get_contents($url_annee_min_obs), true);

  $stades_par_type_evenement = [];
  foreach($stades as $id_stade => $stade) {
    if(empty($stades_par_type_evenement[$stade['nom']])) {
      $stades_par_type_evenement[$stade['nom']] = [];
    }
    $stades_par_type_evenement[$stade['nom']][] = $id_stade;
  }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <meta http-equiv="Content-style-type" content="text/css" />
      <meta http-equiv="Content-script-type" content="text/javascript" />
      <meta http-equiv="Content-language" content="fr" />

      <base href="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>" />

      <title>Graphiques</title>

      <meta name="revisit-after" content="15 days" />
      <meta name="robots" content="index,follow" />
      <meta name="author" content="Tela Botanica" />

            <script type="text/javascript" src="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>js/jquery-3.2.1.min.js"></script>
            <script type="text/javascript" src="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>js/plotly.min.js"></script>
            <script type="text/javascript" src="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>js/config.js"></script>
            <script type="text/javascript" src="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>js/evolution-evenements.js"></script>
            <link media="screen" href="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>css/graphiques.css" type="text/css" rel="stylesheet" />

      <script type="text/javascript">
        var url_jrest = <?= json_encode($url_jrest, true) ?>;
        var global_evenements = <?= json_encode($stades, true) ?>;
        var annees_observations = <?= json_encode(range($annee_min_obs, date('Y')), true) ?>;
      </script>
    </head>
    <body>
             <div class="conteneur">
                       <div class="conteneur-criteres">

             <div class="conteneur_selecteur_especes">
               <select id="selecteur_liste_especes">
                 <option value="0" class="espece_type_0" selected="selected"> Choisissez une espèce </option>
                 <?php foreach($especes as $id_espece => $infos_espece) : ?>
                   <option data-id-evenements="[<?= $infos_espece['evenements'] ?>]" value="<?= $id_espece; ?>"><?= mb_ucfirst($infos_espece['nom_vernaculaire']); ?></option>
                 <?php endforeach; ?>
               </select>
             </div>

             <div class="conteneur_selecteur_stades">
               <select id="selecteur_stade" class="hide">
                 <option data-evenements="[]" value="0" class="stade" selected="selected"> Choisissez un évènement </option>
                 <?php foreach($stades_par_type_evenement as $nom_stade => $ids_stades) : ?>
                   <option data-evenements="[<?= implode(',', $ids_stades); ?>]" value="<?= implode(',', $ids_stades); ?>"><?= mb_ucfirst($nom_stade); ?></option>
                 <?php endforeach; ?>
               </select>
             </div>


           </div>
                       <div id="conteneur-graphique" class="conteneur-graphique"></div>
             </div>
    </body>
</html>