<?php

include_once './cad/DAL/Connection.php';
include_once './cad/BLL/ClaseCategoriaBLL.php';
include_once './cad/DTO/ClaseCategoria.php';
$categoriaBLL = new CategoriaBLL();
if (isset($_REQUEST["task"])) {
    $task = $_REQUEST["task"];
} else {
    $task = "mostrar";
}
switch ($task) {
    case "insertar":
        if (isset($_REQUEST["nombre"])) {
            $nombre = $_REQUEST["nombre"];
        }
        if (isset($_REQUEST["color"])) {
            $color = $_REQUEST["color"];
        }
        $id = $categoriaBLL->insert($nombre, $color);
        $objCategoria = $categoriaBLL->select($id);
        echo json_encode($objCategoria);
        break;
    case "seleccionar":
        if (isset($_REQUEST["id"])) {
            $id = $_REQUEST["id"];
        }
        $objCategoria = $categoriaBLL->select($id);
        echo json_encode($objCategoria);
        break;
    case "actualizar":
<?php
include_once './cad/DAL/Connection.php';
include_once './cad/BLL/ClaseCategoriaBLL.php';
include_once './cad/DTO/ClaseCategoria.php';
include_once './cad/BLL/ClaseNotaBLL.php';
include_once './cad/DTO/ClaseNota.php';
$categoriaBLL = new CategoriaBLL();
$notaBLL = new NotaBLL();
?>
<!DOCTYPE html>
<html>

    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <link type="text/css" rel="stylesheet" href="css/materialize.css" media="screen,projection" />
        <link type="text/css" rel="stylesheet" href="css/style.css" media="screen,projection" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>

    <body class="grey lighten-2">
        <header>
            <div class="row no-margin-bottom white">
                <div class="col s2">
                    <a href="#"><img class="responsive-img" src="images/logo.png"></a>
                </div>
                <div class="col s4">
                    <nav class="grey lighten-2 z-depth-0">
                        <div class="nav-wrapper">
                            <form>
                                <div class="input-field">
<?php

include_once './cad/DAL/Connection.php';
include_once './cad/BLL/ClaseNotaBLL.php';
include_once './cad/DTO/ClaseNota.php';
include_once './cad/BLL/ClaseCategoriaBLL.php';
include_once './cad/DTO/ClaseCategoria.php';
$NotaBLL = new NotaBLL();
$categoriaBLL = new CategoriaBLL();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <script src="js/script.js" type="text/javascript"></script>
        <link rel="stylesheet" href="css/style.css" type="text/css"> 
        <link rel="stylesheet" href="css/style2.css" type="text/css">  
        <link rel="stylesheet" href="css/style3.css" type="text/css">  
        <link rel="stylesheet" href="css/normalize.css" type="text/css">
        <title>Practico 2</title>

    </head>
    <body id="body">
        <div class="arriba">
            <form  action="index.php" class="main-header__form">             
                
                <a href="javascript:buscar()" ><img src="img/search.png" border="0" class="main-header__form__search-button"></a>
                <input type="text" name="texto" onkeypress="callkeydownhandler(this);" id="tbus" class="main-header__form__search-field" placeholder="Buscar">

            </form>
           
Ejemplo n.º 4
0
<?php

include_once './CAD/DAL/Connection.php';
include_once './CAD/BLL/ClaseNotaBLL.php';
include_once './CAD/DTO/ClaseNota.php';
include_once './CAD/BLL/ClaseCategoriaBLL.php';
include_once './CAD/DTO/ClaseCategoria.php';
$notaBLL = new NotaBLL();
$categoriaBLL = new CategoriaBLL();
if (isset($_REQUEST["task"])) {
    $task = $_REQUEST["task"];
} else {
    $task = "mostrar";
}
switch ($task) {
    case "insertar":
        if (isset($_REQUEST["titulo"])) {
            $titulo = $_REQUEST["titulo"];
        }
        if (isset($_REQUEST["nota"])) {
            $nota = $_REQUEST["nota"];
        }
        if (isset($_REQUEST["idCategoria"])) {
            $idCategoria = $_REQUEST["idCategoria"];
        }
        $id = $notaBLL->insert($titulo, $nota, $idCategoria);
        $objNota = $notaBLL->selectById($id);
        $objCategoria = $categoriaBLL->selectById($idCategoria);
        echo json_encode(array('nota' => $objNota, 'categoria' => $objCategoria));
        break;
    case "seleccionar":