$errores['direccion'] = "Error en el campo Direccion.";
    }
    $o = $_POST['ope'];
    if ($o == "") {
        $HayError = true;
        $errores['ope'] = "Error en el campo Operario.";
    }
    //Campo opcional.
    if (!isset($_POST['anoA'])) {
        $HayError = true;
        $errores['anoA'] = "Error en el campo Anotacion antes de empezar.";
    }
    if (!isset($_POST['tlf']) || !preg_match($patronTLF, $_POST['tlf'])) {
        $HayError = true;
        $errores['tlf'] = "Error en el campo telefono.";
    }
    if (!isset($_POST['CP']) || !preg_match($patronCP, $_POST['CP'])) {
        $HayError = true;
        $errores['CP'] = "Error en el campo Codigo postal.";
    }
    $fecha = TransformarFecha($_POST['fecha_f']);
    //creamos un array con los campos recogidos y filtrados para su inserccion.
    $campos = CreaArrayTareas($_POST['Descr'], $_POST['nombre'], $_POST['tlf'], $fecha, $_POST['correo'], $_POST['ESTADO'], $_POST['Pobla'], $_POST['CP'], $_POST['direccion'], $_POST['provincia'], $_POST['anoA'], "", $_POST['ope']);
    //conectamos con la base de datos y Insertamos el registro.
    if ($HayError) {
        include_once "\\..\\View\\form_insert.php";
    } else {
        InsertaTarea($campos);
        include VIEW_PATH . "insertado.php";
    }
}
Example #2
0
include_once "\\Helpers\\form.php";
include_once "\\model\\login.php";
if (!Estadentro()) {
    $HayError = true;
    $errores['autenticacion'] = "Registrese correctamente.";
    include '\\ctrl\\inicio.php';
    exit;
}
if (!$_POST) {
    include_once VIEW_PATH . 'form_buscar.php';
} else {
    if (isset($_POST['pendiente'])) {
        $condicion = "estado='Pendiente'";
        include CTRL_PATH . 'listarFiltro.php';
    }
    if (isset($_POST['Buscarfecha'])) {
        $fecha = $_POST['fecha_b'];
        $fecha = TransformarFecha($fecha);
        $condicion = "f_fin= '{$fecha}'";
        include CTRL_PATH . 'listarFiltro.php';
    }
    if (isset($_POST['Buscarid'])) {
        $id = $_POST['id'];
        $ListaTareas = BuscarTareas("idtarea='{$id}'", 0, 1);
        if (Nregistrosfiltrados("idtarea='{$id}'") > 0) {
            include VIEW_PATH . 'listarFiltroid.php';
        } else {
            echo "<h3 align='center'> No existen tareas</h3>";
        }
    }
}