Subversion Repositories Sites.obs-saisons.fr

Rev

Rev 330 | Rev 333 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
330 aurelien 1
<?php
2
 
3
  function mb_ucfirst($str) {
4
    $fc = mb_strtoupper(mb_substr($str, 0, 1));
5
    return $fc.mb_substr($str, 1);
6
  }
7
 
8
  $config = parse_ini_file('config.ini');
9
  $url_jrest = $config['url_jrest'];
10
 
11
  $url_infos_especes = $url_jrest.'OdsEspece/ToutesEspeces';
12
  $especes = json_decode(file_get_contents($url_infos_especes), true);
13
 
14
  $url_infos_stades = $url_jrest.'OdsEvenement/TousEvenements';
15
  $stades = json_decode(file_get_contents($url_infos_stades), true);
16
 
17
  $url_annee_min_obs = $url_jrest.'OdsObservation/AnneeMinimumObservation';
18
  $annee_min_obs = json_decode(file_get_contents($url_annee_min_obs), true);
19
 
20
  $stades_par_type_evenement = [];
21
  foreach($stades as $id_stade => $stade) {
22
    if(empty($stades_par_type_evenement[$stade['nom']])) {
23
      $stades_par_type_evenement[$stade['nom']] = [];
24
    }
25
    $stades_par_type_evenement[$stade['nom']][] = $id_stade;
26
  }
27
?>
28
 
29
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
30
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
31
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
32
    <head>
33
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
34
      <meta http-equiv="Content-style-type" content="text/css" />
35
      <meta http-equiv="Content-script-type" content="text/javascript" />
36
      <meta http-equiv="Content-language" content="fr" />
37
 
38
      <base href="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>" />
39
 
40
      <title>Graphiques</title>
41
 
42
      <meta name="revisit-after" content="15 days" />
43
      <meta name="robots" content="index,follow" />
44
      <meta name="author" content="Tela Botanica" />
45
 
46
	    <script type="text/javascript" src="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>js/jquery-3.2.1.min.js"></script>
47
	    <script type="text/javascript" src="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>js/plotly.min.js"></script>
48
	    <script type="text/javascript" src="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>js/evolution-evenements.js"></script>
49
	    <link media="screen" href="<?= dirname($_SERVER['PHP_SELF'])."/"; ?>css/graphiques.css" type="text/css" rel="stylesheet" />
50
 
51
      <script type="text/javascript">
52
        var url_jrest = <?= json_encode($url_jrest, true) ?>;
53
        var global_evenements = <?= json_encode($stades, true) ?>;
54
        var annees_observations = <?= json_encode(range($annee_min_obs, date('Y')), true) ?>;
55
      </script>
56
    </head>
57
    <body>
58
	     <div class="conteneur">
59
		       <div class="conteneur-criteres">
60
 
61
             <div class="conteneur_selecteur_especes">
62
               <select id="selecteur_liste_especes">
63
                 <option value="0" class="espece_type_0" selected="selected"> Choisissez une espèce </option>
64
                 <?php foreach($especes as $id_espece => $infos_espece) : ?>
65
                   <option data-id-evenements="[<?= $infos_espece['evenements'] ?>]" value="<?= $id_espece; ?>"><?= mb_ucfirst($infos_espece['nom_vernaculaire']); ?></option>
66
                 <?php endforeach; ?>
67
               </select>
68
             </div>
69
 
70
             <div class="conteneur_selecteur_stades">
71
               <select id="selecteur_stade" class="hide">
72
                 <option data-evenements="[]" value="0" class="stade" selected="selected"> Choisissez un évènement </option>
73
                 <?php foreach($stades_par_type_evenement as $nom_stade => $ids_stades) : ?>
74
                   <option data-evenements="[<?= implode(',', $ids_stades); ?>]" value="<?= implode(',', $ids_stades); ?>"><?= mb_ucfirst($nom_stade); ?></option>
75
                 <?php endforeach; ?>
76
               </select>
77
             </div>
78
 
79
 
80
           </div>
81
		       <div id="conteneur-graphique" class="conteneur-graphique"></div>
82
	     </div>
83
    </body>
84
</html>