From 03f6b86a8083cdb31d8e17dffff54622d283e8fd Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Tue, 20 Nov 2018 20:43:01 -0200 Subject: [PATCH 01/25] commit inicial envio dos arquivos da estrutura inicial. --- API Cursos.PNG | Bin 0 -> 33510 bytes apiCursos.sql | 157 ++++++++++++++++++++++++++++++++++++ conexao/Conexao.php | 30 +++++++ conexao/config.php | 9 +++ control/ConteudoControl.php | 32 ++++++++ model/Conteudo.php | 106 ++++++++++++++++++++++++ view/Conteudo/editar.php | 23 ++++++ view/Conteudo/excluir.php | 23 ++++++ view/Conteudo/index.php | 49 +++++++++++ view/Conteudo/inserir.php | 96 ++++++++++++++++++++++ view/Conteudo/listar.php | 9 +++ 11 files changed, 534 insertions(+) create mode 100644 API Cursos.PNG create mode 100644 apiCursos.sql create mode 100644 conexao/Conexao.php create mode 100644 conexao/config.php create mode 100644 control/ConteudoControl.php create mode 100644 model/Conteudo.php create mode 100644 view/Conteudo/editar.php create mode 100644 view/Conteudo/excluir.php create mode 100644 view/Conteudo/index.php create mode 100644 view/Conteudo/inserir.php create mode 100644 view/Conteudo/listar.php diff --git a/API Cursos.PNG b/API Cursos.PNG new file mode 100644 index 0000000000000000000000000000000000000000..aab421da4ccef952607af6282c0f589f9e5f0974 GIT binary patch literal 33510 zcmeFZXH=7E+cv7A#s)ZcArMDKQ4p}vOT+>y3QAQeQ4x_6g3=*HMZgBpK|pCikuF49 z=!Bv~KnT(TM2Hw5^cDz&wC@h;43=l+-Ot+Z+CTR9!zHki`@YKAkK;V=oiWrGT_v$< z(V|77CypOAUbILAv}n=d%oWRlzo?qlhynjCb~DyLyeOj{JOKQ%)L!?r?xIDR*wx%i z%Yffkx*k98wrG)9rSRWk5+eD^qD8m;P8`)W^|l!)v3z9R>yw_&Y0juQR&h-6MmN~y z#^aMUyQ!&fQfQp*X8cf8rjx9pnOLry%nrl~yj-FgxaCyz)bxUrkAKwyV zx#YvT!|RsUuG6qQye(zfy7chE9e*rtU0i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xo*KDEy@YIW!L@mA@OL zjGCa4jLAB7%wA_XXgd^=P%rj+jm8f#yKG3~?SUHsR&hZ zWC-vJ!dIO?^a?8C_CYvdR_{7MHI7nBjitlEn+VRB&fIF);y(R1N-YvS&zRsgP z*`|lYzmpvg0087_!48$KAECLNH^RQ9P@YU-{gXUWfcVJ3(4O(t~5xAdQ1Qz@K|*Ysu{s6kOXF-mSq z3pNXRJXuUul?slFp=K$Jra%8b6e9g!d`-_us$8fjYC3)So7!dXz{hfj)%KLH9l!k- Dqt@%n literal 0 HcmV?d00001 diff --git a/apiCursos.sql b/apiCursos.sql new file mode 100644 index 000000000..facae0804 --- /dev/null +++ b/apiCursos.sql @@ -0,0 +1,157 @@ +-- phpMyAdmin SQL Dump +-- version 4.8.0.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1 +-- Generation Time: 17-Nov-2018 às 13:18 +-- Versão do servidor: 10.1.30-MariaDB +-- PHP Version: 7.2.1 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `apidb` +-- +CREATE DATABASE IF NOT EXISTS `apicursos` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +USE `apicursos`; + +-- -------------------------------------------------------- + +-- +-- Estrutura da tabela `cursos` +-- + +CREATE TABLE `cursos` ( + `idcurso` int(11) NOT NULL, + `curso` varchar(45) DEFAULT NULL, + `hora_inico` varchar(4) DEFAULT NULL, + `hora_fim` varchar(4) DEFAULT NULL, + `fk_idprofessor` int(11) NOT NULL, + `fk_idsala` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Estrutura da tabela `professores` +-- + +CREATE TABLE `professores` ( + `idprofessor` int(11) NOT NULL, + `professor` varchar(45) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Estrutura da tabela `salas` +-- + +CREATE TABLE `salas` ( + `idsala` int(11) NOT NULL, + `sala` varchar(45) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Estrutura da tabela `usuarios` +-- + +CREATE TABLE `usuarios` ( + `idusuario` int(11) NOT NULL, + `usuario` varchar(45) DEFAULT NULL, + `senha` varchar(45) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Extraindo dados da tabela `usuarios` +-- + +INSERT INTO `usuarios` (`idusuario`, `usuario`, `senha`) VALUES +(1, 'admin', '123456'); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `cursos` +-- +ALTER TABLE `cursos` + ADD PRIMARY KEY (`idcurso`,`fk_idprofessor`,`fk_idsala`), + ADD KEY `fk_cursos_professores_idx` (`fk_idprofessor`), + ADD KEY `fk_cursos_salas1_idx` (`fk_idsala`); + +-- +-- Indexes for table `professores` +-- +ALTER TABLE `professores` + ADD PRIMARY KEY (`idprofessor`); + +-- +-- Indexes for table `salas` +-- +ALTER TABLE `salas` + ADD PRIMARY KEY (`idsala`), + ADD UNIQUE KEY `sala_UNIQUE` (`sala`); + +-- +-- Indexes for table `usuarios` +-- +ALTER TABLE `usuarios` + ADD PRIMARY KEY (`idusuario`), + ADD UNIQUE KEY `usuario_UNIQUE` (`usuario`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `cursos` +-- +ALTER TABLE `cursos` + MODIFY `idcurso` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT for table `professores` +-- +ALTER TABLE `professores` + MODIFY `idprofessor` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT for table `salas` +-- +ALTER TABLE `salas` + MODIFY `idsala` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT for table `usuarios` +-- +ALTER TABLE `usuarios` + MODIFY `idusuario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +-- +-- Constraints for dumped tables +-- + +-- +-- Limitadores para a tabela `cursos` +-- +ALTER TABLE `cursos` + ADD CONSTRAINT `fk_cursos_professores` FOREIGN KEY (`fk_idprofessor`) REFERENCES `professores` (`idprofessor`) ON DELETE NO ACTION ON UPDATE NO ACTION, + ADD CONSTRAINT `fk_cursos_salas1` FOREIGN KEY (`fk_idsala`) REFERENCES `salas` (`idsala`) ON DELETE NO ACTION ON UPDATE NO ACTION; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/conexao/Conexao.php b/conexao/Conexao.php new file mode 100644 index 000000000..a213ac568 --- /dev/null +++ b/conexao/Conexao.php @@ -0,0 +1,30 @@ +setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + self::$instance->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); + } catch (PDOException $e) { + echo $e->getMessage(); + } + + } + + return self::$instance; + } + + public static function prepare($sql){ + return self::getInstance()->prepare($sql); + } + +} \ No newline at end of file diff --git a/conexao/config.php b/conexao/config.php new file mode 100644 index 000000000..376409ce2 --- /dev/null +++ b/conexao/config.php @@ -0,0 +1,9 @@ + + diff --git a/control/ConteudoControl.php b/control/ConteudoControl.php new file mode 100644 index 000000000..72dff23b8 --- /dev/null +++ b/control/ConteudoControl.php @@ -0,0 +1,32 @@ +titulo; + return $conteudo->insert($obj); + header('Location:listar.php'); + } + + function update($obj,$id){ + $conteudo = new Conteudo(); + return $conteudo->update($obj,$id); + } + + function delete($obj,$id){ + $conteudo = new Conteudo(); + return $conteudo->delete($obj,$id); + } + + function find($id = null){ + + } + + function findAll(){ + $conteudo = new Conteudo(); + return $conteudo->findAll(); + } +} + +?> \ No newline at end of file diff --git a/model/Conteudo.php b/model/Conteudo.php new file mode 100644 index 000000000..306b3be6d --- /dev/null +++ b/model/Conteudo.php @@ -0,0 +1,106 @@ +titulo; + } + + function getDescricao() { + return $this->descricao; + } + + function getHorario() { + return $this->horario; + } + + function getCurso_id() { + return $this->curso_id; + } + + function getPeriodo_id() { + return $this->periodo_id; + } + + function getDisciplina_id() { + return $this->disciplina_id; + } + + function setTitulo($titulo) { + $this->titulo = $titulo; + } + + function setDescricao($descricao) { + $this->descricao = $descricao; + } + + function setHorario($horario) { + $this->horario = $horario; + } + + function setCurso_id($curso_id) { + $this->curso_id = $curso_id; + } + + function setPeriodo_id($periodo_id) { + $this->periodo_id = $periodo_id; + } + + function setDisciplina_id($disciplina_id) { + $this->disciplina_id = $disciplina_id; + } + + public function insert($obj){ + $sql = "INSERT INTO conteudo(titulo,descricao,horario,curso_id,periodo_id,disciplina_id) VALUES (:titulo,:descricao,:horario,:curso_id,:periodo_id,:disciplina_id)"; + $consulta = Conexao::prepare($sql); + $consulta->bindValue('titulo', $obj->titulo); + $consulta->bindValue('descricao', $obj->descricao); + $consulta->bindValue('horario' , $obj->horario); + $consulta->bindValue('curso_id' , $obj->curso_id); + $consulta->bindValue('periodo_id' , $obj->periodo_id); + $consulta->bindValue('disciplina_id' , $obj->periodo_id); + return $consulta->execute(); + + } + + public function update($obj,$id = null){ + $sql = "UPDATE conteudo SET titulo = :titulo, descricao = :descricao,horario = :horario, curso_id = :curso_id,periodo_id =:periodo_id, disciplina_id = :disciplina_id WHERE id = :id "; + $consulta = Conexao::prepare($sql); + $consulta->bindValue('titulo', $obj->titulo); + $consulta->bindValue('descricao', $obj->descricao); + $consulta->bindValue('horario' , $obj->horario); + $consulta->bindValue('curso_id', $obj->curso_id); + $consulta->bindValue('periodo_id' , $obj->periodo_id); + $consulta->bindValue('disciplina_id' , $obj->disciplina_id); + $consulta->bindValue('id', $id); + return $consulta->execute(); + } + + public function delete($obj,$id = null){ + $sql = "DELETE FROM conteudo WHERE id = :id"; + $consulta = Conexao::prepare($sql); + $consulta->bindValue('id',$id); + $consulta->execute(); + } + + public function find($id = null){ + + } + + public function findAll(){ + $sql = "SELECT c.curso, p.professor, s.sala, c.hora_inicio, c.hora_fim FROM cursos c, professores p, salas s WHERE c.fk_idprofessor = p.idprofessor and c.fk_idsala = s.idsala"; + $consulta = Conexao::prepare($sql); + $consulta->execute(); + return $consulta->fetchAll(); + } + +} + +?> \ No newline at end of file diff --git a/view/Conteudo/editar.php b/view/Conteudo/editar.php new file mode 100644 index 000000000..a10a5f72b --- /dev/null +++ b/view/Conteudo/editar.php @@ -0,0 +1,23 @@ +titulo; + +$id = $obj->id; + + +if(!empty($data)){ + $conteudoControl = new ConteudoControl(); + $conteudoControl->update($obj , $id); + header('Location:listar.php'); +} + + + + + + + +?> \ No newline at end of file diff --git a/view/Conteudo/excluir.php b/view/Conteudo/excluir.php new file mode 100644 index 000000000..63d86a88d --- /dev/null +++ b/view/Conteudo/excluir.php @@ -0,0 +1,23 @@ +titulo; + +$id = $obj->id; + + +if(!empty($data)){ + $conteudoControl = new ConteudoControl(); + $conteudoControl->delete($obj,$id); + header('Location:listar.php'); +} + + + + + + + +?> \ No newline at end of file diff --git a/view/Conteudo/index.php b/view/Conteudo/index.php new file mode 100644 index 000000000..37ce06430 --- /dev/null +++ b/view/Conteudo/index.php @@ -0,0 +1,49 @@ + + + + + + + + + + + API Cursos + + + + + +
+ + +
+
Cursos
+
+ findAll() as $valor){ ?> +
+
+
+
curso;?>
+

+
Prof.: professor;?>

+
Sala: sala;?>
hora_inicio;?> s hora_fim;?>
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/view/Conteudo/inserir.php b/view/Conteudo/inserir.php new file mode 100644 index 000000000..5d9e7b180 --- /dev/null +++ b/view/Conteudo/inserir.php @@ -0,0 +1,96 @@ + + + + + + + + + + + API Cursos + + + + insert($obj); + + } + ?> + +
+ +
+
Detalhes do Curso
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+ +
+ + + + + + + + \ No newline at end of file diff --git a/view/Conteudo/listar.php b/view/Conteudo/listar.php new file mode 100644 index 000000000..7280e0cf1 --- /dev/null +++ b/view/Conteudo/listar.php @@ -0,0 +1,9 @@ +findAll() as $valor){ + echo $valor->id; +} \ No newline at end of file From d4f022d75597d25b6bb012c606badd5391f0eabe Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Tue, 20 Nov 2018 21:03:30 -0200 Subject: [PATCH 02/25] Primeiro teste de commit. --- view/Conteudo/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/Conteudo/index.php b/view/Conteudo/index.php index 37ce06430..7b261cb20 100644 --- a/view/Conteudo/index.php +++ b/view/Conteudo/index.php @@ -29,8 +29,8 @@
curso;?>


