Beispiel #1
0
function load_recipe_brewing_update_data($table)
{
    global $fieldData;
    $brewBitterness = explode("-", $_POST['brewBitterness']);
    $fieldData["brewBitterness"] = GetSQLValueString($brewBitterness[0], "text");
    $fieldData["brewIBUFormula"] = GetSQLValueString($brewBitterness[1], "text");
    $brewLovibond = explode("-", $_POST['brewLovibond']);
    $fieldData["brewLovibond"] = GetSQLValueString($brewLovibond[0], "text");
    $fieldData["brewColorFormula"] = GetSQLValueString($brewLovibond[1], "text");
    // Hop Use and Type aren't considered in the calculator so we have to make some assumptions here.
    $boilTime = $_POST['brewBoilTime'];
    for ($i = 0; $i < MAX_HOPS; $i++) {
        $key = "brewHops" . ($i + 1) . "Use";
        $fieldData[$key] = GetSQLValueString(get_hop_use($_POST['hopsTime'][$i], $boilTime), "text");
        $key = "brewHops" . ($i + 1) . "Type";
        $fieldData[$key] = GetSQLValueString(get_hop_type($_POST['hopsTime'][$i]), "text");
    }
    // If this is a blog, we want to update the target/predicted OG and FG; Otherwise, it's a
    // recipe so we just update the 'brewOG' and 'brewFG'.
    if ($table == "brewing") {
        $fieldData["brewTargetOG"] = GetSQLValueString($_POST['brewOG'], "text");
        $fieldData["brewTargetFG"] = GetSQLValueString($_POST['brewFG'], "text");
    } else {
        $fieldData["brewOG"] = GetSQLValueString($_POST['brewOG'], "text");
        $fieldData["brewFG"] = GetSQLValueString($_POST['brewFG'], "text");
    }
}
     echo "SELECTED";
 }
 /*
 if (($action == "edit") || ($action == "import") || ($action == "importRecipe") || ($action == "reuse")) {
   if ($row_log[$key] == "Aroma") {
     echo "SELECTED";
   }
 } elseif ($action == "importCalc") {
   if (get_hop_type($hopsTime[$i], "Aroma")) {
     echo "SELECTED";
   }
 }
 */
 echo '>Aroma</option>' . "\n";
 echo '<option value="Both" ';
 if ($action != "add" && ($action != "importCalc" && $row_log[$key] == "Both" || $action == "importCalc" && get_hop_type($hopsTime[$i], "Both"))) {
     echo "SELECTED";
 }
 /*
 if (($action == "edit") || ($action == "import") || ($action == "importRecipe") || ($action == "reuse")) {
   if ($row_log[$key] == "Both") {
     echo "SELECTED";
   }
 } elseif ($action == "importCalc") {
   if (get_hop_type($hopsTime[$i], "Both")) {
     echo "SELECTED";
   }
 }
 */
 echo '>Both</option>' . "\n";
 echo '</select>' . "\n";