Skip to content

Commit

Permalink
Merge pull request #17 from douglas-88/projeto-final
Browse files Browse the repository at this point in the history
Painel Admin - Starting
  • Loading branch information
douglas-88 authored Feb 16, 2020
2 parents 476ee5e + 4dbab3e commit e694ba6
Show file tree
Hide file tree
Showing 2,155 changed files with 806,696 additions and 451 deletions.
Empty file modified .env.example
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
99 changes: 54 additions & 45 deletions app/Controller/Admin/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,62 @@


namespace App\Controller\Admin;
use App\Model\User;
use App\Model\Admin;

use Core\Controller;
use Core\Redirect;
use Core\Validate;
use Core\Login;
use Slim\Http\Request;
use Slim\Http\Response;

class AdminController extends Controller
{
public function index(){
session_destroy();
var_dump($_SESSION);
$this->view("admin/login");
}

public function store(){
$validate = new Validate();
$data = $validate->validate([
"email" => "required:email",
"senha" => "required"
]);

if($validate->hasErros()){
foreach($data as $field => $value){
flash("post_".$field,$data[$field]);
}
back();
exit;
}

$login = new Login("admin");
$loginIn = $login->login($data,new Admin);

if($loginIn){
Redirect::redirect("/painel");
exit;
}else{
Redirect::redirect("/admin");
exit;
}

}

public function destroy(){

$login = new Login("admin");
$login->logout();

}
/**
* Página Inicial
*/
public function index() {

$this->view("admin/master",["template_admin" => $this->templateAdmin]);

}

/**
* Exibe o formulário de criação
*/
public function create() {
echo 'create';
}

/**
* Processa Formulário de criação
*/
public function store(Request $request,Response $response) {
echo 'store';
}

/**
* Exibe dado do Banco de dados
*/
public function show($id) {
echo 'show';
}

/**
* Exibe o formulário de edição
*/
public function edit($id) {
echo 'edit';
}

/**
* Processa o formulário de edição
*/
public function update(Request $request,Response $response,$args) {
echo 'update';
}

/**
* Remove dados do Banco
*/
public function destroy($id) {
echo 'destroy';
}

}
104 changes: 104 additions & 0 deletions app/Controller/Admin/LoginController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?php


namespace App\Controller\Admin;

use Core\Controller;
use Core\Flash;
use Core\Load;
use Core\Login;
use Core\Redirect;
use Core\Validate;
use Slim\Http\Request;
use Slim\Http\Response;
use App\Model\Admin;

class LoginController extends Controller
{

/**
* Página Inicial
*/
public function index()
{
$this->view("admin/login",["template_admin" => $this->templateAdmin]);
}

/**
* Exibe o formulário de criação
*/
public function create()
{
echo 'create';
}

/**
* Processa Formulário de criação
*/
public function store(Request $request, Response $response)
{
$validate = new Validate();
$data = $validate->validate([
"email" => "required:email",
"password" => "required"
]);

if($validate->hasErros()){
foreach($data as $field => $value){
flash("post_".$field,$data[$field]);
}
back();
}

$login = new Login();
$loggedIn = $login->login($data);

if(!$loggedIn){
Flash::add("warning",error("Email ou Senha inválidos."));
back();
}

Redirect::redirect("/painel/admin");


}

/**
* Exibe dado do Banco de dados
*/
public function show($id)
{
echo 'show';
}

/**
* Exibe o formulário de edição
*/
public function edit($id)
{
echo 'edit';
}

/**
* Processa o formulário de edição
*/
public function update(Request $request, Response $response, $args)
{
echo 'update';
}

/**
* Remove dados do Banco
*/
public function destroy()
{

if(isset($_SESSION["loginInfo"]) && !empty($_SESSION["loginInfo"])){
unset($_SESSION["loginInfo"]);
}

Redirect::redirect("/login");

}

}
16 changes: 0 additions & 16 deletions app/Controller/Admin/PainelController.php

This file was deleted.

61 changes: 61 additions & 0 deletions app/Controller/Admin/ProfessorController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php


namespace App\Controller\Admin;

use Core\Controller;
use Slim\Http\Request;
use Slim\Http\Response;

class ProfessorController extends Controller
{
/**
* Página Inicial
*/
public function index() {
echo 'index professor';
}

/**
* Exibe o formulário de criação
*/
public function create() {
echo 'create';
}

/**
* Processa Formulário de criação
*/
public function store(Request $request,Response $response) {
echo 'store';
}

/**
* Exibe dado do Banco de dados
*/
public function show($id) {
echo 'show';
}

/**
* Exibe o formulário de edição
*/
public function edit($id) {
echo 'edit';
}

/**
* Processa o formulário de edição
*/
public function update(Request $request,Response $response,$args) {
echo 'update';
}

/**
* Remove dados do Banco
*/
public function destroy($id) {
echo 'destroy';
}

}
15 changes: 0 additions & 15 deletions app/Controller/HomeController.php

This file was deleted.

Loading

0 comments on commit e694ba6

Please sign in to comment.