diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..9b45638b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +vendor/ +node_modules/ +*.clpprj diff --git a/README.md b/README.md index 86d70e367..430af9696 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,43 @@ # Desafio Celso Lisboa para FullStack -### Cenário - -**Como** Coordenador Acadêmico de uma Instituição de Ensino -**Eu preciso** realizar a gestão dos cursos oferecidos pela Instituição, com seus respectivos professores, salas e horários -**Para** que o setor de Marketing possa vender os cursos online. - -### Segue instruções para realizar o desafio - -1. Faça um fork deste repositório. -2. Baseado no cenário acima, modele e crie o esquema do banco de dados para armazenar as informações normalizadas. - * Comite a imagem em jpg ou png do DER e o script do DDL. -3. Desenvolva uma API REST para realizar as operações necessárias com o banco de dados criado. -4. Baseado nas imagens `wireframe/1-login-mobile.png` e `wireframe/2-login-desktop.png`, crie a tela de login da aplicação. - * Considere apenas uma validação simples por e-mail e senha. - * Não existe a necessidade de CRUD de usuário, recuperação de senha ou outra operação mais complexa. -5. Baseado nas imagens `wireframe/3-cursos-mobile.png` e `wireframe/4-cursos-desktop.png`, crie a tela de visualização e deleção de cursos. - * Deve conter as informações de horário, professor e sala. -6. Baseado nas imagens `wireframe/5-detalhe-mobile.png` e `wireframe/6-detalhe-desktop.png`, crie a tela de criação e alteração de cursos. - * Os campos de professor e sala deverão ser um multi-select. - * Não existe a necessidade de CRUD de professor e sala. -7. Realizar um Pull Request para este repositório, com instruções necessárias para instalação e instânciação dos sistemas. - -### O que será avaliado - -1. Fidelidade às instruções e ao cenário. -2. Clean Code e boas práticas. -3. Boas práticas de versionamento. +### Instalação + +1. Na pasta **/scripts/SQL/**, você encontrará o arquivo **desafiofullstack.sql** para criar e popular o banco de dados MySql. Caso deseje, você pode visualizar o DER no arquivo localizado na pasta **/scrits/DER/**. + +2. Caso seja necessário alterar os dados de acesso ao banco, abra o arquivo **/api/app/src/settings.php** e encontre o seguinte trecho de código: +>'db' => [ +> 'driver' => 'mysql', +> 'host' => 'localhost', +> 'database' => 'celsolisboa', +> 'username' => 'root', +> 'password' => '', +> 'charset' => 'utf8', +> 'collation' => 'utf8_unicode_ci', +> 'prefix' => '', +> ] + +3. Na raiz do projeto, execute o comando: +```sh +$ npm install +``` + +4. Navegue até a pasta **/api/** e execute o comando: +```sh +$ composer install +``` + +5. No terminal, navegue até a raiz do projeto e execute o comando: +```sh +$ php -S localhost:8080 +``` + +6. No navegador, acesse a url **localhost:8080** para iniciar o sistema. + + + +### Dados para login no sistema + +**email**: desafio@celsolisboa.edu.br +**senha**: celsolisboa + + diff --git a/api/.htaccess b/api/.htaccess new file mode 100644 index 000000000..889b428aa --- /dev/null +++ b/api/.htaccess @@ -0,0 +1,16 @@ +# For production, put your rewrite rules directly into your VirtualHost +# directive and turn off AllowOverride. + + + RewriteEngine On + + RewriteCond %{REQUEST_FILENAME} -s [OR] + RewriteCond %{REQUEST_FILENAME} -l [OR] + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^.*$ - [NC,L] + + + RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$ + RewriteRule ^(.*) - [E=BASE:%1] + RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] + \ No newline at end of file diff --git a/api/app/dependencies.php b/api/app/dependencies.php new file mode 100644 index 000000000..3e9df7104 --- /dev/null +++ b/api/app/dependencies.php @@ -0,0 +1,53 @@ +getContainer(); + +// ----------------------------------------------------------------------------- +// Service providers +// ----------------------------------------------------------------------------- +// Service factory for the ORM +$container['db'] = function ($container) { + $capsule = new \Illuminate\Database\Capsule\Manager; + $capsule->addConnection($container['settings']['db']); + + $capsule->setAsGlobal(); + $capsule->bootEloquent(); + + return $capsule; +}; + +// ----------------------------------------------------------------------------- +// Action factories +// ----------------------------------------------------------------------------- + + +$container[AutenticacaoTokenMiddleware::class] = function ($container) { + return new AutenticacaoTokenMiddleware($container['db']); +}; + + +$container[App\Action\UsuarioLogar::class] = function ($container) { + return new App\Action\UsuarioLogar($container['db']); +}; + +$container[App\Action\CursoListar::class] = function ($container) { + return new App\Action\CursoListar($container['db']); +}; + +$container[App\Action\VerificarToken::class] = function ($container) { + return new App\Action\VerificarToken($container['db']); +}; + +$container[App\Action\CursoExcluir::class] = function ($container) { + return new App\Action\CursoExcluir($container['db']); +}; diff --git a/api/app/middleware.php b/api/app/middleware.php new file mode 100644 index 000000000..7150d5512 --- /dev/null +++ b/api/app/middleware.php @@ -0,0 +1,43 @@ +getHeader('token'); + $emailHeader = $request->getHeader('email'); + + $usuario = new Usuario(); + $usuario->email = $emailHeader; + $usuario->token = $tokenHeader; + + + $uS = new UsuarioService( $usuario ); + $verificado = $uS->verificarToken(); + + $status = $response->getStatusCode(); + + }catch( \Exception $e ){ + $msg = $e->getMessage(); + die( FuncoesHelper::formatarSaidaJson(401,"Requisição não autorizada! Token Inválido!",[],1)); + } + + return $next($request, $response); + } +} \ No newline at end of file diff --git a/api/app/routes.php b/api/app/routes.php new file mode 100644 index 000000000..432af4624 --- /dev/null +++ b/api/app/routes.php @@ -0,0 +1,11 @@ +get('/usuario/logar', App\Action\UsuarioLogar::class); +$app->get('/usuario/verificarToken', App\Action\VerificarToken::class); +$app->get('/cursos', App\Action\CursoListar::class)->add( AutenticacaoTokenMiddleware::class ); +$app->get('/curso/{id}', App\Action\CursoListar::class)->add( AutenticacaoTokenMiddleware::class ); +$app->delete('/curso/{id}', App\Action\CursoExcluir::class)->add( AutenticacaoTokenMiddleware::class ); +$app->get('/professores', App\Action\ProfessorListar::class)->add( AutenticacaoTokenMiddleware::class ); +$app->get('/salas', App\Action\SalaListar::class)->add( AutenticacaoTokenMiddleware::class ); +$app->post('/curso', App\Action\CursoSalvar::class)->add( AutenticacaoTokenMiddleware::class ); \ No newline at end of file diff --git a/api/app/settings.php b/api/app/settings.php new file mode 100644 index 000000000..a6723b2bd --- /dev/null +++ b/api/app/settings.php @@ -0,0 +1,37 @@ + [ + // Slim Settings + 'determineRouteBeforeAppMiddleware' => false, + 'displayErrorDetails' => true, + + // View settings + 'view' => [ + 'template_path' => __DIR__ . '/templates', + 'twig' => [ + 'cache' => __DIR__ . '/../cache/twig', + 'debug' => true, + 'auto_reload' => true, + ], + ], + + // monolog settings + 'logger' => [ + 'name' => 'app', + 'path' => __DIR__ . '/../log/app.log', + ], + + 'db' => [ + 'driver' => 'mysql', + 'host' => 'localhost', + 'database' => 'celsolisboa', + 'username' => 'root', + 'password' => '', + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + ] + + + ], +]; diff --git a/api/app/src/Action/CursoExcluir.php b/api/app/src/Action/CursoExcluir.php new file mode 100644 index 000000000..2944aab5b --- /dev/null +++ b/api/app/src/Action/CursoExcluir.php @@ -0,0 +1,40 @@ +excluir($id); + + $erro = 0; + $msg = "Curso Excluído com sucesso!"; + $dados = []; + + }catch( \Exception $e ){ + $erro = 1; + $msg = $e->getMessage(); + $dados = []; + } + + $status = $response->getStatusCode(); + + return FuncoesHelper::formatarSaidaJson($status, $msg, $dados, $erro); + } +} diff --git a/api/app/src/Action/CursoListar.php b/api/app/src/Action/CursoListar.php new file mode 100644 index 000000000..5278ea7d8 --- /dev/null +++ b/api/app/src/Action/CursoListar.php @@ -0,0 +1,49 @@ +listar($id); + + $listaCursos = []; + foreach($cursos as $curso){ + $listaCursos[] = array( + 'curso' => $curso->toArray(), + 'professores' => $curso->professores->toArray(), + 'salas' => $curso->salas->toArray() + ); + } + + $erro = 0; + $msg = "Lista de Cursos"; + $dados = $listaCursos; + + }catch( \Exception $e ){ + $erro = 1; + $msg = $e->getMessage(); + $dados = []; + } + + $status = $response->getStatusCode(); + + return FuncoesHelper::formatarSaidaJson($status, $msg, $dados, $erro); + } +} diff --git a/api/app/src/Action/CursoSalvar.php b/api/app/src/Action/CursoSalvar.php new file mode 100644 index 000000000..4d0076a46 --- /dev/null +++ b/api/app/src/Action/CursoSalvar.php @@ -0,0 +1,103 @@ +getBody()->getContents(); + parse_str($strParam, $arrParam); + + $id = isset($arrParam['id']) ? $arrParam['id'] : null; + + + + $curso = new Curso(); + + if( $id ){ + $cursoExistente = new CursoService(new Curso()); + $curso = $cursoExistente->listar($id)[0]; + } + + $disciplina = new Disciplina(); + $disciplinaService = new DisciplinaService($disciplina); + $disciplinaExistente = $disciplinaService->listarPorNome( trim($arrParam['nome']) ); + + if( $disciplinaExistente ){ + $disciplina = $disciplinaExistente; + } + $disciplina->nome = trim($arrParam['nome']); + $disciplinaService = new DisciplinaService($disciplina); + $disciplinaService->salvar(); + + + $curso->id = $id; + $curso->disciplina_id = $disciplina->id; + $curso->horario_inicio = $arrParam['inicio']; + $curso->horario_fim = $arrParam['fim']; + + $cursoService = new CursoService($curso); + $cursoService->salvar(); + + if( $curso->id ){ + + + $cursoSalaService = new CursoSalaService(new CursoSala()); + $cursoSalaService->excluir($curso->id); + foreach( $arrParam['salas'] as $sala_id ){ + $cursoSala = new CursoSala(); + $cursoSala->curso_id = $curso->id; + $cursoSala->sala_id = $sala_id; + + $cursoSalaService = new CursoSalaService($cursoSala); + $cursoSalaService->salvar(); + } + + $cursoProfessorService = new CursoProfessorService(new CursoProfessor()); + $cursoProfessorService->excluir($curso->id); + foreach( $arrParam['professores'] as $professor_id ){ + $cursoProfessor = new CursoProfessor(); + $cursoProfessor->curso_id = $curso->id; + $cursoProfessor->professor_id = $professor_id; + + $cursoProfessorService = new CursoProfessorService($cursoProfessor); + $cursoProfessorService->salvar(); + } + }else{ + $erro = 1; + $msg = "Ocorreu um erro ao salvar o curso."; + $dados = []; + } + + $erro = 0; + $msg = "O curso foi salvo com sucesso!"; + $dados = $curso->id; + + }catch( \Exception $e ){ + $erro = 1; + $msg = $e->getMessage(); + $dados = []; + } + + $status = $response->getStatusCode(); + + return FuncoesHelper::formatarSaidaJson($status, $msg, $dados, $erro); + } +} diff --git a/api/app/src/Action/ProfessorListar.php b/api/app/src/Action/ProfessorListar.php new file mode 100644 index 000000000..99c779402 --- /dev/null +++ b/api/app/src/Action/ProfessorListar.php @@ -0,0 +1,40 @@ +listar(); + + $erro = 0; + $msg = "Lista de Professores"; + $dados = $professores; + + }catch( \Exception $e ){ + $erro = 1; + $msg = $e->getMessage(); + $dados = []; + } + + $status = $response->getStatusCode(); + + return FuncoesHelper::formatarSaidaJson($status, $msg, $dados, $erro); + } +} diff --git a/api/app/src/Action/SalaListar.php b/api/app/src/Action/SalaListar.php new file mode 100644 index 000000000..549e10d40 --- /dev/null +++ b/api/app/src/Action/SalaListar.php @@ -0,0 +1,39 @@ +listar(); + + $erro = 0; + $msg = "Lista de Salas"; + $dados = $salas; + + }catch( \Exception $e ){ + $erro = 1; + $msg = $e->getMessage(); + $dados = []; + } + + $status = $response->getStatusCode(); + + return FuncoesHelper::formatarSaidaJson($status, $msg, $dados, $erro); + } +} diff --git a/api/app/src/Action/UsuarioLogar.php b/api/app/src/Action/UsuarioLogar.php new file mode 100644 index 000000000..5bc686b07 --- /dev/null +++ b/api/app/src/Action/UsuarioLogar.php @@ -0,0 +1,44 @@ +getParam("email"); + $senha = $request->getParam("senha"); + + $usuario = new Usuario(); + $usuario->email = $email; + $usuario->senha = $senha; + + $us = new UsuarioService( $usuario ); + $token = $us->logar(); + + + if( $token ){ + $erro = 0; + $msg = "Usuário Logado com Sucesso!"; + $dados = ['token'=>$token]; + } + + }catch( \Exception $e ){ + $erro = 1; + $msg = $e->getMessage(); + $dados = []; + } + + $status = $response->getStatusCode(); + + return FuncoesHelper::formatarSaidaJson($status, $msg, $dados, $erro); + } +} diff --git a/api/app/src/Action/VerificarToken.php b/api/app/src/Action/VerificarToken.php new file mode 100644 index 000000000..f2b7add9e --- /dev/null +++ b/api/app/src/Action/VerificarToken.php @@ -0,0 +1,45 @@ +getHeader("email")[0] ) ? $request->getHeader("email")[0] : ''; + $token = isset( $request->getHeader("token")[0] ) ? $request->getHeader("token")[0] : ''; + + + $usuario = new Usuario(); + $usuario->email = $email; + $usuario->token = $token; + + $usuarioService = new UsuarioService( $usuario ); + + $verificado = $usuarioService->verificarToken(); + + $erro = 0; + $msg = "Usuário Verificado"; + $dados = []; + + + }catch( \Exception $e ){ + $erro = 1; + $msg = $e->getMessage(); + $dados = []; + } + + $status = $response->getStatusCode(); + + return FuncoesHelper::formatarSaidaJson($status, $msg, $dados, $erro); + } +} diff --git a/api/app/src/Entity/Curso.php b/api/app/src/Entity/Curso.php new file mode 100644 index 000000000..a92bc1cdd --- /dev/null +++ b/api/app/src/Entity/Curso.php @@ -0,0 +1,27 @@ +belongsTo('\App\Entity\Disciplina'); + } + + public function professores() + { + return $this->belongsToMany('\App\Entity\Professor'); + } + + public function salas() + { + return $this->belongsToMany('\App\Entity\Sala'); + } +} diff --git a/api/app/src/Entity/Curso.php~ b/api/app/src/Entity/Curso.php~ new file mode 100644 index 000000000..f778bf777 --- /dev/null +++ b/api/app/src/Entity/Curso.php~ @@ -0,0 +1,49 @@ +belongsToMany('\App\Entity\Curso'); + } +} diff --git a/api/app/src/Entity/Professor.php~ b/api/app/src/Entity/Professor.php~ new file mode 100644 index 000000000..e8ad9eae9 --- /dev/null +++ b/api/app/src/Entity/Professor.php~ @@ -0,0 +1,32 @@ +belongsToMany('\App\Entity\Curso'); + } +} diff --git a/api/app/src/Entity/Sala.php~ b/api/app/src/Entity/Sala.php~ new file mode 100644 index 000000000..526a7f113 --- /dev/null +++ b/api/app/src/Entity/Sala.php~ @@ -0,0 +1,32 @@ + $status, "msg" => $msg, "dados" => $dados, "erro" => $erro)); + if( json_last_error() > 0 ){ + throw new \Exception('Erro na formação do JSON'); + } + + return $retorno; + } + +} \ No newline at end of file diff --git a/api/app/src/Service/CursoProfessorService.php b/api/app/src/Service/CursoProfessorService.php new file mode 100644 index 000000000..849efd930 --- /dev/null +++ b/api/app/src/Service/CursoProfessorService.php @@ -0,0 +1,28 @@ +cursoProfessor = $cursoProfessor; + } + + public function excluir($curso_id){ + + $cursos = CursoProfessor::where('curso_id', $curso_id)->get(); + + foreach($cursos as $curso){ + $curso->delete(); + } + } + + public function salvar(){ + return $this->cursoProfessor->save(); + } + +} \ No newline at end of file diff --git a/api/app/src/Service/CursoSalaService.php b/api/app/src/Service/CursoSalaService.php new file mode 100644 index 000000000..99e1b38a3 --- /dev/null +++ b/api/app/src/Service/CursoSalaService.php @@ -0,0 +1,31 @@ +cursoSala = $cursoSala; + } + + public function excluir($curso_id){ + + $cursos = CursoSala::where('curso_id', $curso_id)->get(); + + foreach($cursos as $curso){ + $curso->delete(); + } + } + + public function salvar(){ + + return $this->cursoSala->save(); + + } + +} \ No newline at end of file diff --git a/api/app/src/Service/CursoService.php b/api/app/src/Service/CursoService.php new file mode 100644 index 000000000..29e077249 --- /dev/null +++ b/api/app/src/Service/CursoService.php @@ -0,0 +1,64 @@ +curso = $curso; + } + + public function getProfessores( Curso $curso ){ + //$lista = $this->em->getRepository('\App\Entity\CursoProfessor')->findBy( array('curso' => $curso->getId() ) ); + + $lista = CursoProfessor::where('curso_id' ,$curso->getId())->get(); + $curso->setProfessores( $lista ); + return $curso; + } + + public function getSalas( Curso $curso ) { + //$lista = $this->em->getRepository('\App\Entity\CursoSala')->findBy( array('curso' => $curso->getId() ) ); + $lista = CursoSala::where('curso_id' ,$curso->getId())->get(); + $curso->setSalas($lista); + return $curso; + } + + public function listar($id = null) { + if( $id ){ + return Curso::with("Disciplina")->where('id',$id)->get(); + }else{ + return Curso::with("Disciplina")->get(); + } + } + + public function salvar(){ + + $retorno = $this->curso->save(); + + return $retorno; + } + + public function excluir($id) { + $retorno = false; + if( $id ){ + + $curso = Curso::find($id); + if($curso){ + $retorno = $curso->delete(); + + if( ! $retorno ){ + throw new \Exception("Erro ao excluir o curso."); + } + } + + + } + return $retorno; + } + +} \ No newline at end of file diff --git a/api/app/src/Service/DisciplinaService.php b/api/app/src/Service/DisciplinaService.php new file mode 100644 index 000000000..6a87e9ef1 --- /dev/null +++ b/api/app/src/Service/DisciplinaService.php @@ -0,0 +1,29 @@ +disciplina = $disciplina; + } + + public function listarPorNome($nome) { + $disciplina = Disciplina::where('nome', $nome)->first(); + + return $disciplina; + } + + + public function salvar(){ + + $retorno = $this->disciplina->save(); + + return $retorno; + } + + +} \ No newline at end of file diff --git a/api/app/src/Service/ProfessorService.php b/api/app/src/Service/ProfessorService.php new file mode 100644 index 000000000..26d802a1a --- /dev/null +++ b/api/app/src/Service/ProfessorService.php @@ -0,0 +1,23 @@ +professor = $professor; + } + + public function listar($id = null) { + if( $id ){ + return Professor::where('id', $id)->get(); + }else{ + return Professor::all(); + } + } + +} \ No newline at end of file diff --git a/api/app/src/Service/SalaService.php b/api/app/src/Service/SalaService.php new file mode 100644 index 000000000..7f2f47e8c --- /dev/null +++ b/api/app/src/Service/SalaService.php @@ -0,0 +1,23 @@ +sala = $sala; + } + + public function listar($id = null) { + if( $id ){ + return Sala::where('id', $id)->get(); + }else{ + return Sala::all(); + } + } + +} \ No newline at end of file diff --git a/api/app/src/Service/UsuarioService.php b/api/app/src/Service/UsuarioService.php new file mode 100644 index 000000000..021e6a5d7 --- /dev/null +++ b/api/app/src/Service/UsuarioService.php @@ -0,0 +1,66 @@ +usuario = $usuario; + } + + private static function gerarToken(Usuario $usuario) : string{ + $id = $usuario->id; + $data = date("YmdHis"); + + if( $id == null ){ + throw new \Exception('Usuário inválido'); + } + + return md5($id.$data); + } + + public function verificarToken() : bool{ + + $email = $this->usuario->email; + $token = $this->usuario->token; + + $usuario = $this->usuario->where('email',$email)->where('token',$token)->first(); + + $retorno = false; + if( $usuario ){ + $retorno = true; + }else{ + throw new \Exception("Requisição não autorizada! Token Inválido!"); + } + + return $retorno; + + } + + public function logar() : string{ + + $email = $this->usuario->email; + $senha = md5( $this->usuario->senha ); + + $usuario = Usuario::where(array('email' => $email, 'senha'=> $senha))->first(); + + + $retorno = ""; + if( $usuario ){ + $token = self::gerarToken($usuario); + + //gravar token na tabela + $usuario->token = $token; + $salvou = $usuario->save(); + + $retorno = $token; + }else{ + throw new \Exception("Os dados de email e/ou senha são inválidos!"); + } + + return $retorno; + } +} \ No newline at end of file diff --git a/api/app/templates/home.twig b/api/app/templates/home.twig new file mode 100644 index 000000000..3a769addf --- /dev/null +++ b/api/app/templates/home.twig @@ -0,0 +1,13 @@ + + + + Slim 3 + + + + +

