<?php

//recuperamos la cookie del usuario para hacer el query en la tabla 
$query = $_COOKIE['usuario'];


/*
 * Editor server script for DB table sprectable
 * Created by http://editor.datatables.net/generator
 */

// DataTables PHP library and database connection
include( "lib/DataTables.php" );

// Alias Editor classes so they are easy to use
use
	DataTables\Editor,
	DataTables\Editor\Field,
	DataTables\Editor\Format,
	DataTables\Editor\Mjoin,
	DataTables\Editor\Options,
	DataTables\Editor\Upload,
	DataTables\Editor\Validate,
	DataTables\Editor\ValidateOptions;



// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'sprectable', 'id' )
	->fields(
		Field::inst( 'id' ),
		Field::inst( 'tipo' ),
		Field::inst( 'nombre' ),
		Field::inst( 'identificacion' ),
		Field::inst( 'empresa' ),
		Field::inst( 'cargo' ),
		Field::inst( 'linea' ),
		Field::inst( 'lugar' ),
		Field::inst( 'lugarespecifico' ),
		Field::inst( 'probabilidad' ),
		Field::inst( 'severidad' ),
		Field::inst( 'riesgo' ),
		Field::inst( 'valoracion' ),
		Field::inst( 'reporte' ),
		Field::inst( 'plan' ),
		Field::inst( 'timestamp' ),
		Field::inst( 'estado' ),
		Field::inst( 'seguimiento' ),
		Field::inst( 'ticket' )
	)

	
	// ***** ESTE ES EL QUERY PERSONALIZADO DE LA TABLA ***
	->where( function ( $q ) use ( $query ) {
		$q->where( 'lugar', $query );
	} )

	->process( $_POST )
	->json();
