www/export_fermentables.php

Thu, 05 Dec 2019 22:47:40 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 05 Dec 2019 22:47:40 +0100
changeset 563
acdd54144838
child 786
c2cf34d3184a
permissions
-rw-r--r--

Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.

563
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 <?php
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 require_once($_SERVER['DOCUMENT_ROOT'].'/config.php');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/formulas.php');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 if (! $link) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 if (! mysqli_set_charset($link, "utf8" )) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 echo "error";
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 return 1;
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 $result = mysqli_query($link, "SELECT * FROM inventory_fermentables ORDER BY supplier,name");
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 $row = mysqli_fetch_array($result);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 $fermentabletype = array( 'Grain', 'Sugar', 'Extract', 'Dry extract', 'Adjunct' );
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 $graintype = array( 'Base', 'Roast', 'Crystal', 'Kilned', 'Sour malt', 'Special', 'No malt' );
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 $addedtype = array( 'Mash', 'Boil', 'Fermentation', 'Lagering', 'Bottle', 'Kegs' );
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 /*
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 * Create beerxml output
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 */
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 $xw = xmlwriter_open_memory();
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 xmlwriter_set_indent($xw, 1);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 $res = xmlwriter_set_indent_string($xw, ' ');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 xmlwriter_start_document($xw, '1.0', 'UTF-8');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 xmlwriter_start_element($xw, 'FERMENTABLES');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 while ($row = mysqli_fetch_array($result)) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 xmlwriter_start_element($xw, 'FERMENTABLES');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 xmlwriter_start_element($xw, 'VERSION');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 xmlwriter_text($xw, '1');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 xmlwriter_start_element($xw, 'NAME');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 xmlwriter_text($xw, $row['name']);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 xmlwriter_start_element($xw, 'NOTES');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 xmlwriter_text($xw, $row['notes']);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 xmlwriter_start_element($xw, 'TYPE');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 xmlwriter_text($xw, $fermentabletype[$row['type']]);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 xmlwriter_start_element($xw, 'YIELD');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 xmlwriter_text($xw, sprintf("%.5f",floatval($row['yield'])));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 xmlwriter_start_element($xw, 'COLOR');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 xmlwriter_text($xw, sprintf("%.3f",ebc_to_srm(floatval($row['color']))));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 xmlwriter_start_element($xw, 'ADD_AFTER_BOIL');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 ($row['added'] > 1) ? xmlwriter_text($xw, 'TRUE') : xmlwriter_text($xw, 'FALSE');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 xmlwriter_start_element($xw, 'ORIGIN');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 xmlwriter_text($xw, $row['origin']);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 xmlwriter_start_element($xw, 'SUPPLIER');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 xmlwriter_text($xw, $row['supplier']);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 if (floatval($row['coarse_fine_diff'])) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 xmlwriter_start_element($xw, 'COARSE_FINE_DIFF');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 xmlwriter_text($xw, sprintf("%.4f",floatval($row['coarse_fine_diff'])));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 if (floatval($row['moisture'])) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 xmlwriter_start_element($xw, 'MOISTURE');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 xmlwriter_text($xw, sprintf("%.4f",floatval($row['moisture'])));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 if (floatval($row['diastatic_power'])) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 xmlwriter_start_element($xw, 'DIASTATIC_POWER');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 xmlwriter_text($xw, sprintf("%.4f",floatval($row['diastatic_power'])));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 if (floatval($row['protein'])) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 xmlwriter_start_element($xw, 'PROTEIN');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 xmlwriter_text($xw, sprintf("%.4f",floatval($row['protein'])));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 if (floatval($row['max_in_batch'])) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 xmlwriter_start_element($xw, 'MAX_IN_BATCH');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 xmlwriter_text($xw, sprintf("%.3f",floatval($row['max_in_batch'])));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 xmlwriter_start_element($xw, 'RECOMMEND_MASH');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 ($row['recommend_mash']) ? xmlwriter_text($xw, 'TRUE') : xmlwriter_text($xw, 'FALSE');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 xmlwriter_start_element($xw, 'DISPLAY_COLOR');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 xmlwriter_text($xw, sprintf("%.0f EBC",floatval($row['color'])));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 xmlwriter_start_element($xw, 'GRAINTYPE');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 xmlwriter_text($xw, $graintype[$row['graintype']]);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 xmlwriter_start_element($xw, 'ADDED');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 xmlwriter_text($xw, $addedtype[$row['added']]);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 if (floatval($row['di_ph'])) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 xmlwriter_start_element($xw, 'DI_pH');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 xmlwriter_text($xw, sprintf("%.5f",floatval($row['di_ph'])));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 if (floatval($row['acid_to_ph_57'])) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 xmlwriter_start_element($xw, 'ACID_TO_pH_5.7');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 xmlwriter_text($xw, sprintf("%.5f",floatval($row['acid_to_ph_57'])));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 xmlwriter_end_element($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 xmlwriter_end_element($xw); // FERMENTABLE
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 }
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 xmlwriter_end_element($xw); // FERMENTABLES
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 $beerxml = xmlwriter_output_memory($xw);
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 Header('Content-type: text/xml');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 header('Content-Disposition: attachment; filename="fermentables.xml"');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 header('Content-Transfer-Encoding: binary');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 header('Expires: 0');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 header('Pragma: no-cache');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 header('Content-Length: '.strlen($beerxml));
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 exit($beerxml);

mercurial