Commit 6ddcfdb19475224a25502fc25b21765e1d929297
1 parent
58238402
Test Graphe
Showing
3 changed files
with
78 additions
and
1 deletions
Show diff stats
... | ... | @@ -0,0 +1,44 @@ |
1 | +<div class="row"> | |
2 | + <div class="col-4 col-md-4 offset-md-4 offset-4"> | |
3 | + <br/> | |
4 | + <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fas fa-chart-line"></i> Affichage un graphe</h1> | |
5 | + <form action="graphique.php" method="post"> | |
6 | + <table class="table table-striped table-bordered"> | |
7 | + <tbody> | |
8 | + <tr> | |
9 | + <td><label for="names">Nom du capteur : </label></td> | |
10 | + <td> | |
11 | + <div class="form-group my-1 mr-sm-2"> | |
12 | + <select class="custom-select my-1 mr-sm-2" id="names" name="nom"> | |
13 | + <option></option> | |
14 | + <?php | |
15 | + $names = get(nom); | |
16 | + foreach($names as $name) | |
17 | + { ?> | |
18 | + <option><?php echo $name['nom'];?></option> | |
19 | + <?php }?> | |
20 | + </select> | |
21 | + </div> | |
22 | + </td> | |
23 | + </tr> | |
24 | + | |
25 | + <tr> | |
26 | + <td><label for="start">Date de début :</label></td> | |
27 | + <td><input type="date" id="start" name="start-date" min="<?php echo $date_min; ?>" max="<?php echo $date_max; ?>" /></td> | |
28 | + </tr> | |
29 | + | |
30 | + <tr> | |
31 | + <td><label for="end">Date de fin :</label></td> | |
32 | + <td><input type="date" id="end" name="end-date" min="<?php echo $date_min; ?>" max="<?php echo $date_max; ?>" /></td> | |
33 | + </tr> | |
34 | + | |
35 | + <tr> | |
36 | + <td><label for"nombre">Nombre de points (entre 4 et 100) :</label></td> | |
37 | + <td><input type="text" id="nombre" name="nombre" min="4" max="100" value="10" /></td> | |
38 | + </tr> | |
39 | + </tbody> | |
40 | + </table> | |
41 | + <input type="submit" class="btn btn-dark btn-lg btn-block" style="margin-top:20px; margin-bottom:20px;" value="Afficher le graphe"/> | |
42 | + </form> | |
43 | + </div> | |
44 | +</div> | ... | ... |
site/graphe.php
... | ... | @@ -3,7 +3,14 @@ require_once ('jpgraph/jpgraph.php'); |
3 | 3 | require_once ('jpgraph/jpgraph_line.php'); |
4 | 4 | require_once('accesBase.php'); |
5 | 5 | |
6 | -$history1 = getHistory('Solaris', '', '', '2020-01-02 00:00:00', '2020-04-05 23:59:59', 4); | |
6 | +$start = $_POST['start-date']; | |
7 | +$end = $_POST['end-date']; | |
8 | +if(($end == NULL) || ($end < $start)) {$e = date_max(); $end = $e['max'];} | |
9 | +else $end = $end." 23:59:59"; | |
10 | +if($start == NULL) {$s = date_min(); $start = $s['min'];} | |
11 | +else $start = $start." 00:00:00"; | |
12 | + | |
13 | +$history1 = getHistory($_POST['nom'], '', '', $start, $end, $_POST['nombre']); | |
7 | 14 | $datay1 = makeArray($history1, "value"); |
8 | 15 | |
9 | 16 | $history2 = getHistory('Atmos', '', '', '2020-01-02 00:00:00', '2020-04-05 23:59:59', 4); | ... | ... |
... | ... | @@ -0,0 +1,26 @@ |
1 | +<?php | |
2 | +session_start(); | |
3 | +?> | |
4 | +<!DOCTYPE html> | |
5 | + | |
6 | +<html> | |
7 | + <head> | |
8 | + <?php include("head.php"); ?> | |
9 | + </head> | |
10 | + | |
11 | + <!-- Contenu du site --> | |
12 | + <body> | |
13 | + <?php | |
14 | + include("header.php"); | |
15 | + if(isset($_SESSION['Login'], $_SESSION['Password'])) | |
16 | + { | |
17 | + include("formGraphe.php"); | |
18 | + } | |
19 | + else | |
20 | + { | |
21 | + include("formConnexion.php"); | |
22 | + } | |
23 | + ?> | |
24 | + </body> | |
25 | +</html> | |
26 | + | ... | ... |