www-thermferm/archives.php

changeset 537
4eebab50993e
parent 536
e833bbd5e733
child 539
300b5c4cd977
equal deleted inserted replaced
536:e833bbd5e733 537:4eebab50993e
1 <?php 1 <?php
2 /***************************************************************************** 2 /**
3 * @file archives.php
4 * @brief Display as chart or download a fermentation logfile.
5 * @author Michiel Broek <mbroek at mbse dot eu>
6 *
3 * Copyright (C) 2015-2018 7 * Copyright (C) 2015-2018
4 * 8 *
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 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 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 11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version. 12 * later version.
13 * 13 *
17 * General Public License for more details. 17 * General Public License for more details.
18 * 18 *
19 * You should have received a copy of the GNU General Public License 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 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. 21 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 *****************************************************************************/ 22 */
23
23 24
24 require_once('utilities.php'); 25 require_once('utilities.php');
25 $my_style = 'ui-redmond'; 26 $my_style = 'ui-redmond';
26 27
27 if (isset($_GET['action'])) { 28 if (isset($_GET['action'])) {
172 $outstr .= ' maxValue: 100,'.PHP_EOL; 173 $outstr .= ' maxValue: 100,'.PHP_EOL;
173 $outstr .= ' displayValueAxis: false,'.PHP_EOL; 174 $outstr .= ' displayValueAxis: false,'.PHP_EOL;
174 $outstr .= ' description: "Heat/Cool %"'.PHP_EOL; 175 $outstr .= ' description: "Heat/Cool %"'.PHP_EOL;
175 $outstr .= ' },'.PHP_EOL; 176 $outstr .= ' },'.PHP_EOL;
176 $outstr .= ' series: ['.PHP_EOL; 177 $outstr .= ' series: ['.PHP_EOL;
177 $outstr .= ' { dataField: "CoolUse", lineWidth: 1, displayText: "Cool %", opacity: 0.5 },'.PHP_EOL; 178 $outstr .= ' { dataField: "CoolUse", lineWidth: 1, displayText: "Cool %", opacity: 0.2 },'.PHP_EOL;
178 $outstr .= ' { dataField: "HeatUse", lineWidth: 1, displayText: "Heat %", opacity: 0.5 }'.PHP_EOL; 179 $outstr .= ' { dataField: "HeatUse", lineWidth: 1, displayText: "Heat %", opacity: 0.2 }'.PHP_EOL;
179 $outstr .= ' ]'.PHP_EOL; 180 $outstr .= ' ]'.PHP_EOL;
180 $outstr .= ' },'.PHP_EOL; 181 $outstr .= ' },'.PHP_EOL;
181 $outstr .= ' {'.PHP_EOL; 182 $outstr .= ' {'.PHP_EOL;
182 $outstr .= ' type: \'spline\','.PHP_EOL; 183 $outstr .= ' type: \'spline\','.PHP_EOL;
183 $outstr .= ' valueAxis:'.PHP_EOL; 184 $outstr .= ' valueAxis:'.PHP_EOL;
189 $outstr .= ' { dataField: "Air", lineWidth: 1, displayText: "Air" },'.PHP_EOL; 190 $outstr .= ' { dataField: "Air", lineWidth: 1, displayText: "Air" },'.PHP_EOL;
190 $outstr .= ' { dataField: "Beer", lineWidth: 2, displayText: "Beer" },'.PHP_EOL; 191 $outstr .= ' { dataField: "Beer", lineWidth: 2, displayText: "Beer" },'.PHP_EOL;
191 $outstr .= ' { dataField: "Target_lo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 },'.PHP_EOL; 192 $outstr .= ' { dataField: "Target_lo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 },'.PHP_EOL;
192 $outstr .= ' { dataField: "Target_hi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 },'.PHP_EOL; 193 $outstr .= ' { dataField: "Target_hi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 },'.PHP_EOL;
193 $outstr .= ' { dataField: "Room", lineWidth: 1, displayText: "Room", opacity: 0.5 },'.PHP_EOL; 194 $outstr .= ' { dataField: "Room", lineWidth: 1, displayText: "Room", opacity: 0.5 },'.PHP_EOL;
194 $outstr .= ' { dataField: "Chiller", lineWidth: 1, displayText: "Chiller", opacity: 0.4 }'.PHP_EOL; 195 $outstr .= ' { dataField: "Chiller", lineWidth: 1, displayText: "Chiller", color: \'#0000bb\' }'.PHP_EOL;
195 $outstr .= ' ]'.PHP_EOL; 196 $outstr .= ' ]'.PHP_EOL;
196 $outstr .= ' }]'.PHP_EOL; 197 $outstr .= ' }]'.PHP_EOL;
197 $outstr .= ' };'.PHP_EOL; 198 $outstr .= ' };'.PHP_EOL;
198 $outstr .= ' $("#fermentor_chart").jqxChart(settings);'.PHP_EOL; 199 $outstr .= ' $("#fermentor_chart").jqxChart(settings);'.PHP_EOL;
199 200
214 $outstr .= ' document.close();'.PHP_EOL; 215 $outstr .= ' document.close();'.PHP_EOL;
215 $outstr .= ' newWindow.print();'.PHP_EOL; 216 $outstr .= ' newWindow.print();'.PHP_EOL;
216 $outstr .= ' });'.PHP_EOL; 217 $outstr .= ' });'.PHP_EOL;
217 $outstr .= ' $("#print").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL; 218 $outstr .= ' $("#print").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL;
218 219
219 $outstr .= ' $("#pngButton").click(function () {'.PHP_EOL;
220 $outstr .= ' $("#fermentor_chart").jqxChart("saveAsPNG", "Chart_'.$name.'.png", getExportServer());'.PHP_EOL;
221 $outstr .= ' });'.PHP_EOL;
222 $outstr .= ' $("#pdfButton").click(function () {'.PHP_EOL; 220 $outstr .= ' $("#pdfButton").click(function () {'.PHP_EOL;
223 $outstr .= ' $("#fermentor_chart").jqxChart("saveAsPDF", "Chart_'.$name.'.pdf", getExportServer());'.PHP_EOL; 221 $outstr .= ' $("#fermentor_chart").jqxChart("saveAsPDF", "Chart_'.$name.'.pdf", getExportServer());'.PHP_EOL;
224 $outstr .= ' });'.PHP_EOL; 222 $outstr .= ' });'.PHP_EOL;
225 $outstr .= ' $("#pngButton").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL;
226 $outstr .= ' $("#pdfButton").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL; 223 $outstr .= ' $("#pdfButton").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL;
227 224
228 $outstr .= ' });'.PHP_EOL; 225 $outstr .= ' });'.PHP_EOL;
229 $outstr .= ' </script>'.PHP_EOL; 226 $outstr .= ' </script>'.PHP_EOL;
230 $outstr .= ' <div id="fermentor">'.PHP_EOL; 227 $outstr .= ' <div id="fermentor">'.PHP_EOL;
231 $outstr .= ' <div id="fermentor_chart" style="width:850px; height:410px; float:left"></div>'.PHP_EOL; 228 $outstr .= ' <div id="fermentor_chart" style="width:850px; height:410px; float:left"></div>'.PHP_EOL;
232 $outstr .= ' <div style="margin-top: 2px; margin-left: 10px;">'.PHP_EOL; 229 $outstr .= ' <div style="margin-top: 2px; margin-left: 10px;">'.PHP_EOL;
233 $outstr .= ' <input style="float: left; margin-left: 10px;" id="print" type="button" value="Print Graph" />'.PHP_EOL; 230 $outstr .= ' <input style="float: left; margin-left: 10px;" id="print" type="button" value="Print Graph" />'.PHP_EOL;
234 $outstr .= ' <input style="float: left; margin-left: 10px; margin-top: 10px;" id="pngButton" type="button" value="Save as PNG" />'.PHP_EOL;
235 $outstr .= ' <input style="float: left; margin-left: 10px; margin-top: 10px;" id="pdfButton" type="button" value="Save as PDF" />'.PHP_EOL; 231 $outstr .= ' <input style="float: left; margin-left: 10px; margin-top: 10px;" id="pdfButton" type="button" value="Save as PDF" />'.PHP_EOL;
236 $outstr .= ' </div>'.PHP_EOL; 232 $outstr .= ' </div>'.PHP_EOL;
237 $outstr .= ' </div> <!-- fermentor -->'.PHP_EOL; 233 $outstr .= ' </div> <!-- fermentor -->'.PHP_EOL;
238 234
239 $outstr .= ' <script type="text/javascript">'.PHP_EOL; 235 $outstr .= ' <script type="text/javascript">'.PHP_EOL;

mercurial