-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpers_press.php
More file actions
111 lines (97 loc) · 4.01 KB
/
Copy pathpers_press.php
File metadata and controls
111 lines (97 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
require_once('session_check.php');
require_once('WebServiceClient.php');
require_once('chart/graph.php');
require_once 'Utilis.php';
$display_err_style = $_SESSION['errCode'] == ERR_NO_ERROR ? 'style="display: none;"' : 'style="display: block;"';
//Controllo se mi sono arrivati dati dal form
if (isset($_POST['press_period']) === true) {
switch ($_POST['press_period']) {
case PERIOD_5MINUTES:
$_SESSION['pres_sel'] = PERIOD_5MINUTES;
break;
case PERIOD_30MINUTES:
$_SESSION['pres_sel'] = PERIOD_30MINUTES;
break;
case PERIOD_3HOURS:
$_SESSION['pres_sel'] = PERIOD_3HOURS;
break;
default:
$_SESSION['pres_sel'] = PERIOD_5MINUTES;
break;
}
}
else{
if(isset($_SESSION['pres_sel']) == false)
$_SESSION['pres_sel'] = PERIOD_5MINUTES;
}
?>
<html lang="en">
<head>
<?php require_once('header.php'); ?>
</head>
<body>
<!-- Intestazione -->
<div class="container-fluid">
<?php require_once('intestazione.php'); ?>
</div>
<!-- Corpo -->
<div class="container">
<div class="row">
<div class="col-sm-3 st_menu">
<!-- menu laterale -->
<?php require_once('menu.php'); ?>
</div>
<div class="col-sm-9 st_main">
<div class="container-fluid">
<div class="row">
<h2>Welcome to your personal page</h2>
<br>
<div class="container-fluid">
<!-- Alert di errore -->
<?php require_once('error_alert.php') ?>
<!-- contenuto della pagina -->
<div class="row">
<form class="form-inline" role="form" action="pers_press.php" method="POST">
<!--PRESSIONE-->
<div class="col-md-9">
<h3>Pressure</h3>
<label class="radio-inline">
<input type="radio" name="press_period" id="press_radio1"
value="<?php echo PERIOD_5MINUTES ?>" onclick="this.form.submit()"
<?php if($_SESSION['pres_sel'] === PERIOD_5MINUTES) echo 'checked'; ?>> 5 Minutes
</label>
<label class="radio-inline">
<input type="radio" name="press_period" id="press_radio2"
value="<?php echo PERIOD_30MINUTES ?>" onclick="this.form.submit()"
<?php if($_SESSION['pres_sel'] === PERIOD_30MINUTES) echo 'checked'; ?>> 30 Minutes
</label>
<label class="radio-inline">
<input type="radio" name="press_period" id="press_radio3"
value="<?php echo PERIOD_3HOURS ?>" onclick="this.form.submit()"
<?php if($_SESSION['pres_sel'] === PERIOD_3HOURS) echo 'checked'; ?>> 3 Hours
</label>
<?php
//Interrogo il WS per ottenere i dati
$pres_value_string = WebServiceClient::get_pressure($_SESSION['token'], $_SESSION['pres_sel']);
//Ricavo la stringa da mettere nel grafico
$title_tag = $_SESSION['pres_sel'] === PERIOD_5MINUTES ? 'Last 5 Minutes' : ($_SESSION['pres_sel'] === PERIOD_30MINUTES ? 'Last 30 Minutes' : 'Last 3 Hours');
//Creo il grafico
press_chart($pres_value_string, $title_tag);
echo '<img width="'.CHART_WIDTH.'" height="'.CHART_HEIGTH.'" src="chart/pres_graph.png"/>';
?>
</div>
</form>
</div>
</div>
</div>
<div class="row">
<br/>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>