Wed, 16 Oct 2019 21:05:03 +0200
Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | <?php |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | require_once('config.php'); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | |
69
ca25fdce3b85
Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
4 | $query = "SELECT * FROM inventory_hops ORDER BY origin,name"; |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | $connect = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | if (! $connect) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | echo "[]"; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | return; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | $result = mysqli_query($connect, $query); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | $hops[] = array( |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | 'record' => $row['record'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | 'name' => $row['name'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | 'alpha' => $row['alpha'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | 'beta' => $row['beta'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | 'humulene' => $row['humulene'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | 'caryophyllene' => $row['caryophyllene'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | 'cohumulone' => $row['cohumulone'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | 'myrcene' => $row['myrcene'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | 'hsi' => $row['hsi'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | 'total_oil' => $row['total_oil'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | 'type' => $row['type'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | 'form' => $row['form'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | 'origin' => $row['origin'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | 'inventory' => $row['inventory'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | 'cost' => $row['cost'] |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | ); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | } |
296
69fadd1aded2
Updated design document. Add content header application/json to all scripts that produce json output. Chart prints show the beer code and name in the header. Charts don't display the menu anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
219
diff
changeset
|
30 | header("Content-type: application/json"); |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | echo json_encode($hops); |