add auth to inscriptos, fix table view resonsive for inscriptos
This commit is contained in:
parent
e204f612a7
commit
f24319d961
@ -18,7 +18,8 @@
|
||||
"slim/twig-view": "^2.3",
|
||||
"google/recaptcha": "^1.1",
|
||||
"kanellov/slim-twig-flash": "^0.2.0",
|
||||
"phpmailer/phpmailer": "~6.0"
|
||||
"phpmailer/phpmailer": "~6.0",
|
||||
"tuupola/slim-basic-auth": "^3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": ">=4.8 < 6.0"
|
||||
|
324
composer.lock
generated
324
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1812fa080861f1fd00320ca0ab0acdb8",
|
||||
"content-hash": "39b38af13b004d514b8fa19e295ad0d9",
|
||||
"packages": [
|
||||
{
|
||||
"name": "container-interop/container-interop",
|
||||
@ -428,6 +428,58 @@
|
||||
],
|
||||
"time": "2017-02-14T16:28:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-factory",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-factory.git",
|
||||
"reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/378bfe27931ecc54ff824a20d6f6bfc303bbd04c",
|
||||
"reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"psr/http-message": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Message\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interfaces for PSR-7 HTTP message factories",
|
||||
"keywords": [
|
||||
"factory",
|
||||
"http",
|
||||
"message",
|
||||
"psr",
|
||||
"psr-17",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2018-07-30T21:54:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.0.1",
|
||||
@ -478,6 +530,112 @@
|
||||
],
|
||||
"time": "2016-08-06T14:39:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-server-handler",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-server-handler.git",
|
||||
"reference": "439d92054dc06097f2406ec074a2627839955a02"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/439d92054dc06097f2406ec074a2627839955a02",
|
||||
"reference": "439d92054dc06097f2406ec074a2627839955a02",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"psr/http-message": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Server\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP server-side request handler",
|
||||
"keywords": [
|
||||
"handler",
|
||||
"http",
|
||||
"http-interop",
|
||||
"psr",
|
||||
"psr-15",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response",
|
||||
"server"
|
||||
],
|
||||
"time": "2018-01-22T17:04:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-server-middleware",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-server-middleware.git",
|
||||
"reference": "ea17eb1fb2c8df6db919cc578451a8013c6a0ae5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/ea17eb1fb2c8df6db919cc578451a8013c6a0ae5",
|
||||
"reference": "ea17eb1fb2c8df6db919cc578451a8013c6a0ae5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"psr/http-message": "^1.0",
|
||||
"psr/http-server-handler": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Server\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP server-side middleware",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-interop",
|
||||
"middleware",
|
||||
"psr",
|
||||
"psr-15",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2018-01-22T17:08:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
@ -812,6 +970,170 @@
|
||||
],
|
||||
"time": "2018-08-06T14:22:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tuupola/callable-handler",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tuupola/callable-handler.git",
|
||||
"reference": "8b9d87f88056d4234af317d65612d7b6307a747a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tuupola/callable-handler/zipball/8b9d87f88056d4234af317d65612d7b6307a747a",
|
||||
"reference": "8b9d87f88056d4234af317d65612d7b6307a747a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1",
|
||||
"psr/http-server-middleware": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"codedungeon/phpunit-result-printer": "^0.4.4",
|
||||
"overtrue/phplint": "^1.0",
|
||||
"phpunit/phpunit": "^6.5",
|
||||
"squizlabs/php_codesniffer": "^3.2",
|
||||
"tuupola/http-factory": "^0.4.0|^1.0",
|
||||
"zendframework/zend-diactoros": "^1.6.0|^2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Tuupola\\Middleware\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mika Tuupola",
|
||||
"email": "tuupola@appelsiini.net",
|
||||
"homepage": "https://appelsiini.net/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Compatibility layer for PSR-7 double pass and PSR-15 middlewares.",
|
||||
"homepage": "https://github.com/tuupola/callable-handler",
|
||||
"keywords": [
|
||||
"middleware",
|
||||
"psr-15",
|
||||
"psr-7"
|
||||
],
|
||||
"time": "2018-10-12T09:59:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tuupola/http-factory",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tuupola/http-factory.git",
|
||||
"reference": "dd38c41facebdec20b5b4a120cd6380e30720ce8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tuupola/http-factory/zipball/dd38c41facebdec20b5b4a120cd6380e30720ce8",
|
||||
"reference": "dd38c41facebdec20b5b4a120cd6380e30720ce8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1",
|
||||
"psr/http-factory": "^1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"nyholm/psr7": "<1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"http-interop/http-factory-tests": "^0.5.0",
|
||||
"overtrue/phplint": "^1.0",
|
||||
"phpunit/phpunit": "^6.5",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Tuupola\\Http\\Factory\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mika Tuupola",
|
||||
"email": "tuupola@appelsiini.net",
|
||||
"homepage": "https://appelsiini.net/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Lightweight autodiscovering PSR-17 HTTP factories",
|
||||
"homepage": "https://github.com/tuupola/http-factory",
|
||||
"keywords": [
|
||||
"http",
|
||||
"psr-17",
|
||||
"psr-7"
|
||||
],
|
||||
"time": "2018-10-12T09:32:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tuupola/slim-basic-auth",
|
||||
"version": "3.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tuupola/slim-basic-auth.git",
|
||||
"reference": "40f5efe991ac4e2441ee05b830375c02432ff3f8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tuupola/slim-basic-auth/zipball/40f5efe991ac4e2441ee05b830375c02432ff3f8",
|
||||
"reference": "40f5efe991ac4e2441ee05b830375c02432ff3f8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1",
|
||||
"psr/http-message": "^1.0.1",
|
||||
"psr/http-server-middleware": "^1.0",
|
||||
"tuupola/callable-handler": "^0.3.0|^0.4.0|^1.0",
|
||||
"tuupola/http-factory": "^0.4.0|^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"codedungeon/phpunit-result-printer": "^0.19.14",
|
||||
"equip/dispatch": "^2.0",
|
||||
"overtrue/phplint": "^1.1",
|
||||
"phpstan/phpstan": "^0.9.2",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"squizlabs/php_codesniffer": "^3.2",
|
||||
"zendframework/zend-diactoros": "^1.3|^2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Tuupola\\Middleware\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mika Tuupola",
|
||||
"email": "tuupola@appelsiini.net",
|
||||
"homepage": "https://appelsiini.net/"
|
||||
}
|
||||
],
|
||||
"description": "PSR-7 and PSR-15 HTTP Basic Authentication Middleware",
|
||||
"homepage": "https://appelsiini.net/projects/slim-basic-auth",
|
||||
"keywords": [
|
||||
"auth",
|
||||
"middleware",
|
||||
"psr-15",
|
||||
"psr-7"
|
||||
],
|
||||
"time": "2018-10-15T12:48:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v2.5.0",
|
||||
|
@ -4,6 +4,13 @@ use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
||||
// Routes
|
||||
$app->add(new Tuupola\Middleware\HttpBasicAuthentication([
|
||||
"path" => ["/inscriptos", "inscriptoscsv"], /* or ["/admin", "/api"] */
|
||||
"realm" => "Protected",
|
||||
"users" => [
|
||||
"admin" => "puntofijo"
|
||||
]
|
||||
]));
|
||||
|
||||
$app->get('/', function (Request $request, Response $response, array $args) {
|
||||
$this->logger->info("GDDWorkshop '/' route");
|
||||
@ -61,9 +68,17 @@ $app->get('/program', function (Request $request, Response $response, array $arg
|
||||
});
|
||||
|
||||
$app->get('/inscriptos', function(Request $request, Response $response, array $args){
|
||||
$dbfile = $this->settings['db']['path'];
|
||||
exec('sqlite3 -header -csv '.$dbfile.' "select * from registro" > "inscriptos.csv"');
|
||||
$file = 'inscriptos.csv';
|
||||
$this->logger->info("GDDWorkshop '/practicalinfo' route");
|
||||
$db = $this->db;
|
||||
$data = $db->getAll();
|
||||
return $this->renderer->render($response, 'inscriptos.html', ["registros" => $data]);
|
||||
});
|
||||
|
||||
$app->get('/inscriptoscsv', function(Request $request, Response $response, array $args){
|
||||
$this->logger->info("GDDWorkshop '/practicalinfo' route");
|
||||
$dbfile = $this->settings['db']['path'];
|
||||
exec('sqlite3 -header -csv '.$dbfile.' "select * from registro" > "inscriptos.csv"');
|
||||
$file = 'inscriptos.csv';
|
||||
$fh = fopen($file,"rb");
|
||||
$stream = new \Slim\Http\Stream($fh);
|
||||
return $response->withHeader('Content-Type', 'application/force-download')
|
||||
@ -77,14 +92,14 @@ $app->get('/inscriptos', function(Request $request, Response $response, array $a
|
||||
->withHeader('Pragma', 'public')
|
||||
->withBody($stream);
|
||||
});
|
||||
/*
|
||||
|
||||
$mw = function ($request, $response, $next) {
|
||||
$response->getBody()->write('BEFORE');
|
||||
$response = $next($request, $response);
|
||||
$response->getBody()->write('AFTER');
|
||||
|
||||
return $response;
|
||||
};*/
|
||||
};
|
||||
|
||||
// API ROUTES
|
||||
$app->group('/api', function($app){
|
||||
|
166
templates/inscriptos.html
Normal file
166
templates/inscriptos.html
Normal file
@ -0,0 +1,166 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Surface Dynamics Workshop 2018</title>
|
||||
<meta name="description" content="Workshop on Surfaces Dynamics 2018" />
|
||||
<meta name="keywords" content="Workshop Surfaces Patrice Le Calvez" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link rel="alternate" href="http://www.surfacesdynamics2018.cmat.edu.uy" hreflang="es-uy" />
|
||||
|
||||
<!-- Jquery -->
|
||||
<script type="text/javascript" src="js/lib/jquery/jquery-3.2.1.min.js"></script>
|
||||
|
||||
|
||||
<!-- Moment.js -->
|
||||
<script type="text/javascript" src="js/lib/fullcalendar/lib/moment.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap 3.3.7 -->
|
||||
<link rel="stylesheet" href="js/lib/bootstrap/dist/css/bootstrap.min.css">
|
||||
<script src="js/lib/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
|
||||
|
||||
<!-- My App -->
|
||||
<link rel="stylesheet" type="text/css" href="style/style.css" />
|
||||
<script type="text/javascript" src="js/app.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
/* Zebra striping */
|
||||
tr:nth-of-type(odd) {
|
||||
background: #eee;
|
||||
}
|
||||
th {
|
||||
background: #333;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
td, th {
|
||||
padding: 6px;
|
||||
border: 1px solid #ccc;
|
||||
text-align: left;
|
||||
}
|
||||
.buttonwrapper{
|
||||
margin: 10px 0px;
|
||||
}
|
||||
@media
|
||||
only screen and (max-width: 760px),
|
||||
(min-device-width: 768px) and (max-device-width: 1024px) {
|
||||
|
||||
/* Force table to not be like tables anymore */
|
||||
table, thead, tbody, th, td, tr {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Hide table headers (but not display: none;, for accessibility) */
|
||||
thead tr {
|
||||
position: absolute;
|
||||
top: -9999px;
|
||||
left: -9999px;
|
||||
}
|
||||
|
||||
tr {
|
||||
margin-top:5px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
td {
|
||||
/* Behave like a "row" */
|
||||
border: none;
|
||||
border-bottom: 1px solid #eee;
|
||||
position: relative;
|
||||
padding-left: 30%;
|
||||
}
|
||||
|
||||
td:before {
|
||||
/* Now like a table header */
|
||||
position: absolute;
|
||||
/* Top/left values mimic padding */
|
||||
top: 6px;
|
||||
left: 6px;
|
||||
width: 35%;
|
||||
padding-right: 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/*
|
||||
Label the data
|
||||
*/
|
||||
td:before{font-weight: bold;}
|
||||
td:nth-of-type(1):before { content: "Nombre:"; }
|
||||
td:nth-of-type(2):before { content: "e-mail:"; }
|
||||
td:nth-of-type(3):before { content: "Título:"; }
|
||||
td:nth-of-type(4):before { content: "Ciudad:"; }
|
||||
td:nth-of-type(5):before { content: "País:"; }
|
||||
td:nth-of-type(6):before { content: "Afiliación:"; }
|
||||
td:nth-of-type(7):before { content: "LLegada:"; }
|
||||
td:nth-of-type(8):before { content: "Salida:"; }
|
||||
td:nth-of-type(9):before { content: "Carta:"; }
|
||||
td:nth-of-type(10):before { content: "Room Pref.:"; }
|
||||
td:nth-of-type(11):before { content: "Roomate:"; }
|
||||
td:nth-of-type(12):before { content: "Fecha Reg.:"; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nombre</th>
|
||||
<th>e-Mail</th>
|
||||
<th>Título</th>
|
||||
<th>Ciudad</th>
|
||||
<th>País</th>
|
||||
<th>Afiliación</th>
|
||||
<th>Llegada</th>
|
||||
<th>Salida</th>
|
||||
<th>Carta Invitación</th>
|
||||
<th>Preferencia de habitación</th>
|
||||
<th>Compañero de cuarto</th>
|
||||
<th>Fecha de registro</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for reg in registros %}
|
||||
<tr>
|
||||
<td>{{ reg.nombre | title }} {{ reg.apellido | title }}</td>
|
||||
<td>{{ reg.email }}</td>
|
||||
<td>{{ reg.titulo | default("No especificado") }}</td>
|
||||
<td>{{ reg.ciudad | default("No especificado") }}</td>
|
||||
<td>{{ reg.pais }}</td>
|
||||
<td>{{ reg.afiliacion | default("No especificado") }}</td>
|
||||
<td>{{ reg.fechaLlegada | default("No especificado") }}</td>
|
||||
<td>{{ reg.fechaPartida | default("No especificado") }}</td>
|
||||
<td>{{ reg.cartaInvitacion ? 'Si' : 'No' }}</td>
|
||||
<td>{{ reg.roomingPref }}</td>
|
||||
<td>{{ reg.roomate|default("No especificado") }}</td>
|
||||
<td>{{ reg.fechaRegistro }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 buttonwrapper center">
|
||||
<a href="/inscriptoscsv" class="btn btn-primary btn-lg">Bajar CSV </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user