diff --git a/db/bkp/2017-12-18.bkp.db b/db/bkp/2017-12-18.bkp.db deleted file mode 100644 index dd3ca00..0000000 --- a/db/bkp/2017-12-18.bkp.db +++ /dev/null @@ -1,62 +0,0 @@ -PRAGMA foreign_keys=OFF; -BEGIN TRANSACTION; -CREATE TABLE Registro -( - id INTEGER PRIMARY KEY AUTOINCREMENT, - nombre VARCHAR(50) NOT NULL, - apellido VARCHAR(50) NOT NULL, - titulo VARCHAR(50), - afiliacion VARCHAR(50), - ciudad VARCHAR(50), - pais VARCHAR(50), - email VARCHAR(80) NOT NULL UNIQUE, - fechaLlegada DATE, - fechaPartida DATE, - financiacion BOOLEAN NOT NULL, - invitado BOOLEAN NOT NULL, - cartaInvitacion BOOLEAN NOT NULL, - roomingPref VARCHAR(50), - roommate VARCHAR(50), - fechaRegistro DATETIME NOT NULL -); -INSERT INTO "Registro" VALUES(1,'German','Correa','','','Montevideo','Uruguay','german.correa.balier@gmail.com','','',0,0,0,' - ','German Correa','2017-12-18 18:05:28'); -INSERT INTO "Registro" VALUES(2,'German','Correa','','','Montevideo','Uruguay','german.correa.basslier@gmail.com','','',1,1,1,' - ','German Correa','2017-12-18 19:04:38'); -INSERT INTO "Registro" VALUES(3,'German','Correa','','','Montevideo','Uruguay','gaaerman.correa.balier@gmail.com','','',0,0,1,' - ','German Correa','2017-12-18 19:05:15'); -INSERT INTO "Registro" VALUES(4,'German','Correa','','','Montevideo','Uruguay','aagerman.correa.balier@gmail.com','','',1,0,1,' - ','German Correa','2017-12-18 19:06:34'); -CREATE TABLE Speakers -( - id INTEGER PRIMARY KEY AUTOINCREMENT, - nombre VARCHAR(50) NOT NULL, - apellido VARCHAR(50) NOT NULL, - afiliacion VARCHAR(50) NOT NULL, - foto VARCHAR(200), - web VARCHAR(200), - confirmado BOOLEAN -); -INSERT INTO "Speakers" VALUES(1,'Jairo','Bochi','Universidad Católica de Chile','img/speakers/jariobochi.jpg','http://www.mat.uc.cl/~jairo.bochi/',1); -INSERT INTO "Speakers" VALUES(2,'Christian','Bonatti','Université de Bourgogne','img/speakers/cbonatti.jpg','http://bonatti.perso.math.cnrs.fr/',1); -INSERT INTO "Speakers" VALUES(3,'Keith','Burns','Northwestern University','img/speakers/kburns.jpg','http://www.math.northwestern.edu/~burns/',1); -INSERT INTO "Speakers" VALUES(4,'Yaiza','Canzani','University of North Carolina at Chapel Hill','img/speakers/ycanzani.jpg','http://canzani.web.unc.edu/',1); -INSERT INTO "Speakers" VALUES(5,'Gonzalo','Contreras','CIMAT, Guanajuato','img/speakers/gcontreras.jpg','http://www.cimat.mx/~gonzalo/',1); -INSERT INTO "Speakers" VALUES(6,'Adriana','da Luz','Universidad de la República','img/speakers/adaluz.jpg','',1); -INSERT INTO "Speakers" VALUES(7,'Colin','Guillarmou','Université Paris-Sud','img/speakers/cguillarmou.jpg','https://www.math.u-psud.fr/~guillarmou/',1); -INSERT INTO "Speakers" VALUES(8,'Ursula','Hamenstädt','Universität Bonn','img/speakers/uhamenstadt.jpg','http://www.math.uni-bonn.de/people/ursula/',1); -INSERT INTO "Speakers" VALUES(9,'Thomas','Koberda','University of Virginia','img/speakers/tkoberda.jpg','http://faculty.virginia.edu/Koberda/',1); -INSERT INTO "Speakers" VALUES(10,'Andrés','Koropecki','Universidade Federal Fluminense','img/speakers/akoropecki.jpg','http://www.professores.uff.br/koro/',1); -INSERT INTO "Speakers" VALUES(11,'François','Ledrappier','University of Notre Dame','img/speakers/fledrappier.jpg','http://math.nd.edu/people/faculty/francois-ledrappier/',1); -INSERT INTO "Speakers" VALUES(12,'Yash','Lodha','Cornell University','img/speakers/ylodha.jpg','http://www.math.cornell.edu/m/People/bynetid/yl763',1); -INSERT INTO "Speakers" VALUES(13,'Leonardo','Macarini','Universidade Federal do Rio de Janeiro','img/speakers/lmacarini.jpg','http://www.im.ufrj.br/visualizarDocente.php?idDepartamento=3&idDocente=28',1); -INSERT INTO "Speakers" VALUES(14,'Kathryn','Mann','Brown University','img/speakers/kmann.jpg','http://www.math.brown.edu/~mann/index.html',1); -INSERT INTO "Speakers" VALUES(15,'Andrés','Navas','Universidad de Santiago de Chile','img/speakers/anavas.jpg','http://www.mat.usach.cl/index.php/2012-12-19-12-50-19/academicos/75-andres-navas-flores',1); -INSERT INTO "Speakers" VALUES(16,'Jean-François','Quint','Université Bordeaux I','img/speakers/jfquint.jpg','https://www.math.u-bordeaux.fr/~jquint/',1); -INSERT INTO "Speakers" VALUES(17,'Andrés','Sambarino','Université Paris VI','img/speakers/asambarino.jpg','https://webusers.imj-prg.fr/~andres.sambarino/',1); -INSERT INTO "Speakers" VALUES(18,'Pablo','Shmerkin','Universidad Torcuato Di Tella','img/speakers/pshmerkin.jpg','http://www.utdt.edu/profesores/pshmerkin',1); -INSERT INTO "Speakers" VALUES(19,'Maxime','Wolff','Université Paris VI','img/speakers/mwolff.jpg','https://webusers.imj-prg.fr/~maxime.wolff/',1); -DELETE FROM sqlite_sequence; -INSERT INTO "sqlite_sequence" VALUES('Speakers',19); -INSERT INTO "sqlite_sequence" VALUES('Registro',4); -COMMIT; diff --git a/db/clam2020.db b/db/clam2021.db similarity index 87% rename from db/clam2020.db rename to db/clam2021.db index be648e1..5127719 100644 Binary files a/db/clam2020.db and b/db/clam2021.db differ diff --git a/db/db.php b/db/db.php index 0bc910b..87c3cd2 100644 --- a/db/db.php +++ b/db/db.php @@ -12,11 +12,8 @@ } public function insert($registro){ - $sql = 'INSERT INTO Registro (nombre,apellido,titulo,afiliacion,ciudad,' - .'pais,email,fechaLlegada,fechaPartida,' - ."cartaInvitacion,roomingPref,roommate,fechaRegistro)" - .' VALUES (:nombre,:apellido,:titulo,:afiliacion,:ciudad,:pais,:email,:fechaLlegada,' - .':fechaPartida,:cartaInvitacion,:roomingPref,:roommate,:fechaRegistro);'; + $sql = 'INSERT INTO Registro (nombre,apellido,titulo,afiliacion,ciudad,pais,email,emailzoom,fechaRegistro)' + .' VALUES (:nombre,:apellido,:titulo,:afiliacion,:ciudad,:pais,:email,:emailzoom,:fechaRegistro);'; $stmt = $this->pdo->prepare($sql); $stmt->execute([ @@ -27,13 +24,7 @@ ':ciudad' => $registro['ciudad'], ':pais' => $registro['pais'], ':email' => $registro['email'], - ':fechaLlegada' => $registro['bda'], - ':fechaPartida' => $registro['eda'], - //':financiacion' => $registro['financiacion'], - //':invitado' => $registro['invited'], - ':cartaInvitacion' => $registro['letterinvited'], - ':roomingPref' => $registro['roomtype'], - ':roommate' => $registro['roomate'], + ':emailzoom' => $registro['emailzoom'], ':fechaRegistro' => $date = date('Y-m-d H:i:s'), ]); return $this->pdo->lastInsertId(); @@ -45,12 +36,7 @@ return $stmt->fetchAll(\PDO::FETCH_BOTH); } - public function getSpeakers(){ - $stmt = $this->pdo->prepare("SELECT * FROM Speakers"); - $stmt -> execute(); - return $stmt->fetchAll(\PDO::FETCH_BOTH); - - } + public function findByMail($email){ $stmt = $this->pdo->prepare("SELECT * FROM Registro WHERE email=:email"); $stmt->bindParam(":email",$email); diff --git a/db/schema.sql b/db/schema.sql index 8ccbd8c..4f35460 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -8,34 +8,7 @@ CREATE TABLE IF NOT EXISTS Registro ciudad VARCHAR(50), pais VARCHAR(50), email VARCHAR(80) NOT NULL UNIQUE, - fechaLlegada DATE, - fechaPartida DATE, - /*financiacion BOOLEAN NOT NULL,*/ - /*invitado BOOLEAN NOT NULL,*/ - cartaInvitacion BOOLEAN NOT NULL, - roomingPref VARCHAR(50), - roommate VARCHAR(50), + emailzoom VARCHAR(80) NOT NULL UNIQUE, fechaRegistro DATETIME NOT NULL ); -CREATE TABLE IF NOT EXISTS Speakers -( - id INTEGER PRIMARY KEY AUTOINCREMENT, - nombre VARCHAR(50) NOT NULL, - apellido VARCHAR(50) NOT NULL, - afiliacion VARCHAR(50) NOT NULL, - foto VARCHAR(200), - web VARCHAR(200), - confirmado BOOLEAN -); - -INSERT INTO Speakers(nombre,apellido,afiliacion,foto,web,confirmado) -VALUES('Alicia','Dickenstein','Universidad de Buenos Aires','img/speakers/adickenstein.jpg','http://mate.dm.uba.ar/~alidick/',1); -INSERT INTO Speakers(nombre,apellido,afiliacion,foto,web,confirmado) -VALUES('Antonio','Montalban','University of California','img/speakers/amontalban.jpg','https://math.berkeley.edu/~antonio/',1); -INSERT INTO Speakers(nombre,apellido,afiliacion,foto,web,confirmado) -VALUES('Jairo','Bochi','Pontificia Universidad Católica de Chile','img/speakers/jbochi.jpg','http://www.mat.uc.cl/~jairo.bochi/',1); -INSERT INTO Speakers(nombre,apellido,afiliacion,foto,web,confirmado) -VALUES('Milton','Jara','Instituto de Matemática Pura e Aplicada','img/speakers/mjara.jpg','https://impa.br/page-pessoas/milton-jara/',1); -INSERT INTO Speakers(nombre,apellido,afiliacion,foto,web,confirmado) -VALUES('Tatiana', 'Toro','University of Washington','img/speakers/ttoro.jpg','https://sites.math.washington.edu/~toro/',1); \ No newline at end of file diff --git a/public/js/registerform.js b/public/js/registerform.js index 5af60d6..7afb509 100644 --- a/public/js/registerform.js +++ b/public/js/registerform.js @@ -5,7 +5,7 @@ function recaptchaCallback(){ } $().ready(function(){ - + $("#otrotitulohidden").hide() $("#statusmsg").hide(); $("#txtbda,#txteda").datepicker({ @@ -13,34 +13,31 @@ $().ready(function(){ minDate:new Date(2018,11,17), maxDate:new Date(2018,11,20) }); - + $("#titulo").select2({ + data: [ + "Estudiante de grado", + "Estudiante de posgrado", + "Posdoctorando", + "Profesor", + "Otro", + ], + placeholder: "Seleccione", + width: "100%", + minimumResultsForSearch: Infinity, + }); + $("#titulo").on('select2:select', function (e){ + var data = e.params.data; + if(data.text==="Otro") + $("#otrotitulohidden").show(500) + else + $("#otrotitulohidden").hide(); + }) $("#pais").select2({ data: data.paises, - placeholder: "Select Country", + placeholder: "Seleccione", width: "100%", - });/*.one('select2-focus', select2Focus).on("select2-blur", function () { - $(this).one('select2-focus', select2Focus) }); -function select2Focus() { - var select2 = $(this).data('select2'); - setTimeout(function() { - if (!select2.opened()) { - select2.open(); - } - }, 0); - }*/ - - $("#roomtype").select2({ - data: data.roomtypes, - placeholder: "Select Rooming Preference", - width:"100%", - minimumResultsForSearch: -1, - dropdownCssClass: "bigdrop", - - }); - - $('#registerform').on('submit',function(e) { e.preventDefault(); }); @@ -59,9 +56,16 @@ function select2Focus() { required: true, email: true }, - //invited:{required:true}, - //financiacion:"required", - letterinvited:"required", + ciudad:{required:true}, + pais:{required:true}, + titulo:{required:true}, + otrotitulo:{required: function(){ + if($("#titulo").select2('data')[0].id === 'Otro') + return true; + else return false + }}, + profesion:{required:true}, + afiliacion:{required:true}, hiddenRecaptcha: { required: function() { if(grecaptcha.getResponse() == "") return true; @@ -73,18 +77,20 @@ function select2Focus() { }, messages: { nombre: { - required: "Please enter your firstname", - minlength: "Your firstname must be at least 2 characters long" + required: "Debe ingresar Nombre", + minlength: "Nombre debe tener al menos 2 caracteres" }, apellido: { - required: "Please enter your lastname", - minlength: "Your lastname must be at least 2 characters long" + required: "Debe ingresar Apellido", + minlength: "Apellido debe tener al menos 2 caracteres" }, - email: "Please enter a valid e-mail address", - invited: "Select one option please", - financiacion: "Select one option please", - letterinvited: "Select one option please", - hiddenRecaptcha: "Please validate reCAPTCHA", + email: "Dirección de e-mail inválida", + ciudad:"Ingrese ciudad", + pais:"Seleccione País", + titulo: "Debe ingresar profesión o actividiad", + otrotitulo:"Aclare el detalle de su profesión o actividad", + afiliacion:"Debe ingresar su afiliación", + hiddenRecaptcha: "Debe validar reCAPTCHA", }, @@ -92,7 +98,11 @@ function select2Focus() { var formdata = $(form).serializeArray(); formdata.find(item => item.name === "pais").value = $("#pais").select2("data")[0].text.trim(); - formdata.find(item => item.name === "roomtype").value = $("#roomtype").select2("data")[0].text.trim(); + if ($("#titulo").select2("data")[0].id !== "Otro") + formdata.find((item) => item.name === "titulo").value = $("#titulo").select2("data")[0].text.trim(); + else + formdata.find((item) => item.name === "titulo").value = $("#otrotitulo").val() + console.log(formdata) var parameters = $.param(formdata); /*$.ajax({ url: 'api/register', diff --git a/src/routes.php b/src/routes.php index 0646a7c..116eef6 100644 --- a/src/routes.php +++ b/src/routes.php @@ -41,7 +41,29 @@ $app->get('/participantes', function (Request $request, Response $response, arra $this->logger->info("GDDWorkshop '/participants' route"); $db = $this->db; $data = $db->getAll(); - return $this->renderer->render($response, 'participants.html', ['registros' => $data]); + $result = array('Estudiante de grado'=>array(),'Estudiante de posgrado'=>array(),'Profesor'=>array(),'Posdoctorando'=>array(),'Otro'=>array()); + foreach ($data as $element) { + switch ($element['titulo']){ + case 'Profesor': + $result['Profesor'][] = $element; + break; + case 'Posdoctorando': + $result['Posdoctorando'][] = $element; + break; + case 'Estudiante de posgrado': + $result['Estudiante de posgrado'][] = $element; + break; + case 'Estudiante de grado': + $result['Estudiante de grado'][] = $element; + break; + default: + $result['Otro'][] = $element; + break; + } + } + //echo '
' . json_encode($result,JSON_PRETTY_PRINT). ''; + + return $this->renderer->render($response, 'participants.html', ['registros' => $result]); }); @@ -158,13 +180,23 @@ $app->group('/api', function($app){ else{ if(!isset($data['nombre'])||empty($data['nombre'])) - $messages->addMessageNow("submit-register-err", "First name could not be empty"); + $messages->addMessageNow("submit-register-err", "Debe ingresar nombre"); if(!isset($data['apellido'])||empty($data['apellido'])) - $messages->addMessageNow("submit-register-err", "Last name could not be empty"); + $messages->addMessageNow("submit-register-err", "Debe ingresar apellido"); if(!isset($data['email'])||empty($data['email'])) - $messages->addMessageNow("submit-register-err", "E-mail could not be empty"); - if(!isset($data['letterinvited'])||!is_numeric($data['letterinvited'])) - $messages->addMessageNow("submit-register-err", "Question about needing a letter of invitation must have a selected answer"); + $messages->addMessageNow("submit-register-err", "Debe ingresar e-mail"); + if(!isset($data['ciudad'])||empty($data['ciudad'])) + $messages->addMessageNow("submit-register-err", "Debe ingresar ciudad"); + if(!isset($data['pais'])||empty($data['pais'])) + $messages->addMessageNow("submit-register-err", "Debe seleccionar pais"); + if(!isset($data['titulo'])||empty($data['titulo'])) + $messages->addMessageNow("submit-register-err", "Debe seleccionar profesión o actividad"); + if(!isset($data['afiliacion'])||empty($data['afiliacion'])) + $messages->addMessageNow("submit-register-err", "Debe ingresar afiliación"); + if(!isset($data['emailzoom'])||empty($data['emailzoom'])) + $messages->addMessageNow("submit-register-err", "Debe ingresar e-mail asociado a cuenta Zoom"); + /*if(!isset($data['letterinvited'])||!is_numeric($data['letterinvited'])) + $messages->addMessageNow("submit-register-err", "Question about needing a letter of invitation must have a selected answer");*/ //ReCaptcha Validation if(!isset($data['g-recaptcha-response'])||empty($data['g-recaptcha-response'])){ @@ -189,8 +221,8 @@ $app->group('/api', function($app){ try{ if($db->findByMail($data['email'])) - $messages->addMessageNow("submit-register-err", $data['email']." is already registered