www/includes/db_recipes.php

changeset 667
1246550451ca
parent 565
dfc850e6ee1f
child 710
9646123ea063
equal deleted inserted replaced
666:029e65ca3678 667:1246550451ca
302 302
303 $mashs = '['; 303 $mashs = '[';
304 $comma = FALSE; 304 $comma = FALSE;
305 if (isset($_POST['mashs'])) { 305 if (isset($_POST['mashs'])) {
306 $array = $_POST['mashs']; 306 $array = $_POST['mashs'];
307 // Sort the array 307 // Write the array and fix missing data.
308 $temp = array();
309 for ($i = 0; $i < count($array); $i++) {
310 $temp[] = $array[$i]['step_temp'];
311 }
312 array_multisort($temp, SORT_ASC, SORT_NUMERIC, $array);
313 // Write the sorted array.
314 foreach($array as $key => $item) { 308 foreach($array as $key => $item) {
315 if ($comma) 309 if ($comma)
316 $mashs .= ','; 310 $mashs .= ',';
317 $comma = TRUE; 311 $comma = TRUE;
318 $mash = '{"step_name":"' . str_replace($rescapers,$rreplacements,$item['step_name']); 312 $mash = '{"step_name":"' . str_replace($rescapers,$rreplacements,$item['step_name']);
319 $mash .= '","step_type":' . $item['step_type']; 313 $mash .= '","step_type":' . $item['step_type'];
314 if (isset($item['step_volume']) && $item['step_volume'] != "")
315 $mash .= ',"step_volume":' . $item['step_volume'];
316 else
317 $mash .= ',"step_volume":0';
320 if (isset($item['step_infuse_amount']) && $item['step_infuse_amount'] != "") 318 if (isset($item['step_infuse_amount']) && $item['step_infuse_amount'] != "")
321 $mash .= ',"step_infuse_amount":' . $item['step_infuse_amount']; 319 $mash .= ',"step_infuse_amount":' . $item['step_infuse_amount'];
322 else 320 else
323 $mash .= ',"step_infuse_amount":0'; 321 $mash .= ',"step_infuse_amount":0';
322 if (isset($item['step_infuse_temp']) && $item['step_infuse_temp'] != "")
323 $mash .= ',"step_infuse_temp":' . $item['step_infuse_temp'];
324 else
325 $mash .= ',"step_infuse_temp":0';
324 $mash .= ',"step_temp":' . $item['step_temp']; 326 $mash .= ',"step_temp":' . $item['step_temp'];
325 $mash .= ',"step_time":' . $item['step_time']; 327 $mash .= ',"step_time":' . $item['step_time'];
326 $mash .= ',"ramp_time":' . $item['ramp_time']; 328 $mash .= ',"ramp_time":' . $item['ramp_time'];
327 $mash .= ',"end_temp":' . $item['end_temp'] . '}'; 329 $mash .= ',"end_temp":' . $item['end_temp'];
330 if (isset($item['step_wg_ratio']) && $item['step_wg_ratio'] != "")
331 $mash .= ',"step_wg_ratio":' . $item['step_wg_ratio'];
332 else
333 $mash .= ',"step_wg_ratio":0';
334 $mash .= '}';
328 $mashs .= $mash; 335 $mashs .= $mash;
329 //syslog(LOG_NOTICE, $mash); 336 //syslog(LOG_NOTICE, $mash);
330 } 337 }
331 } 338 }
332 $mashs .= ']'; 339 $mashs .= ']';

mercurial