Exemple #1
0
        }
        $objNota = $notaBLL->selectById($id);
        $fecha = date("Y-m-d H:i:s");
        $notaBLL->update($id, $fecha, $objNota->getTitulo(), $nota);
        $objNota = $notaBLL->selectById($id);
        echo json_encode($objNota);
        break;
    case "cambiarCategoria":
        if (isset($_REQUEST["id"])) {
            $id = $_REQUEST["id"];
        }
        if (isset($_REQUEST["idCategoria"])) {
            $idCategoria = $_REQUEST["idCategoria"];
        }
        $objNota = $notaBLL->selectById($id);
        $objCategoriaAnterior = $categoriaBLL->selectById($objNota->getIdCategoria());
        $notaBLL->updateCategoria($id, $idCategoria);
        $objNota = $notaBLL->selectById($id);
        $objCategoria = $categoriaBLL->selectById($objNota->getIdCategoria());
        echo json_encode(array('nota' => $objNota, 'categoria' => $objCategoria, 'categoriaAnterior' => $objCategoriaAnterior));
        break;
    case "eliminar":
        if (isset($_REQUEST["id"])) {
            $id = $_REQUEST["id"];
        }
        $objNota = $notaBLL->selectById($id);
        $notaBLL->delete($id);
        // $objCategoria = $categoriaBLL->selectById($idCategoria);
        echo json_encode($objNota);
        break;
}