Commit 6b916214ad6ba2b77dff936f80c0e98780e58478

Authored by Guillaume
1 parent 6ddcfdb1

Test Graphe

Showing 3 changed files with 12 additions and 4 deletions   Show diff stats
@@ -10,7 +10,7 @@ else $end = $end." 23:59:59"; @@ -10,7 +10,7 @@ else $end = $end." 23:59:59";
10 if($start == NULL) {$s = date_min(); $start = $s['min'];} 10 if($start == NULL) {$s = date_min(); $start = $s['min'];}
11 else $start = $start." 00:00:00"; 11 else $start = $start." 00:00:00";
12 12
13 -$history1 = getHistory($_POST['nom'], '', '', $start, $end, $_POST['nombre']); 13 +$history1 = getHistory($_REQUEST['nom'], '', '', $_REQUEST['start'], $_REQUEST['end'], $_REQUEST['nombre']);
14 $datay1 = makeArray($history1, "value"); 14 $datay1 = makeArray($history1, "value");
15 15
16 $history2 = getHistory('Atmos', '', '', '2020-01-02 00:00:00', '2020-04-05 23:59:59', 4); 16 $history2 = getHistory('Atmos', '', '', '2020-01-02 00:00:00', '2020-04-05 23:59:59', 4);
site/graphique.php
1 <?php 1 <?php
2 session_start(); 2 session_start();
  3 +$nom = $_POST['nom'];
  4 +$nombre = $_POST['nombre'];
  5 +$start = $_POST['start-date'];
  6 +$end = $_POST['end-date'];
  7 +if(($end == NULL) || ($end < $start)) {$e = date_max(); $end = $e['max'];}
  8 +else $end = $end." 23:59:59";
  9 +if($start == NULL) {$s = date_min(); $start = $s['min'];}
  10 +else $start = $start." 00:00:00";
3 ?> 11 ?>
4 <!DOCTYPE html> 12 <!DOCTYPE html>
5 13
@@ -20,7 +28,7 @@ session_start(); @@ -20,7 +28,7 @@ session_start();
20 <br/> 28 <br/>
21 <h1 style="margin-bottom:20px; margin-top:30px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fas fa-chart-line"></i> Graphe du capteur</h1> 29 <h1 style="margin-bottom:20px; margin-top:30px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fas fa-chart-line"></i> Graphe du capteur</h1>
22 <br/> 30 <br/>
23 - <img src="graphe.php" alt="graphe"> 31 + <img src="graphe.php?nom=<?php echo $nom;?>&nombre=<?php echo $nombre;?>&start=<?php echo $start;?>&end=<?php echo $end;?>" alt="graphe">
24 </div> 32 </div>
25 </div> 33 </div>
26 <?php 34 <?php
site/recherche.php
@@ -40,8 +40,8 @@ session_start(); @@ -40,8 +40,8 @@ session_start();
40 if(($end == NULL) || ($end < $start)) {$e = date_max(); $end = $e['max'];} 40 if(($end == NULL) || ($end < $start)) {$e = date_max(); $end = $e['max'];}
41 else $end = $end." 23:59:59"; 41 else $end = $end." 23:59:59";
42 if($start == NULL) {$s = date_min(); $start = $s['min'];} 42 if($start == NULL) {$s = date_min(); $start = $s['min'];}
43 - else $start = $start." 00:00:00";?>  
44 - <?php 43 + else $start = $start." 00:00:00";
  44 +
45 $history = getHistory($name, $type, $raspberry, $start, $end, $_POST['nombre']); 45 $history = getHistory($name, $type, $raspberry, $start, $end, $_POST['nombre']);
46 foreach($history as $sensor){ 46 foreach($history as $sensor){
47 ?> 47 ?>