| Server IP : 52.9.100.119 / Your IP : 216.73.216.135 Web Server : Apache/2.4.61 (Amazon) OpenSSL/1.0.2k-fips PHP/7.3.30 Phusion_Passenger/5.1.5 System : Linux ip-172-31-9-35 4.14.355-196.618.amzn1.x86_64 #1 SMP Mon Apr 7 17:09:50 UTC 2025 x86_64 User : root ( 0) PHP Version : 7.3.30 Disable Function : exec,passthru,shell_exec,system,popen,proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /data/html/seica-apis/ |
Upload File : |
<?php
//header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json,application/x-www-form-urlencoded');
header('Access-Control-Allow-Headers: Content-Type');
include_once 'lib/rb_setup.php';
//require_once 'lib/api_token.php';
$data = array();
// - - - Initializing output parameters - - -
$update_time = R::isoDateTime();
$error_code = 0;
$error_description = "";
$status_filter = ['Terminado','En proceso'];
// - - - Defining flags - - -
$ALL_CLEAR = false;
// - - - get data - - -
$clientes_bean = R::getAll('select id,nombre from cliente');
$categorias_bean = R::getAll('select id,nombre,nombre_en from categoria');
$ubicaciones_bean = R::getAll('select e.id as estado_id, e.estado as estado from municipio m inner join estado_municipio em on m.id = em.municipio_id inner join estado e on em.estado_id = e.id where m.longitud is not null group by estado');
$f_fin_bean = R::getAll('select year(fin) as fecha from proyecto order by fin desc');
//var_dump($f_fin_bean);
$fin = unique_multidim_array($f_fin_bean,'fecha');
//$certificaciones_bean = R::getAll('select * from certificacion_nivel where certificacion = 1');
$certificaciones_bean = R::getAll('select * from certificacion_nivel');
$ALL_CLEAR = true;
// - - - Error definitions - - -
if ($ALL_CLEAR) {
$error_code = 0;
$error_description = 'Sucessful';
}
// - - - Delivering result data - - -
$data['status'] = $status_filter;
$data['clientes'] = $clientes_bean;
$data['categorias'] = $categorias_bean;
$data['ubicaciones'] = $ubicaciones_bean;
$data['fechas'] = $fin;
$data['certificaciones'] = $certificaciones_bean;
$data['update_time'] = $update_time;
$data['error'] = array("code" => $error_code, "description" => $error_description);
function unique_multidim_array($array, $key) {
$temp_array = array();
$i = 0;
$key_array = array();
foreach($array as $val) {
if (!in_array($val[$key], $key_array)) {
$key_array[$i] = $val[$key];
array_push($temp_array,$val);
}
$i++;
}
return $temp_array;
}
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);