www-thermferm/profiles.php

Fri, 20 Jul 2018 21:37:45 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 20 Jul 2018 21:37:45 +0200
changeset 548
2924fe4911d9
parent 399
2f472a9081c9
permissions
-rw-r--r--

Versie 0.8.1. Geen DDATA als fermenter uit staat. Profile JSON formaat is nu werkend.

134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 <?php
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 /*****************************************************************************
379
50675fd80fed Small code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 378
diff changeset
3 * Copyright (C) 2014-2015
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 *
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * Michiel Broek <mbroek at mbse dot eu>
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 *
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * This file is part of ThermFerm
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * This is free software; you can redistribute it and/or modify it
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * under the terms of the GNU General Public License as published by the
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * Free Software Foundation; either version 2, or (at your option) any
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * later version.
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * ThermFerm is distributed in the hope that it will be useful, but
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * General Public License for more details.
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 *
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * along with ThermFerm; see the file COPYING. If not, write to the Free
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 *****************************************************************************/
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 require_once('utilities.php');
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
25 $my_style = 'ui-redmond';
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
26
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
28 /*
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
29 * Each time this page is loaded, get the profiles from the server.
191
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 141
diff changeset
30 * $arr contains the complete reply of he PROFILE LIST command.
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
31 */
196
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
32 $answer = send_cmd("PROFILE LIST");
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
33 $arr = explode("\r\n", $answer);
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
34
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
35
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
36
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
37 if (isset($_GET['action'])) {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
38 switch ($_GET['action']) {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
39 case 'edit': profile_edit();
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
40 break;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
41 case 'esteps': profile_steps();
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
42 break;
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
43 default: break;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
44 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
45 } elseif (isset($_POST['action'])) {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
46 switch ($_POST['action']) {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
47 case 'testdata': testdata();
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
48 break;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
49 case 'teststeps': teststeps();
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
50 break;
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
51 default: break;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
52 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
53 } else {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
54 profile_list();
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
55 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
56
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 exit;
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
61 /*
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
62 * Profile steps
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
63 */
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
64 function profile_steps()
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
65 {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
66 global $arr;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
67 $UUID = $_GET['UUID'];
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
68
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
69 /*
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
70 * $steps contains all steps of a profile
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
71 */
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
72 $steps = array (
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
73 1 => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
74 2 => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
75 3 => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
76 4 => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
77 5 => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
78 6 => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
79 7 => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
80 8 => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
81 );
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
82
196
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
83 $answer = send_cmd("PROFILE GETS ".$UUID);
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
84 $psteps = explode("\r\n", $answer);
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
85
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
86 if (startsWith($arr[0], "212")) {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
87 $j = 1;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
88 while (1) {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
89 if (strcmp($psteps[$j], ".") == 0)
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
90 break;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
91 $f = explode(",", $psteps[$j]);
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
92 $steps[$j]["steptime"] = $f[0];
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
93 $steps[$j]["resttime"] = $f[1];
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
94 $steps[$j]["target_lo"] = $f[2];
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
95 $steps[$j]["target_hi"] = $f[3];
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
96 $steps[$j]["fridge_mode"] = $f[4];
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
97 $j++;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
98 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
99 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
100
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
101 edit_steps($UUID, $steps, "", "ThermFerm - Edit Profile Steps");
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
102 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
103
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
104
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
105 function edit_steps($UUID, $steps, $error_message, $heading)
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
106 {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
107 $outstr = build_header($heading);
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
108 $outstr .= ' <div id="errors">'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
109 $outstr .= ' '.$error_message.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
110 $outstr .= ' </div> <!-- errors -->'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
111 $outstr .= ' <div id="etable">'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
112 $outstr .= ' <form method="POST" action="profiles.php">'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
113 $outstr .= ' <table class="editor">'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
114 $outstr .= ' <tr class="trhead">'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
115 $outstr .= ' <td>Step</td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
116 $outstr .= ' <td>Steptime</td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
117 $outstr .= ' <td>Resttime</td>'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
118 $outstr .= ' <td>Temp low</td>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
119 $outstr .= ' <td>Temp high</td>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
120 $outstr .= ' <td>Fridge mode</td>'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
121 $outstr .= ' </tr>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
122
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
123 for ($i = 1; $i <= 8; $i++) {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
124 $outstr .= ' <tr class="editor">'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
125 $outstr .= ' <td>Step '.$i.'</td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
126 $outstr .= ' <td><input type="text" name="steptime'.$i.'" size="4" value="'.$steps[$i]["steptime"].'"></td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
127 $outstr .= ' <td><input type="text" name="resttime'.$i.'" size="4" value="'.$steps[$i]["resttime"].'"></td>'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
128 $outstr .= ' <td><input type="text" name="target_lo'.$i.'" size="4" value="'.$steps[$i]["target_lo"].'"></td>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
129 $outstr .= ' <td><input type="text" name="target_hi'.$i.'" size="4" value="'.$steps[$i]["target_hi"].'"></td>'.PHP_EOL;
399
2f472a9081c9 Changed frdige_mode paramater to 0..100 so we can work with a percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
130 $outstr .= ' <td><input type="hidden" name="fridge_mode'.$i.'" value="0"><input type="checkbox" name="fridge_mode'.$i.'" value="100"';
2f472a9081c9 Changed frdige_mode paramater to 0..100 so we can work with a percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
131 if ($steps[$i]["fridge_mode"] > 0)
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
132 $outstr .= ' checked';
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
133 $outstr .= '></td>'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
134 $outstr .= ' </tr>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
135 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
136
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
137 $outstr .= ' <tr class="editor">'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
138 $outstr .= ' <td class="editname">&nbsp;</td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
139 $outstr .= ' <td class="editname"><input type="submit" value="Save" name="key"></td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
140 $outstr .= ' <td class="editname"><input type="submit" value="Cancel" name="key">';
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
141 $outstr .= '<input type="hidden" value="teststeps" name="action">';
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
142 $outstr .= '<input type="hidden" value="'.$UUID.'" name="UUID"></td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
143 $outstr .= ' <td class="editname">&nbsp;</td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
144 $outstr .= ' </tr>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
145 $outstr .= ' </table>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
146 $outstr .= ' </form>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
147 $outstr .= ' </div> <!-- etable -->'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
148 $outstr .= ' <div id="atable" style="margin-left: 100px; width:780px;">'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
149 $outstr .= ' The steptime is the time to go from the previous to the target temperature.'.PHP_EOL;
274
111b0e9663dc Added logging if profile state is changed via the web interface. Log profile progress each half hour in syslog. Profile resttime steps 0 hours is allowed, meaning resttime or steptime must be set for a valid step. Updated the helptext on the web page.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
150 $outstr .= ' The resttime is the time in this step holding the target temperature.'.PHP_EOL;
111b0e9663dc Added logging if profile state is changed via the web interface. Log profile progress each half hour in syslog. Profile resttime steps 0 hours is allowed, meaning resttime or steptime must be set for a valid step. Updated the helptext on the web page.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
151 $outstr .= ' The duration of the step is steptime + resttime.'.PHP_EOL;
111b0e9663dc Added logging if profile state is changed via the web interface. Log profile progress each half hour in syslog. Profile resttime steps 0 hours is allowed, meaning resttime or steptime must be set for a valid step. Updated the helptext on the web page.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
152 $outstr .= ' Steps are valid if the steptime or resttime is greater then zero.'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
153 $outstr .= ' Order is important.'.PHP_EOL;
274
111b0e9663dc Added logging if profile state is changed via the web interface. Log profile progress each half hour in syslog. Profile resttime steps 0 hours is allowed, meaning resttime or steptime must be set for a valid step. Updated the helptext on the web page.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
154 $outstr .= ' Lines with a zero steptime and zero resttime are ignored.'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
155 $outstr .= ' The step- and resttimes are in hours.'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
156 $outstr .= ' </div> <!-- atable -->'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
157 $outstr .= ' <script type="text/javascript">'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
158 $outstr .= ' $(document).ready(function () {'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
159 $outstr .= ' $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
160 $outstr .= ' });'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
161 $outstr .= ' </script>'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
162 $outstr .= build_footer();
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
163 echo $outstr;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
164 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
165
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
166
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
167
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
169 /*
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
170 * Profile add
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
171 *
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
172 * @param string $_POST['Name'] The rpofile name
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
173 */
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 function profile_add() {
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
175
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
176 if ($_POST['key'] == 'Add') {
196
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
177 send_cmd("PROFILE ADD ".$_POST['Name']);
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 }
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
179 unset($_POST['UUID']);
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
180 unset($_POST['Name']);
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
181 unset($_POST['Steps']);
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
182 unset($_POST['key']);
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
183 unset($_POST['command']);
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
184 load('profiles.php');
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 }
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
189 /*
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
190 * Profile update or delete
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
191 *
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
192 * @param string $_POST['UUID'] The profile UUID
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
193 * @param string $_POST['Name'] The profile name
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
194 * @param string $_POST['Inittemp_lo'] The profile initial temperature low
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
195 * @param string $_POST['Inittemp_hi'] The profile initial temperature high
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
196 * @param string $_POST['Fridge_mode'] The profile fridge/beer mode
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
197 * @param string $_POST['key'] The button pressed.
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
198 */
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 function profile_update() {
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 /*
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 * Build the update command
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 */
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
203 if ($_POST['key'] == 'Delete') {
196
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
204 send_cmd("PROFILE DEL ".$_POST['UUID']);
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
205 }
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
206
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
207 if ($_POST['key'] == 'Save') {
253
7b6abc0dd1c6 Global and profile editor use array commands
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
208 $cmd = array("PROFILE PUT ".$_POST['UUID']);
7b6abc0dd1c6 Global and profile editor use array commands
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
209 $cmd[] = "NAME,".$_POST['Name'];
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
210 $cmd[] = "INITTEMP_LO,".$_POST['Inittemp_lo'];
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
211 $cmd[] = "INITTEMP_HI,".$_POST['Inittemp_hi'];
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
212 $cmd[] = "FRIDGE_MODE,".$_POST['Fridge_mode'];
253
7b6abc0dd1c6 Global and profile editor use array commands
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
213 $cmd[] = ".";
7b6abc0dd1c6 Global and profile editor use array commands
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
214 send_array($cmd);
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 }
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
216
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
217 unset($_POST['UUID']);
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
218 unset($_POST['Name']);
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
219 unset($_POST['Inittemp_lo']);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
220 unset($_POST['Inittemp_hi']);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
221 unset($_POST['Fridge_mode']);
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
222 unset($_POST['key']);
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
223 unset($_POST['command']);
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
224 load('profiles.php');
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
225 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
226
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
227
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
228
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
229 /*
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
230 * Test input of a modified or new profile.
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
231 *
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
232 * @param string $_POST['UUID'] Unique record UUID
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
233 * @param int $_POST['steptime'n] Profile steptime
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
234 * @param int $_POST['resttime'n] Profile resttime
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
235 * @param float $_POST['target_lo'n] Profile target temperature low
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
236 * @param float $_POST['target_hi'n] Profile target temperature high
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
237 * @param int $_POST['fridge_mode'n] Profile fridge mode
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
238 * @param string $_POST['key'] Key choice, Save or Cancel
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
239 *
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
240 * Return: 0 = Ok
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
241 * 1 = Missing data
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
242 * 3 = A target temperature out of range
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
243 * 99 = Cancel key
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
244 */
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
245 function test_thesteps() {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
246
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
247 global $arr;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
248
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
249 for ($i = 1; $i <= 8; $i++) {
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
250 if ((! isset($_POST['steptime'.$i])) || (! isset($_POST['resttime'.$i])) || (! isset($_POST['target_lo'.$i])) || (! isset($_POST['target_hi'.$i])) || (! isset($_POST['fridge_mode'.$i])))
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
251 return 1;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
252 if ((strlen($_POST['steptime'.$i]) == 0) || (strlen($_POST['resttime'.$i]) == 0) || (strlen($_POST['target_lo'.$i]) == 0) || (strlen($_POST['target_hi'.$i]) == 0) || (strlen($_POST['fridge_mode'.$i]) == 0))
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
253 return 1;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
254 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
255
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
256 if (isset($_POST['UUID']) && isset($_POST['key'])) {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
257
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
258 if ($_POST['key'] == 'Cancel')
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
259 return 99;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
260
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
261 for ($i = 1; $i <= 8; $i++) {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
262
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
263 if (($_POST['target_lo'.$i] < -5) || ($_POST['target_lo'.$i] > 30))
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
264 return 3;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
265 if (($_POST['target_hi'.$i] < -5) || ($_POST['target_hi'.$i] > 30))
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
266 return 3;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
267 if ($_POST['target_lo'.$i] > $_POST['target_hi'.$i])
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
268 return 3;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
269 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
270 } else {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
271 return 1;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
272 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
273
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
274 return 0;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
275 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
276
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
277
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
278
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
279 /*
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
280 * Test result from edit_steps screen and do next action
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
281 */
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
282 function teststeps() {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
283
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
284 $result = test_thesteps();
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
285 $error = '';
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
286
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
287 switch ($result) {
378
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
288 case 0: $cmd = array("PROFILE PUTS ".$_POST['UUID']);
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
289 for ($i = 1; $i <= 8; $i++) {
274
111b0e9663dc Added logging if profile state is changed via the web interface. Log profile progress each half hour in syslog. Profile resttime steps 0 hours is allowed, meaning resttime or steptime must be set for a valid step. Updated the helptext on the web page.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
290 if (($_POST['steptime'.$i] > 0) || ($_POST['resttime'.$i] > 0)) {
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
291 $cmd[] = $_POST['steptime'.$i].','.$_POST['resttime'.$i].','.$_POST['target_lo'.$i].','.$_POST['target_hi'.$i].','.$_POST['fridge_mode'.$i];
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
292 }
378
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
293 unset($_POST['steptime'.$i]);
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
294 unset($_POST['resttime'.$i]);
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
295 unset($_POST['target_lo'.$i]);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
296 unset($_POST['target_hi'.$i]);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
297 unset($_POST['fridge_mode'.$i]);
378
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
298 }
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
299 $cmd[] = ".";
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
300 send_array($cmd);
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
301 unset($_POST['UUID']);
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
302 unset($_POST['key']);
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
303 load('profiles.php');
313efe6bf5b3 Fixed profile steps updateing from the web interface.
Michiel Broek <mbroek@mbse.eu>
parents: 274
diff changeset
304 return;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
305 break;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
306 case 1: $error = 'Missing data';
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
307 break;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
308 case 2: $error = 'A resttime is shorter then the steptime';
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
309 break;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
310 case 3: $error = 'A target temperature is out of range';
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
311 break;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
312 case 99:
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
313 load('profiles.php');
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
314 break;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
315 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
316
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
317 $steps = array (
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
318 1 => array("steptime" => $_POST['steptime1'], "resttime" => $_POST['resttime1'], "target_lo" => $_POST['target_lo1'], "target_hi" => $_POST['target_hi1'], "fridge_mode" => $_POST['mode_fridge1'] ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
319 2 => array("steptime" => $_POST['steptime2'], "resttime" => $_POST['resttime2'], "target_lo" => $_POST['target_lo2'], "target_hi" => $_POST['target_hi2'], "fridge_mode" => $_POST['mode_fridge2'] ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
320 3 => array("steptime" => $_POST['steptime3'], "resttime" => $_POST['resttime3'], "target_lo" => $_POST['target_lo3'], "target_hi" => $_POST['target_hi3'], "fridge_mode" => $_POST['mode_fridge3'] ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
321 4 => array("steptime" => $_POST['steptime4'], "resttime" => $_POST['resttime4'], "target_lo" => $_POST['target_lo4'], "target_hi" => $_POST['target_hi4'], "fridge_mode" => $_POST['mode_fridge4'] ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
322 5 => array("steptime" => $_POST['steptime5'], "resttime" => $_POST['resttime5'], "target_lo" => $_POST['target_lo5'], "target_hi" => $_POST['target_hi5'], "fridge_mode" => $_POST['mode_fridge5'] ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
323 6 => array("steptime" => $_POST['steptime6'], "resttime" => $_POST['resttime6'], "target_lo" => $_POST['target_lo6'], "target_hi" => $_POST['target_hi6'], "fridge_mode" => $_POST['mode_fridge6'] ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
324 7 => array("steptime" => $_POST['steptime7'], "resttime" => $_POST['resttime7'], "target_lo" => $_POST['target_lo7'], "target_hi" => $_POST['target_hi7'], "fridge_mode" => $_POST['mode_fridge7'] ),
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
325 8 => array("steptime" => $_POST['steptime8'], "resttime" => $_POST['resttime8'], "target_lo" => $_POST['target_lo8'], "target_hi" => $_POST['target_hi8'], "fridge_mode" => $_POST['mode_fridge8'] ),
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
326 );
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
327
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
328 edit_steps($_POST['UUID'], $steps, $error, "ThermFerm - Edit Profile Steps");
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
329 }
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
330
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
331
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
332
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
333 /*
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
334 * Test input of a modified or new profile.
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
335 *
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
336 * @param string $_POST['UUID'] Unique record UUID
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
337 * @param string $_POST['Name'] Profile name
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
338 * @param float $_POST['Inittemp_lo'] Profile initial temperature
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
339 * @param float $_POST['Inittemp_hi'] Profile initial temperature
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
340 * @param float $_POST['Fridge_mode'] Profile fridge mode
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
341 * @param string $_POST['key'] Key choice, Save or Cancel
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
342 * @param string $_POST['command'] Command used, 'add' or 'update'
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
343 *
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
344 * Return: 0 = Ok
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
345 * 1 = Missing data
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
346 * 2 = Name field too short
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
347 * 3 = Name already in use
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
348 * 99 = Cancel key
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
349 */
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
350 function test_thedata() {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
351
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
352 global $arr;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
353
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
354 if (isset($_POST['UUID']) && isset($_POST['Name']) && isset($_POST['Inittemp_lo']) && isset($_POST['Inittemp_hi']) && isset($_POST['key']) && isset($_POST['command'])) {
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
355
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
356 if ($_POST['key'] == 'Cancel')
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
357 return 99;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
358
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
359 if (strlen($_POST['Name']) < 2)
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
360 return 2;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
361
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
362 if (startsWith($arr[0], "212")) {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
363 $j = 1;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
364 while (1) {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
365 if (strcmp($arr[$j], ".") == 0)
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
366 break;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
367 $f = explode(",", $arr[$j]);
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
368 if (strcmp($f[0], $_POST['UUID']) && (strcmp($f[1], $_POST['Name']) == 0)) {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
369 return 3;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
370 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
371 $j++;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
372 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
373 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
374
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
375 } else {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
376 return 1;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
377 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
378
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
379 return 0;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
380 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
381
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
382
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
383
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
384 /*
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
385 * Test result from edit screen and do next action
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
386 */
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
387 function testdata() {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
388
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
389 $result = test_thedata();
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
390 $error = '';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
391
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
392 switch ($result) {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
393 case 0: if ($_POST['command'] == 'add') {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
394 profile_add();
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
395 return;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
396 } else if ($_POST['command'] == 'update') {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
397 profile_update();
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
398 return;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
399 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
400 break;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
401 case 1: $error = 'Missing data';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
402 break;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
403 case 2: $error = 'The name is too short';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
404 break;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
405 case 3: $error = 'The name is already in use, choose another one';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
406 break;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
407 case 99:
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
408 load('profiles.php');
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
409 break;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
410 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
411
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
412 if ($_POST['command'] == 'add') {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
413 $heading = 'ThermFerm - Add Profile';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
414 } else {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
415 $heading = 'ThermFerm - Edit Profile';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
416 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
417
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
418 edit_screen($_POST['UUID'], $_POST['command'], $heading, $error);
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
419 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
420
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
421
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
422
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
423 /*
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
424 * Profiles edit screen. Used by profile_edit(), profile_add() and testdata()
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
425 *
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
426 * @param string $UUID The record UUID (fixed).
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
427 * @param string $Name The Profile Name.
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
428 * @param string $command 'add' or 'update'
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
429 * @param string $heading Pagina heading title.
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
430 * @Param string $error_message Blank or previous error.
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
431 */
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
432 function edit_screen($UUID, $command, $heading, $error_message) {
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
433
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
434 /*
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
435 * Get current profile data
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
436 */
196
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
437 $answer = send_cmd("PROFILE GET ".$UUID);
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
438 $reply = explode("\r\n", $answer);
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
439
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
440 $outstr = build_header($heading);
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
441 $outstr .= ' <div id="errors">'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
442 $outstr .= ' '.$error_message.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
443 $outstr .= ' </div> <!-- errors -->'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
444 $outstr .= ' <div id="etable">'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
445 $outstr .= ' <form method="POST" action="profiles.php">'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
446 $outstr .= ' <table class="editor">'.PHP_EOL;
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
447
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
448 if (startsWith($reply[0], "213")) {
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
449 $i = 1;
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
450 while (1) {
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
451 if (strcmp($reply[$i], ".") == 0)
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
452 break;
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
453 $f = explode(",", $reply[$i]);
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
454
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
455 if ($f[0] == "NAME") {
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
456 $outstr .= ' <tr class="editor">'.PHP_EOL;
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
457 $outstr .= ' <td class="editname">Profile Name</td>'.PHP_EOL;
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
458 $outstr .= ' <td class="editfield"><input type="text" name="Name" size="50" value="'.$f[1].'"></td>'.PHP_EOL;
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
459 $outstr .= ' </tr>'.PHP_EOL;
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
460 }
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
461 if ($f[0] == "INITTEMP_LO") {
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
462 $outstr .= ' <tr class="editor">'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
463 $outstr .= ' <td class="editname">Initial temperature low</td>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
464 $outstr .= ' <td class="editfield"><input type="text" name="Inittemp_lo" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
465 $outstr .= ' </tr>'.PHP_EOL;
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
466 }
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
467 if ($f[0] == "INITTEMP_HI") {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
468 $outstr .= ' <tr class="editor">'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
469 $outstr .= ' <td class="editname">Initial temperature high</td>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
470 $outstr .= ' <td class="editfield"><input type="text" name="Inittemp_hi" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
471 $outstr .= ' </tr>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
472 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
473 if ($f[0] == "FRIDGE_MODE") {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
474 $outstr .= ' <tr class="editor">'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
475 $outstr .= ' <td class="editname">Fridge mode</td>'.PHP_EOL;
399
2f472a9081c9 Changed frdige_mode paramater to 0..100 so we can work with a percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
476 $outstr .= ' <td class="editfield"><input type="hidden" name="Fridge_mode" value="0"><input type="checkbox" name="Fridge_mode" value="100"';
2f472a9081c9 Changed frdige_mode paramater to 0..100 so we can work with a percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
477 if ($f[1] > 0)
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
478 $outstr .= " checked";
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
479 $outstr .= '></td>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
480 $outstr .= ' </tr>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
481 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
482
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
483 $i++;
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
484 }
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
485 }
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
486 $outstr .= ' <tr class="editor">'.PHP_EOL;
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
487 $outstr .= ' <td class="editname"><input type="submit" value="Save" name="key"></td>'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
488 $outstr .= ' <td class="editfield"><input type="submit" value="Cancel" name="key">';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
489 $outstr .= '<input type="submit" value="Delete" name="key" style="margin-left: 100px;">';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
490 $outstr .= '<input type="hidden" value="testdata" name="action">';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
491 $outstr .= '<input type="hidden" value="'.$command.'" name="command">';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
492 $outstr .= '<input type="hidden" value="'.$UUID.'" name="UUID"></td>'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
493 $outstr .= ' </tr>'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
494 $outstr .= ' </table>'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
495 $outstr .= ' </form>'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
496 $outstr .= ' </div> <!-- etable -->'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
497 $outstr .= ' <script type="text/javascript">'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
498 $outstr .= ' $(document).ready(function () {'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
499 $outstr .= ' $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
500 $outstr .= ' });'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
501 $outstr .= ' </script>'.PHP_EOL;
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
502 $outstr .= build_footer();
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
503 echo $outstr;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
504 }
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
505
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
506
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
507
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
508 /*
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
509 * Edit a Profile. Fetches the record data and shows the edit screen.
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
510 *
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
511 * @param string $_GET['action'] Must be 'edit'.
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
512 * @param string $_GET['UUID'] The UUID of the Profile.
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
513 */
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
514 function profile_edit() {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
515 if ($_GET['action'] == 'edit') {
192
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
516 edit_screen($_GET['UUID'], 'update', 'ThermFerm - Edit Profile', '');
5d013b4a9138 Added PROFILE GET and PROFILE PUT commands. Adjusted the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
517 return;
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
518 } else {
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
519 load('profiles.php');
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
520 }
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
521 }
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
522
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
523
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
524
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
525 /*
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
526 * @link Edit profile
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
527 * @link Add profile
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
528 */
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
529 function profile_list() {
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
530
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
531 global $arr;
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
532
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
533 $outstr = build_header("ThermFerm - Profiles");
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
534
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
535 $outstr .= ' <div id="errors">'.PHP_EOL;
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
536 $outstr .= ' </div> <!-- errors -->'.PHP_EOL;
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
537 $outstr .= ' <div id="etable">'.PHP_EOL;
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
538 $outstr .= ' <table class="setup">'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
539 $outstr .= ' <tr class="trhead">'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
540 $outstr .= ' <td class="setup" style="width: 300px;">UUID</td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
541 $outstr .= ' <td class="setup" style="width: 300px;">Name</td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
542 $outstr .= ' <td class="setup" style="width: 40px;">Steps</td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
543 $outstr .= ' <td class="setup" style="width: 40px;">Edit</td>'.PHP_EOL;
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
544 $outstr .= ' </tr>'.PHP_EOL;
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
545
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
546 if (startsWith($arr[0], "212")) {
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
547 $j = 1;
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
548 while (1) {
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
549 if (strcmp($arr[$j], ".") == 0)
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
550 break;
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
551 $f = explode(",", $arr[$j]);
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
552 $outstr .= ' <tr class="setup">'.PHP_EOL;
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
553 $outstr .= ' <td class="setup">'.$f[0].'</td>'.PHP_EOL;
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
554 $outstr .= ' <td class="setup">'.$f[1].'</td>'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
555 if ($f[3] == 1) {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
556 $outstr .= ' <td class="setup">'.$f[2].'</td>'.PHP_EOL;
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
557 $outstr .= ' <td class="setup">Busy</td>'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
558 } else {
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
559 $outstr .= ' <td class="setup"><a href="profiles.php?action=esteps&amp;UUID='.$f[0].'">'.$f[2].'</a></td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
560 $outstr .= ' <td class="setup"><a href="profiles.php?action=edit&amp;UUID='.$f[0].'">Edit</a></td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
561 }
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
562 $outstr .= ' </tr>'.PHP_EOL;
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
563 $j++;
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
564 }
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
565 }
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
566
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
567 $outstr .= ' </table>'.PHP_EOL;
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
568 $outstr .= ' </div> <!-- etable -->'.PHP_EOL;
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
569 $outstr .= ' <div id="atable">'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
570
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
571 $outstr .= ' <form method="POST" action="profiles.php">'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
572 $outstr .= ' <table class="editor">'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
573 $outstr .= ' <tr class="trhead"><td colspan="3">Add new profile</td></tr>'.PHP_EOL;
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
574 $outstr .= ' <tr class="editor">'.PHP_EOL;
139
ffcabb9166bf Better screen name
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
575 $outstr .= ' <td class="editname">Profile Name</td>'.PHP_EOL;
140
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
576 $outstr .= ' <td class="editfield"><input type="text" name="Name" size="50" value=""></td>'.PHP_EOL;
1b001de37945 Implemented PROFILE PUTS command
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
577 $outstr .= ' <td class="editsub"><input type="submit" value="Add" name="key"></td>'.PHP_EOL;
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
578 $outstr .= '<input type="hidden" value="testdata" name="action">';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
579 $outstr .= '<input type="hidden" value="add" name="command">';
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
580 $outstr .= '<input type="hidden" value="00000000-0000-0000-0000-000000000000" name="UUID">';
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
581 $outstr .= '<input type="hidden" value="19.8" name="Inittemp_lo"></td>';
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
582 $outstr .= '<input type="hidden" value="20.2" name="Inittemp_hi"></td>';
137
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
583 $outstr .= ' </tr>'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
584 $outstr .= ' </table>'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
585 $outstr .= ' </form>'.PHP_EOL;
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
586
e4518fd9b626 Profiles can be managed via the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
587 $outstr .= ' </div> <!-- atable -->'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
588 $outstr .= ' <script type="text/javascript">'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
589 $outstr .= ' $(document).ready(function () {'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
590 $outstr .= ' $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
591 $outstr .= ' });'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 379
diff changeset
592 $outstr .= ' </script>'.PHP_EOL;
134
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 $outstr .= build_footer();
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
594 echo $outstr;
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
595 }
f05601490415 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
596

mercurial