From fb5e8e2809140620d97417e88f7f3638350a41a7 Mon Sep 17 00:00:00 2001 From: Jonathas Date: Fri, 22 Jun 2018 11:39:24 -0300 Subject: [PATCH] Projeto_Adidas --- ProjetoAdidas/.idea/ProjetoGol.iml | 18 ++++++++++++++++++ ProjetoAdidas/.idea/modules.xml | 8 ++++++++ ProjetoAdidas/.idea/workspace.xml | 869 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/Estrutura/ProjetoGol.sql | 361 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/.htaccess | 16 ++++++++++++++++ ProjetoAdidas/adm/.idea/adm.iml | 18 ++++++++++++++++++ ProjetoAdidas/adm/.idea/modules.xml | 8 ++++++++ ProjetoAdidas/adm/.idea/workspace.xml | 397 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/assets/css/dashboard.css | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/assets/css/signin.css | 45 +++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/config/Config.php | 31 +++++++++++++++++++++++++++++++ ProjetoAdidas/adm/config/ConfigController.php | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/config/ConfigView.php | 35 +++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/controllers/ControllerAuth.php | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/controllers/ControllerHome.php | 9 +++++++++ ProjetoAdidas/adm/controllers/ControllerUsers.php | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/index.php | 9 +++++++++ ProjetoAdidas/adm/models/ModelsAuth.php | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/models/ModelsUsers.php | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/models/helper/ModelsConn.php | 29 +++++++++++++++++++++++++++++ ProjetoAdidas/adm/models/helper/ModelsCreate.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/models/helper/ModelsDelete.php | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/models/helper/ModelsRead.php | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/models/helper/ModelsUpdate.php | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/views/auth/login.php | 38 ++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/views/home/index.php | 11 +++++++++++ ProjetoAdidas/adm/views/includes/footer.php | 14 ++++++++++++++ ProjetoAdidas/adm/views/includes/header.php | 23 +++++++++++++++++++++++ ProjetoAdidas/adm/views/includes/menu.php | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/views/includes/menu_antigo.php | 29 +++++++++++++++++++++++++++++ ProjetoAdidas/adm/views/users/editarUsers.php | 38 ++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/views/users/inserirUsers.php | 38 ++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/views/users/listarUsers.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ ProjetoAdidas/adm/views/users/visualizarUsers.php | 27 +++++++++++++++++++++++++++ ProjetoAdidas/~$ES-DW-MVC-parte02.doc | Bin 0 -> 162 bytes ProjetoAdidas/~WRL0003.tmp | Bin 0 -> 353280 bytes 36 files changed, 3012 insertions(+), 0 deletions(-) create mode 100644 ProjetoAdidas/.idea/ProjetoGol.iml create mode 100644 ProjetoAdidas/.idea/modules.xml create mode 100644 ProjetoAdidas/.idea/workspace.xml create mode 100644 ProjetoAdidas/Estrutura/ProjetoGol.sql create mode 100644 ProjetoAdidas/adm/.htaccess create mode 100644 ProjetoAdidas/adm/.idea/adm.iml create mode 100644 ProjetoAdidas/adm/.idea/modules.xml create mode 100644 ProjetoAdidas/adm/.idea/workspace.xml create mode 100644 ProjetoAdidas/adm/assets/css/dashboard.css create mode 100644 ProjetoAdidas/adm/assets/css/signin.css create mode 100644 ProjetoAdidas/adm/config/Config.php create mode 100644 ProjetoAdidas/adm/config/ConfigController.php create mode 100644 ProjetoAdidas/adm/config/ConfigView.php create mode 100644 ProjetoAdidas/adm/controllers/ControllerAuth.php create mode 100644 ProjetoAdidas/adm/controllers/ControllerHome.php create mode 100644 ProjetoAdidas/adm/controllers/ControllerUsers.php create mode 100644 ProjetoAdidas/adm/index.php create mode 100644 ProjetoAdidas/adm/models/ModelsAuth.php create mode 100644 ProjetoAdidas/adm/models/ModelsUsers.php create mode 100644 ProjetoAdidas/adm/models/helper/ModelsConn.php create mode 100644 ProjetoAdidas/adm/models/helper/ModelsCreate.php create mode 100644 ProjetoAdidas/adm/models/helper/ModelsDelete.php create mode 100644 ProjetoAdidas/adm/models/helper/ModelsRead.php create mode 100644 ProjetoAdidas/adm/models/helper/ModelsUpdate.php create mode 100644 ProjetoAdidas/adm/views/auth/login.php create mode 100644 ProjetoAdidas/adm/views/home/index.php create mode 100644 ProjetoAdidas/adm/views/includes/footer.php create mode 100644 ProjetoAdidas/adm/views/includes/header.php create mode 100644 ProjetoAdidas/adm/views/includes/menu.php create mode 100644 ProjetoAdidas/adm/views/includes/menu_antigo.php create mode 100644 ProjetoAdidas/adm/views/users/editarUsers.php create mode 100644 ProjetoAdidas/adm/views/users/inserirUsers.php create mode 100644 ProjetoAdidas/adm/views/users/listarUsers.php create mode 100644 ProjetoAdidas/adm/views/users/visualizarUsers.php create mode 100644 ProjetoAdidas/~$ES-DW-MVC-parte02.doc create mode 100644 ProjetoAdidas/~WRL0003.tmp diff --git a/ProjetoAdidas/.idea/ProjetoGol.iml b/ProjetoAdidas/.idea/ProjetoGol.iml new file mode 100644 index 0000000..b313593 --- /dev/null +++ b/ProjetoAdidas/.idea/ProjetoGol.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/.idea/modules.xml b/ProjetoAdidas/.idea/modules.xml new file mode 100644 index 0000000..4566305 --- /dev/null +++ b/ProjetoAdidas/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/.idea/workspace.xml b/ProjetoAdidas/.idea/workspace.xml new file mode 100644 index 0000000..d0d0e80 --- /dev/null +++ b/ProjetoAdidas/.idea/workspace.xml @@ -0,0 +1,869 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + resulta + resul + result + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + project + + + + + + + + + + + + + + + + project + + + true + + + + DIRECTORY + + false + + + + + + + + + 1523624394982 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/Estrutura/ProjetoGol.sql b/ProjetoAdidas/Estrutura/ProjetoGol.sql new file mode 100644 index 0000000..706acba --- /dev/null +++ b/ProjetoAdidas/Estrutura/ProjetoGol.sql @@ -0,0 +1,361 @@ +-- phpMyAdmin SQL Dump +-- version 4.7.2 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1 +-- Tempo de geração: 13/04/2018 às 10:14 +-- Versão do servidor: 10.1.18-MariaDB-1~xenial +-- Versão do PHP: 7.0.29-1+ubuntu16.04.1+deb.sury.org+1 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + +-- +-- Banco de dados: `dw_projeto_gol` +-- + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `classes` +-- + +CREATE TABLE `classes` ( + `id` int(11) NOT NULL, + `nome_classe` varchar(220) DEFAULT NULL, + `criado` datetime DEFAULT NULL, + `modificado` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `classes` +-- + + + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `metodos` +-- + +CREATE TABLE `metodos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `nome_metodo` varchar(220) DEFAULT NULL, + `classes_id` int(11) DEFAULT NULL, + `criado` datetime DEFAULT NULL, + `modificado` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `metodos` +-- + + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `niveis_acessos` +-- + +CREATE TABLE `niveis_acessos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `nome_niveis_acesso` varchar(220) NOT NULL, + `criado` datetime NOT NULL, + `modificado` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `niveis_acessos` +-- + +INSERT INTO `niveis_acessos` (`id`, `nome_niveis_acesso`, `criado`, `modificado`) VALUES +(1, 'Administrador', '2018-02-13 20:38:08', NULL), +(2, 'Publico', '2018-02-13 20:38:43', NULL), +(3, 'Colaborador', '2018-02-13 20:38:52', NULL), +(4, 'Cliente', '2018-02-13 20:38:59', NULL); + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `permissoes` +-- + +CREATE TABLE `permissoes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `classes_id` int(11) DEFAULT NULL, + `metodos_id` int(11) DEFAULT NULL, + `niveis_acesso_id` int(11) DEFAULT NULL, + `situacao_permissao` int(11) DEFAULT NULL, + `criado` datetime DEFAULT NULL, + `modificado` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `permissoes` +-- + + + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `situacoes_users` +-- + +CREATE TABLE `situacoes_users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `nome_sit_user` varchar(30) NOT NULL, + `criado` datetime NOT NULL, + `modificado` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `situacoes_users` +-- + +INSERT INTO `situacoes_users` (`id`, `nome_sit_user`, `criado`, `modificado`) VALUES +(1, 'Ativo', '2018-02-13 00:00:00', NULL), +(2, 'Inativo', '2018-02-13 00:00:00', NULL), +(3, 'Aguardando Confirmacao', '2018-02-13 00:00:00', NULL); + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `users` +-- + +CREATE TABLE `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `nome` varchar(100) DEFAULT NULL, + `email` varchar(60) DEFAULT NULL, + `password` char(32) DEFAULT NULL, + `foto` varchar(60) DEFAULT NULL, + `niveis_acesso_id` int(11) DEFAULT NULL, + `situacoes_user_id` int(11) DEFAULT NULL, + `criado` datetime DEFAULT NULL, + `modificado` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `users` +-- + +INSERT INTO `users` (`id`, `nome`, `email`, `password`, `foto`, `niveis_acesso_id`, `situacoes_user_id`, `criado`, `modificado`) VALUES +(1, 'Flávio', 'flavio@flavioizo.com', '202cb962ac59075b964b07152d234b70', 'flavio.jpg', 1, 1, '2018-02-13 13:00:00', NULL), +(2, 'Maria', 'maria@flavioizo.com', '202cb962ac59075b964b07152d234b70', 'maria.jpg', 3, 1, '2018-02-13 13:45:20', NULL), +(3, 'João', 'joao@flavioizo.com', '202cb962ac59075b964b07152d234b70', 'joao.jpg', 3, 1, '2018-02-13 13:48:58', NULL); + + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `players_peso` +-- + +CREATE TABLE `players_peso` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `situacao` varchar(25) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `futebol_players` +-- + +INSERT INTO `players_peso` (`id`, `situacao`) VALUES +(1, 'Goleiro'), +(2, 'Decisivo'), +(3, 'Mediano'), +(4, 'Café com leite'); + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `players` +-- + +CREATE TABLE `players` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `nome` varchar(40) NOT NULL, + `players_peso_id` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `futebol_players` +-- + +INSERT INTO `players` (`id`, `nome`, `players_peso_id`) VALUES +(1, 'Ronaldinho', 2), +(2, 'Sávio', 2), +(3, 'Gabriel Jesus', 2); + + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `locais` +-- + +CREATE TABLE `locais` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `nome` varchar(40) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `locais` +-- + +INSERT INTO `locais` (`id`, `nome`) VALUES +(1, 'Bom gosto'), +(2, 'Hangar'); + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `matchs` +-- + +CREATE TABLE `matchs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dia_hora` datetime DEFAULT NULL, + `locais_id` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `matchs` +-- + +INSERT INTO `matchs` (`id`, `dia_hora`, `locais_id`) VALUES +(1, '2018-03-13 13:48:58', 1); + +-- -------------------------------------------------------- + +-- +-- Estrutura para tabela `matchs_players` +-- + +CREATE TABLE `matchs_players` ( + `matchs_id` int(11) NOT NULL, + `players_id` int(11) NOT NULL, + `gols` int(11) NOT NULL DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Fazendo dump de dados para tabela `matchs_players` +-- + +INSERT INTO `matchs_players` (`matchs_id`, `players_id`, `gols`) VALUES +(1, 1, 0), +(1, 2, 0), +(1, 3, 0); + +-- -------------------------------------------------------- + +-- +-- Índices de tabela `classes` +-- +ALTER TABLE `classes` + ADD PRIMARY KEY (`id`); + +-- +-- Índices de tabela `metodos` +-- +ALTER TABLE `metodos` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `metodos` + ADD CONSTRAINT FK_ClassesMetodos + FOREIGN KEY (`classes_id`) REFERENCES classes(`id`); + +-- +-- Índices de tabela `niveis_acessos` +-- +ALTER TABLE `niveis_acessos` + ADD PRIMARY KEY (`id`); + +-- +-- Índices de tabela `permissoes` +-- +ALTER TABLE `permissoes` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `permissoes` + ADD CONSTRAINT `FK_ClassesPermissoes` + FOREIGN KEY (`classes_id`) REFERENCES `classes`(`id`); + +ALTER TABLE `permissoes` + ADD CONSTRAINT `FK_MetodosPermissoes` + FOREIGN KEY (`metodos_id`) REFERENCES `classes`(`id`); + +ALTER TABLE `permissoes` + ADD CONSTRAINT `FK_NiveisAcessoPermissoes` + FOREIGN KEY (`niveis_acesso_id`) REFERENCES `niveis_acessos`(`id`); + +-- +-- Índices de tabela `situacoes_users` +-- +ALTER TABLE `situacoes_users` + ADD PRIMARY KEY (`id`); + +-- +-- Índices de tabela `users` +-- +ALTER TABLE `users` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `users` + ADD CONSTRAINT `FK_NiveisAcessoUsers` + FOREIGN KEY (`niveis_acesso_id`) REFERENCES `niveis_acessos`(`id`); + +ALTER TABLE `users` + ADD CONSTRAINT `FK_SituacoesUserUsers` + FOREIGN KEY (`situacoes_user_id`) REFERENCES `situacoes_users`(`id`); + +-- +-- Índices de tabela `players_peso` +-- +ALTER TABLE `players_peso` + ADD PRIMARY KEY (`id`); + +-- +-- Índices de tabela `players` +-- +ALTER TABLE `players` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `players` + ADD CONSTRAINT `FK_PlayersPesoPlayers` + FOREIGN KEY (`players_peso_id`) REFERENCES `players_peso`(`id`); + +-- +-- Índices de tabela `local` +-- +ALTER TABLE `locais` + ADD PRIMARY KEY (`id`); + +-- +-- Índices de tabela `match` +-- +ALTER TABLE `matchs` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `matchs` + ADD CONSTRAINT `FK_LocaisMatchs` + FOREIGN KEY (`locais_id`) REFERENCES `locais`(`id`); + +-- +-- Índices de tabela `matchs_players` +-- +ALTER TABLE `matchs_players` + ADD PRIMARY KEY (`matchs_id`, `players_id`); + +ALTER TABLE `matchs_players` + ADD CONSTRAINT `FK_MatchsMatchsPlayers` + FOREIGN KEY (`matchs_id`) REFERENCES `matchs`(`id`); + +ALTER TABLE `matchs_players` + ADD CONSTRAINT `FK_PlayersMatchsPlayers` + FOREIGN KEY (`players_id`) REFERENCES `players`(`id`); + \ No newline at end of file diff --git a/ProjetoAdidas/adm/.htaccess b/ProjetoAdidas/adm/.htaccess new file mode 100644 index 0000000..f74f3d7 --- /dev/null +++ b/ProjetoAdidas/adm/.htaccess @@ -0,0 +1,16 @@ +# ativar a escrita +RewriteEngine On + +# Informando o caminho principal do seu projeto +# Importante quando se utiliza Alias +RewriteBase /dw/ProjetoGol/adm/ + +# informando que a regra é para pegar os valores e não +# tentar acessar diretórios, arquivos e links conhecidos +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-l + +# expressao regular para pegar tudo após o index.php +# e anexar à query URL. Encerrar o .htaccess +RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] \ No newline at end of file diff --git a/ProjetoAdidas/adm/.idea/adm.iml b/ProjetoAdidas/adm/.idea/adm.iml new file mode 100644 index 0000000..b313593 --- /dev/null +++ b/ProjetoAdidas/adm/.idea/adm.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/adm/.idea/modules.xml b/ProjetoAdidas/adm/.idea/modules.xml new file mode 100644 index 0000000..52b9a11 --- /dev/null +++ b/ProjetoAdidas/adm/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/adm/.idea/workspace.xml b/ProjetoAdidas/adm/.idea/workspace.xml new file mode 100644 index 0000000..fe1531b --- /dev/null +++ b/ProjetoAdidas/adm/.idea/workspace.xml @@ -0,0 +1,397 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + project + + + true + + + + DIRECTORY + + false + + + + + + + + + 1524783134806 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/adm/assets/css/dashboard.css b/ProjetoAdidas/adm/assets/css/dashboard.css new file mode 100644 index 0000000..3918097 --- /dev/null +++ b/ProjetoAdidas/adm/assets/css/dashboard.css @@ -0,0 +1,107 @@ +body { + font-size: .875rem; +} + +.feather { + width: 16px; + height: 16px; + vertical-align: text-bottom; +} + +/* + * Sidebar + */ + +.sidebar { + position: fixed; + top: 0; + bottom: 0; + left: 0; + z-index: 100; /* Behind the navbar */ + padding: 48px 0 0; /* Height of navbar */ + box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1); +} + +.sidebar-sticky { + position: relative; + top: 0; + height: calc(100vh - 48px); + padding-top: .5rem; + overflow-x: hidden; + overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */ +} + +@supports ((position: -webkit-sticky) or (position: sticky)) { + .sidebar-sticky { + position: -webkit-sticky; + position: sticky; + } +} + +.sidebar .nav-link { + font-weight: 500; + color: #333; +} + +.sidebar .nav-link .feather { + margin-right: 4px; + color: #999; +} + +.sidebar .nav-link.active { + color: #007bff; +} + +.sidebar .nav-link:hover .feather, +.sidebar .nav-link.active .feather { + color: inherit; +} + +.sidebar-heading { + font-size: .75rem; + text-transform: uppercase; +} + +/* + * Content + */ + +[role="main"] { + padding-top: 48px; /* Space for fixed navbar */ +} + +/* + * Navbar + */ + +.navbar-brand { + padding-top: .75rem; + padding-bottom: .75rem; + font-size: 1rem; + background-color: rgba(0, 0, 0, .25); + box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25); +} + +.navbar .form-control { + padding: .75rem 1rem; + border-width: 0; + border-radius: 0; +} + +.form-control-dark { + color: #fff; + background-color: rgba(255, 255, 255, .1); + border-color: rgba(255, 255, 255, .1); +} + +.form-control-dark:focus { + border-color: transparent; + box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); +} + +/* + * Utilities + */ + +.border-top { border-top: 1px solid #e5e5e5; } +.border-bottom { border-bottom: 1px solid #e5e5e5; } diff --git a/ProjetoAdidas/adm/assets/css/signin.css b/ProjetoAdidas/adm/assets/css/signin.css new file mode 100644 index 0000000..1e9956c --- /dev/null +++ b/ProjetoAdidas/adm/assets/css/signin.css @@ -0,0 +1,45 @@ +html, +body { + height: 100%; +} + +body { + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + padding-top: 40px; + padding-bottom: 40px; + background-color: lightgray; +} + +.form-signin { + width: 100%; + max-width: 330px; + padding: 15px; + margin: auto; + background-color: #fff; +} +.form-signin .checkbox { + font-weight: 400; +} +.form-signin .form-control { + position: relative; + box-sizing: border-box; + height: auto; + padding: 10px; + font-size: 16px; +} +.form-signin .form-control:focus { + z-index: 2; +} +.form-signin input[type="email"] { + margin-bottom: -1px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.form-signin input[type="password"] { + margin-bottom: 10px; + border-top-left-radius: 0; + border-top-right-radius: 0; +} diff --git a/ProjetoAdidas/adm/config/Config.php b/ProjetoAdidas/adm/config/Config.php new file mode 100644 index 0000000..993dc31 --- /dev/null +++ b/ProjetoAdidas/adm/config/Config.php @@ -0,0 +1,31 @@ +url = filter_input(INPUT_GET, 'url', FILTER_DEFAULT); + //echo $this->url; + + //echo "
Antes da formatação: " .$this->url; + $this->clearUrl(); + //echo "
Depois da formatação: " .$this->url; + + // SEPARA OS VALORES EM ARRAY + $this->urlConjunto = explode("/", $this->url); + + /*echo "
";
+            print_r($this->urlConjunto);
+            echo "
";*/ + // trata o controller, caso exista + if (isset($this->urlConjunto[0])){ + $this->urlController = $this->validarController($this->urlConjunto[0]); + } + // trata o método, caso exista + if (isset($this->urlConjunto[1])){ + $this->urlMetodo = $this->validarMetodo($this->urlConjunto[1]); + } + // trata o parâmetro, caso exista + if (isset($this->urlConjunto[2])){ + $this->urlParametro = (int)$this->urlConjunto[2]; + //echo "
{$this->urlParametro}"; + }else { + $this->urlParametro = null; + } + + }else{ + $this->urlController = $this->validarController(CONTROLLER); + $this->urlMetodo = $this->validarMetodo(METHOD); + } + } + + public function clearUrl(){ + // eliminar as tags html + $this->url = strip_tags($this->url); + // retirar espaços em branco contidos nas laterais da variável URL + $this->url = trim($this->url); + // retirar a última barra, caso exista + $this->url = rtrim($this->url, "/"); + // FORMATA OS CARACTERES + self::$formatar = array(); + self::$formatar['a'] = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜüÝÞßàáâãäåæçèéêëìíîï + ðñòóôõöøùúûýýþÿRr"!@#$%&*()_-+={[}]?;:.,\\\'<>°ºª '; + self::$formatar['b'] = 'aaaaaaaceeeeiiiidnoooooouuuuuybsaaaaaaaceeeeiiii + dnoooooouuuyybyRr--------------------------------'; + // traduz os caracteres do padrão A para o padrão B + $this->url = strtr(utf8_decode($this->url), utf8_decode(self::$formatar['a']), + self::$formatar['b']); + } + + // método que trata o nome do controller passado na url para o padrao CamelCase. + // Ex.: ControlleUsuario de Classe + public function validarController($controller){ + // retiro os espaços entre as palavras e acrescento as palavras para o + // primeiro caracter em maiúsculo + // separa o - para retirá-lo + $controller = explode("-", strtolower($controller)); + // Junto através de espaços para que eu possa colocar as primeiras em maiúsculo + $controller = implode(" ", $controller); + // Coloco as primeiras palavras em maiúsculo + $controller = ucwords($controller); + // Substituo o espaço em branco para juntar as palavras + $controller = str_replace(" ", "", $controller); + //echo "
{$controller}"; + return $controller; + } + + // método que trata o nome do método passado na url + public function validarMetodo($metodo) { + // retiro os espaços entre as palavras e acrescento as palavras para + // o primeiro caracter em minúsculo + // separa o - para retirá-lo + $metodo = explode("-", strtolower($metodo)); + // Junto através de espaços para que eu possa colocar as primeiras em maiúsculo + $metodo = implode(" ", $metodo); + // Coloco as primeiras palavras em maiúsculo + $metodo = ucwords($metodo); + // Substituo o espaço em branco para juntar as palavras e coloco a primeira em minúsculo + $metodo = lcfirst(str_replace(" ", "", $metodo)); + //echo "
{$metodo}"; + // retorna o nome do método, com o primeiro caracter em minúsculo. Ex.: index + return $metodo; + } + + public function carregar() { + //Verifica se a classe que está na urlController existe + //echo "Classe a ser carregada: {$this->urlController}"; + if (class_exists($this->urlController)) { + try { + // verifica se o usuario está logado + $this->validarSessao(); + // peço para carregar o método + $this->carregarMetodo(); + } catch (Exception $e) { + echo "Erro ao carregar a classe e o método: " . $e->getMessage() . "
"; + $this->urlController = $this->validarController(CONTROLLER); + $this->urlMetodo = $this->validarMetodo(METHOD); + $this->carregar(); + } + }else { + //echo "Erro ao carregar a classe {$this->urlController}
"; + $this->urlController = $this->validarController(CONTROLLER); + $this->urlMetodo = $this->validarMetodo(METHOD); + $this->carregar(); + } + } + + public function carregarMetodo() + { + $classeCarregar = new $this->urlController(); + + //Verificar se existe o método + if (method_exists($classeCarregar, $this->urlMetodo)){ + //echo "
Método a ser carregador: {$this->urlMetodo}"; + if ($this->urlParametro !== null) { + $classeCarregar->{$this->urlMetodo}($this->urlParametro); + }else { + $classeCarregar->{$this->urlMetodo}(); + } + }else{ + //echo "
Erro ao carregar o método: {$this->urlMetodo}"; + $this->urlController = $this->validarController(CONTROLLER); + $this->urlMetodo = $this->validarMetodo(METHOD); + $this->carregarMetodo(); + } + } + + private function validarSessao(){ + if (!isset($_SESSION['id'])) { + if (($this->urlController != 'ControllerAuth') && ($this->urlMetodo != 'auth')){ + $_SESSION['msg'] = " + + "; + $this->urlController = 'ControllerAuth'; + $this->urlMetodo = 'auth'; + } + } + } + +} \ No newline at end of file diff --git a/ProjetoAdidas/adm/config/ConfigView.php b/ProjetoAdidas/adm/config/ConfigView.php new file mode 100644 index 0000000..892412e --- /dev/null +++ b/ProjetoAdidas/adm/config/ConfigView.php @@ -0,0 +1,35 @@ +nome = (string) $nome; + $this->dados = $dados; + //var_dump($this->dados); + } + + public function renderizar(){ + include_once('views/includes/header.php'); + include_once('views/includes/menu.php'); + include_once('views/includes/footer.php'); + if (file_exists("views/{$this->nome}.php")){ + include_once("views/{$this->nome}.php"); + }else{ + echo "Erro ao carregar a view: {$this->nome}"; + } + } + + public function renderizarAuth() + { + if (file_exists('views/' . $this->nome . '.php')){ + include 'views/' . $this->nome . '.php'; + } + } + + + public function getDados(){ + return $this->dados; + } + +} \ No newline at end of file diff --git a/ProjetoAdidas/adm/controllers/ControllerAuth.php b/ProjetoAdidas/adm/controllers/ControllerAuth.php new file mode 100644 index 0000000..9a9e74a --- /dev/null +++ b/ProjetoAdidas/adm/controllers/ControllerAuth.php @@ -0,0 +1,50 @@ +dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); + if (isset($this->dados['sendLogin'])) { + unset($this->dados['sendLogin']); + //var_dump($this->dados); + if (($this->dados['email'] != null) && ($this->dados['password'] != null)) { + $login = new ModelsAuth(); + $login->autenticar($this->dados); + if (!$login->getResult()) { + $_SESSION['msg'] = $login->getMsg(); + }else { + $this->dados = $login->getResult(); + $this->dados = $this->dados[0]; + $_SESSION['id'] = $this->dados['id']; + $_SESSION['nome'] = $this->dados['nome']; + $_SESSION['email'] = $this->dados['email']; + $urlDestino = URL . 'controller-home/index'; + header("Location: $urlDestino"); + } + }else{ + $_SESSION['msg'] = " + + "; + } + }else { + $this->dados = null; + } + + + $carregarView = new ConfigView("auth/login", $this->dados); + $carregarView->renderizarAuth(); + } + + public function logout() { + $_SESSION['msg'] = " + + "; + unset($_SESSION['id'], $_SESSION['nome'], $_SESSION['email']); + $urlDestino = URL . 'controller-auth/auth'; + header("Location: $urlDestino"); + } +} diff --git a/ProjetoAdidas/adm/controllers/ControllerHome.php b/ProjetoAdidas/adm/controllers/ControllerHome.php new file mode 100644 index 0000000..7d1a0f4 --- /dev/null +++ b/ProjetoAdidas/adm/controllers/ControllerHome.php @@ -0,0 +1,9 @@ +renderizar(); + } +} diff --git a/ProjetoAdidas/adm/controllers/ControllerUsers.php b/ProjetoAdidas/adm/controllers/ControllerUsers.php new file mode 100644 index 0000000..012e200 --- /dev/null +++ b/ProjetoAdidas/adm/controllers/ControllerUsers.php @@ -0,0 +1,82 @@ +dados = $listarUsers->listar(); + //var_dump($this->dados); + $carregarView = new ConfigView("users/listarUsers", $this->dados); + $carregarView->renderizar(); + } + + public function visualizar($userId){ + $visualizarUser = new ModelsUsers(); + $this->dados = $visualizarUser->visualizar($userId); + $carregarView = new ConfigView("users/visualizarUsers", $this->dados); + $carregarView->renderizar(); + } + + public function inserir(){ + $this->dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); + if (isset($this->dados['enviarInserirUser'])){ + unset($this->dados['enviarInserirUser']); + //var_dump($this->dados); + $inserirUsuario = new ModelsUsers(); + $inserirUsuario->inserir($this->dados); + $this->dados['msg'] = $inserirUsuario->getMsg(); + if ($inserirUsuario->getResult()){ + $urlDestino = URL .'ControllerUsers/index'; + header("location: {$urlDestino}"); + } + } + + $carregarView = new ConfigView("users/inserirUsers", $this->dados); + $carregarView->renderizar(); + } + + public function editar($userId) { + $this->dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); + $this->userId = (int) $userId; + //var_dump($this->dados); + if (isset($this->dados['enviarEditarUser'])) { + //var_dump($this->dados); + unset($this->dados['enviarEditarUser']); + $editarUsuario = new ModelsUsers(); + $editarUsuario->editar($userId, $this->dados); + $this->dados['msg'] = $editarUsuario->getMsg(); + + if ($editarUsuario->getResult()) { + $urlDestino = URL . 'controller-users/index'; + header("Location: $urlDestino"); + } + }else { + $visualizarUser = new ModelsUsers(); + $this->dados = $visualizarUser->visualizar($this->userId); + $this->dados = $this->dados[0]; + //var_dump($this->dados); + } + + $CarregarView = new ConfigView("users/editarUsers", $this->dados); + $CarregarView->renderizar(); + } + + public function apagar($userId = null){ + $this->userId = (int) $userId; + if ($this->userId != null){ + $apagarUser = new ModelsUsers(); + $apagarUser->apagar($this->userId); + $_SESSION['msg'] = $apagarUser->getMsg(); + }else{ + $_SESSION['msg'] = " + + "; + } + $urlDestino = URL . 'controller-users/index'; + header("Location: $urlDestino"); + } + +} \ No newline at end of file diff --git a/ProjetoAdidas/adm/index.php b/ProjetoAdidas/adm/index.php new file mode 100644 index 0000000..189bd66 --- /dev/null +++ b/ProjetoAdidas/adm/index.php @@ -0,0 +1,9 @@ +carregar(); + + //$conexao = new ModelsConn(); + //$conexao->getConn(); + +?> \ No newline at end of file diff --git a/ProjetoAdidas/adm/models/ModelsAuth.php b/ProjetoAdidas/adm/models/ModelsAuth.php new file mode 100644 index 0000000..3549431 --- /dev/null +++ b/ProjetoAdidas/adm/models/ModelsAuth.php @@ -0,0 +1,62 @@ +dados = $dados; + $this->validar(); + if ($this->result){ + $visulizar = new ModelsRead(); + $visulizar->exeRead(self::ENTITY, 'WHERE email =:email AND password =:password LIMIT :limit', + "email={$this->dados['email']}&password={$this->dados['password']}&limit=1"); + if ($visulizar->getRowCount() == 1) { + //var_dump($Visulizar->getResultado()); + $this->result = $visulizar->getResult(); + }else { + $this->result = false; + $this->msg = " + + "; + } + } + } + + public function validar() + { + $this->dados = array_map('strip_tags', $this->dados); + $this->dados = array_map('trim', $this->dados); + if (in_array('', $this->dados)){ + $this->result = false; + $this->msg = " + + "; + }else{ + $this->dados['password'] = md5($this->dados['password']); + $this->result = true; + } + } + + function getResult() { + return $this->result; + } + + function getMsg() { + return $this->msg; + } + + function getRowCount() { + return $this->rowCount; + } + +} diff --git a/ProjetoAdidas/adm/models/ModelsUsers.php b/ProjetoAdidas/adm/models/ModelsUsers.php new file mode 100644 index 0000000..c6760a2 --- /dev/null +++ b/ProjetoAdidas/adm/models/ModelsUsers.php @@ -0,0 +1,120 @@ +exeRead('users', 'LIMIT :limit', 'limit=10'); + $this->result = $listar->getResult(); + return $this->result; + } + + public function visualizar($userId){ + $this->userId = (int) $userId; + $listar = new ModelsRead(); + $listar->exeRead(self::ENTITY, 'WHERE id =:id LIMIT :limit', + "id={$this->userId}&limit=1"); + $this->result = $listar->getResult(); + return $this->result; + } + + public function inserir(array $dados){ + $this->dados = $dados; + $this->validarDados($dados); + if ($this->result){ + $create = new ModelsCreate; + $create->exeCreate(self::ENTITY, $this->dados); + if ($create->getResult()){ + $this->result = $create->getResult(); + $this->msg = " + + "; + } + } + return $this->result; + } + + public function validarDados(){ + $this->dados = array_map('strip_tags', $this->dados); + $this->dados = array_map('trim', $this->dados); + if (in_array('', $this->dados)){ + $this->result = false; + $this->msg = " + + "; + }else{ + $this->dados['password'] = md5($this->dados['password']); + $this->result = true; + } + } + + public function editar($userId, array $dados) { + $this->userId = (int) $userId; + $this->dados = $dados; + + $this->validarDados(); + if ($this->result) { + $this->procEditar(); + } + } + + private function procEditar() { + $update = new ModelsUpdate(); + $update->exeUpdate(self::ENTITY, $this->dados, "WHERE id = :id", "id={$this->userId }"); + if ($update->getResult()){ + $this->msg = " + + "; + $this->result = true; + }else{ + $this->msg = " + + "; + $this->result = false; + } + } + + public function apagar($userId){ + $this->userId = (int) $userId; + $this->dados = $this->visualizar($this->userId); + if (count($this->dados) > 0){ + $delete = new ModelsDelete(); + $delete->exeDelete(self::ENTITY, "WHERE id = :id", "id={$this->userId }"); + $this->msg = " + + "; + $this->result = $delete->getResult(); + }else{ + $this->msg = " + + "; + $this->result = false; + } + } + + public function getMsg() + { + return $this->msg; + } + + public function getResult(){ + return $this->result; + } +} diff --git a/ProjetoAdidas/adm/models/helper/ModelsConn.php b/ProjetoAdidas/adm/models/helper/ModelsConn.php new file mode 100644 index 0000000..089be69 --- /dev/null +++ b/ProjetoAdidas/adm/models/helper/ModelsConn.php @@ -0,0 +1,29 @@ +Conectado com sucesso!"; + } + } catch (Exception $e) { + echo 'Mensagem: ' . $e->getMessage(); + die; + } + self::$CONNECT->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + return self::$CONNECT; + } + + protected static function getConn(){ + return self::conectar(); + } +} diff --git a/ProjetoAdidas/adm/models/helper/ModelsCreate.php b/ProjetoAdidas/adm/models/helper/ModelsCreate.php new file mode 100644 index 0000000..edbe781 --- /dev/null +++ b/ProjetoAdidas/adm/models/helper/ModelsCreate.php @@ -0,0 +1,49 @@ +tabela = (string) $tabela; + $this->dados = $dados; + + $this->getInstrucao(); + $this->executarInstrucao(); + } + + public function getInstrucao(){ + $keys = implode(', ', array_keys($this->dados)); + $values = ':' . implode(', :', array_keys($this->dados)); + + $this->query = "INSERT INTO {$this->tabela} ({$keys}) VALUES ({$values})"; + } + + private function executarInstrucao() { + $this->conexao(); + try { + $this->query->execute($this->dados); + $this->result = $this->conn->lastInsertId(); + }catch (Exception $e) { + $this->result = null; + return "Erro ao Cadastrar: {$e->getMessage()}"; + } + } + + public function conexao(){ + $this->conn = parent::getConn(); + $this->query = $this->conn->prepare($this->query); + } + + public function getMsg(){ + return $this->msg; + } + + public function getResult(){ + return $this->result; + } +} diff --git a/ProjetoAdidas/adm/models/helper/ModelsDelete.php b/ProjetoAdidas/adm/models/helper/ModelsDelete.php new file mode 100644 index 0000000..c360aa2 --- /dev/null +++ b/ProjetoAdidas/adm/models/helper/ModelsDelete.php @@ -0,0 +1,59 @@ +tabela = (string) $tabela; + $this->termos = (string) $termos; + + parse_str($parseString, $this->values); + + $this->getInstrucao(); + $this->executarInstrucao(); + } + + public function getResult() { + return $this->result; + } + + public function getMsg() { + return $this->msg; + } + + public function getRowCount() { + return $this->query->rowCount(); + } + + private function conexao() { + $this->conn = parent::getConn(); + $this->query = $this->conn->prepare($this->query); + } + + private function getInstrucao() { + $this->query = "DELETE FROM {$this->tabela} {$this->termos}"; + } + + private function executarInstrucao() { + $this->conexao(); + try { + $this->query->execute($this->values); + $this->result = true; + $this->msg = "
+ Usuário apagado com sucesso! +
"; + } catch (Exception $e) { + $this->result = null; + $this->msg = "
+ Erro ao Apagar {$e->getMessage()} +
"; + } + } +} diff --git a/ProjetoAdidas/adm/models/helper/ModelsRead.php b/ProjetoAdidas/adm/models/helper/ModelsRead.php new file mode 100644 index 0000000..6a3b5d0 --- /dev/null +++ b/ProjetoAdidas/adm/models/helper/ModelsRead.php @@ -0,0 +1,70 @@ +values + parse_str($parseString, $this->values); + } + // Montando a SQL para busca em BD + $this->select = "SELECT * FROM {$tabela} {$termos}"; + $this->executarInstrucao(); + } + + private function getInstrucao(){ + if ($this->values) { + foreach ($this->values as $link => $valor) { + if ($link == 'limit' || $link == 'offset') { + $valor = (int)$valor; + } + // garantido a integridade dos valores passados (bindvalue) + $this->query->bindValue(":{$link}", $valor, (is_int($valor) ? PDO::PARAM_INT : PDO::PARAM_STR)); + } + } + } + private function executarInstrucao(){ + $this->conexao(); + try{ + // associando os atributos aos identificadores para a SQL + $this->getInstrucao(); + $this->query->execute(); + // traz todas as linhas do registro + $this->result = $this->query->fetchAll(); + }catch (PDOException $e){ + $this->result = null; + $this->msg = "Erro ao Ler dados: {$e->getMessage()}"; + } + } + + private function conexao(){ + // chamando o método da classe pai + $this->conn = parent::getConn(); + // preparando a SQL + $this->query = $this->conn->prepare($this->select); + // colocando o modo de exibição da query como ASSOCIAÇÃO (nome dos campos) + $this->query->setFetchMode(PDO::FETCH_ASSOC); + } + + + + // GETTERS IMPORTANTES PARA ACESSO EXTERNO + public function getResult(){ + return $this->result; + } + + public function getMsg(){ + return $this->msg; + } + + public function getRowCount() { + return $this->query->rowCount(); + } +} \ No newline at end of file diff --git a/ProjetoAdidas/adm/models/helper/ModelsUpdate.php b/ProjetoAdidas/adm/models/helper/ModelsUpdate.php new file mode 100644 index 0000000..d588ab6 --- /dev/null +++ b/ProjetoAdidas/adm/models/helper/ModelsUpdate.php @@ -0,0 +1,62 @@ +tabela = (string) $tabela; + $this->dados = $dados; + $this->termos = (string) $termos; + + parse_str($parseString, $this->values); + $this->getIntrucao(); + $this->executarInstrucao(); + } + + public function getResult() { + return $this->result; + } + + public function getMsg() { + return $this->msg; + } + + public function getRowCount() { + return $this->query->rowCount; + } + + public function conexao() { + $this->conn = parent::getConn(); + $this->query = $this->conn->prepare($this->query); + } + + private function getIntrucao() { + foreach ($this->dados as $key => $value) { + $values[] = $key . ' = :' . $key; + } + $values = implode(', ', $values); + $this->query = "UPDATE {$this->tabela} SET {$values} {$this->termos}"; + } + + private function executarInstrucao(){ + $this->conexao(); + try { + $this->query->execute(array_merge($this->dados, $this->values)); + $this->result = true; + $this->msg = "
+ Usuário alterado com sucesso! +
"; + } catch (Exception $e) { + $this->result = null; + $this->msg = "
+ Erro ao Alterar {$e->getMessage()} +
"; + } + } +} diff --git a/ProjetoAdidas/adm/views/auth/login.php b/ProjetoAdidas/adm/views/auth/login.php new file mode 100644 index 0000000..c819975 --- /dev/null +++ b/ProjetoAdidas/adm/views/auth/login.php @@ -0,0 +1,38 @@ + + + + + Bem vindo! + + + + + +
+ + + + + +
+ + \ No newline at end of file diff --git a/ProjetoAdidas/adm/views/home/index.php b/ProjetoAdidas/adm/views/home/index.php new file mode 100644 index 0000000..617e218 --- /dev/null +++ b/ProjetoAdidas/adm/views/home/index.php @@ -0,0 +1,11 @@ + +
+
+

Dashboard

+
+ +
+
Bem vindo!
+
+ +
diff --git a/ProjetoAdidas/adm/views/includes/footer.php b/ProjetoAdidas/adm/views/includes/footer.php new file mode 100644 index 0000000..a0231d2 --- /dev/null +++ b/ProjetoAdidas/adm/views/includes/footer.php @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/adm/views/includes/header.php b/ProjetoAdidas/adm/views/includes/header.php new file mode 100644 index 0000000..142c55c --- /dev/null +++ b/ProjetoAdidas/adm/views/includes/header.php @@ -0,0 +1,23 @@ + + + + + Bem vindo! + + + + + + + + + +
+
\ No newline at end of file diff --git a/ProjetoAdidas/adm/views/includes/menu.php b/ProjetoAdidas/adm/views/includes/menu.php new file mode 100644 index 0000000..72b30e6 --- /dev/null +++ b/ProjetoAdidas/adm/views/includes/menu.php @@ -0,0 +1,75 @@ + diff --git a/ProjetoAdidas/adm/views/includes/menu_antigo.php b/ProjetoAdidas/adm/views/includes/menu_antigo.php new file mode 100644 index 0000000..da95157 --- /dev/null +++ b/ProjetoAdidas/adm/views/includes/menu_antigo.php @@ -0,0 +1,29 @@ + diff --git a/ProjetoAdidas/adm/views/users/editarUsers.php b/ProjetoAdidas/adm/views/users/editarUsers.php new file mode 100644 index 0000000..7e60185 --- /dev/null +++ b/ProjetoAdidas/adm/views/users/editarUsers.php @@ -0,0 +1,38 @@ + + + + + Edição de usuários + + + + +dados['msg'])){ + echo $this->dados['msg']; + } +?> +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/adm/views/users/inserirUsers.php b/ProjetoAdidas/adm/views/users/inserirUsers.php new file mode 100644 index 0000000..f29ac85 --- /dev/null +++ b/ProjetoAdidas/adm/views/users/inserirUsers.php @@ -0,0 +1,38 @@ + + + + + Cadastro de usuários + + + + +dados)){ + echo $this->dados['msg']; + } +?> +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/adm/views/users/listarUsers.php b/ProjetoAdidas/adm/views/users/listarUsers.php new file mode 100644 index 0000000..bed56db --- /dev/null +++ b/ProjetoAdidas/adm/views/users/listarUsers.php @@ -0,0 +1,46 @@ + + + +
+
+

Dashboard

+
+ Registros Encontrados: dados); ?> +
+
+
+ + + + + + + + + + + + dados as $linha){ + extract($linha); + ?> + + + + + + + + +
#NomeCriado emAções
+ Visualizar + Editar + Apagar +
+
+
\ No newline at end of file diff --git a/ProjetoAdidas/adm/views/users/visualizarUsers.php b/ProjetoAdidas/adm/views/users/visualizarUsers.php new file mode 100644 index 0000000..452d212 --- /dev/null +++ b/ProjetoAdidas/adm/views/users/visualizarUsers.php @@ -0,0 +1,27 @@ + + + + + Visualizando os usuários + + + + + +dados); + echo "ID: {$this->dados[0]['id']}
"; + echo "NOME: {$this->dados[0]['nome']}
"; + echo "CRIAÇÃO: {$this->dados[0]['criado']}

"; + +?> + + + + + \ No newline at end of file diff --git a/ProjetoAdidas/~$ES-DW-MVC-parte02.doc b/ProjetoAdidas/~$ES-DW-MVC-parte02.doc new file mode 100644 index 0000000..dd890f8 Binary files /dev/null and b/ProjetoAdidas/~$ES-DW-MVC-parte02.doc differ diff --git a/ProjetoAdidas/~WRL0003.tmp b/ProjetoAdidas/~WRL0003.tmp new file mode 100644 index 0000000..fcd9d1f Binary files /dev/null and b/ProjetoAdidas/~WRL0003.tmp differ -- libgit2 0.21.2