<?php

include_once './cad/DAL/Connection.php';
include_once './cad/BLL/ClaseCategoriasBLL.php';
include_once './cad/BLL/ClaseNotasBLL.php';
include_once './cad/DTO/ClaseCategorias.php';
include_once './cad/DTO/ClaseNotas.php';
$NotasBLL = new NotasBLL();
$CategoriasBLL = new CategoriasBLL();
$task = "";
if (isset($_REQUEST["task"])) {
    $task = $_REQUEST["task"];
} else {
    $task = "mostrar";
}
switch ($task) {
    case "insertar":
        if (isset($_REQUEST["titulo"])) {
            $titulo = $_REQUEST["titulo"];
        }
        if (isset($_REQUEST["texto"])) {
            $texto = $_REQUEST["texto"];
        }
        if (isset($_REQUEST["estado"])) {
            $estado = $_REQUEST["estado"];
        }
        if (isset($_REQUEST["categoria"])) {
            $categoria = $_REQUEST["categoria"];
        }
        $id = $NotasBLL->insert($titulo, $texto, $estado, $categoria);
        $objNota = $NotasBLL->select($id);
<?php

include_once 'cad/DAL/Connection.php';
include_once 'cad/BLL/NotasBLL.php';
include_once 'cad/DTO/Notas.php';
$id = $_REQUEST["id"];
$notaBLL = new NotasBLL();
$objnota = $notaBLL->select($id);
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        
    </body>
</html>
<?php

include_once './cad/DAL/Connection.php';
include_once './cad/BLL/ClaseNotasBLL.php';
include_once './cad/DTO/ClaseNotas.php';
$NotasBLL = new NotasBLL();
?>


<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link href="css/normalize.css" rel="stylesheet" type="text/css"/>
        <link href="css/style.css" rel="stylesheet" type="text/css"/>
        <script src="js/jquery-1.11.3.min.js" type="text/javascript"></script>
        <script src="js/script.js" type="text/javascript"></script>
    </head>
    <body>
        <div id="header">
            <button id="btnNuevo" onclick="mostrarNotaNueva()">Nueva Nota</button>
            <button id="btnArchivados" style="display:inline" onclick="setBlockGuardados()">Archivados</button>
            <button id="btnGuardados" style="display:none" onclick="setBlockArchivados()">Guardados</button>
            <form class="header__form">
                <input type="image" alt="Buscar" src="images/search.png" class="header__form-icon" disabled="disabled">
                <input type="search" placeholder="Buscar" onkeyup="javascript:mostrarBusqueda()" onsearch="javascript:mostrarBusqueda()" id="inpBusqueda" class="header__form-input">
            </form>
        </div>
        <div id="Nota-Nueva"  style="display:block">
            <div><input type="text" placeholder="Título" name="titulo" id="Nota-Nueva--Titulo" ></div>
<?php

include_once 'cad/DAL/Connection.php';
include_once 'cad/BLL/NotasBLL.php';
include_once 'cad/DTO/Notas.php';
$notaBLL = new NotasBLL();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script src="script.js" type="text/javascript"></script>
        <link href="css/style.css" rel="stylesheet" type="text/css"/>
        <link href="css/head.css" rel="stylesheet" type="text/css"/>
        <link href="css/main.css" rel="stylesheet" type="text/css"/>
        <link href="css/popup.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
        <header class="main-header">
            <h1 class="main-header__title">Google<span class='color_back'>Keep</span></h1
            <form action="index.html" class="main-header__form">
                <a href="#" class="icon-search"></a>
                <input type="text" id="buscar" placeholder="Buscar" onkeyup="busqueda()" class="main-header__form__search-field">
                <div id="resultadoBusqueda"></div>
            </form>
            
	</header>
        <main class="main-content">
            <section class="main-content_options">
                <a href="javascript:mostrarFormularioNotaArchivada()" id="mfna" class="icon-menu"></a>
<?php

include_once 'cad/DAL/Connection.php';
include_once 'cad/BLL/NotasBLL.php';
include_once 'cad/DTO/Notas.php';
$notasBLL = new NotasBLL();
if (isset($_REQUEST["task"])) {
    $task = $_REQUEST["task"];
} else {
    $task = "mostrar";
}
switch ($task) {
    case "insertar":
        if (isset($_REQUEST["fecha"])) {
            $fecha = $_REQUEST["fecha"];
        }
        if (isset($_REQUEST["nota"])) {
            $nota = $_REQUEST["nota"];
        }
        if (isset($_REQUEST["estado"])) {
            $estado = $_REQUEST["estado"];
        }
        if (isset($_REQUEST["idCategoria"])) {
            $categoria = $_REQUEST["idCategoria"];
        }
        if (isset($_REQUEST["titulo"])) {
            $titulo = $_REQUEST["titulo"];
        }
        $id = $notasBLL->insert($fecha, $nota, $estado, $categoria, $titulo);
        $objnota = $notasBLL->select($id);
        echo json_encode($objnota);