<?php
/**
 * Created by PhpStorm.
 * User: Joseg
 * Date: 4/6/2018
 * Time: 2:08 AM
 */

include '../comun/validarSesion.php';
if (isset($_REQUEST['token'])) {
    $Valido = new validator();
    if ($Valido->checkToken($_REQUEST['token'])){
            $creadoPor = $Valido->retornarIdToken($_REQUEST['token']);
            $condominioData = $Valido->retornarDatos($creadoPor);
            $condominio = $condominioData["condominio_id"];
            $validar  = R::findAll( 'usuario', ' tipo_usuario =:tipoU AND condominio_id =:id_condominioc ',array('tipoU' => '5', 'id_condominioc' => $condominio));
            foreach ($validar as $valor) {
                unset($valor['clave']);
            }
            if (sizeof($validar) == 0){
                    include '../comun/mensajeOk.php';
                    $data = array("message" => "No hay datos para mostrar");
                    print_r(json_encode($data));

            }else{
                    include '../comun/mensajeOk.php';
                    print_r(json_encode($validar));
                }

    }else{
        include '../comun/mensajeDatosInvalidos.php';
    }
}else{
    include '../comun/mensajeSesionInvalida.php';
}