コード例 #1
0
<?php 
if (isset($_GET['submit'])) {
    $id = $_GET['id'];
    $descripcion = ucwords(strtolower(trim($_GET['descripcion'])));
    $tipo_ingrediente = $_GET['tipo_ingrediente'];
    $costo_adicional = trim($_GET['costo_adicional']);
    if (isset($_GET['activo'])) {
        $activo = 1;
    } else {
        $activo = 0;
    }
    $obj_tipo_ingrediente = FactoryTipoIngrediente::getTipoIngrediente($tipo_ingrediente);
    $ingrediente = new Ingrediente($id, $descripcion, $costo_adicional, $obj_tipo_ingrediente, $activo);
    try {
        $resultado = ingredienteBLL::modificar($ingrediente);
    } catch (Exception $ex) {
        $resultado = $ex->getMessage();
    }
    if ($resultado) {
        echo "<div class=\"alert alert-success\" role=\"alert\">\n    \t\t          <strong>Éxito!</strong> Ingrediente <strong>{$descripcion}</strong> editado correctamente.\n    \t\t      </div>";
    } else {
        echo "<div class=\"alert alert-danger\" role=\"alert\">\n    \t\t          <strong>Error!</strong> No se pudo editar el ingrediente.<strong>{$resultado}</strong>\n    \t\t     </div>";
    }
    echo "<p class=\"text-right\">\n    \t<a href=\"mantenimiento.php?view=modificar_ingrediente\"\n    \t\t\t  \tclass=\"btn btn-primary\">\n    \t\t\t\t\t<span class=\"glyphicon glyphicon-edit\"></span>\n    \t\t\t  \t\tEditar Otro Ingrediente\n    \t\t\t  \t</a>\n    \t\t\t  </p>";
    return;
}
if (isset($_GET['modificar'])) {
    $id = -1;
    if (isset($_GET['id'])) {
        $id = $_GET['id'];