Thu, 07 Aug 2014 21:19:30 +0200
Auto refresh LED's state added.
100 | 1 | <?php |
2 | /***************************************************************************** | |
3 | * Copyright (C) 2014 | |
4 | * | |
5 | * Michiel Broek <mbroek at mbse dot eu> | |
6 | * | |
7 | * This file is part of ThermFerm | |
8 | * | |
9 | * This is free software; you can redistribute it and/or modify it | |
10 | * under the terms of the GNU General Public License as published by the | |
11 | * Free Software Foundation; either version 2, or (at your option) any | |
12 | * later version. | |
13 | * | |
14 | * ThermFerm is distributed in the hope that it will be useful, but | |
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with ThermFerm; see the file COPYING. If not, write to the Free | |
21 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
22 | *****************************************************************************/ | |
23 | ||
24 | ||
25 | require_once('utilities.php'); | |
26 | ||
27 | ||
28 | ||
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
29 | function showunit($unit, $unr) |
100 | 30 | { |
117 | 31 | global $my_style; |
32 | ||
100 | 33 | $outstr = ''; |
102
e37b9c571a56
Units can display the temperature
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
34 | $air_state = $beer_state = 1; |
100 | 35 | |
36 | $sock = open_socket(); | |
37 | if ($sock == false) { | |
38 | return ''; | |
39 | } | |
40 | ||
175
b73490398368
Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents:
173
diff
changeset
|
41 | socket_write($sock, "UNIT GET ".$unit, 4096); |
100 | 42 | $answer = ""; |
43 | while (1) { | |
44 | $line = socket_read($sock, 4096); | |
45 | if ($line === '') | |
46 | break; | |
47 | $answer .= $line; | |
48 | } | |
49 | socket_close($sock); | |
50 | $arr = explode("\r\n", $answer); | |
51 | ||
52 | if (startsWith($arr[0], "213")) { | |
53 | ||
169 | 54 | $set_temperature = "NA"; |
55 | $air_temperature = "NA"; | |
56 | $beer_temperature = "NA"; | |
153
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
57 | $power_led = $cooler_led = $heater_led = $fan_led = "off"; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
58 | $heater = $cooler = $fan = "no"; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
59 | $heater_state = $cooler_state = $fan_state = 0; |
153
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
60 | |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
61 | foreach($arr as $l) { |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
62 | $vals = explode(",", $l); |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
63 | if (strcmp($vals[0], "MODE") == 0) { |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
64 | $mode = $vals[1]; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
65 | if (strcmp($mode, "OFF")) |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
66 | $power_led = "on"; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
67 | } |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
68 | if (strcmp($vals[0], "AIR_STATE") == 0) { |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
69 | $air_state = $vals[1]; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
70 | } |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
71 | if ((strcmp($vals[0], "AIR_TEMPERATURE") == 0) && ($air_state == 0)) { |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
72 | $air_temperature = $vals[1]; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
73 | } |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
74 | if (strcmp($vals[0], "BEER_STATE") == 0) { |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
75 | $beer_state = $vals[1]; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
76 | } |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
77 | if ((strcmp($vals[0], "BEER_TEMPERATURE") == 0) && ($beer_state == 0)) { |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
78 | $beer_temperature = $vals[1]; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
79 | } |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
80 | if ((strcmp($vals[0], "HEATER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
153
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
81 | $heater = "yes"; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
82 | } |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
83 | if (strcmp($vals[0], "HEATER_STATE") == 0) { |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
84 | $heater_state = $vals[1]; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
85 | } |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
86 | if ((strcmp($vals[0], "COOLER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
153
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
87 | $cooler = "yes"; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
88 | } |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
89 | if (strcmp($vals[0], "COOLER_STATE") == 0) { |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
90 | $cooler_state = $vals[1]; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
91 | } |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
92 | if ((strcmp($vals[0], "FAN_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
153
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
93 | $fan = "yes"; |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
94 | } |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
95 | if (strcmp($vals[0], "FAN_STATE") == 0) { |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
96 | $fan_state = $vals[1]; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
97 | } |
186
7c44b11a10b0
Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents:
185
diff
changeset
|
98 | if (($vals[0] == "BEER_SET") && ($mode == "BEER")) { |
7c44b11a10b0
Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents:
185
diff
changeset
|
99 | $set_temperature = $vals[1]; |
7c44b11a10b0
Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents:
185
diff
changeset
|
100 | } |
7c44b11a10b0
Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents:
185
diff
changeset
|
101 | if (($vals[0] == "FRIDGE_SET") && ($mode == "FRIDGE")) { |
7c44b11a10b0
Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents:
185
diff
changeset
|
102 | $set_temperature = $vals[1]; |
7c44b11a10b0
Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents:
185
diff
changeset
|
103 | } |
7c44b11a10b0
Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents:
185
diff
changeset
|
104 | if (($vals[0] == "PROF_TARGET") && ($mode == "PROFILE")) { |
7c44b11a10b0
Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents:
185
diff
changeset
|
105 | $set_temperature = $vals[1]; |
7c44b11a10b0
Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents:
185
diff
changeset
|
106 | } |
153
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
107 | } |
866a947b732a
Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
108 | |
117 | 109 | $outstr .= ' <script type="text/javascript">'.PHP_EOL; |
110 | $outstr .= ' $(document).ready(function () {'.PHP_EOL; | |
121
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
111 | |
123
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
112 | $outstr .= ' var source'.$unr.' ='.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
113 | $outstr .= ' {'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
114 | $outstr .= ' datatype: "json",'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
115 | $outstr .= ' datafields: ['.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
116 | $outstr .= ' { name: \'Date\' },'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
117 | $outstr .= ' { name: \'Mode\' },'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
118 | $outstr .= ' { name: \'Air\', type: \'float\' },'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
119 | $outstr .= ' { name: \'Beer\', type: \'float\' },'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
120 | $outstr .= ' { name: \'Target\', type: \'float\' },'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
121 | $outstr .= ' { name: \'Heater\' },'.PHP_EOL; |
185 | 122 | $outstr .= ' { name: \'Cooler\', type: \'int\' },'.PHP_EOL; |
123
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
123 | $outstr .= ' { name: \'Fan\' },'.PHP_EOL; |
185 | 124 | $outstr .= ' { name: \'Door\', type: \'bool\' }'.PHP_EOL; |
123
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
125 | $outstr .= ' ],'.PHP_EOL; |
124
350401bac16e
Added maintenance tabs and extended server output
Michiel Broek <mbroek@mbse.eu>
parents:
123
diff
changeset
|
126 | $outstr .= ' url: \'getlog.php?unit='.$unit.'\''.PHP_EOL; |
123
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
127 | $outstr .= ' };'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
128 | |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
129 | $outstr .= ' var dataAdapter'.$unr.' = new $.jqx.dataAdapter(source'.$unr.','.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
130 | $outstr .= ' {'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
131 | $outstr .= ' autoBind: true,'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
132 | $outstr .= ' async: false,'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
133 | $outstr .= ' downloadComplete: function () { },'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
134 | $outstr .= ' loadComplete: function () { },'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
135 | $outstr .= ' loadError: function () { }'.PHP_EOL; |
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
136 | $outstr .= ' });'.PHP_EOL; |
121
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
137 | |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
138 | $outstr .= ' var settings'.$unr.' = {'.PHP_EOL; |
193
4136193a0c22
Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents:
186
diff
changeset
|
139 | $outstr .= ' title: "Fermentation history",'.PHP_EOL; |
121
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
140 | $outstr .= ' description: "",'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
141 | $outstr .= ' padding: { left: 5, top: 5, right: 5, bottom: 5 },'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
142 | $outstr .= ' titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },'.PHP_EOL; |
123
597688feda2f
Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
122
diff
changeset
|
143 | $outstr .= ' source: dataAdapter'.$unr.','.PHP_EOL; |
121
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
144 | $outstr .= ' categoryAxis:'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
145 | $outstr .= ' {'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
146 | $outstr .= ' dataField: \'Date\','.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
147 | $outstr .= ' textRotationAngle: 45,'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
148 | $outstr .= ' showGridLines: false'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
149 | $outstr .= ' },'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
150 | $outstr .= ' colorScheme: \'scheme01\','.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
151 | $outstr .= ' seriesGroups:'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
152 | $outstr .= ' [{'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
153 | $outstr .= ' type: \'line\','.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
154 | $outstr .= ' columnsGapPercent: 30,'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
155 | $outstr .= ' seriesGapPercent: 0,'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
156 | $outstr .= ' valueAxis:'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
157 | $outstr .= ' {'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
158 | $outstr .= ' description: \'Degrees C\''.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
159 | $outstr .= ' },'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
160 | $outstr .= ' series: ['.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
161 | $outstr .= ' { dataField: \'Air\', displayText: \'Air\' },'.PHP_EOL; |
185 | 162 | $outstr .= ' { dataField: \'Beer\', displayText: \'Beer\' },'.PHP_EOL; |
163 | $outstr .= ' { dataField: \'Target\', displayText: \'Target\' }'.PHP_EOL; | |
121
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
164 | $outstr .= ' ]'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
165 | $outstr .= ' }]'.PHP_EOL; |
03306c3bfd60
Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents:
118
diff
changeset
|
166 | $outstr .= ' };'.PHP_EOL; |
185 | 167 | /* Direct draw for the first time */ |
154 | 168 | $outstr .= ' $("#fermentor_chart_'.$unit.'").jqxChart(settings'.$unr.');'.PHP_EOL; |
185 | 169 | /* Regular updates of the chart */ |
170 | // $outstr .= ' setInterval(function(){'.PHP_EOL; | |
171 | // $outstr .= ' $("#fermentor_chart_'.$unit.'").jqxChart("update");'.PHP_EOL; | |
172 | // $outstr .= ' }, 3000);'.PHP_EOL; | |
173 | ||
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
169
diff
changeset
|
174 | $outstr .= ' setInterval(function(){'.PHP_EOL; |
185 | 175 | $outstr .= ' $.getJSON("getstate.php?uuid='.$unit.'", function(data) {'.PHP_EOL; |
176 | $outstr .= ' $("#load_air_'.$unr.'").html(data.air_temperature);'.PHP_EOL; | |
177 | $outstr .= ' $("#load_beer_'.$unr.'").html(data.beer_temperature);'.PHP_EOL; | |
178 | $outstr .= ' $("#load_target_'.$unr.'").html(data.target_temperature);'.PHP_EOL; | |
193
4136193a0c22
Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents:
186
diff
changeset
|
179 | $outstr .= ' $("#load_led1_'.$unr.'").html(data.led1);'.PHP_EOL; |
4136193a0c22
Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents:
186
diff
changeset
|
180 | $outstr .= ' $("#load_led2_'.$unr.'").html(data.led2);'.PHP_EOL; |
4136193a0c22
Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents:
186
diff
changeset
|
181 | $outstr .= ' $("#load_led3_'.$unr.'").html(data.led3);'.PHP_EOL; |
185 | 182 | $outstr .= ' });'.PHP_EOL; |
183 | $outstr .= ' }, 10000);'.PHP_EOL; | |
117 | 184 | $outstr .= ' });'.PHP_EOL; |
185 | $outstr .= ' </script>'.PHP_EOL; | |
100 | 186 | $outstr .= ' <div id="fermentor">'.PHP_EOL; |
154 | 187 | $outstr .= ' <div id="fermentor_chart_'.$unit.'" style="width:720px; height:377px; float:left"></div>'.PHP_EOL; |
100 | 188 | |
151
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
189 | $outstr .= ' <div id="fermentor_panel_top">'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
190 | $outstr .= ' <div id="fermentor_selector">'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
191 | $outstr .= ' <form id="select_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
192 | strcmp($mode, "OFF") ? $se = "" : $se = " checked"; |
168
1288dbf0f9b5
Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
193 | $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="OFF"'.$se.'>Off<br>'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
194 | strcmp($mode, "NONE") ? $se = "" : $se = " checked"; |
168
1288dbf0f9b5
Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
195 | $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="NONE"'.$se.'>None<br>'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
196 | (strcmp($heater, "no") || strcmp($cooler, "no")) ? $dis = "" : $dis = " disabled"; |
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
197 | strcmp($mode, "FRIDGE") ? $se = "" : $se = " checked"; |
168
1288dbf0f9b5
Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
198 | $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="FRIDGE"'.$se.$dis.'>Fridge<br>'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
199 | strcmp($mode, "BEER") ? $se = "" : $se = " checked"; |
168
1288dbf0f9b5
Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
200 | $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="BEER"'.$se.$dis.'>Beer<br>'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
201 | strcmp($mode, "PROFILE") ? $se = "" : $se = " checked"; |
168
1288dbf0f9b5
Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
202 | $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="PROFILE"'.$se.$dis.'>Profile'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
203 | $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
204 | $outstr .= ' </form>'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
205 | $outstr .= ' </div>'.PHP_EOL; |
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
206 | $outstr .= ' <div id="fermentor_powerled">'.PHP_EOL; |
151
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
207 | $outstr .= ' <img src="images/led_green_'.$power_led.'.png"><br>Pwr'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
208 | $outstr .= ' </div>'.PHP_EOL; |
151
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
209 | $outstr .= ' </div> <!-- fermentor_panel_top -->'.PHP_EOL; |
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
210 | |
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
211 | $outstr .= ' <div id="fermentor_panel_display">'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
212 | $outstr .= ' <div id="fermentor_display1">'.PHP_EOL; |
173 | 213 | $outstr .= ' <div id="load_target_'.$unr.'" class="dtemp">'.$set_temperature.'</div>Set'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
214 | $outstr .= ' </div>'.PHP_EOL; |
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
215 | $outstr .= ' <div id="fermentor_display2">'.PHP_EOL; |
173 | 216 | $outstr .= ' <div id="load_air_'.$unr.'" class="dtemp">'.$air_temperature.'</div>Air'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
217 | $outstr .= ' </div>'.PHP_EOL; |
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
218 | $outstr .= ' <div id="fermentor_display3">'.PHP_EOL; |
173 | 219 | $outstr .= ' <div id="load_beer_'.$unr.'" class="dtemp">'.$beer_temperature.'</div>Beer'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
220 | $outstr .= ' </div>'.PHP_EOL; |
151
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
221 | $outstr .= ' </div> <!-- fermentor_panel_display -->'.PHP_EOL; |
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
222 | |
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
223 | $outstr .= ' <div id="fermentor_panel_control">'.PHP_EOL; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
224 | if ($cooler_state == "100") |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
225 | $cooler_led = "on"; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
226 | $outstr .= ' <div id="fermentor_led1">'.PHP_EOL; |
193
4136193a0c22
Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents:
186
diff
changeset
|
227 | $outstr .= ' <div id="load_led1_'.$unr.'"><img src="images/led_green_'.$cooler_led.'.png"></div>Cool'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
228 | $outstr .= ' </div>'.PHP_EOL; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
229 | if ($heater_state == "100") |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
230 | $heater_led = "on"; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
231 | $outstr .= ' <div id="fermentor_led2">'.PHP_EOL; |
193
4136193a0c22
Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents:
186
diff
changeset
|
232 | $outstr .= ' <div id="load_led2_'.$unr.'"><img src="images/led_green_'.$heater_led.'.png"></div>Heat'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
233 | $outstr .= ' </div>'.PHP_EOL; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
234 | if ($fan_state == "100") |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
235 | $fan_led = "on"; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
236 | $outstr .= ' <div id="fermentor_led3">'.PHP_EOL; |
193
4136193a0c22
Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents:
186
diff
changeset
|
237 | $outstr .= ' <div id="load_led3_'.$unr.'"><img src="images/led_green_'.$fan_led.'.png"></div>Fan'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
238 | $outstr .= ' </div>'.PHP_EOL; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
239 | |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
240 | $outstr .= ' <div id="fermentor_toggle1">'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
241 | $outstr .= ' <form action="index.php" method="post">'.PHP_EOL; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
242 | (($mode == "NONE") && ($cooler == "yes")) ? $dis = "" : $dis = " disabled"; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
243 | ($cooler_state == "0") ? $ch = " checked" : $ch = ""; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
244 | $outstr .= ' <input type="radio" name="CoolerState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
245 | ($cooler_state == "100") ? $ch = " checked" : $ch = ""; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
246 | $outstr .= ' <input type="radio" name="CoolerState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
247 | $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
117 | 248 | $outstr .= ' </form>'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
249 | $outstr .= ' </div>'.PHP_EOL; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
250 | |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
251 | $outstr .= ' <div id="fermentor_toggle2">'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
252 | $outstr .= ' <form action="index.php" method="post">'.PHP_EOL; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
253 | (($mode == "NONE") && ($heater == "yes")) ? $dis = "" : $dis = " disabled"; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
254 | ($heater_state == "0") ? $ch = " checked" : $ch = ""; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
255 | $outstr .= ' <input type="radio" name="HeaterState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
256 | ($heater_state == "100") ? $ch = " checked" : $ch = ""; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
257 | $outstr .= ' <input type="radio" name="HeaterState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
258 | $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
117 | 259 | $outstr .= ' </form>'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
260 | $outstr .= ' </div>'.PHP_EOL; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
261 | |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
262 | $outstr .= ' <div id="fermentor_toggle3">'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
263 | $outstr .= ' <form action="index.php" method="post">'.PHP_EOL; |
178
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
264 | (($mode == "NONE") && ($fan== "yes")) ? $dis = "" : $dis = " disabled"; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
265 | ($fan_state == "0") ? $ch = " checked" : $ch = ""; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
266 | $outstr .= ' <input type="radio" name="FanState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
267 | ($fan_state == "100") ? $ch = " checked" : $ch = ""; |
988a898974f3
Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
268 | $outstr .= ' <input type="radio" name="FanState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL; |
155
0d86f3c0a07b
Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
269 | $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
117 | 270 | $outstr .= ' </form>'.PHP_EOL; |
113
cf3f906ffe0d
Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents:
112
diff
changeset
|
271 | $outstr .= ' </div>'.PHP_EOL; |
151
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
272 | $outstr .= ' </div> <!-- fermentor_panel_control -->'.PHP_EOL; |
ab90da2da45d
Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
273 | |
122
e57043423e72
Added fermentor maintenance windows
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
274 | $outstr .= ' </div> <!-- fermentor -->'.PHP_EOL; |
100 | 275 | } |
276 | ||
277 | return $outstr; | |
278 | } | |
279 | ||
280 | ||
281 | ||
282 | function liveview() | |
283 | { | |
284 | $outstr = PHP_EOL; | |
285 | ||
286 | $sock = open_socket(); | |
287 | if ($sock !== false) { | |
288 | socket_write($sock, "LIST", 4096); | |
289 | ||
290 | /* | |
291 | * Multiple reads until the remote closed the connection | |
292 | */ | |
293 | $answer = ""; | |
294 | while (1) { | |
295 | $line = socket_read($sock, 4096); | |
296 | if ($line === '') | |
297 | break; | |
298 | $answer .= $line; | |
299 | } | |
300 | socket_close($sock); | |
301 | $arr = explode("\r\n", $answer); | |
302 | ||
117 | 303 | $outstr .= ' <div id="jqxTabs">'.PHP_EOL; |
304 | $outstr .= ' <ul>'.PHP_EOL; | |
100 | 305 | if (startsWith($arr[0], "212")) { |
306 | $i = 1; | |
307 | while (1) { | |
308 | if (strcmp($arr[$i], ".") == 0) | |
309 | break; | |
310 | $parts = explode(",", $arr[$i]); | |
131
528dc0bb81ab
Always use uuid to select units and remove numeric record id's.
Michiel Broek <mbroek@mbse.eu>
parents:
124
diff
changeset
|
311 | $outstr .= ' <li style="margin-left: 20px;">'.$parts[1].'</li>'.PHP_EOL; |
117 | 312 | $i++; |
313 | } | |
314 | } | |
315 | $outstr .= ' </ul>'.PHP_EOL; | |
316 | ||
317 | if (startsWith($arr[0], "212")) { | |
318 | $i = 1; | |
319 | while (1) { | |
320 | if (strcmp($arr[$i], ".") == 0) | |
321 | break; | |
322 | $parts = explode(",", $arr[$i]); | |
131
528dc0bb81ab
Always use uuid to select units and remove numeric record id's.
Michiel Broek <mbroek@mbse.eu>
parents:
124
diff
changeset
|
323 | $outstr .= showunit($parts[0], $i); |
100 | 324 | $i++; |
325 | } | |
326 | } | |
117 | 327 | $outstr .= ' </div> <!-- jqxTabs -->'.PHP_EOL; |
100 | 328 | } |
329 | ||
330 | return $outstr; | |
331 | } | |
332 | ||
333 | ||
334 | ?> |