<?php
/**
 * Created by PhpStorm.
 * User: Joseg
 * Date: 9/7/2018
 * Time: 8:40 PM
 */

include '../comun/validarSesion.php';

if (isset($_REQUEST['token'])) {
    $Valido = new validator();
    if (isset($_REQUEST['token']) && isset($_REQUEST['id_aviso'])) {
        if ($Valido->checkToken($_REQUEST['token'])) {
            $creadoPor = $Valido->retornarIdToken($_REQUEST['token']);
            $condominioData = $Valido->retornarDatos($creadoPor);
            $aviso = $_REQUEST['id_aviso'];
            $avisos = R::findOne('aviso', 'id = ?', [$aviso]);
            include '../comun/mensajeOk.php';
            if ($avisos) {
                print_r(json_encode($avisos));
            } else {
                include '../comun/mensajeNoHayDatosParaMostrar.php';
            }
        }
    }else{
        include '../comun/mensajeFaltanCampos.php';
    }
}else{
    include '../comun/mensajeSesionInvalida.php';
}