-
Prof.: professor;?>

-
Sala: sala;?>
hora_inicio;?> s hora_fim;?>
+
Prof..: professor;?>

+
Sala: sala;?>
hora_inicio;?> �s hora_fim;?>
From 968a38fc4e5e416e0dd84958977a9f3632df5905 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Tue, 20 Nov 2018 22:24:23 -0200 Subject: [PATCH 03/25] --- control/ConteudoControl.php | 18 ++++-- model/Conteudo.php | 108 ++++++++++++++++++------------------ view/Conteudo/editar.php | 85 +++++++++++++++++++++++++++- view/Conteudo/excluir.php | 13 +---- view/Conteudo/index.php | 8 +-- view/Conteudo/inserir.php | 46 +++++++-------- 6 files changed, 180 insertions(+), 98 deletions(-) diff --git a/control/ConteudoControl.php b/control/ConteudoControl.php index 72dff23b8..cf845b0fb 100644 --- a/control/ConteudoControl.php +++ b/control/ConteudoControl.php @@ -9,20 +9,30 @@ function insert($obj){ header('Location:listar.php'); } - function update($obj,$id){ + function update($id){ $conteudo = new Conteudo(); - return $conteudo->update($obj,$id); + return $conteudo->update($id); } - function delete($obj,$id){ + function delete($id){ $conteudo = new Conteudo(); - return $conteudo->delete($obj,$id); + return $conteudo->delete($id); } function find($id = null){ } + function findProfessores(){ + $conteudo = new Conteudo(); + return $conteudo->findProfessores(); + } + + function findSalas(){ + $conteudo = new Conteudo(); + return $conteudo->findSalas(); + } + function findAll(){ $conteudo = new Conteudo(); return $conteudo->findAll(); diff --git a/model/Conteudo.php b/model/Conteudo.php index 306b3be6d..1a704a035 100644 --- a/model/Conteudo.php +++ b/model/Conteudo.php @@ -2,100 +2,102 @@ include '../../conexao/Conexao.php'; class Conteudo extends Conexao{ - private $titulo; - private $descricao; - private $horario; - private $curso_id; - private $periodo_id; - private $disciplina_id; - - function getTitulo() { - return $this->titulo; - } + private $curso; + private $idprofessor; + private $idsala; + private $inicio; + private $fim; - function getDescricao() { - return $this->descricao; - } - function getHorario() { - return $this->horario; + function getCurso() { + return $this->curso; } - function getCurso_id() { - return $this->curso_id; + function getDescricao() { + return $this->idprofessor; } - function getPeriodo_id() { - return $this->periodo_id; + function getidsala() { + return $this->idsala; } - function getDisciplina_id() { - return $this->disciplina_id; + function getinicio() { + return $this->inicio; } - function setTitulo($titulo) { - $this->titulo = $titulo; + function getfim() { + return $this->fim; } - function setDescricao($descricao) { - $this->descricao = $descricao; + function setCurso($curso) { + $this->curso = $curso; } - function setHorario($horario) { - $this->horario = $horario; + function setDescricao($idprofessor) { + $this->idprofessor = $idprofessor; } - function setCurso_id($curso_id) { - $this->curso_id = $curso_id; + function setidsala($idsala) { + $this->idsala = $idsala; } - function setPeriodo_id($periodo_id) { - $this->periodo_id = $periodo_id; + function setinicio($inicio) { + $this->inicio = $inicio; } - function setDisciplina_id($disciplina_id) { - $this->disciplina_id = $disciplina_id; + function setfim($fim) { + $this->fim = $fim; } + public function insert($obj){ - $sql = "INSERT INTO conteudo(titulo,descricao,horario,curso_id,periodo_id,disciplina_id) VALUES (:titulo,:descricao,:horario,:curso_id,:periodo_id,:disciplina_id)"; + $sql = "INSERT INTO cursos(curso,fk_idprofessor,fk_idsala,inicio,fim) VALUES (:curso,:idprofessor,:idsala,:inicio,:fim)"; $consulta = Conexao::prepare($sql); - $consulta->bindValue('titulo', $obj->titulo); - $consulta->bindValue('descricao', $obj->descricao); - $consulta->bindValue('horario' , $obj->horario); - $consulta->bindValue('curso_id' , $obj->curso_id); - $consulta->bindValue('periodo_id' , $obj->periodo_id); - $consulta->bindValue('disciplina_id' , $obj->periodo_id); + $consulta->bindValue('curso', $obj->curso); + $consulta->bindValue('idprofessor', $obj->idprofessor); + $consulta->bindValue('idsala' , $obj->idsala); + $consulta->bindValue('inicio' , $obj->inicio); + $consulta->bindValue('fim' , $obj->fim); + return $consulta->execute(); } - public function update($obj,$id = null){ - $sql = "UPDATE conteudo SET titulo = :titulo, descricao = :descricao,horario = :horario, curso_id = :curso_id,periodo_id =:periodo_id, disciplina_id = :disciplina_id WHERE id = :id "; + public function update($id = null){ + $sql = "UPDATE cursos SET curso = :curso, fk_idprofessor = :idprofessor, fk_idsala = :idsala, inicio = :inicio, fim =:fim WHERE idcurso = :id "; $consulta = Conexao::prepare($sql); - $consulta->bindValue('titulo', $obj->titulo); - $consulta->bindValue('descricao', $obj->descricao); - $consulta->bindValue('horario' , $obj->horario); - $consulta->bindValue('curso_id', $obj->curso_id); - $consulta->bindValue('periodo_id' , $obj->periodo_id); - $consulta->bindValue('disciplina_id' , $obj->disciplina_id); + $consulta->bindValue('curso', $obj->curso); + $consulta->bindValue('idprofessor', $obj->idprofessor); + $consulta->bindValue('idsala' , $obj->idsala); + $consulta->bindValue('inicio', $obj->inicio); + $consulta->bindValue('fim' , $obj->fim); $consulta->bindValue('id', $id); return $consulta->execute(); } - public function delete($obj,$id = null){ - $sql = "DELETE FROM conteudo WHERE id = :id"; + public function delete($id = null){ + $sql = "DELETE FROM cursos WHERE idcurso = :id"; $consulta = Conexao::prepare($sql); $consulta->bindValue('id',$id); $consulta->execute(); } - public function find($id = null){ - + public function findProfessores(){ + $sql = "SELECT * FROM professores"; + $consulta = Conexao::prepare($sql); + $consulta->execute(); + return $consulta->fetchAll(); + } + + public function findSalas(){ + $sql = "SELECT * FROM salas"; + $consulta = Conexao::prepare($sql); + $consulta->execute(); + return $consulta->fetchAll(); } public function findAll(){ - $sql = "SELECT c.curso, p.professor, s.sala, c.hora_inicio, c.hora_fim FROM cursos c, professores p, salas s WHERE c.fk_idprofessor = p.idprofessor and c.fk_idsala = s.idsala"; + $sql = "SELECT c.idcurso, c.curso, p.professor, s.sala, c.inicio, c.fim FROM cursos c, professores p, salas s WHERE c.fk_idprofessor = p.idprofessor and c.fk_idsala = s.idsala ORDER BY c.idcurso"; $consulta = Conexao::prepare($sql); $consulta->execute(); return $consulta->fetchAll(); diff --git a/view/Conteudo/editar.php b/view/Conteudo/editar.php index a10a5f72b..69d5c48aa 100644 --- a/view/Conteudo/editar.php +++ b/view/Conteudo/editar.php @@ -13,11 +13,94 @@ $conteudoControl->update($obj , $id); header('Location:listar.php'); } +?> + + + + + + + + + + API Cursos + + + insert($obj); + } + ?> +
+ +
+
Detalhes do Curso
+
+
+
+
+
+ +
-?> \ No newline at end of file +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+ +
+ + + + + + + + \ No newline at end of file diff --git a/view/Conteudo/excluir.php b/view/Conteudo/excluir.php index 63d86a88d..5810092d6 100644 --- a/view/Conteudo/excluir.php +++ b/view/Conteudo/excluir.php @@ -1,17 +1,10 @@ titulo; -$id = $obj->id; - - -if(!empty($data)){ +if(isset($_GET['id']) && $_GET['id'] <> ''){ $conteudoControl = new ConteudoControl(); - $conteudoControl->delete($obj,$id); - header('Location:listar.php'); + $conteudoControl->delete($_GET['id']); + header('Location:index.php'); } diff --git a/view/Conteudo/index.php b/view/Conteudo/index.php index 7b261cb20..556f89f79 100644 --- a/view/Conteudo/index.php +++ b/view/Conteudo/index.php @@ -2,7 +2,7 @@ - + @@ -27,10 +27,10 @@
-
curso;?>
+
curso;?>


-
Prof..: professor;?>

-
Sala: sala;?>
hora_inicio;?> �s hora_fim;?>
+
Prof.: professor;?>

+
Sala: sala;?>
inicio;?> às fim;?>
diff --git a/view/Conteudo/inserir.php b/view/Conteudo/inserir.php index 5d9e7b180..5c53877cb 100644 --- a/view/Conteudo/inserir.php +++ b/view/Conteudo/inserir.php @@ -14,39 +14,36 @@ insert($obj); + + $obj = json_encode($_POST); + + if(!empty($obj)){ + $obj = json_decode($obj); + $conteudoControl->insert($obj); - } + } ?>
-
Detalhes do Curso
+
Detalhes do Curso
-
+
- +
- + findProfessores() as $valor){ ?> + +
@@ -55,22 +52,19 @@
- + findSalas() as $valor){ ?> + +
- +
- +
From f1fbd615a3d041cee4afa1687dfb1aac144ec632 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Wed, 21 Nov 2018 22:46:45 -0200 Subject: [PATCH 04/25] --- control/ConteudoControl.php | 5 +++++ model/Conteudo.php | 11 +++++++++- view/Conteudo/editar.php | 40 ++++++++++--------------------------- view/Conteudo/index.php | 2 +- view/Conteudo/inserir.php | 7 ++++--- 5 files changed, 31 insertions(+), 34 deletions(-) diff --git a/control/ConteudoControl.php b/control/ConteudoControl.php index cf845b0fb..7a7aafa4d 100644 --- a/control/ConteudoControl.php +++ b/control/ConteudoControl.php @@ -23,6 +23,11 @@ function find($id = null){ } + function editCurso($id = null){ + $conteudo = new Conteudo(); + return $conteudo->editCurso($id); + } + function findProfessores(){ $conteudo = new Conteudo(); return $conteudo->findProfessores(); diff --git a/model/Conteudo.php b/model/Conteudo.php index 1a704a035..01f037cee 100644 --- a/model/Conteudo.php +++ b/model/Conteudo.php @@ -95,7 +95,16 @@ public function findSalas(){ $consulta->execute(); return $consulta->fetchAll(); } - + + public function editCurso($id = null){ + $sql = "SELECT c.idcurso, c.curso, p.professor, s.sala, c.inicio, c.fim FROM cursos c, professores p, salas s WHERE idcurso = :id and c.fk_idprofessor = p.idprofessor and c.fk_idsala = s.idsala + "; + $consulta = Conexao::prepare($sql); + $consulta->bindValue('id',$id); + $consulta->execute(); + return $consulta->fetchAll(); + } + public function findAll(){ $sql = "SELECT c.idcurso, c.curso, p.professor, s.sala, c.inicio, c.fim FROM cursos c, professores p, salas s WHERE c.fk_idprofessor = p.idprofessor and c.fk_idsala = s.idsala ORDER BY c.idcurso"; $consulta = Conexao::prepare($sql); diff --git a/view/Conteudo/editar.php b/view/Conteudo/editar.php index 69d5c48aa..6f6dd7844 100644 --- a/view/Conteudo/editar.php +++ b/view/Conteudo/editar.php @@ -1,18 +1,11 @@ titulo; -$id = $obj->id; - - -if(!empty($data)){ - $conteudoControl = new ConteudoControl(); - $conteudoControl->update($obj , $id); - header('Location:listar.php'); -} +if(isset($_GET['id']) && $_GET['id'] <> ''){ + $conteudoControl = new ConteudoControl(); + $res = $conteudoControl->editCurso($_GET['id']); + var_dump($res); + } ?> @@ -28,23 +21,12 @@ - insert($obj); - - } - ?>
- +
-
Detalhes do Curso
+
Editar Detalhes do Curso
@@ -52,7 +34,7 @@
- +
@@ -76,11 +58,11 @@
- +
- +
@@ -94,7 +76,7 @@

- +
diff --git a/view/Conteudo/index.php b/view/Conteudo/index.php index 556f89f79..ef2acb30e 100644 --- a/view/Conteudo/index.php +++ b/view/Conteudo/index.php @@ -27,7 +27,7 @@
-
curso;?>
+


Prof.: professor;?>

Sala: sala;?>
inicio;?> às fim;?>
diff --git a/view/Conteudo/inserir.php b/view/Conteudo/inserir.php index 5c53877cb..a70c787ed 100644 --- a/view/Conteudo/inserir.php +++ b/view/Conteudo/inserir.php @@ -16,10 +16,11 @@ include '../../control/ConteudoControl.php'; $conteudoControl = new ConteudoControl(); - $obj = json_encode($_POST); - if(!empty($obj)){ - $obj = json_decode($obj); + if(!empty($_POST)){ + $obj1 = json_encode($_POST); + $obj = json_decode($obj1); + var_dump($obj); $conteudoControl->insert($obj); } From 620f677604de5f26b640cfc6e65ebed43f7689ab Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Wed, 21 Nov 2018 23:23:37 -0200 Subject: [PATCH 05/25] --- model/Conteudo.php | 2 +- view/Conteudo/editar.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/model/Conteudo.php b/model/Conteudo.php index 01f037cee..df36c900d 100644 --- a/model/Conteudo.php +++ b/model/Conteudo.php @@ -97,7 +97,7 @@ public function findSalas(){ } public function editCurso($id = null){ - $sql = "SELECT c.idcurso, c.curso, p.professor, s.sala, c.inicio, c.fim FROM cursos c, professores p, salas s WHERE idcurso = :id and c.fk_idprofessor = p.idprofessor and c.fk_idsala = s.idsala + $sql = "SELECT c.idcurso, c.curso, p.idprofessor, s.idsala, c.inicio, c.fim FROM cursos c, professores p, salas s WHERE idcurso = :id and c.fk_idprofessor = p.idprofessor and c.fk_idsala = s.idsala "; $consulta = Conexao::prepare($sql); $consulta->bindValue('id',$id); diff --git a/view/Conteudo/editar.php b/view/Conteudo/editar.php index 6f6dd7844..53cf9c0cb 100644 --- a/view/Conteudo/editar.php +++ b/view/Conteudo/editar.php @@ -52,7 +52,7 @@
From 0729a818c15e570c76a719c44d683641c659c10d Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 1 Dec 2018 00:25:35 -0200 Subject: [PATCH 06/25] --- control/ConteudoControl.php | 5 +++++ model/Conteudo.php | 13 ++++++++++++- view/Conteudo/index.php | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/control/ConteudoControl.php b/control/ConteudoControl.php index 7a7aafa4d..929dfaaa9 100644 --- a/control/ConteudoControl.php +++ b/control/ConteudoControl.php @@ -2,6 +2,7 @@ include '../../model/Conteudo.php'; class ConteudoControl{ + function insert($obj){ $conteudo = new Conteudo(); //echo $obj->titulo; @@ -42,6 +43,10 @@ function findAll(){ $conteudo = new Conteudo(); return $conteudo->findAll(); } + function login($email, $senha){ + $conteudo = new Conteudo(); + return $conteudo->login($email, $senha); + } } ?> \ No newline at end of file diff --git a/model/Conteudo.php b/model/Conteudo.php index df36c900d..fab48defc 100644 --- a/model/Conteudo.php +++ b/model/Conteudo.php @@ -110,7 +110,18 @@ public function findAll(){ $consulta = Conexao::prepare($sql); $consulta->execute(); return $consulta->fetchAll(); - } + } + + public function login($email, $senha){ + $sql = "SELECT * FROM usuarios WHERE usuario = :email AND senha = :senha"; + $consulta = Conexao::prepare($sql); + $consulta->bindValue('email',$email); + $consulta->bindValue('senha',$senha); + $consulta->execute(); + $reg = $consulta->fetchAll(0); + return $reg; + + } } diff --git a/view/Conteudo/index.php b/view/Conteudo/index.php index ef2acb30e..aa6a1345c 100644 --- a/view/Conteudo/index.php +++ b/view/Conteudo/index.php @@ -13,6 +13,7 @@ From ad20de5720e8f5977af0fdda7087880b9b168e29 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 1 Dec 2018 00:26:04 -0200 Subject: [PATCH 07/25] --- index.php | 13 +++++++ view/Conteudo/header.php | 19 ++++++++++ view/Conteudo/login.php | 76 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 index.php create mode 100644 view/Conteudo/header.php create mode 100644 view/Conteudo/login.php diff --git a/index.php b/index.php new file mode 100644 index 000000000..57aad57e7 --- /dev/null +++ b/index.php @@ -0,0 +1,13 @@ + + + + +API Cursos + + + +Go to Login + + \ No newline at end of file diff --git a/view/Conteudo/header.php b/view/Conteudo/header.php new file mode 100644 index 000000000..26bb82e7a --- /dev/null +++ b/view/Conteudo/header.php @@ -0,0 +1,19 @@ + +
+
+
+ +
+
+ Sair +
+
+ +
\ No newline at end of file diff --git a/view/Conteudo/login.php b/view/Conteudo/login.php new file mode 100644 index 000000000..b43c8a606 --- /dev/null +++ b/view/Conteudo/login.php @@ -0,0 +1,76 @@ +login($email, $senha); + //var_dump($rs->usuario); + if(!empty($rs)) { + + $_SESSION['usuario'] = $rs->usuario; + + header('location:index.php'); + } + else{ + echo "
Usuário ou senha inválido!
"; + } + } + + if(isset($_GET['logout']) && $_GET['logout'] == 'sim') + { + unset($_SESSION['usuario']); + + session_destroy(); + } +?> + + + + + + + + + + + API Cursos + + + +
+
+
Login
+
+ +
+ + + +
+
+ + +
+ + + +
+
+
+ + + + + + + + \ No newline at end of file From 1cf3a69ebf108a0fd8401aec7e8662bff9f822fb Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 1 Dec 2018 20:03:29 -0200 Subject: [PATCH 08/25] --- view/Conteudo/inserir.php | 4 +++- view/Conteudo/login.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/view/Conteudo/inserir.php b/view/Conteudo/inserir.php index a70c787ed..da834fbc5 100644 --- a/view/Conteudo/inserir.php +++ b/view/Conteudo/inserir.php @@ -32,7 +32,7 @@
Detalhes do Curso
-
+
@@ -43,6 +43,7 @@
@@ -55,6 +56,7 @@
diff --git a/view/Conteudo/login.php b/view/Conteudo/login.php index b43c8a606..9f89a0bbf 100644 --- a/view/Conteudo/login.php +++ b/view/Conteudo/login.php @@ -30,6 +30,8 @@ unset($_SESSION['usuario']); session_destroy(); + + header('location:login.php'); } ?> @@ -44,7 +46,7 @@ API Cursos - +
From f0a24a3655759204b48fbc7374c1fcda5e342698 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 1 Dec 2018 20:03:57 -0200 Subject: [PATCH 09/25] --- view/Conteudo/inserir.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/Conteudo/inserir.php b/view/Conteudo/inserir.php index da834fbc5..c4647604a 100644 --- a/view/Conteudo/inserir.php +++ b/view/Conteudo/inserir.php @@ -32,7 +32,7 @@
Detalhes do Curso
- +
From b6593e5f4abc8de3d63c4ec9872e52ecc1efdbb3 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sun, 2 Dec 2018 17:56:56 -0200 Subject: [PATCH 10/25] --- control/ConteudoControl.php | 4 ++-- model/Conteudo.php | 2 +- view/Conteudo/editar.php | 27 ++++++++++++++++++--------- view/Conteudo/excluir.php | 1 + view/Conteudo/header.php | 4 ++-- view/Conteudo/index.php | 2 +- view/Conteudo/inserir.php | 3 ++- view/Conteudo/listar.php | 1 + 8 files changed, 28 insertions(+), 16 deletions(-) diff --git a/control/ConteudoControl.php b/control/ConteudoControl.php index 929dfaaa9..e65a652ce 100644 --- a/control/ConteudoControl.php +++ b/control/ConteudoControl.php @@ -10,9 +10,9 @@ function insert($obj){ header('Location:listar.php'); } - function update($id){ + function update($id, $obj){ $conteudo = new Conteudo(); - return $conteudo->update($id); + return $conteudo->update($id, $obj); } function delete($id){ diff --git a/model/Conteudo.php b/model/Conteudo.php index fab48defc..c52b3c6da 100644 --- a/model/Conteudo.php +++ b/model/Conteudo.php @@ -63,7 +63,7 @@ public function insert($obj){ } - public function update($id = null){ + public function update($id = null, $obj){ $sql = "UPDATE cursos SET curso = :curso, fk_idprofessor = :idprofessor, fk_idsala = :idsala, inicio = :inicio, fim =:fim WHERE idcurso = :id "; $consulta = Conexao::prepare($sql); $consulta->bindValue('curso', $obj->curso); diff --git a/view/Conteudo/editar.php b/view/Conteudo/editar.php index 53cf9c0cb..db8af2345 100644 --- a/view/Conteudo/editar.php +++ b/view/Conteudo/editar.php @@ -1,10 +1,11 @@ ''){ $conteudoControl = new ConteudoControl(); $res = $conteudoControl->editCurso($_GET['id']); - var_dump($res); + } ?> @@ -19,7 +20,7 @@ API Cursos - + @@ -39,9 +40,13 @@
@@ -51,9 +56,13 @@
@@ -66,7 +75,7 @@
- +
diff --git a/view/Conteudo/excluir.php b/view/Conteudo/excluir.php index 5810092d6..341d6b0d6 100644 --- a/view/Conteudo/excluir.php +++ b/view/Conteudo/excluir.php @@ -1,4 +1,5 @@ ''){ diff --git a/view/Conteudo/header.php b/view/Conteudo/header.php index 26bb82e7a..d352f8880 100644 --- a/view/Conteudo/header.php +++ b/view/Conteudo/header.php @@ -6,13 +6,13 @@ } //var_dump($_SESSION); ?> -
+
- Sair +
diff --git a/view/Conteudo/index.php b/view/Conteudo/index.php index aa6a1345c..5b9c66e49 100644 --- a/view/Conteudo/index.php +++ b/view/Conteudo/index.php @@ -10,7 +10,7 @@ API Cursos - + API Cursos - + Date: Sat, 8 Dec 2018 19:09:26 -0200 Subject: [PATCH 11/25] --- conexao/Conexao.php | 30 ------------------------------ conexao/config.php | 9 --------- 2 files changed, 39 deletions(-) delete mode 100644 conexao/Conexao.php delete mode 100644 conexao/config.php diff --git a/conexao/Conexao.php b/conexao/Conexao.php deleted file mode 100644 index a213ac568..000000000 --- a/conexao/Conexao.php +++ /dev/null @@ -1,30 +0,0 @@ -setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - self::$instance->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); - } catch (PDOException $e) { - echo $e->getMessage(); - } - - } - - return self::$instance; - } - - public static function prepare($sql){ - return self::getInstance()->prepare($sql); - } - -} \ No newline at end of file diff --git a/conexao/config.php b/conexao/config.php deleted file mode 100644 index 376409ce2..000000000 --- a/conexao/config.php +++ /dev/null @@ -1,9 +0,0 @@ - - From 2af83be368dd7cb38b8099bcd1c1565f3d819ead Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 8 Dec 2018 19:10:46 -0200 Subject: [PATCH 12/25] --- LICENSE | 21 ------ control/ConteudoControl.php | 52 --------------- index.php | 13 ---- model/Conteudo.php | 128 ------------------------------------ view/Conteudo/editar.php | 97 --------------------------- view/Conteudo/excluir.php | 17 ----- view/Conteudo/header.php | 19 ------ view/Conteudo/index.php | 50 -------------- view/Conteudo/inserir.php | 94 -------------------------- view/Conteudo/listar.php | 10 --- view/Conteudo/login.php | 78 ---------------------- 11 files changed, 579 deletions(-) delete mode 100644 LICENSE delete mode 100644 control/ConteudoControl.php delete mode 100644 index.php delete mode 100644 model/Conteudo.php delete mode 100644 view/Conteudo/editar.php delete mode 100644 view/Conteudo/excluir.php delete mode 100644 view/Conteudo/header.php delete mode 100644 view/Conteudo/index.php delete mode 100644 view/Conteudo/inserir.php delete mode 100644 view/Conteudo/listar.php delete mode 100644 view/Conteudo/login.php diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 7c160f4e9..000000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 celsolisboa - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/control/ConteudoControl.php b/control/ConteudoControl.php deleted file mode 100644 index e65a652ce..000000000 --- a/control/ConteudoControl.php +++ /dev/null @@ -1,52 +0,0 @@ -titulo; - return $conteudo->insert($obj); - header('Location:listar.php'); - } - - function update($id, $obj){ - $conteudo = new Conteudo(); - return $conteudo->update($id, $obj); - } - - function delete($id){ - $conteudo = new Conteudo(); - return $conteudo->delete($id); - } - - function find($id = null){ - - } - - function editCurso($id = null){ - $conteudo = new Conteudo(); - return $conteudo->editCurso($id); - } - - function findProfessores(){ - $conteudo = new Conteudo(); - return $conteudo->findProfessores(); - } - - function findSalas(){ - $conteudo = new Conteudo(); - return $conteudo->findSalas(); - } - - function findAll(){ - $conteudo = new Conteudo(); - return $conteudo->findAll(); - } - function login($email, $senha){ - $conteudo = new Conteudo(); - return $conteudo->login($email, $senha); - } -} - -?> \ No newline at end of file diff --git a/index.php b/index.php deleted file mode 100644 index 57aad57e7..000000000 --- a/index.php +++ /dev/null @@ -1,13 +0,0 @@ - - - - -API Cursos - - - -Go to Login - - \ No newline at end of file diff --git a/model/Conteudo.php b/model/Conteudo.php deleted file mode 100644 index c52b3c6da..000000000 --- a/model/Conteudo.php +++ /dev/null @@ -1,128 +0,0 @@ -curso; - } - - function getDescricao() { - return $this->idprofessor; - } - - function getidsala() { - return $this->idsala; - } - - function getinicio() { - return $this->inicio; - } - - function getfim() { - return $this->fim; - } - - function setCurso($curso) { - $this->curso = $curso; - } - - function setDescricao($idprofessor) { - $this->idprofessor = $idprofessor; - } - - function setidsala($idsala) { - $this->idsala = $idsala; - } - - function setinicio($inicio) { - $this->inicio = $inicio; - } - - function setfim($fim) { - $this->fim = $fim; - } - - - public function insert($obj){ - $sql = "INSERT INTO cursos(curso,fk_idprofessor,fk_idsala,inicio,fim) VALUES (:curso,:idprofessor,:idsala,:inicio,:fim)"; - $consulta = Conexao::prepare($sql); - $consulta->bindValue('curso', $obj->curso); - $consulta->bindValue('idprofessor', $obj->idprofessor); - $consulta->bindValue('idsala' , $obj->idsala); - $consulta->bindValue('inicio' , $obj->inicio); - $consulta->bindValue('fim' , $obj->fim); - - return $consulta->execute(); - - } - - public function update($id = null, $obj){ - $sql = "UPDATE cursos SET curso = :curso, fk_idprofessor = :idprofessor, fk_idsala = :idsala, inicio = :inicio, fim =:fim WHERE idcurso = :id "; - $consulta = Conexao::prepare($sql); - $consulta->bindValue('curso', $obj->curso); - $consulta->bindValue('idprofessor', $obj->idprofessor); - $consulta->bindValue('idsala' , $obj->idsala); - $consulta->bindValue('inicio', $obj->inicio); - $consulta->bindValue('fim' , $obj->fim); - $consulta->bindValue('id', $id); - return $consulta->execute(); - } - - public function delete($id = null){ - $sql = "DELETE FROM cursos WHERE idcurso = :id"; - $consulta = Conexao::prepare($sql); - $consulta->bindValue('id',$id); - $consulta->execute(); - } - - public function findProfessores(){ - $sql = "SELECT * FROM professores"; - $consulta = Conexao::prepare($sql); - $consulta->execute(); - return $consulta->fetchAll(); - } - - public function findSalas(){ - $sql = "SELECT * FROM salas"; - $consulta = Conexao::prepare($sql); - $consulta->execute(); - return $consulta->fetchAll(); - } - - public function editCurso($id = null){ - $sql = "SELECT c.idcurso, c.curso, p.idprofessor, s.idsala, c.inicio, c.fim FROM cursos c, professores p, salas s WHERE idcurso = :id and c.fk_idprofessor = p.idprofessor and c.fk_idsala = s.idsala - "; - $consulta = Conexao::prepare($sql); - $consulta->bindValue('id',$id); - $consulta->execute(); - return $consulta->fetchAll(); - } - - public function findAll(){ - $sql = "SELECT c.idcurso, c.curso, p.professor, s.sala, c.inicio, c.fim FROM cursos c, professores p, salas s WHERE c.fk_idprofessor = p.idprofessor and c.fk_idsala = s.idsala ORDER BY c.idcurso"; - $consulta = Conexao::prepare($sql); - $consulta->execute(); - return $consulta->fetchAll(); - } - - public function login($email, $senha){ - $sql = "SELECT * FROM usuarios WHERE usuario = :email AND senha = :senha"; - $consulta = Conexao::prepare($sql); - $consulta->bindValue('email',$email); - $consulta->bindValue('senha',$senha); - $consulta->execute(); - $reg = $consulta->fetchAll(0); - return $reg; - - } - -} - -?> \ No newline at end of file diff --git a/view/Conteudo/editar.php b/view/Conteudo/editar.php deleted file mode 100644 index db8af2345..000000000 --- a/view/Conteudo/editar.php +++ /dev/null @@ -1,97 +0,0 @@ - ''){ - $conteudoControl = new ConteudoControl(); - $res = $conteudoControl->editCurso($_GET['id']); - - } -?> - - - - - - - - - - - API Cursos - - - - - -
- -
-
Editar Detalhes do Curso
-
-
- - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- - -
-
-
-
- -
- - - - - - - - \ No newline at end of file diff --git a/view/Conteudo/excluir.php b/view/Conteudo/excluir.php deleted file mode 100644 index 341d6b0d6..000000000 --- a/view/Conteudo/excluir.php +++ /dev/null @@ -1,17 +0,0 @@ - ''){ - $conteudoControl = new ConteudoControl(); - $conteudoControl->delete($_GET['id']); - header('Location:index.php'); -} - - - - - - - -?> \ No newline at end of file diff --git a/view/Conteudo/header.php b/view/Conteudo/header.php deleted file mode 100644 index d352f8880..000000000 --- a/view/Conteudo/header.php +++ /dev/null @@ -1,19 +0,0 @@ - -
-
-
- -
-
-
-
-
- -
\ No newline at end of file diff --git a/view/Conteudo/index.php b/view/Conteudo/index.php deleted file mode 100644 index 5b9c66e49..000000000 --- a/view/Conteudo/index.php +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - API Cursos - - - - - -
- - -
-
Cursos
-
- findAll() as $valor){ ?> -
-
-
-
-

-
Prof.: professor;?>

-
Sala: sala;?>
inicio;?> às fim;?>
-
-
-
- -
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/view/Conteudo/inserir.php b/view/Conteudo/inserir.php deleted file mode 100644 index 7b8ca9b35..000000000 --- a/view/Conteudo/inserir.php +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - API Cursos - - - - insert($obj); - - } - ?> - -
- -
-
Detalhes do Curso
-
-
-
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
-
-
-
- -
- - - - - - - - \ No newline at end of file diff --git a/view/Conteudo/listar.php b/view/Conteudo/listar.php deleted file mode 100644 index 4ce6717b7..000000000 --- a/view/Conteudo/listar.php +++ /dev/null @@ -1,10 +0,0 @@ -findAll() as $valor){ - echo $valor->id; -} \ No newline at end of file diff --git a/view/Conteudo/login.php b/view/Conteudo/login.php deleted file mode 100644 index 9f89a0bbf..000000000 --- a/view/Conteudo/login.php +++ /dev/null @@ -1,78 +0,0 @@ -login($email, $senha); - //var_dump($rs->usuario); - if(!empty($rs)) { - - $_SESSION['usuario'] = $rs->usuario; - - header('location:index.php'); - } - else{ - echo "
Usuário ou senha inválido!
"; - } - } - - if(isset($_GET['logout']) && $_GET['logout'] == 'sim') - { - unset($_SESSION['usuario']); - - session_destroy(); - - header('location:login.php'); - } -?> - - - - - - - - - - - API Cursos - - - -
-
-
Login
-
-
-
- - - -
-
- - -
- - -
-
-
-
- - - - - - - - \ No newline at end of file From 5a983db5a2aaed81e8611e050fd8f493d1c0f314 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 8 Dec 2018 19:15:35 -0200 Subject: [PATCH 13/25] Envio do projeto --- api/config/config.php | 9 ++ api/config/core.php | 17 +++ api/config/database.php | 31 ++++ api/curso/create.php | 71 ++++++++++ api/curso/delete.php | 46 ++++++ api/curso/loging.php | 52 +++++++ api/curso/read.php | 67 +++++++++ api/curso/read_one.php | 54 +++++++ api/curso/read_paging.php | 80 +++++++++++ api/curso/search.php | 69 +++++++++ api/curso/update.php | 52 +++++++ api/objetos/curso.php | 291 ++++++++++++++++++++++++++++++++++++++ api/objetos/professor.php | 213 ++++++++++++++++++++++++++++ api/objetos/sala.php | 213 ++++++++++++++++++++++++++++ api/professor/read.php | 61 ++++++++ api/sala/read.php | 61 ++++++++ api/shared/utilities.php | 44 ++++++ pages/editar.php | 135 ++++++++++++++++++ pages/header.php | 21 +++ pages/index.php | 89 ++++++++++++ pages/inserir.php | 124 ++++++++++++++++ pages/login.php | 89 ++++++++++++ 22 files changed, 1889 insertions(+) create mode 100644 api/config/config.php create mode 100644 api/config/core.php create mode 100644 api/config/database.php create mode 100644 api/curso/create.php create mode 100644 api/curso/delete.php create mode 100644 api/curso/loging.php create mode 100644 api/curso/read.php create mode 100644 api/curso/read_one.php create mode 100644 api/curso/read_paging.php create mode 100644 api/curso/search.php create mode 100644 api/curso/update.php create mode 100644 api/objetos/curso.php create mode 100644 api/objetos/professor.php create mode 100644 api/objetos/sala.php create mode 100644 api/professor/read.php create mode 100644 api/sala/read.php create mode 100644 api/shared/utilities.php create mode 100644 pages/editar.php create mode 100644 pages/header.php create mode 100644 pages/index.php create mode 100644 pages/inserir.php create mode 100644 pages/login.php diff --git a/api/config/config.php b/api/config/config.php new file mode 100644 index 000000000..376409ce2 --- /dev/null +++ b/api/config/config.php @@ -0,0 +1,9 @@ + + diff --git a/api/config/core.php b/api/config/core.php new file mode 100644 index 000000000..fc4dc97a8 --- /dev/null +++ b/api/config/core.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/api/config/database.php b/api/config/database.php new file mode 100644 index 000000000..859d4349e --- /dev/null +++ b/api/config/database.php @@ -0,0 +1,31 @@ +setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + self::$instance->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); + } catch (PDOException $e) { + echo $e->getMessage(); + } + + } + + return self::$instance; + } + + public static function prepare($sql){ + return self::getConnection()->prepare($sql); + } + +} +?> \ No newline at end of file diff --git a/api/curso/create.php b/api/curso/create.php new file mode 100644 index 000000000..8d2636d44 --- /dev/null +++ b/api/curso/create.php @@ -0,0 +1,71 @@ +getConnection(); + +$curso = new Curso($db); + +// get posted data + +$data = json_decode(file_get_contents("php://input")); + +// make sure data is not empty +if( + !empty($data->curso) && + !empty($data->idprofessor) && + !empty($data->idsala) && + !empty($data->inicio) && + !empty($data->fim) +){ + + // set curso property values + $curso->curso = $data->curso; + $curso->idprofessor = $data->idprofessor; + $curso->idsala = $data->idsala; + $curso->inicio = $data->inicio; + $curso->fim = $data->fim; + + // create the curso + if($curso->create()){ + + // set response code - 201 created + http_response_code(201); + + // tell the user + echo json_encode(array("message" => "Curso de ".$curso->curso." criado com sucesso.")); + } + + // if unable to create the product, tell the user + else{ + + // set response code - 503 service unavailable + http_response_code(503); + + // tell the user + echo json_encode(array("message" => "Problemas para criar o Curso.")); + } +} + +// tell the user data is incomplete +else{ + + // set response code - 400 bad request + http_response_code(400); + + // tell the user + echo json_encode(array("message" => "Problemas para criar o Curso. Dados incompletos.")); + +} +?> \ No newline at end of file diff --git a/api/curso/delete.php b/api/curso/delete.php new file mode 100644 index 000000000..09fed39a1 --- /dev/null +++ b/api/curso/delete.php @@ -0,0 +1,46 @@ +getConnection(); + +// prepare curso object +$curso = new Curso($db); + +// get curso id +//$data = json_decode(file_get_contents("php://input")); + +// set curso id to be deleted +$curso->idcurso = isset($_GET['idcurso']) ? $_GET['idcurso'] : die(); +//$curso->idcurso = $data->idcurso; + +// delete the curso +if($curso->delete()){ + + // set response code - 200 ok + http_response_code(200); + + // tell the user + echo json_encode(array("message" => "O Curso foi deletado.")); +} + +// if unable to delete the curso +else{ + + // set response code - 503 service unavailable + http_response_code(503); + + // tell the user + echo json_encode(array("message" => "Problemas para deletar o Curso.")); +} +?> \ No newline at end of file diff --git a/api/curso/loging.php b/api/curso/loging.php new file mode 100644 index 000000000..0d0b94640 --- /dev/null +++ b/api/curso/loging.php @@ -0,0 +1,52 @@ +getConnection(); + +// prepare curso object +$curso = new Curso($db); + +$data = json_decode(file_get_contents("php://input")); + +// set ID property of record to read +$curso->usuario = $data->usuario; +$curso->senha = $data->senha; + +// read the details of curso to be edited +$curso->login(); + + if($curso->usuario!=null){ + // create array + $curso_arr = array( + "usuario" => $curso->usuario + ); + + // set response code - 200 OK + http_response_code(200); + + // make it json format + session_start(); + $_SESSION['usuario'] = $curso->usuario; + $_SESSION['id'] = session_id(); + echo json_encode(array("message" => "Logado com sucesso.")); + } + + else{ + // set response code - 404 Not found + http_response_code(404); + + // tell the curso does not exist + echo json_encode(array("message" => "Este Curso não existe.")); + } +?> \ No newline at end of file diff --git a/api/curso/read.php b/api/curso/read.php new file mode 100644 index 000000000..6aeb88064 --- /dev/null +++ b/api/curso/read.php @@ -0,0 +1,67 @@ +getConnection(); + +// initialize object +$curso = new Curso($db); + +// read products will be here +// query products +$stmt = $curso->read(); +$num = $stmt->rowCount(); + +// check if more than 0 record found +if($num>0){ + + // cursos array + $cursos_arr=array(); + $cursos_arr["records"]=array(); + + // retrieve our table contents + // fetch() is faster than fetchAll() + + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ + // extract row + // this will make $row['name'] to + // just $name only + extract($row); + + $curso_item=array( + "idcurso" => $idcurso, + "curso" => html_entity_decode($curso), + "idprofessor" => $idprofessor, + "professor" => $professor, + "idsala" => $idsala, + "sala" => $sala, + "inicio" => $inicio, + "fim" => $fim + ); + + array_push($cursos_arr["records"], $curso_item); + } + + // set response code - 200 OK + http_response_code(200); + + // show cursos data in json format + echo json_encode($cursos_arr); +}else{ + + // set response code - 404 Not found + http_response_code(404); + + // tell the user no products found + echo json_encode( + array("message" => "Nenhum Curso encontrado.") + ); +} \ No newline at end of file diff --git a/api/curso/read_one.php b/api/curso/read_one.php new file mode 100644 index 000000000..94a14a8a9 --- /dev/null +++ b/api/curso/read_one.php @@ -0,0 +1,54 @@ +getConnection(); + +// prepare curso object +$curso = new Curso($db); + +// set ID property of record to read +$curso->idcurso = isset($_GET['idcurso']) ? $_GET['idcurso'] : die(); + +// read the details of curso to be edited +$curso->readOne(); + +if($curso->curso!=null){ + // create array + $curso_arr = array( + "idcurso" => $curso->idcurso, + "curso" => $curso->curso, + "idprofessor" => $curso->idprofessor, + "professor" => $curso->professor, + "idsala" => $curso->idsala, + "sala" => $curso->sala, + "inicio" => $curso->inicio, + "fim" => $curso->fim + + ); + + // set response code - 200 OK + http_response_code(200); + + // make it json format + echo json_encode($curso_arr); +} + +else{ + // set response code - 404 Not found + http_response_code(404); + + // tell the curso does not exist + echo json_encode(array("message" => "Este Curso não existe.")); +} +?> \ No newline at end of file diff --git a/api/curso/read_paging.php b/api/curso/read_paging.php new file mode 100644 index 000000000..2df4693f2 --- /dev/null +++ b/api/curso/read_paging.php @@ -0,0 +1,80 @@ +getConnection(); + +// initialize object +$curso = new Curso($db); + +// query cursos +$stmt = $curso->readPaging($from_record_num, $records_per_page); +$num = $stmt->rowCount(); + +// check if more than 0 record found +if($num>0){ + + // cursos array + $cursos_arr=array(); + $cursos_arr["records"]=array(); + $cursos_arr["paging"]=array(); + + // retrieve our table contents + // fetch() is faster than fetchAll() + + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ + // extract row + // this will make $row['curso'] to + // just $curso only + extract($row); + + $curso_item=array( + "idcurso" => $idcurso, + "curso" => $curso, + "professor" => $professor, + "sala" => $sala, + "inicio" => $inicio, + "fim" => $fim + ); + + array_push($cursos_arr["records"], $curso_item); + } + + + // include paging + + $total_rows= '$curso->total()'; + $page_url="{$home_url}curso/read_paging.php?"; + $paging=$utilities->getPaging($page, $total_rows, $records_per_page, $page_url); + $cursos_arr["paging"]=$paging; + + // set response code - 200 OK + http_response_code(200); + + // make it json format + echo json_encode($cursos_arr); +} + +else{ + + // set response code - 404 Not found + http_response_code(404); + + // tell the user cursos does not exist + echo json_encode( + array("message" => "Nenhum curso encontrado.") + ); +} +?> \ No newline at end of file diff --git a/api/curso/search.php b/api/curso/search.php new file mode 100644 index 000000000..8fabc773b --- /dev/null +++ b/api/curso/search.php @@ -0,0 +1,69 @@ +getConnection(); + +// initialize object +$curso = new Curso($db); + +// get keywords +$keywords=isset($_GET["s"]) ? $_GET["s"] : ""; + +// query cursos +$stmt = $curso->search($keywords); +$num = $stmt->rowCount(); + +// check if more than 0 record found +if($num>0){ + + // cursos array + $cursos_arr=array(); + $cursos_arr["records"]=array(); + + // retrieve our table contents + // fetch() is faster than fetchAll() + + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ + // extract row + // this will make $row['curso'] to + // just $curso only + extract($row); + + $curso_item=array( + "idcurso" => $idcurso, + "curso" => html_entity_decode($curso), + "professor" => $professor, + "sala" => $sala, + "inicio" => $inicio, + "fim" => $fim + ); + + array_push($cursos_arr["records"], $curso_item); + } + + // set response code - 200 OK + http_response_code(200); + + // show cursos data + echo json_encode($cursos_arr); +} + +else{ + // set response code - 404 Not found + http_response_code(404); + + // tell the user no cursos found + echo json_encode( + array("message" => "Nenhum registro encontrado.") + ); +} +?> diff --git a/api/curso/update.php b/api/curso/update.php new file mode 100644 index 000000000..88b7a8390 --- /dev/null +++ b/api/curso/update.php @@ -0,0 +1,52 @@ +getConnection(); + +// prepare curso object +$curso = new Curso($db); + +// get id of curso to be edited +$data = json_decode(file_get_contents("php://input")); + +// set ID property of curso to be edited +$curso->idcurso = $data->idcurso; + +// set curso property values +$curso->curso = $data->curso; +$curso->idprofessor = $data->idprofessor; +$curso->idsala = $data->idsala; +$curso->inicio = $data->inicio; +$curso->fim = $data->fim; + +// update the curso +if($curso->update()){ + + // set response code - 200 ok + http_response_code(200); + + // tell the user + echo json_encode(array("message" => "O Curso foi Atualizado.")); +} + +// if unable to update the curso, tell the user +else{ + + // set response code - 503 service unavailable + http_response_code(503); + + // tell the user + echo json_encode(array("message" => "Problemas para atualizar o curso.")); +} +?> diff --git a/api/objetos/curso.php b/api/objetos/curso.php new file mode 100644 index 000000000..a28ed200d --- /dev/null +++ b/api/objetos/curso.php @@ -0,0 +1,291 @@ +conn = $db; + } + + + public function login(){ + + // query to read single record + $query ="SELECT + usuario, senha + FROM + usuarios + WHERE + usuario = ? AND + senha = ?"; + + // prepare query statement + $stmt = $this->conn->prepare( $query ); + + // bind id of login to be updated + $stmt->bindParam(1, $this->usuario); + $stmt->bindParam(2, $this->senha); + + // execute query + $stmt->execute(); + + // get retrieved row + $row = $stmt->fetch(PDO::FETCH_ASSOC); + + // set values to object properties + $this->usuario = $row['usuario']; + + } + + // read cursos + function read(){ + + // select all query + $query = "SELECT + c.idcurso, c.curso,c.idprofessor, p.professor,c.idsala, s.sala, c.inicio, c.fim + FROM + cursos c, professores p, salas s + WHERE + c.idprofessor = p.idprofessor and + c.idsala = s.idsala + ORDER BY + c.idcurso"; + + // prepare query statement + $stmt = $this->conn->prepare($query); + + // execute query + $stmt->execute(); + + return $stmt; + } + + // create curso + public function create(){ + + // query to insert record + $query = "INSERT INTO + cursos (curso, idprofessor, idsala, inicio, fim) + VALUES (:curso, :idprofessor, :idsala, :inicio, :fim)"; + + + // prepare query + $stmt = $this->conn->prepare($query); + + // sanitize + $this->curso=htmlspecialchars(strip_tags($this->curso)); + $this->idprofessor=htmlspecialchars(strip_tags($this->idprofessor)); + $this->idsala=htmlspecialchars(strip_tags($this->idsala)); + $this->inicio=htmlspecialchars(strip_tags($this->inicio)); + $this->fim=htmlspecialchars(strip_tags($this->fim)); + + // bind values + $stmt->bindParam(":curso", $this->curso); + $stmt->bindParam(":idprofessor", $this->idprofessor); + $stmt->bindParam(":idsala", $this->idsala); + $stmt->bindParam(":inicio", $this->inicio); + $stmt->bindParam(":fim", $this->fim); + + // execute query + if($stmt->execute()){ + return true; + } + + return false; + + } + + // used when filling up the update product form + public function readOne(){ + + // query to read single record + $query ="SELECT + c.idcurso, c.curso, c.idprofessor, p.professor, c.idsala, s.sala, c.inicio, c.fim + FROM + cursos c, professores p, salas s + WHERE + c.idprofessor = p.idprofessor AND + c.idsala = s.idsala AND + c.idcurso = ? + LIMIT + 0,1"; + + // prepare query statement + $stmt = $this->conn->prepare( $query ); + + // bind id of product to be updated + $stmt->bindParam(1, $this->idcurso); + + // execute query + $stmt->execute(); + + // get retrieved row + $row = $stmt->fetch(PDO::FETCH_ASSOC); + + // set values to object properties + $this->curso = $row['curso']; + $this->idprofessor = $row['idprofessor']; + $this->professor = $row['professor']; + $this->idsala = $row['idsala']; + $this->sala = $row['sala']; + $this->inicio = $row['inicio']; + $this->fim = $row['fim']; + } + + // update the curso + public function update(){ + + // update query + $query = "UPDATE + cursos + SET + curso = :curso, + idprofessor = :idprofessor, + idsala = :idsala, + inicio = :inicio, + fim = :fim + WHERE + idcurso = :idcurso"; + + // prepare query statement + $stmt = $this->conn->prepare($query); + + // sanitize + $this->curso=htmlspecialchars(strip_tags($this->curso)); + $this->idprofessor=htmlspecialchars(strip_tags($this->idprofessor)); + $this->idsala=htmlspecialchars(strip_tags($this->idsala)); + $this->inicio=htmlspecialchars(strip_tags($this->inicio)); + $this->fim=htmlspecialchars(strip_tags($this->fim)); + $this->idcurso=htmlspecialchars(strip_tags($this->idcurso)); + + // bind new values + $stmt->bindParam(':curso', $this->curso); + $stmt->bindParam(':idprofessor', $this->idprofessor); + $stmt->bindParam(':idsala', $this->idsala); + $stmt->bindParam(':inicio', $this->inicio); + $stmt->bindParam(':fim', $this->fim); + $stmt->bindParam(':idcurso', $this->idcurso); + + // execute the query + if($stmt->execute()){ + return true; + } + + return false; + } + + // delete the curso + public function delete(){ + + // delete query + $query = "DELETE FROM cursos WHERE idcurso = ?"; + + // prepare query + $stmt = $this->conn->prepare($query); + + // sanitize + $this->idcurso=htmlspecialchars(strip_tags($this->idcurso)); + + // bind id of record to delete + $stmt->bindParam(1, $this->idcurso); + + // execute query + if($stmt->execute()){ + return true; + } + + return false; + + } + + // search products + public function search($keywords){ + + // select all query + $query = "SELECT + c.idcurso, c.curso, p.professor, s.sala, c.inicio, c.fim + FROM + cursos c + INNER JOIN + professores p ON c.idprofessor = p.idprofessor + INNER JOIN + salas s ON c.idsala = s.idsala + WHERE + c.curso LIKE ? OR p.professor LIKE ? OR s.sala LIKE ? + ORDER BY + c.curso DESC"; + + // prepare query statement + $stmt = $this->conn->prepare($query); + + // sanitize + $keywords=htmlspecialchars(strip_tags($keywords)); + $keywords = "%{$keywords}%"; + + // bind + $stmt->bindParam(1, $keywords); + $stmt->bindParam(2, $keywords); + $stmt->bindParam(3, $keywords); + + // execute query + $stmt->execute(); + + return $stmt; + } + + // read products with pagination + public function readPaging($from_record_num, $records_per_page){ + + // select query + $query = "SELECT + c.idcurso, c.curso, p.professor, s.sala, c.inicio, c.fim + FROM + cursos c, professores p, salas s + WHERE + c.idprofessor = p.idprofessor and + c.idsala = s.idsala + ORDER BY + c.idcurso DESC + LIMIT ?, ?"; + + // prepare query statement + $stmt = $this->conn->prepare( $query ); + + // bind variable values + $stmt->bindParam(1, $from_record_num, PDO::PARAM_INT); + $stmt->bindParam(2, $records_per_page, PDO::PARAM_INT); + + // execute query + $stmt->execute(); + + // return values from database + return $stmt; + } + + // used for paging products + public function total(){ + $query = "SELECT COUNT(*) as total FROM cursos"; + + $stmt = $this->conn->prepare( $query ); + $stmt->execute(); + $row = $stmt->fetchAll(PDO::FETCH_ASSOC); + + return $row['total']; + } +} \ No newline at end of file diff --git a/api/objetos/professor.php b/api/objetos/professor.php new file mode 100644 index 000000000..029a3051b --- /dev/null +++ b/api/objetos/professor.php @@ -0,0 +1,213 @@ +conn = $db; + } + + // read professores + function read(){ + + // select all query + $query = "SELECT + idprofessor, professor + FROM + professores + ORDER BY + idprofessor"; + + // prepare query statement + $stmt = $this->conn->prepare($query); + + // execute query + $stmt->execute(); + + return $stmt; + } + + // create professor + public function create(){ + + // query to insert record + $query = "INSERT INTO + professores + SET + professor=:professor"; + + // prepare query + $stmt = $this->conn->prepare($query); + + // sanitize + $this->professor=htmlspecialchars(strip_tags($this->professor)); + + // bind values + $stmt->bindParam(":professor", $this->professor); + + // execute query + if($stmt->execute()){ + return true; + } + + return false; + + } + + // used when filling up the update product form + public function readOne(){ + + // query to read single record + $query ="SELECT + idprofessor, professor + FROM + professores + WHERE + idprofessor = ? + LIMIT + 0,1"; + + // prepare query statement + $stmt = $this->conn->prepare( $query ); + + // bind id of product to be updated + $stmt->bindParam(1, $this->idprofessor); + + // execute query + $stmt->execute(); + + // get retrieved row + $row = $stmt->fetch(PDO::FETCH_ASSOC); + + // set values to object properties + $this->idprofessor = $row['idprofessor']; + $this->professor = $row['professor']; + } + + // update the professor + public function update(){ + + // update query + $query = "UPDATE + professores + SET + professor = :professor, + WHERE + idprofessor = :idprofessor"; + + // prepare query statement + $stmt = $this->conn->prepare($query); + + // sanitize + $this->professor=htmlspecialchars(strip_tags($this->professor)); + $this->idprofessor=htmlspecialchars(strip_tags($this->idprofessor)); + // bind new values + $stmt->bindParam(':professor', $this->professor); + $stmt->bindParam(':idprofessor', $this->idprofessor); + + // execute the query + if($stmt->execute()){ + return true; + } + + return false; + } + + // delete the professor + public function delete(){ + + // delete query + $query = "DELETE FROM professores WHERE idprofessor = ?"; + + // prepare query + $stmt = $this->conn->prepare($query); + + // sanitize + $this->idprofessor=htmlspecialchars(strip_tags($this->idprofessor)); + + // bind id of record to delete + $stmt->bindParam(1, $this->idprofessor); + + // execute query + if($stmt->execute()){ + return true; + } + + return false; + + } + + // search products + public function search($keywords){ + + // select all query + $query = "SELECT + idprofessor, professor + FROM + professores + WHERE + professor LIKE ? + ORDER BY + professor DESC"; + + // prepare query statement + $stmt = $this->conn->prepare($query); + + // sanitize + $keywords=htmlspecialchars(strip_tags($keywords)); + $keywords = "%{$keywords}%"; + + // bind + $stmt->bindParam(1, $keywords); + + // execute query + $stmt->execute(); + + return $stmt; + } + + // read professores with pagination + public function readPaging($from_record_num, $records_per_page){ + + // select query + $query = "SELECT + idprofessor, professor + FROM + professores + ORDER BY + professor DESC + LIMIT ?, ?"; + + // prepare query statement + $stmt = $this->conn->prepare( $query ); + + // bind variable values + $stmt->bindParam(1, $from_record_num, PDO::PARAM_INT); + $stmt->bindParam(2, $records_per_page, PDO::PARAM_INT); + + // execute query + $stmt->execute(); + + // return values from database + return $stmt; + } + + // used for paging professores + public function total(){ + $query = "SELECT COUNT(*) as total FROM professores"; + + $stmt = $this->conn->prepare( $query ); + $stmt->execute(); + $row = $stmt->fetchAll(PDO::FETCH_ASSOC); + + return $row['total']; + } +} \ No newline at end of file diff --git a/api/objetos/sala.php b/api/objetos/sala.php new file mode 100644 index 000000000..604679d90 --- /dev/null +++ b/api/objetos/sala.php @@ -0,0 +1,213 @@ +conn = $db; + } + + // read salaes + function read(){ + + // select all query + $query = "SELECT + idsala, sala + FROM + salas + ORDER BY + idsala"; + + // prepare query statement + $stmt = $this->conn->prepare($query); + + // execute query + $stmt->execute(); + + return $stmt; + } + + // create sala + public function create(){ + + // query to insert record + $query = "INSERT INTO + salas + SET + sala=:sala"; + + // prepare query + $stmt = $this->conn->prepare($query); + + // sanitize + $this->sala=htmlspecialchars(strip_tags($this->sala)); + + // bind values + $stmt->bindParam(":sala", $this->sala); + + // execute query + if($stmt->execute()){ + return true; + } + + return false; + + } + + // used when filling up the update product form + public function readOne(){ + + // query to read single record + $query ="SELECT + idsala, sala + FROM + salas + WHERE + idsala = ? + LIMIT + 0,1"; + + // prepare query statement + $stmt = $this->conn->prepare( $query ); + + // bind id of product to be updated + $stmt->bindParam(1, $this->idsala); + + // execute query + $stmt->execute(); + + // get retrieved row + $row = $stmt->fetch(PDO::FETCH_ASSOC); + + // set values to object properties + $this->idsala = $row['idsala']; + $this->sala = $row['sala']; + } + + // update the sala + public function update(){ + + // update query + $query = "UPDATE + salas + SET + sala = :sala, + WHERE + idsala = :idsala"; + + // prepare query statement + $stmt = $this->conn->prepare($query); + + // sanitize + $this->sala=htmlspecialchars(strip_tags($this->sala)); + $this->idsala=htmlspecialchars(strip_tags($this->idsala)); + // bind new values + $stmt->bindParam(':sala', $this->sala); + $stmt->bindParam(':idsala', $this->idsala); + + // execute the query + if($stmt->execute()){ + return true; + } + + return false; + } + + // delete the sala + public function delete(){ + + // delete query + $query = "DELETE FROM salas WHERE idsala = ?"; + + // prepare query + $stmt = $this->conn->prepare($query); + + // sanitize + $this->idsala=htmlspecialchars(strip_tags($this->idsala)); + + // bind id of record to delete + $stmt->bindParam(1, $this->idsala); + + // execute query + if($stmt->execute()){ + return true; + } + + return false; + + } + + // search products + public function search($keywords){ + + // select all query + $query = "SELECT + idsala, sala + FROM + salas + WHERE + sala LIKE ? + ORDER BY + sala DESC"; + + // prepare query statement + $stmt = $this->conn->prepare($query); + + // sanitize + $keywords=htmlspecialchars(strip_tags($keywords)); + $keywords = "%{$keywords}%"; + + // bind + $stmt->bindParam(1, $keywords); + + // execute query + $stmt->execute(); + + return $stmt; + } + + // read salaes with pagination + public function readPaging($from_record_num, $records_per_page){ + + // select query + $query = "SELECT + idsala, sala + FROM + salas + ORDER BY + sala DESC + LIMIT ?, ?"; + + // prepare query statement + $stmt = $this->conn->prepare( $query ); + + // bind variable values + $stmt->bindParam(1, $from_record_num, PDO::PARAM_INT); + $stmt->bindParam(2, $records_per_page, PDO::PARAM_INT); + + // execute query + $stmt->execute(); + + // return values from database + return $stmt; + } + + // used for paging salas + public function total(){ + $query = "SELECT COUNT(*) as total FROM salas"; + + $stmt = $this->conn->prepare( $query ); + $stmt->execute(); + $row = $stmt->fetchAll(PDO::FETCH_ASSOC); + + return $row['total']; + } +} \ No newline at end of file diff --git a/api/professor/read.php b/api/professor/read.php new file mode 100644 index 000000000..1487dd316 --- /dev/null +++ b/api/professor/read.php @@ -0,0 +1,61 @@ +getConnection(); + +// initialize object +$prof = new Professor($db); + +// read professores will be here +// query professores +$stmt = $prof->read(); +$num = $stmt->rowCount(); + +// check if more than 0 record found +if($num>0){ + + // profs array + $profs_arr=array(); + $profs_arr["records"]=array(); + + // retrieve our table contents + // fetch() is faster than fetchAll() + + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ + // extract row + // this will make $row['name'] to + // just $name only + extract($row); + + $prof_item=array( + "idprofessor" => $idprofessor, + "professor" => html_entity_decode($professor), + ); + + array_push($profs_arr["records"], $prof_item); + } + + // set response code - 200 OK + http_response_code(200); + + // show profs data in json format + echo json_encode($profs_arr); +}else{ + + // set response code - 404 Not found + http_response_code(404); + + // tell the user no products found + echo json_encode( + array("message" => "Nenhum Professor encontrado.") + ); +} \ No newline at end of file diff --git a/api/sala/read.php b/api/sala/read.php new file mode 100644 index 000000000..45cbb482d --- /dev/null +++ b/api/sala/read.php @@ -0,0 +1,61 @@ +getConnection(); + +// initialize object +$sala = new Sala($db); + +// read products will be here +// query products +$stmt = $sala->read(); +$num = $stmt->rowCount(); + +// check if more than 0 record found +if($num>0){ + + // salas array + $salas_arr=array(); + $salas_arr["records"]=array(); + + // retrieve our table contents + // fetch() is faster than fetchAll() + + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ + // extract row + // this will make $row['name'] to + // just $name only + extract($row); + + $sala_item=array( + "idsala" => $idsala, + "sala" => html_entity_decode($sala), + ); + + array_push($salas_arr["records"], $sala_item); + } + + // set response code - 200 OK + http_response_code(200); + + // show salas data in json format + echo json_encode($salas_arr); +}else{ + + // set response code - 404 Not found + http_response_code(404); + + // tell the user no products found + echo json_encode( + array("message" => "Nenhum sala encontrado.") + ); +} \ No newline at end of file diff --git a/api/shared/utilities.php b/api/shared/utilities.php new file mode 100644 index 000000000..d9b3b0946 --- /dev/null +++ b/api/shared/utilities.php @@ -0,0 +1,44 @@ +1 ? "{$page_url}page=1" : ""; + + // count all products in the database to calculate total pages + $total_pages = ceil(intval($total_rows) / $records_per_page); + + // range of links to show + $range = 2; + + // display links to 'range of pages' around 'current page' + $initial_num = $page - $range; + $condition_limit_num = ($page + $range) + 1; + + $paging_arr['pages']=array(); + $page_count=0; + + for($x=$initial_num; $x<$condition_limit_num; $x++){ + // be sure '$x is greater than 0' AND 'less than or equal to the $total_pages' + if(($x > 0) && ($x <= $total_pages)){ + $paging_arr['pages'][$page_count]["page"]=$x; + $paging_arr['pages'][$page_count]["url"]="{$page_url}page={$x}"; + $paging_arr['pages'][$page_count]["current_page"] = $x==$page ? "yes" : "no"; + + $page_count++; + } + } + + // button for last page + $paging_arr["last"] = $page<$total_pages ? "{$page_url}page={$total_pages}" : ""; + + // json format + return $paging_arr; + } + +} +?> \ No newline at end of file diff --git a/pages/editar.php b/pages/editar.php new file mode 100644 index 000000000..790cdaf30 --- /dev/null +++ b/pages/editar.php @@ -0,0 +1,135 @@ + + + + + + + + + + + API Cursos + + + ''){ + $id = $_GET['id']; + $dados = json_decode(file_get_contents('http://localhost:88/curso/api/curso/read_one.php?idcurso='.$id)); + $professores = json_decode(file_get_contents('http://localhost:88/curso/api/professor/read.php')); + $salas = json_decode(file_get_contents('http://localhost:88/curso/api/sala/read.php')); + + + } + + + ?> + + +
+ +
+ +
Editar Detalhes do Curso
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/pages/header.php b/pages/header.php new file mode 100644 index 000000000..d0f0cc511 --- /dev/null +++ b/pages/header.php @@ -0,0 +1,21 @@ + +
+
+
+ +
+
+
Sair
+
+
+ +
diff --git a/pages/index.php b/pages/index.php new file mode 100644 index 000000000..4d0c31743 --- /dev/null +++ b/pages/index.php @@ -0,0 +1,89 @@ + ''){ + + $dados = json_decode(file_get_contents('http://localhost:88/curso/api/curso/delete.php?idcurso='.$_GET['id'])); + + header('location:index.php'); + echo $dados->message; +} +?> + + + + + + + + + + + API Cursos + + + +
+ + +
+
Cursos
+
+ records as $valor){ ?> +
+
+
+
+

+
Prof.: professor;?>

+
Sala: sala;?>
inicio;?> às fim;?>
+
+
+
+ +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/pages/inserir.php b/pages/inserir.php new file mode 100644 index 000000000..36e7144d0 --- /dev/null +++ b/pages/inserir.php @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + API Cursos + + + +
+
+ +
+
Detalhes do Curso
+
+
+
+ + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/pages/login.php b/pages/login.php new file mode 100644 index 000000000..4ffe3e320 --- /dev/null +++ b/pages/login.php @@ -0,0 +1,89 @@ + + + + + + + + + + + + API Cursos + + +
+ +
+
+
+
Login
+
+
+
+ + + +
+
+ + +
+ + +
+
+
+
+ + + + + + + + + + + \ No newline at end of file From 773f047068849d33e11e0c74e4fdf90397584a33 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 8 Dec 2018 19:16:30 -0200 Subject: [PATCH 14/25] --- apiCursos.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apiCursos.sql b/apiCursos.sql index facae0804..afa348487 100644 --- a/apiCursos.sql +++ b/apiCursos.sql @@ -35,8 +35,8 @@ CREATE TABLE `cursos` ( `curso` varchar(45) DEFAULT NULL, `hora_inico` varchar(4) DEFAULT NULL, `hora_fim` varchar(4) DEFAULT NULL, - `fk_idprofessor` int(11) NOT NULL, - `fk_idsala` int(11) NOT NULL + `idprofessor` int(11) NOT NULL, + `idsala` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -78,7 +78,7 @@ CREATE TABLE `usuarios` ( -- INSERT INTO `usuarios` (`idusuario`, `usuario`, `senha`) VALUES -(1, 'admin', '123456'); +(1, 'admin@admin.com', '123456'); -- -- Indexes for dumped tables @@ -88,9 +88,9 @@ INSERT INTO `usuarios` (`idusuario`, `usuario`, `senha`) VALUES -- Indexes for table `cursos` -- ALTER TABLE `cursos` - ADD PRIMARY KEY (`idcurso`,`fk_idprofessor`,`fk_idsala`), - ADD KEY `fk_cursos_professores_idx` (`fk_idprofessor`), - ADD KEY `fk_cursos_salas1_idx` (`fk_idsala`); + ADD PRIMARY KEY (`idcurso`,`idprofessor`,`idsala`), + ADD KEY `fk_cursos_professores_idx` (`idprofessor`), + ADD KEY `fk_cursos_salas1_idx` (`idsala`); -- -- Indexes for table `professores` @@ -148,8 +148,8 @@ ALTER TABLE `usuarios` -- Limitadores para a tabela `cursos` -- ALTER TABLE `cursos` - ADD CONSTRAINT `fk_cursos_professores` FOREIGN KEY (`fk_idprofessor`) REFERENCES `professores` (`idprofessor`) ON DELETE NO ACTION ON UPDATE NO ACTION, - ADD CONSTRAINT `fk_cursos_salas1` FOREIGN KEY (`fk_idsala`) REFERENCES `salas` (`idsala`) ON DELETE NO ACTION ON UPDATE NO ACTION; + ADD CONSTRAINT `fk_cursos_professores` FOREIGN KEY (`idprofessor`) REFERENCES `professores` (`idprofessor`) ON DELETE NO ACTION ON UPDATE NO ACTION, + ADD CONSTRAINT `fk_cursos_salas1` FOREIGN KEY (`idsala`) REFERENCES `salas` (`idsala`) ON DELETE NO ACTION ON UPDATE NO ACTION; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; From 4a3ff9c3a3a2c39208c7ed0584591a380b01e174 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 8 Dec 2018 19:17:38 -0200 Subject: [PATCH 15/25] Add files via upload --- index.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 index.php diff --git a/index.php b/index.php new file mode 100644 index 000000000..df8bf0082 --- /dev/null +++ b/index.php @@ -0,0 +1,13 @@ + + + + +API Cursos + + + +Go to Login + + \ No newline at end of file From b67d15335e830e8e756bf19df12325c32e5bdfba Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 8 Dec 2018 20:45:13 -0200 Subject: [PATCH 16/25] Modificado o caminho dos arquivos da API para pegar sempre o nome do host com a porta usada. Criado o arquivo README.md. --- README.md | 104 +++++++++++++++++++++++++++++++------------ api/curso/loging.php | 7 ++- pages/editar.php | 6 +-- pages/index.php | 6 +-- pages/inserir.php | 8 ++-- 5 files changed, 87 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 86d70e367..316568887 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,75 @@ -# 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. +API Curso + +#Introdução +Esta API executa um CRUD de informações sobre curso. +Exibindo no formato JSON: curso, Professor, Sala, Horário de início e horário de fim. +Este projeto é simples e básico. +O intuito deste é mostrar de forma fácil como consumir dados utilizando padrão Rest. + +#Instalação + +1- Utilize o arquivo apiCursos.sql, para a criação da base de dados. +2- Modifique o arquivo api/config/config.php, com as informações para acessar o banco de dados MYSQL. +3- Crie um diretório no servidor web e baixe e descompacte o conteúdo deste repositório. +4- Por padrão usuario: admin@admin.com e senha: 123456. + +#Sobre +Neste projeto foi utilizado o AJAX para comunicação da interface com a API. +Não foi utilizado validações de sala, horário, autenticação dentro outras deixando o projeto o mais básico possível. + +#Autenticação +Não existe autenticação com a API. O login é básico utilizando apenas autenticação de usuario e senha. + +#Codigos de Erro +Codigos de status e erros. + +create +201 - Cadastrado com sucesso. +503 - Serviço indisponível, problemas para criar o curso. +400 - Dados incompetos. + +Delete +200 - O curso foi deletado com sucesso. +503 - Serviço indisponível, problemas para deletar o curso + +Loging +200 - Logado com sucesso. +503 - Erro ao logar. + +read_one +200 - Curso localizado com sucesso. +503 - Curso não existe. + +read_paging +200 - Sucesso na paginação. +404 - Nenhum curso encontrado. + +read +200 - listar cursos com sucesso. +404 - Nenhum curso encontrado. + +search +200 - curso localizado com sucesso. +404 - Nenhum curso encontrado. + +update +200 - Curso atualizado com sucesso. +503 - Serviço indisponível, problemas para atualizar o curso. + +---------------------------------------------------- +#Rotas + +Lista os cursos +POST curso/api/curso/read.php + +Lista o curso selecionado pelo idcurso +GET curso/api/curso/read_one.php?idcurso= + +Deleta o curso selecionado pelo idcurso +GET curso/api/curso/delete.php?idcurso= + +Cadastra curso +POST curso/api/curso/create.php + +Atualiza dados de um curso selecionado pelo idcurso +GET curso/api/curso/update.php?idcurso= \ No newline at end of file diff --git a/api/curso/loging.php b/api/curso/loging.php index 0d0b94640..d67f1d3f7 100644 --- a/api/curso/loging.php +++ b/api/curso/loging.php @@ -43,10 +43,9 @@ } else{ - // set response code - 404 Not found - http_response_code(404); + // set response code - + http_response_code(503); - // tell the curso does not exist - echo json_encode(array("message" => "Este Curso não existe.")); + echo json_encode(array("message" => "Erro ao logar.")); } ?> \ No newline at end of file diff --git a/pages/editar.php b/pages/editar.php index 790cdaf30..2ce73fe7f 100644 --- a/pages/editar.php +++ b/pages/editar.php @@ -16,9 +16,9 @@ if(isset($_GET['id']) && $_GET['id'] <> ''){ $id = $_GET['id']; - $dados = json_decode(file_get_contents('http://localhost:88/curso/api/curso/read_one.php?idcurso='.$id)); - $professores = json_decode(file_get_contents('http://localhost:88/curso/api/professor/read.php')); - $salas = json_decode(file_get_contents('http://localhost:88/curso/api/sala/read.php')); + $dados = json_decode(file_get_contents('HTTP://'.$_SERVER['HTTP_HOST'].'/curso/api/curso/read_one.php?idcurso='.$id)); + $professores = json_decode(file_get_contents('HTTP://'.$_SERVER['HTTP_HOST'].'/curso/api/professor/read.php')); + $salas = json_decode(file_get_contents('HTTP://'.$_SERVER['HTTP_HOST'].'/curso/api/sala/read.php')); } diff --git a/pages/index.php b/pages/index.php index 4d0c31743..1e3b3ead4 100644 --- a/pages/index.php +++ b/pages/index.php @@ -1,12 +1,12 @@ ''){ - $dados = json_decode(file_get_contents('http://localhost:88/curso/api/curso/delete.php?idcurso='.$_GET['id'])); + $dados = json_decode(file_get_contents('HTTP://'.$_SERVER['HTTP_HOST'].'/curso/api/curso/delete.php?idcurso='.$_GET['id'])); header('location:index.php'); echo $dados->message; diff --git a/pages/inserir.php b/pages/inserir.php index 36e7144d0..7eb2b584a 100644 --- a/pages/inserir.php +++ b/pages/inserir.php @@ -1,9 +1,7 @@ From 7cf074b92c580d74e119fa51f45b8e8e5d81af17 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 8 Dec 2018 20:46:20 -0200 Subject: [PATCH 17/25] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 316568887..df73bd391 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ API Curso #Introdução + Esta API executa um CRUD de informações sobre curso. Exibindo no formato JSON: curso, Professor, Sala, Horário de início e horário de fim. Este projeto é simples e básico. @@ -14,13 +15,16 @@ O intuito deste é mostrar de forma fácil como consumir dados utilizando padrã 4- Por padrão usuario: admin@admin.com e senha: 123456. #Sobre + Neste projeto foi utilizado o AJAX para comunicação da interface com a API. Não foi utilizado validações de sala, horário, autenticação dentro outras deixando o projeto o mais básico possível. #Autenticação + Não existe autenticação com a API. O login é básico utilizando apenas autenticação de usuario e senha. #Codigos de Erro + Codigos de status e erros. create @@ -72,4 +76,4 @@ Cadastra curso POST curso/api/curso/create.php Atualiza dados de um curso selecionado pelo idcurso -GET curso/api/curso/update.php?idcurso= \ No newline at end of file +GET curso/api/curso/update.php?idcurso= From 6c4035a453280d7f9786988f92a4d674936f4562 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 8 Dec 2018 20:48:23 -0200 Subject: [PATCH 18/25] Update config.php Corrigindo os parametros de acesso ao banco de dados. --- api/config/config.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/config/config.php b/api/config/config.php index 376409ce2..b0b3a009f 100644 --- a/api/config/config.php +++ b/api/config/config.php @@ -2,8 +2,7 @@ define('DB_NAME','apicursos'); define('DB_HOST', 'localhost'); - define('DB_PASS','l015077'); - define('DB_USER','root'); - + define('DB_USER',''); + define('DB_PASS',''); ?> From 98f6a206e7e72c629389e3f0e72791fca2c2e75a Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 8 Dec 2018 20:49:07 -0200 Subject: [PATCH 19/25] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index df73bd391..18c37f5f9 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ API Curso -#Introdução +#Introdução
Esta API executa um CRUD de informações sobre curso. Exibindo no formato JSON: curso, Professor, Sala, Horário de início e horário de fim. Este projeto é simples e básico. O intuito deste é mostrar de forma fácil como consumir dados utilizando padrão Rest. -#Instalação +#Instalação
-1- Utilize o arquivo apiCursos.sql, para a criação da base de dados. -2- Modifique o arquivo api/config/config.php, com as informações para acessar o banco de dados MYSQL. -3- Crie um diretório no servidor web e baixe e descompacte o conteúdo deste repositório. -4- Por padrão usuario: admin@admin.com e senha: 123456. +1- Utilize o arquivo apiCursos.sql, para a criação da base de dados.
+2- Modifique o arquivo api/config/config.php, com as informações para acessar o banco de dados MYSQL.
+3- Crie um diretório no servidor web e baixe e descompacte o conteúdo deste repositório.
+4- Por padrão usuario: admin@admin.com e senha: 123456.
#Sobre From 11cad14fae16c61cec5d98942207d97404ba664c Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Sat, 8 Dec 2018 20:50:12 -0200 Subject: [PATCH 20/25] Update README.md --- README.md | 86 +++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 18c37f5f9..5bb3decf4 100644 --- a/README.md +++ b/README.md @@ -14,66 +14,66 @@ O intuito deste é mostrar de forma fácil como consumir dados utilizando padrã 3- Crie um diretório no servidor web e baixe e descompacte o conteúdo deste repositório.
4- Por padrão usuario: admin@admin.com e senha: 123456.
-#Sobre +#Sobre
-Neste projeto foi utilizado o AJAX para comunicação da interface com a API. -Não foi utilizado validações de sala, horário, autenticação dentro outras deixando o projeto o mais básico possível. +Neste projeto foi utilizado o AJAX para comunicação da interface com a API.
+Não foi utilizado validações de sala, horário, autenticação dentro outras deixando o projeto o mais básico possível.
-#Autenticação +#Autenticação
-Não existe autenticação com a API. O login é básico utilizando apenas autenticação de usuario e senha. +Não existe autenticação com a API. O login é básico utilizando apenas autenticação de usuario e senha.
-#Codigos de Erro +#Codigos de Erro
-Codigos de status e erros. +Codigos de status e erros.
-create -201 - Cadastrado com sucesso. -503 - Serviço indisponível, problemas para criar o curso. -400 - Dados incompetos. +create
+201 - Cadastrado com sucesso.
+503 - Serviço indisponível, problemas para criar o curso.
+400 - Dados incompetos.
-Delete -200 - O curso foi deletado com sucesso. -503 - Serviço indisponível, problemas para deletar o curso +Delete
+200 - O curso foi deletado com sucesso.
+503 - Serviço indisponível, problemas para deletar o curso
-Loging -200 - Logado com sucesso. -503 - Erro ao logar. +Loging
+200 - Logado com sucesso.
+503 - Erro ao logar.
-read_one -200 - Curso localizado com sucesso. -503 - Curso não existe. +read_one
+200 - Curso localizado com sucesso.
+503 - Curso não existe.
-read_paging -200 - Sucesso na paginação. -404 - Nenhum curso encontrado. +read_paging
+200 - Sucesso na paginação.
+404 - Nenhum curso encontrado.
-read -200 - listar cursos com sucesso. -404 - Nenhum curso encontrado. +read
+200 - listar cursos com sucesso.
+404 - Nenhum curso encontrado.
-search -200 - curso localizado com sucesso. -404 - Nenhum curso encontrado. +search
+200 - curso localizado com sucesso.
+404 - Nenhum curso encontrado.
-update -200 - Curso atualizado com sucesso. -503 - Serviço indisponível, problemas para atualizar o curso. +update
+200 - Curso atualizado com sucesso.
+503 - Serviço indisponível, problemas para atualizar o curso.
---------------------------------------------------- -#Rotas +#Rotas
-Lista os cursos -POST curso/api/curso/read.php +Lista os cursos
+POST curso/api/curso/read.php
-Lista o curso selecionado pelo idcurso -GET curso/api/curso/read_one.php?idcurso= +Lista o curso selecionado pelo idcurso
+GET curso/api/curso/read_one.php?idcurso=
-Deleta o curso selecionado pelo idcurso -GET curso/api/curso/delete.php?idcurso= +Deleta o curso selecionado pelo idcurso
+GET curso/api/curso/delete.php?idcurso=
-Cadastra curso -POST curso/api/curso/create.php +Cadastra curso
+POST curso/api/curso/create.php
-Atualiza dados de um curso selecionado pelo idcurso -GET curso/api/curso/update.php?idcurso= +Atualiza dados de um curso selecionado pelo idcurso
+GET curso/api/curso/update.php?idcurso=
From 398ca0e5729c7ab7d7d4d49f0a1ec1bc9d692db8 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Tue, 11 Dec 2018 20:50:02 -0200 Subject: [PATCH 21/25] Corrigido o nome dos campos: hora_inicio => inicio hora_fim => fim dentro da tabela cursos --- apiCursos.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apiCursos.sql b/apiCursos.sql index afa348487..89b1ae6d7 100644 --- a/apiCursos.sql +++ b/apiCursos.sql @@ -21,8 +21,8 @@ SET time_zone = "+00:00"; -- -- Database: `apidb` -- -CREATE DATABASE IF NOT EXISTS `apicursos` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; -USE `apicursos`; +CREATE DATABASE IF NOT EXISTS `apicursos2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +USE `apicursos2`; -- -------------------------------------------------------- @@ -33,8 +33,8 @@ USE `apicursos`; CREATE TABLE `cursos` ( `idcurso` int(11) NOT NULL, `curso` varchar(45) DEFAULT NULL, - `hora_inico` varchar(4) DEFAULT NULL, - `hora_fim` varchar(4) DEFAULT NULL, + `inico` varchar(4) DEFAULT NULL, + `fim` varchar(4) DEFAULT NULL, `idprofessor` int(11) NOT NULL, `idsala` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; From c086a5ab09de077871e111e439e3386433d1a946 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Tue, 11 Dec 2018 20:50:40 -0200 Subject: [PATCH 22/25] --- apiCursos.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apiCursos.sql b/apiCursos.sql index 89b1ae6d7..4eb483914 100644 --- a/apiCursos.sql +++ b/apiCursos.sql @@ -21,8 +21,8 @@ SET time_zone = "+00:00"; -- -- Database: `apidb` -- -CREATE DATABASE IF NOT EXISTS `apicursos2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; -USE `apicursos2`; +CREATE DATABASE IF NOT EXISTS `apicursos` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +USE `apicursos`; -- -------------------------------------------------------- From f4b20179c40da4e037df55b7a18c71a06b423e96 Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Fri, 14 Dec 2018 13:29:02 -0200 Subject: [PATCH 23/25] =?UTF-8?q?Corrigido=20caminho=20dos=20arquivos=20da?= =?UTF-8?q?=20api=20na=20fun=C3=A7=C3=A3o=20file=5Fget=5Fcontents(),=20par?= =?UTF-8?q?a=20pegar=20automaticamente=20o=20caminho=20do=20host.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/editar.php | 2 +- pages/index.php | 6 +++--- pages/inserir.php | 2 +- pages/login.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pages/editar.php b/pages/editar.php index 2ce73fe7f..6f9e6feaa 100644 --- a/pages/editar.php +++ b/pages/editar.php @@ -99,7 +99,7 @@ // submit form data to api $.ajax({ - url: "/curso/api/curso/update.php", + url: "../api/curso/update.php", type : "POST", contentType : 'application/json', data : form_data, diff --git a/pages/index.php b/pages/index.php index 1e3b3ead4..bd131fabe 100644 --- a/pages/index.php +++ b/pages/index.php @@ -1,8 +1,7 @@ ''){ @@ -10,6 +9,7 @@ header('location:index.php'); echo $dados->message; + } ?> @@ -61,7 +61,7 @@ function deletarCurso(id){ // submit form data to api $.ajax({ - url: "/curso/api/curso/delete.php", + url: "../api/curso/delete.php", type : "GET", contentType : 'application/json', data : {'idcurso': id}, diff --git a/pages/inserir.php b/pages/inserir.php index 7eb2b584a..2465cca03 100644 --- a/pages/inserir.php +++ b/pages/inserir.php @@ -93,7 +93,7 @@ // submit form data to api $.ajax({ - url: "/curso/api/curso/create.php", + url: "../api/curso/create.php", type : "POST", contentType : 'application/json', data : form_data, diff --git a/pages/login.php b/pages/login.php index 4ffe3e320..f343da215 100644 --- a/pages/login.php +++ b/pages/login.php @@ -60,7 +60,7 @@ // submit form data to api $.ajax({ - url: "/curso/api/curso/loging.php", + url: "../api/curso/loging.php", type : "POST", contentType : 'application/json', data : form_data, From 7a794d55b16fb6aae8f58039bd01aa182404630b Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Fri, 14 Dec 2018 13:34:29 -0200 Subject: [PATCH 24/25] =?UTF-8?q?Corrigido=20a=20instru=C3=A7=C3=A3o=20de?= =?UTF-8?q?=20instala=C3=A7=C3=A3o:=20Informando=20ao=20usu=C3=A1rio=20que?= =?UTF-8?q?=20crie=20o=20diret=C3=B3rio=20com=20o=20nome=20"curso".?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5bb3decf4..b81b9e719 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ O intuito deste é mostrar de forma fácil como consumir dados utilizando padrã 1- Utilize o arquivo apiCursos.sql, para a criação da base de dados.
2- Modifique o arquivo api/config/config.php, com as informações para acessar o banco de dados MYSQL.
-3- Crie um diretório no servidor web e baixe e descompacte o conteúdo deste repositório.
+3- Crie um diretório no servidor web com o nome "curso" e baixe e descompacte o conteúdo deste repositório.
4- Por padrão usuario: admin@admin.com e senha: 123456.
#Sobre
From 4dcf01a0d5fd563077e7a1a9ef86250fd093d57a Mon Sep 17 00:00:00 2001 From: Marcello Lyrio Date: Fri, 14 Dec 2018 17:28:53 -0200 Subject: [PATCH 25/25] =?UTF-8?q?Corrido=20problemas=20de=20interliga?= =?UTF-8?q?=C3=A7=C3=A3o=20da=20interface=20com=20a=20API.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/editar.php | 186 ++++++++++++++++++++++++++++++---------------- pages/index.php | 63 +++++++++------- pages/inserir.php | 141 +++++++++++++++++++++-------------- 3 files changed, 241 insertions(+), 149 deletions(-) diff --git a/pages/editar.php b/pages/editar.php index 6f9e6feaa..998a531b1 100644 --- a/pages/editar.php +++ b/pages/editar.php @@ -10,20 +10,10 @@ API Cursos - + ''){ - $id = $_GET['id']; - $dados = json_decode(file_get_contents('HTTP://'.$_SERVER['HTTP_HOST'].'/curso/api/curso/read_one.php?idcurso='.$id)); - $professores = json_decode(file_get_contents('HTTP://'.$_SERVER['HTTP_HOST'].'/curso/api/professor/read.php')); - $salas = json_decode(file_get_contents('HTTP://'.$_SERVER['HTTP_HOST'].'/curso/api/sala/read.php')); - - - } - - ?> @@ -33,66 +23,130 @@
Editar Detalhes do Curso
-
-
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
+

diff --git a/pages/index.php b/pages/index.php index bd131fabe..dce569a47 100644 --- a/pages/index.php +++ b/pages/index.php @@ -1,17 +1,3 @@ - ''){ - - $dados = json_decode(file_get_contents('HTTP://'.$_SERVER['HTTP_HOST'].'/curso/api/curso/delete.php?idcurso='.$_GET['id'])); - - header('location:index.php'); - echo $dados->message; - -} -?> @@ -24,26 +10,15 @@ API Cursos - +
Cursos
-
- records as $valor){ ?> -
-
-
-
-

-
Prof.: professor;?>

-
Sala: sala;?>
inicio;?> às fim;?>
-
-
-
- +
+

@@ -83,6 +58,38 @@ function deletarCurso(id){ return false; }; + + function listarCurso(){ + + + // get list of curso from the API + $.getJSON("../api/curso/read.php", function(data){ + + // html for listing curso + var read_curso_html=""; + + // loop through returned list of data + $.each(data.records, function(key, val) { + + // creating new table row per record + read_curso_html+='
'; + read_curso_html+='
'; + read_curso_html+='
'; + read_curso_html+='
'; + read_curso_html+='

'; + read_curso_html+='
Prof.: '+ val.professor +'

'; + read_curso_html+='
Sala: '+ val.sala +'
'+ val.inicio +' às '+ val.fim +'
'; + read_curso_html+='
'; + read_curso_html+='
'; + read_curso_html+='
'; + + }); + // inject to 'page-content' of our app + $(".card-deck").html(read_curso_html); + }); + }; + + diff --git a/pages/inserir.php b/pages/inserir.php index 2465cca03..82f747f50 100644 --- a/pages/inserir.php +++ b/pages/inserir.php @@ -1,8 +1,3 @@ - @@ -17,7 +12,7 @@ API Cursos - +
@@ -25,54 +20,7 @@
Detalhes do Curso
-
-
- - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
+

@@ -87,7 +35,88 @@ \ No newline at end of file