Slim

+
a microframework for PHP
+ + + diff --git a/api/app/var/doctrine/49/5b4170705c456e746974795c437572736f53616c6124434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/49/5b4170705c456e746974795c437572736f53616c6124434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..c409f26d9 Binary files /dev/null and b/api/app/var/doctrine/49/5b4170705c456e746974795c437572736f53616c6124434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/5b/5b5c4170705c456e746974795c437572736f53616c6124434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/5b/5b5c4170705c456e746974795c437572736f53616c6124434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..c409f26d9 Binary files /dev/null and b/api/app/var/doctrine/5b/5b5c4170705c456e746974795c437572736f53616c6124434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/68/5b4170705c456e746974795c437572736f24434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/68/5b4170705c456e746974795c437572736f24434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..3a9893d06 Binary files /dev/null and b/api/app/var/doctrine/68/5b4170705c456e746974795c437572736f24434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/ad/5b4170705c456e746974795c4469736369706c696e6124434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/ad/5b4170705c456e746974795c4469736369706c696e6124434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..f706be2b1 Binary files /dev/null and b/api/app/var/doctrine/ad/5b4170705c456e746974795c4469736369706c696e6124434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/af/5b4170705c456e746974795c50726f666573736f7224434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/af/5b4170705c456e746974795c50726f666573736f7224434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..9ec4785ee Binary files /dev/null and b/api/app/var/doctrine/af/5b4170705c456e746974795c50726f666573736f7224434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/c5/5b4170705c456e746974795c437572736f50726f666573736f7224434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/c5/5b4170705c456e746974795c437572736f50726f666573736f7224434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..316c5cecc Binary files /dev/null and b/api/app/var/doctrine/c5/5b4170705c456e746974795c437572736f50726f666573736f7224434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/d6/5b5c4170705c456e746974795c5573756172696f24434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/d6/5b5c4170705c456e746974795c5573756172696f24434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..3873c91b6 Binary files /dev/null and b/api/app/var/doctrine/d6/5b5c4170705c456e746974795c5573756172696f24434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/d8/5b4170705c456e746974795c5573756172696f24434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/d8/5b4170705c456e746974795c5573756172696f24434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..3873c91b6 Binary files /dev/null and b/api/app/var/doctrine/d8/5b4170705c456e746974795c5573756172696f24434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/d9/5b5c4170705c456e746974795c437572736f50726f666573736f7224434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/d9/5b5c4170705c456e746974795c437572736f50726f666573736f7224434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..316c5cecc Binary files /dev/null and b/api/app/var/doctrine/d9/5b5c4170705c456e746974795c437572736f50726f666573736f7224434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/df/5b5c4170705c456e746974795c437572736f24434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/df/5b5c4170705c456e746974795c437572736f24434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..3a9893d06 Binary files /dev/null and b/api/app/var/doctrine/df/5b5c4170705c456e746974795c437572736f24434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/app/var/doctrine/e8/5b4170705c456e746974795c53616c6124434c4153534d455441444154415d5b315d.doctrinecache.data b/api/app/var/doctrine/e8/5b4170705c456e746974795c53616c6124434c4153534d455441444154415d5b315d.doctrinecache.data new file mode 100644 index 000000000..d1faebafa Binary files /dev/null and b/api/app/var/doctrine/e8/5b4170705c456e746974795c53616c6124434c4153534d455441444154415d5b315d.doctrinecache.data differ diff --git a/api/cache/twig/.keepme b/api/cache/twig/.keepme new file mode 100644 index 000000000..e69de29bb diff --git a/api/cache/twig/81/818e26bad1f44cc5bec623ce17d7842bd3ac5ba2abd71439d4ab2aaf0b27afda.php b/api/cache/twig/81/818e26bad1f44cc5bec623ce17d7842bd3ac5ba2abd71439d4ab2aaf0b27afda.php new file mode 100644 index 000000000..6bb94deb1 --- /dev/null +++ b/api/cache/twig/81/818e26bad1f44cc5bec623ce17d7842bd3ac5ba2abd71439d4ab2aaf0b27afda.php @@ -0,0 +1,74 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = array( + ); + } + + protected function doDisplay(array $context, array $blocks = array()) + { + // line 1 + echo " + + + Slim 3 + + baseUrl(), "html", null, true); + echo "/css/style.css' rel='stylesheet' type='text/css'> + + +

Slim

+
a microframework for PHP
+ + + +"; + } + + public function getTemplateName() + { + return "home.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 30 => 6, 23 => 1,); + } + + public function getSourceContext() + { + return new Twig_Source(" + + + Slim 3 + + + + +

Slim

+
a microframework for PHP
+ + + +", "home.twig", "C:\\xampp7\\htdocs\\celsolisboa\\app\\templates\\home.twig"); + } +} diff --git a/api/cache/twig/a8/a8e1b2577448d349a17cb310a3b9cc3dfd524dd94bb51e06b534a374a578dbf0.php b/api/cache/twig/a8/a8e1b2577448d349a17cb310a3b9cc3dfd524dd94bb51e06b534a374a578dbf0.php new file mode 100644 index 000000000..69ed0e0db --- /dev/null +++ b/api/cache/twig/a8/a8e1b2577448d349a17cb310a3b9cc3dfd524dd94bb51e06b534a374a578dbf0.php @@ -0,0 +1,74 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = array( + ); + } + + protected function doDisplay(array $context, array $blocks = array()) + { + // line 1 + echo " + + + Slim 3 + + baseUrl(), "html", null, true); + echo "/css/style.css' rel='stylesheet' type='text/css'> + + +

Slim

+
a microframework for PHP
+ + + +"; + } + + public function getTemplateName() + { + return "home.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 30 => 6, 23 => 1,); + } + + public function getSourceContext() + { + return new Twig_Source(" + + + Slim 3 + + + + +

Slim

+
a microframework for PHP
+ + + +", "home.twig", "C:\\xampp7\\htdocs\\slim-doctrine\\app\\templates\\home.twig"); + } +} diff --git a/api/composer.json b/api/composer.json new file mode 100644 index 000000000..b873e1e18 --- /dev/null +++ b/api/composer.json @@ -0,0 +1,12 @@ +{ + "autoload": { + "psr-4": { + "App\\": "app/src" + } + }, + "require": { + "php": ">=7.1.3", + "slim/slim": "^3.0", + "illuminate/database": "^5.1" + } +} diff --git a/api/composer.lock b/api/composer.lock new file mode 100644 index 000000000..34fa0989d --- /dev/null +++ b/api/composer.lock @@ -0,0 +1,895 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "5efd6fad78392418761bccb3976f5c49", + "packages": [ + { + "name": "container-interop/container-interop", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "shasum": "" + }, + "require": { + "psr/container": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14T19:40:03+00:00" + }, + { + "name": "doctrine/inflector", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2018-01-09T20:05:19+00:00" + }, + { + "name": "illuminate/container", + "version": "v5.7.20", + "source": { + "type": "git", + "url": "https://github.com/illuminate/container.git", + "reference": "53a0991e918efaace42cde526a04fdb832128a03" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/container/zipball/53a0991e918efaace42cde526a04fdb832128a03", + "reference": "53a0991e918efaace42cde526a04fdb832128a03", + "shasum": "" + }, + "require": { + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", + "php": "^7.1.3", + "psr/container": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Container\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Container package.", + "homepage": "https://laravel.com", + "time": "2018-12-18T14:00:02+00:00" + }, + { + "name": "illuminate/contracts", + "version": "v5.7.20", + "source": { + "type": "git", + "url": "https://github.com/illuminate/contracts.git", + "reference": "758927e5e925c1d442a1faaa1356675ceba0194c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/758927e5e925c1d442a1faaa1356675ceba0194c", + "reference": "758927e5e925c1d442a1faaa1356675ceba0194c", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Contracts\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Contracts package.", + "homepage": "https://laravel.com", + "time": "2018-11-15T13:49:08+00:00" + }, + { + "name": "illuminate/database", + "version": "v5.7.20", + "source": { + "type": "git", + "url": "https://github.com/illuminate/database.git", + "reference": "784247326e93c4db6a70a635d01399a8a28e308f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/database/zipball/784247326e93c4db6a70a635d01399a8a28e308f", + "reference": "784247326e93c4db6a70a635d01399a8a28e308f", + "shasum": "" + }, + "require": { + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", + "php": "^7.1.3" + }, + "suggest": { + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", + "illuminate/console": "Required to use the database commands (5.7.*).", + "illuminate/events": "Required to use the observers with Eloquent (5.7.*).", + "illuminate/filesystem": "Required to use the migrations (5.7.*).", + "illuminate/pagination": "Required to paginate the result set (5.7.*)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Database\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Database package.", + "homepage": "https://laravel.com", + "keywords": [ + "database", + "laravel", + "orm", + "sql" + ], + "time": "2019-01-06T17:57:30+00:00" + }, + { + "name": "illuminate/support", + "version": "v5.7.20", + "source": { + "type": "git", + "url": "https://github.com/illuminate/support.git", + "reference": "ea3f30dd824bba52bcff4290dc7431b0ffb478e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/support/zipball/ea3f30dd824bba52bcff4290dc7431b0ffb478e1", + "reference": "ea3f30dd824bba52bcff4290dc7431b0ffb478e1", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.1", + "ext-mbstring": "*", + "illuminate/contracts": "5.7.*", + "nesbot/carbon": "^1.26.3", + "php": "^7.1.3" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "suggest": { + "illuminate/filesystem": "Required to use the composer class (5.7.*).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "ramsey/uuid": "Required to use Str::uuid() (^3.7).", + "symfony/process": "Required to use the composer class (^4.1).", + "symfony/var-dumper": "Required to use the dd function (^4.1)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Support\\": "" + }, + "files": [ + "helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Support package.", + "homepage": "https://laravel.com", + "time": "2019-01-07T13:39:07+00:00" + }, + { + "name": "nesbot/carbon", + "version": "1.36.2", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9", + "reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7" + }, + "suggest": { + "friendsofphp/php-cs-fixer": "Needed for the `composer phpcs` command. Allow to automatically fix code style.", + "phpstan/phpstan": "Needed for the `composer phpstan` command. Allow to detect potential errors." + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "http://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "time": "2018-12-28T10:07:33+00:00" + }, + { + "name": "nikic/fast-route", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "FastRoute\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "time": "2018-02-13T20:26:39+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2018-01-21T07:42:36+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.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 interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "slim/slim", + "version": "3.11.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "d378e70431e78ee92ee32ddde61ecc72edf5dc0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/d378e70431e78ee92ee32ddde61ecc72edf5dc0a", + "reference": "d378e70431e78ee92ee32ddde61ecc72edf5dc0a", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.2", + "nikic/fast-route": "^1.0", + "php": ">=5.5.0", + "pimple/pimple": "^3.0", + "psr/container": "^1.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\": "Slim" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + } + ], + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "homepage": "https://slimframework.com", + "keywords": [ + "api", + "framework", + "micro", + "router" + ], + "time": "2018-09-16T10:54:21+00:00" + }, + { + "name": "symfony/contracts", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/contracts.git", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "require-dev": { + "psr/cache": "^1.0", + "psr/container": "^1.0" + }, + "suggest": { + "psr/cache": "When using the Cache contracts", + "psr/container": "When using the Service contracts", + "symfony/cache-contracts-implementation": "", + "symfony/service-contracts-implementation": "", + "symfony/translation-contracts-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\": "" + }, + "exclude-from-classmap": [ + "**/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A set of abstractions extracted out of the Symfony components", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2018-12-05T08:06:11+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-09-21T13:07:52+00:00" + }, + { + "name": "symfony/translation", + "version": "v4.2.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/939fb792d73f2ce80e6ae9019d205fc480f1c9a0", + "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/contracts": "^1.0.2", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "symfony/translation-contracts-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/intl": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "https://symfony.com", + "time": "2019-01-03T09:07:35+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/api/config/cli-config.php b/api/config/cli-config.php new file mode 100644 index 000000000..03cfee2af --- /dev/null +++ b/api/config/cli-config.php @@ -0,0 +1,21 @@ +setProxyNamespace('App\Entity'); + +$em = \Doctrine\ORM\EntityManager::create($settings['connection'], $config); + +return ConsoleRunner::createHelperSet($em); \ No newline at end of file diff --git a/api/index.php b/api/index.php new file mode 100644 index 000000000..91cd5fca4 --- /dev/null +++ b/api/index.php @@ -0,0 +1,27 @@ +run(); diff --git a/api/log/.keepme b/api/log/.keepme new file mode 100644 index 000000000..e69de29bb diff --git a/api/log/app.log b/api/log/app.log new file mode 100644 index 000000000..15ac4afc8 --- /dev/null +++ b/api/log/app.log @@ -0,0 +1,30 @@ +[2019-01-04 17:32:04] app.INFO: Home page action dispatched [] {"uid":"d426af2"} +[2019-01-07 12:56:24] app.INFO: Home page action dispatched [] {"uid":"14ab347"} +[2019-01-07 13:05:22] app.INFO: Home page action dispatched [] {"uid":"d0aa455"} +[2019-01-07 13:05:42] app.INFO: Home page action dispatched [] {"uid":"b4e2955"} +[2019-01-07 13:05:43] app.INFO: Home page action dispatched [] {"uid":"7884220"} +[2019-01-07 13:05:56] app.INFO: Home page action dispatched [] {"uid":"63b0162"} +[2019-01-07 13:11:26] app.INFO: Home page action dispatched [] {"uid":"593a24c"} +[2019-01-07 13:19:12] app.INFO: Home page action dispatched [] {"uid":"efd3d04"} +[2019-01-07 13:19:12] app.INFO: Home page action dispatched [] {"uid":"530f9e8"} +[2019-01-07 14:21:45] app.INFO: Home page action dispatched [] {"uid":"29953f9"} +[2019-01-07 14:22:26] app.INFO: Home page action dispatched [] {"uid":"f141788"} +[2019-01-07 14:23:12] app.INFO: Home page action dispatched [] {"uid":"ce0358a"} +[2019-01-07 14:25:43] app.INFO: Home page action dispatched [] {"uid":"e404257"} +[2019-01-07 14:26:01] app.INFO: Home page action dispatched [] {"uid":"7cc187a"} +[2019-01-07 14:26:26] app.INFO: Home page action dispatched [] {"uid":"5c40f7a"} +[2019-01-07 14:29:31] app.INFO: Home page action dispatched [] {"uid":"e5488fa"} +[2019-01-07 14:30:01] app.INFO: Home page action dispatched [] {"uid":"4665dab"} +[2019-01-07 14:30:13] app.INFO: Home page action dispatched [] {"uid":"3adf80d"} +[2019-01-07 14:44:25] app.INFO: Home page action dispatched [] {"uid":"b84a9f5"} +[2019-01-07 14:45:01] app.INFO: Home page action dispatched [] {"uid":"11e5c3e"} +[2019-01-07 14:45:01] app.INFO: Home page action dispatched [] {"uid":"9134fc3"} +[2019-01-07 14:45:03] app.INFO: Home page action dispatched [] {"uid":"c8ca916"} +[2019-01-07 14:45:04] app.INFO: Home page action dispatched [] {"uid":"a8627ac"} +[2019-01-07 14:49:52] app.INFO: Home page action dispatched [] {"uid":"e5b2a05"} +[2019-01-07 14:49:59] app.INFO: Home page action dispatched [] {"uid":"9d2e9c6"} +[2019-01-07 14:50:29] app.INFO: Home page action dispatched [] {"uid":"1698252"} +[2019-01-07 14:51:17] app.INFO: Home page action dispatched [] {"uid":"44386fb"} +[2019-01-07 14:52:21] app.INFO: Home page action dispatched [] {"uid":"9d435e9"} +[2019-01-07 14:52:42] app.INFO: Home page action dispatched [] {"uid":"a6221b4"} +[2019-01-07 14:53:07] app.INFO: Home page action dispatched [] {"uid":"9196d8c"} diff --git a/api/public/.htaccess b/api/public/.htaccess new file mode 100644 index 000000000..889b428aa --- /dev/null +++ b/api/public/.htaccess @@ -0,0 +1,16 @@ +# For production, put your rewrite rules directly into your VirtualHost +# directive and turn off AllowOverride. + + + RewriteEngine On + + RewriteCond %{REQUEST_FILENAME} -s [OR] + RewriteCond %{REQUEST_FILENAME} -l [OR] + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^.*$ - [NC,L] + + + RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$ + RewriteRule ^(.*) - [E=BASE:%1] + RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] + \ No newline at end of file diff --git a/api/public/css/style.css b/api/public/css/style.css new file mode 100644 index 000000000..322b3bf28 --- /dev/null +++ b/api/public/css/style.css @@ -0,0 +1,18 @@ +body { + margin: 50px 0 0 0; + padding: 0; + width: 100%; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + text-align: center; + color: #aaa; + font-size: 18px; +} + +h1 { + color: #719e40; + letter-spacing: -3px; + font-family: 'Lato', sans-serif; + font-size: 100px; + font-weight: 200; + margin-bottom: 0; +} diff --git a/api/public/index.php b/api/public/index.php new file mode 100644 index 000000000..8643d9910 --- /dev/null +++ b/api/public/index.php @@ -0,0 +1,27 @@ +run(); diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 000000000..b32fd4714 --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,7 @@ +.boxCurso{ display: none; } +.boxCursoCp {margin-bottom: 20px;} +.topo{ margin-bottom: 40px;} +#iconeTopo{margin-top: 8px; color:#fff} +#iconeTopo:hover{color:blue} +.card a{color:#000; text-decoration: none;} +.card i.btnExcluir:hover{color:#f00;} diff --git a/assets/js/autenticacao.js b/assets/js/autenticacao.js new file mode 100644 index 000000000..1aed58601 --- /dev/null +++ b/assets/js/autenticacao.js @@ -0,0 +1,27 @@ +$(document).ready( function(){ + + var email = localStorage.getItem('email'); + var token = localStorage.getItem('token'); + + if( email != '' && token != '' ){ + $.ajax({ + accepts: "application/json", + contentType: 'application/json; charset=UTF-8', + dataType: 'json', + headers :{ "email": email, "token": token }, + data:{}, + method: 'GET', + url: localStorage.getItem("base_url") + "api/usuario/verificarToken", + success: function(resposta){ + if( resposta.erro == 1 ){ + location.href = localStorage.getItem("base_url"); + } + } + }); + }else{ + + location.href = localStorage.getItem("base_url"); + } + + +}); \ No newline at end of file diff --git a/assets/js/curso-criar.js b/assets/js/curso-criar.js new file mode 100644 index 000000000..cb7281277 --- /dev/null +++ b/assets/js/curso-criar.js @@ -0,0 +1,91 @@ +$('select').chosen(); + +listarProfessores(function(lista){ + var html = ''; + for( var i=0; i"+lista[i].nome+""; + } + $("#professores").html(html).trigger("chosen:updated"); + +}); + +listarSalas(function(lista){ + var html = ''; + for( var i=0; i"+lista[i].numero+""; + } + $("#salas").html(html).trigger("chosen:updated"); + +}); + + +function listarProfessores(callback){ + var url = localStorage.getItem("base_url") + "api/professores"; + + requisicaoAjax( url, 'get', {}, function( resposta ){ + + if( resposta.erro == 0 ){ + if( resposta.dados.length > 0){ + + var lista = []; + for(var i=0; i 0){ + var lista = []; + for(var i=0; iVoltar a listagem"; + gera_modal("", resposta.msg + "
" + btn, "success"); + } + }); +} \ No newline at end of file diff --git a/assets/js/curso-editar.js b/assets/js/curso-editar.js new file mode 100644 index 000000000..2c36530c0 --- /dev/null +++ b/assets/js/curso-editar.js @@ -0,0 +1,37 @@ + +var url = localStorage.getItem("base_url") + "api/curso/"+getParam('id'); + +requisicaoAjax( url, 'get', {}, function( resposta ){ + if( resposta.erro == 0 ){ + console.log(resposta); + var id = resposta.dados[0].curso.id; + var nome = resposta.dados[0].curso.disciplina.nome; + var inicio = resposta.dados[0].curso.horario_inicio; + var fim = resposta.dados[0].curso.horario_fim; + var salas = resposta.dados[0].salas; + var professores = resposta.dados[0].professores; + + $("#id").val(id); + $("#nome").val(nome); + $("#inicio").val(inicio); + $("#fim").val(fim); + + for(var i=0; i 0){ + for(var i=0; i 0){ + virg = ", "; + } + professores += virg + arrProfessores[j].nome; + } + + var arrSalas = resposta.dados[i].salas; + var salas = ""; + var virg = ""; + for( var j=0; j 0){ + virg = ", "; + } + salas += virg + arrSalas[j].numero ; + } + + html = html.replace("{{nome_disciplina}}", nome_disciplina); + html = html.replace("{{horario}}", horario); + html = html.replace("{{id}}", id); + html = html.replace("{{professores}}", professores); + html = html.replace("{{salas}}", salas); + + $("#conteudoCurso").html( html ); + + } + }else{ + gera_alert("Este curso não existe!", "danger", "#conteudoCurso"); + } + + }else{ + gera_modal('Erro', resposta.msg, "danger"); + } +}); \ No newline at end of file diff --git a/assets/js/cursos-listar.js b/assets/js/cursos-listar.js new file mode 100644 index 000000000..a88c8d4a3 --- /dev/null +++ b/assets/js/cursos-listar.js @@ -0,0 +1,74 @@ + +function excluirCurso(id){ + gera_confirm("Deseja realmente excluir o curso?", function(resposta){ + if( resposta == true ){ + var url = localStorage.getItem("base_url") + "api/curso/"+id; + requisicaoAjax( url, 'delete', {}, function( resposta ){ + + if( resposta ){ + location.href = localStorage.getItem("base_url") + "painel/cursos.php"; + } + + }); + } + }); +} + + +var url = localStorage.getItem("base_url") + "api/cursos"; + +requisicaoAjax( url, 'get', {}, function( resposta ){ + if( resposta.erro == 0 ){ + + for(var i=0; i 0){ + virg = ", "; + } + professores += virg + arrProfessores[j].nome; + } + + var arrSalas = resposta.dados[i].salas; + var salas = ""; + var virg = ""; + for( var j=0; j 0){ + virg = ", "; + } + salas += virg + arrSalas[j].numero ; + } + + html = html.replace("{{nome_disciplina}}", nome_disciplina); + html = html.replace("{{horario}}", horario); + html = html.replace(/{{id}}/g, id); + html = html.replace("{{professores}}", professores); + html = html.replace("{{salas}}", salas); + + $( ".container > .row" ).append( html ); + } + + $(".boxCurso").remove(); + + $(".btnExcluir").on('click', function(event){ + var id = $(event.target).attr('id'); + event.preventDefault(); + excluirCurso( id ); + return false; + }); + + }else{ + gera_modal('Erro', resposta.msg, "danger"); + } +}); + \ No newline at end of file diff --git a/assets/js/geral.js b/assets/js/geral.js new file mode 100644 index 000000000..48fd76956 --- /dev/null +++ b/assets/js/geral.js @@ -0,0 +1,119 @@ +if( localStorage.getItem("base_url") == null ){ + var port = location.port == 80 ? "" : ":"+location.port; + + var _pathname = location.pathname == "" ? "/" : ""; + var url = location.protocol + "//" + location.hostname + port + location.pathname; + + + localStorage.setItem("base_url", url); +} + + + + + +function requisicaoAjax( url, metodo, params, callback ){ + $.ajax({ + accepts: "application/json", + contentType: 'application/json; charset=UTF-8', + dataType: 'json', + headers :{ "email": localStorage.getItem('email'), "token": localStorage.getItem('token') }, + data: params, + method: metodo, + url: url, + success: function(resposta){ + callback(resposta); + }, + error: function(resposta) { + //location.href = localStorage.getItem('base_url') + "/erro" + } + }); +} + + +function gera_alert(texto, classe, divContainer){ + + html = "
" + texto + "
"; + + $(divContainer).html(html); + +} + + +function gera_confirm( texto, callback ){ + + var htmlconfirm = ""; + + if( $("#mi-modal").length == 0 ){ + $("body").append( htmlconfirm ); + } + + $("#mi-modal").modal('show'); + + $("#modal-btn-si").on("click", function(){ + callback(true); + $("#mi-modal").modal('hide'); + $("#confirmlLabel").html("Confirmar?"); + $("#modal-btn-si").off("click"); + $(".modal").remove(); + }); + + $("#modal-btn-no").on("click", function(){ + callback(false); + $("#mi-modal").modal('hide'); + $("#confirmlLabel").html("Confirmar?"); + $("#modal-btn-no").off("click"); + $(".modal").remove(); + }); + + +}; + + +//gera modal +function gera_modal(titulo, texto, classe){ + var html = ""; + + $(html).modal(); + +} + +function getParam(name, url) { + if (!url) url = window.location.href; + name = name.replace(/[\[\]]/g, '\\$&'); + var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), + results = regex.exec(url); + if (!results) return null; + if (!results[2]) return ''; + return decodeURIComponent(results[2].replace(/\+/g, ' ')); +} \ No newline at end of file diff --git a/assets/js/index.js b/assets/js/index.js new file mode 100644 index 000000000..b31428878 --- /dev/null +++ b/assets/js/index.js @@ -0,0 +1,29 @@ +function logar(event){ + event.preventDefault(); + + var email = event.target.querySelector('#email').value.trim(); + var senha = event.target.querySelector('#senha').value.trim(); + + $.ajax({ + accepts: "application/json", + contentType: 'application/json; charset=UTF-8', + dataType: 'json', + data:{ 'email': email, 'senha': senha }, + method: 'GET', + url: localStorage.getItem("base_url") + 'api/usuario/logar', + success: function(resposta){ + + localStorage.removeItem("email"); + localStorage.removeItem("token"); + + if( resposta.erro == 1 ){ + gera_modal("Erro", resposta.msg, "danger"); + } else{ + localStorage.setItem("email", email); + localStorage.setItem("token", resposta.dados.token); + window.location.href = "painel/cursos.php"; + } + }, + }); + + } \ No newline at end of file diff --git a/footer.php b/footer.php new file mode 100644 index 000000000..4d4a7e528 --- /dev/null +++ b/footer.php @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 000000000..d97cce949 --- /dev/null +++ b/header.php @@ -0,0 +1,13 @@ + + + + + + Desafio FullStack + + + + + + + \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 000000000..914dce505 --- /dev/null +++ b/index.php @@ -0,0 +1,26 @@ + + +
+
+

LOGIN

+
+
+ + +
+
+ + +
+
+ +
+
+
+
+ + + + + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..5c5ac3020 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,30 @@ +{ + "lockfileVersion": 1, + "dependencies": { + "@fortawesome/fontawesome-free": { + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.6.3.tgz", + "integrity": "sha512-s5PLdI9NYgjBvfrv6rhirPHlAHWx+Sfo/IjsAeiXYfmemC/GSjwsyz1wLnGPazbLPXWfk62ks980o9AmsxYUEQ==" + }, + "bootstrap": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.2.1.tgz", + "integrity": "sha512-tt/7vIv3Gm2mnd/WeDx36nfGGHleil0Wg8IeB7eMrVkY0fZ5iTaBisSh8oNANc2IBsCc6vCgCNTIM/IEN0+50Q==" + }, + "bootstrap4-chosen": { + "version": "1.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/bootstrap4-chosen/-/bootstrap4-chosen-1.0.0-alpha.1.tgz", + "integrity": "sha512-WlIYHxFoPb1iWe1C/D1xZd6GncNOTSDrm6gYdr76iH8ztvpEnxZmAc8mz3g4r65KX6+mwt9v1vgYAMIGI54Pkw==" + }, + "chosen-js": { + "version": "1.8.7", + "resolved": "https://registry.npmjs.org/chosen-js/-/chosen-js-1.8.7.tgz", + "integrity": "sha512-eVdrZJ2U5ISdObkgsi0od5vIJdLwq1P1Xa/Vj/mgxkMZf14DlgobfB6nrlFi3kW4kkvKLsKk4NDqZj1MU1DCpw==" + }, + "jquery": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", + "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==" + } + } +} diff --git a/painel/criar-curso.php b/painel/criar-curso.php new file mode 100644 index 000000000..3da79972c --- /dev/null +++ b/painel/criar-curso.php @@ -0,0 +1,13 @@ + + +
+
+ +
+
+ + + \ No newline at end of file diff --git a/painel/curso.php b/painel/curso.php new file mode 100644 index 000000000..e84ef0c7d --- /dev/null +++ b/painel/curso.php @@ -0,0 +1,30 @@ + + +
+
+
+

{{nome_disciplina}}

+ + + + + + + + + + + + + +
Prof.{{professores}}
Sala{{salas}}
Horário{{horario}}
+
+ +
+
+ + + \ No newline at end of file diff --git a/painel/cursos.php b/painel/cursos.php new file mode 100644 index 000000000..cff7ef3d3 --- /dev/null +++ b/painel/cursos.php @@ -0,0 +1,44 @@ + + + + + + + \ No newline at end of file diff --git a/painel/editar-curso.php b/painel/editar-curso.php new file mode 100644 index 000000000..ea18dd606 --- /dev/null +++ b/painel/editar-curso.php @@ -0,0 +1,14 @@ + + +
+
+ +
+
+ + + + \ No newline at end of file diff --git a/painel/footer_painel.php b/painel/footer_painel.php new file mode 100644 index 000000000..4d4a7e528 --- /dev/null +++ b/painel/footer_painel.php @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/painel/form-curso.php b/painel/form-curso.php new file mode 100644 index 000000000..10ccb9567 --- /dev/null +++ b/painel/form-curso.php @@ -0,0 +1,56 @@ +
+ +
+ + + +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+ +
+ +
+ +
+
+
+
+
+ +
+
+ +
+
+ + + +
+ +
\ No newline at end of file diff --git a/painel/functions-cursos.js b/painel/functions-cursos.js new file mode 100644 index 000000000..a8c7225da --- /dev/null +++ b/painel/functions-cursos.js @@ -0,0 +1,74 @@ + +function excluirCurso(id){ + gera_confirm("Deseja realmente excluir o curso?", function(resposta){ + if( resposta == true ){ + var url = localStorage.getItem("base_url") + "/api/curso/"+id; + requisicaoAjax( url, 'delete', {}, function( resposta ){ + + if( resposta ){ + location.href = localStorage.getItem("base_url") + "/painel/cursos.php"; + } + + }); + } + }); +} + + +var url = localStorage.getItem("base_url") + "/api/cursos"; + +requisicaoAjax( url, 'get', {}, function( resposta ){ + if( resposta.erro == 0 ){ + + for(var i=0; i 0){ + virg = ", "; + } + professores += virg + arrProfessores[j].nome; + } + + var arrSalas = resposta.dados[i].salas; + var salas = ""; + var virg = ""; + for( var j=0; j 0){ + virg = ", "; + } + salas += virg + arrSalas[j].numero ; + } + + html = html.replace("{{nome_disciplina}}", nome_disciplina); + html = html.replace("{{horario}}", horario); + html = html.replace(/{{id}}/g, id); + html = html.replace("{{professores}}", professores); + html = html.replace("{{salas}}", salas); + + $( ".container > .row" ).append( html ); + } + + $(".boxCurso").remove(); + + $(".btnExcluir").on('click', function(event){ + var id = $(event.target).attr('id'); + event.preventDefault(); + excluirCurso( id ); + return false; + }); + + }else{ + gera_modal('Erro', resposta.msg, "danger"); + } +}); + \ No newline at end of file diff --git a/painel/header_painel.php b/painel/header_painel.php new file mode 100644 index 000000000..f4c773b79 --- /dev/null +++ b/painel/header_painel.php @@ -0,0 +1,33 @@ + + + + + + Painel - Desafio FullStack + + + + + + + + + + + + + + + + + +
+
+
+

+ + +

+
+
+
\ No newline at end of file diff --git a/scripts/DER/DER.jpg b/scripts/DER/DER.jpg new file mode 100644 index 000000000..9194c7b7a Binary files /dev/null and b/scripts/DER/DER.jpg differ diff --git a/scripts/SQL/desafiofullstack.sql b/scripts/SQL/desafiofullstack.sql new file mode 100644 index 000000000..37abb03ee --- /dev/null +++ b/scripts/SQL/desafiofullstack.sql @@ -0,0 +1,136 @@ +/* +MySQL - 10.1.21-MariaDB : Database - celsolisboa +********************************************************************* +*/ + + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/`celsolisboa` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; + +USE `celsolisboa`; + +/*Table structure for table `curso` */ + +DROP TABLE IF EXISTS `curso`; + +CREATE TABLE `curso` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `disciplina_id` int(11) NOT NULL, + `horario_inicio` time NOT NULL, + `horario_fim` time NOT NULL, + PRIMARY KEY (`id`), + KEY `disciplina_id` (`disciplina_id`), + CONSTRAINT `curso_ibfk_1` FOREIGN KEY (`disciplina_id`) REFERENCES `disciplina` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; + +/*Data for the table `curso` */ + +insert into `curso`(`id`,`disciplina_id`,`horario_inicio`,`horario_fim`) values (1,1,'09:00:00','12:00:00'),(2,2,'09:30:00','12:30:00'),(3,3,'14:45:00','18:00:00'),(4,4,'14:45:00','18:00:00'); + +/*Table structure for table `curso_professor` */ + +DROP TABLE IF EXISTS `curso_professor`; + +CREATE TABLE `curso_professor` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `curso_id` int(11) NOT NULL, + `professor_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `professor_id` (`professor_id`), + KEY `curso_id` (`curso_id`), + CONSTRAINT `curso_professor_ibfk_1` FOREIGN KEY (`curso_id`) REFERENCES `curso` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `curso_professor_ibfk_2` FOREIGN KEY (`professor_id`) REFERENCES `professor` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `curso_professor` */ + +insert into `curso_professor`(`id`,`curso_id`,`professor_id`) values (2,2,2),(3,3,3),(4,3,4),(5,4,5),(7,1,1); + +/*Table structure for table `curso_sala` */ + +DROP TABLE IF EXISTS `curso_sala`; + +CREATE TABLE `curso_sala` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `curso_id` int(11) NOT NULL, + `sala_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `curso_id` (`curso_id`), + KEY `sala_id` (`sala_id`), + CONSTRAINT `curso_sala_ibfk_1` FOREIGN KEY (`curso_id`) REFERENCES `curso` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `curso_sala_ibfk_2` FOREIGN KEY (`sala_id`) REFERENCES `sala` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; + +/*Data for the table `curso_sala` */ + +insert into `curso_sala`(`id`,`curso_id`,`sala_id`) values (2,2,1),(3,3,4),(4,4,2),(5,4,3),(7,1,5); + +/*Table structure for table `disciplina` */ + +DROP TABLE IF EXISTS `disciplina`; + +CREATE TABLE `disciplina` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `nome` char(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `disciplina` */ + +insert into `disciplina`(`id`,`nome`) values (1,'Biologia'),(2,'Gestão'),(3,'História'),(4,'Matemática'); + +/*Table structure for table `professor` */ + +DROP TABLE IF EXISTS `professor`; + +CREATE TABLE `professor` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `nome` char(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `professor` */ + +insert into `professor`(`id`,`nome`) values (1,'Álvares de Azevedo'),(2,'Mario de Andrade'),(3,'Ruy Barbosa'),(4,'Agatha Christie'),(5,'Mario Quintana'); + +/*Table structure for table `sala` */ + +DROP TABLE IF EXISTS `sala`; + +CREATE TABLE `sala` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `numero` char(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `sala` */ + +insert into `sala`(`id`,`numero`) values (1,'301'),(2,'302'),(3,'303'),(4,'402'),(5,'502'); + +/*Table structure for table `usuario` */ + +DROP TABLE IF EXISTS `usuario`; + +CREATE TABLE `usuario` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `email` char(255) COLLATE utf8_unicode_ci NOT NULL, + `senha` char(255) COLLATE utf8_unicode_ci NOT NULL, + `token` char(255) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `usuario` */ + +insert into `usuario`(`id`,`email`,`senha`,`token`) values (1,'desafio@celsolisboa.edu.br','16e712811732f084779be026bd1ba896',''); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; diff --git a/wireframe/1-login-mobile.png b/scripts/wireframe/1-login-mobile.png similarity index 100% rename from wireframe/1-login-mobile.png rename to scripts/wireframe/1-login-mobile.png diff --git a/wireframe/2-login-desktop.png b/scripts/wireframe/2-login-desktop.png similarity index 100% rename from wireframe/2-login-desktop.png rename to scripts/wireframe/2-login-desktop.png diff --git a/wireframe/3-cursos-mobile.png b/scripts/wireframe/3-cursos-mobile.png similarity index 100% rename from wireframe/3-cursos-mobile.png rename to scripts/wireframe/3-cursos-mobile.png diff --git a/wireframe/4-cursos-desktop.png b/scripts/wireframe/4-cursos-desktop.png similarity index 100% rename from wireframe/4-cursos-desktop.png rename to scripts/wireframe/4-cursos-desktop.png diff --git a/wireframe/5-detalhe-mobile.png b/scripts/wireframe/5-detalhe-mobile.png similarity index 100% rename from wireframe/5-detalhe-mobile.png rename to scripts/wireframe/5-detalhe-mobile.png diff --git a/wireframe/6-detalhe-desktop.png b/scripts/wireframe/6-detalhe-desktop.png similarity index 100% rename from wireframe/6-detalhe-desktop.png rename to scripts/wireframe/6-detalhe-desktop.png