1
0
Fork 0
milfskleper/rest/src/rutas/aplicaciones.php

57 lines
1.6 KiB
PHP
Raw Normal View History

2018-10-13 17:01:33 +00:00
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
$app =new \Slim\app;
2018-10-14 02:26:34 +00:00
/// listado de todos los proyectos
2018-10-15 14:14:35 +00:00
$app ->get('/api/proyectos', function(Request $request, Response $response){
2018-10-14 02:26:34 +00:00
$array = aplicaciones_listado("",'','array','');
2018-10-15 19:14:18 +00:00
echo json_encode($array,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT);
2018-10-14 02:26:34 +00:00
});
/// aplicaciones por proyecto
$app ->get('/api/proyectos/{id}', function(Request $request, Response $response){
$id= $request->getAttribute('id');
2018-10-15 14:14:35 +00:00
$array = empresa_datos("$id",'array');
2018-10-15 19:14:18 +00:00
echo json_encode($array,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT);
2018-10-14 02:26:34 +00:00
});
2018-10-15 14:14:35 +00:00
2018-10-14 02:26:34 +00:00
// entradas a aplicacion por id
2018-10-15 14:14:35 +00:00
$app ->get('/api/proyectos/{id}/aplicaciones', function(Request $request, Response $response){
$id= $request->getAttribute('id');
$array = aplicaciones_listado("$id",'','array','');
2018-10-15 19:14:18 +00:00
echo json_encode($array,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT);
2018-10-15 14:14:35 +00:00
});
// entradas a aplicacion por id
$app ->get('/api/proyectos/{id}/aplicaciones/{aplicacion}', function(Request $request, Response $response){
2018-10-13 17:01:33 +00:00
$datos= array();
2018-10-15 14:14:35 +00:00
$datos['id']= $request->getAttribute('aplicacion');
$datos['proyecto']= $request->getAttribute('id');
2018-10-13 17:01:33 +00:00
$datos['tipo']='simple';
2018-10-15 14:14:35 +00:00
//print_r($datos);
2018-10-13 17:01:33 +00:00
echo json($datos);
});
2018-10-15 14:14:35 +00:00
2018-10-14 02:26:34 +00:00
// entradas a aplicacion por identificador
2018-10-15 14:14:35 +00:00
$app ->get('/api/proyectos/{id}/aplicaciones/{aplicacion}/{identificador}', function(Request $request, Response $response){
2018-10-13 17:01:33 +00:00
$datos= array();
2018-10-15 14:14:35 +00:00
$datos['id']= $request->getAttribute('aplicacion');
$datos['proyecto']= $request->getAttribute('id');
2018-10-14 02:26:34 +00:00
$datos['identificador']= $request->getAttribute('identificador');
2018-10-13 17:01:33 +00:00
$datos['tipo']='simple';
2018-10-14 02:26:34 +00:00
echo json($datos);
2018-10-13 17:01:33 +00:00
});