<?php

include_once "../dao/VeiculoDao.php";
include_once "../model/Veiculo.php";
include "../lib/sessions.php";
$tipoSession = checkSession();
if (!$tipoSession) {
    header('location: ../view/index.php');
} else {
    if ($tipoSession != "funcionario") {
        header('location: templateMenuAdmin.php');
    } else {
        $marca = $_POST['marca'];
        $placa = $_POST['placa'];
        $modelo = $_POST['modelo'];
        $cor = $_POST['cor'];
        $tipo = $_POST['tipo'];
        $_SESSION['placa'] = $placa;
        $veiculo = new Veiculo($placa, $tipo, $marca, $modelo, $cor);
        $veiculoDao = new VeiculoDao();
        $veiculoDao->add($veiculo);
        if ($veiculoDao->entradaVeiculo($veiculo)) {
            header('Location: templateEntrada.php');
        } else {
            header('Location: ../view/semVagas.html');
        }
    }
}
<?php

require_once "../lib/Template.php";
use raelgc\view\Template;
include "../dao/VeiculoDao.php";
include "../lib/sessions.php";
$tipoSession = checkSession();
if (!$tipoSession) {
    header('location: ../view/index.php');
} else {
    if ($tipoSession != "funcionario") {
        header('location: templateMenuAdmin.php');
    }
}
$tpl = new Template("../view/situacaoEstacionamento.html");
$veiculoDao = new VeiculoDao();
$entradas = $veiculoDao->getEntradasAtuais();
foreach ($entradas as $entrada) {
    $tpl->PLACA = $entrada['placa_veiculo'];
    $tpl->ANDAR_ENTRADA = $entrada['andar_vaga'];
    $tpl->NUMERO_ENTRADA = $entrada['numero_vaga'];
    $tpl->HORA = $entrada['hora_entrada'];
    $tpl->TIPO_VEICULO = $entrada['nome'];
    $tpl->block("BLOCK_ESTACIONAMENTO");
}
$vagas = $veiculoDao->getVagasLivres();
if ($vagas) {
    foreach ($vagas as $vaga) {
        $tpl->ANDAR_VAGA = $vaga['andar'];
        $tpl->NUMERO_VAGA = $vaga['numero'];
        $tpl->TIPO_VAGA = $vaga['nome'];
<?php 
error_reporting(E_ALL);
require_once "../lib/Template.php";
use raelgc\view\Template;
include "../dao/VeiculoDao.php";
include "../lib/sessions.php";
$tipoSession = checkSession();
if (!$tipoSession) {
    header('location: ../view/index.php');
} else {
    if ($tipoSession != "funcionario") {
        header('location: templateMenuAdmin.php');
    }
}
$tpl = new Template("../view/entradaVeiculo.html");
$veiculoDao = new VeiculoDao();
$entrada = $veiculoDao->getEntrada($_SESSION['placa']);
$tpl->PLACA = $entrada[0]['placa_veiculo'];
$tpl->HORARIO = $entrada[0]['hora_entrada'];
$tpl->ANDAR = $entrada[0]['andar_vaga'];
$tpl->NUMERO = $entrada[0]['numero_vaga'];
$tpl->show();
<?php

ini_set("error_reporting()", "E_ALL");
error_reporting(E_ALL);
include "../lib/sessions.php";
$tipoSession = checkSession();
if (!$tipoSession) {
    header('location: ../view/index.php');
} else {
    if ($tipoSession != "funcionario") {
        header('location: templateMenuAdmin.php');
    } else {
        $placa = $_POST['placa'];
        include "../dao/VeiculoDao.php";
        $veiculoDao = new VeiculoDao();
        $veiculo = $veiculoDao->getByPlaca($placa);
        $_SESSION['placa'] = $placa;
        if (!is_null($veiculo)) {
            if ($veiculoDao->checaEntrada($placa)) {
                $veiculoDao->saidaVeiculo($veiculo);
                header('Location: templateSaida.php');
            } else {
                if ($veiculoDao->entradaVeiculo($veiculo)) {
                    header('Location: templateEntrada.php');
                } else {
                    header('Location: ../view/semVagas.html');
                }
            }
        } else {
            header('Location: templateCadastroVeiculo.php');
        }
<?php 
require_once "../lib/Template.php";
use raelgc\view\Template;
include "../dao/VeiculoDao.php";
include "../lib/sessions.php";
$tipoSession = checkSession();
if (!$tipoSession) {
    header('location: ../view/index.php');
} else {
    if ($tipoSession != "funcionario") {
        header('location: templateMenuAdmin.php');
    }
}
$tpl = new Template("../view/cadastroVeiculos.html");
$tpl->PLACA = $_SESSION['placa'];
$veiculoDao = new VeiculoDao();
$tipos = $veiculoDao->getTipos();
foreach ($tipos as $t) {
    $tpl->OPTION = $t['id'];
    $tpl->OPTION_NAME = $t['nome'];
    $tpl->block("BLOCK_OPTIONS");
}
$tpl->show();
Пример #6
0
<?php

include "../dao/VeiculoDao.php";
include "../lib/sessions.php";
$tipoSession = checkSession();
if (!$tipoSession) {
    header('location: ../view/index.php');
} else {
    if ($tipoSession == "funcionario") {
        header('location: ../view/menu.php');
    }
}
$veiculoDao = new VeiculoDao();
$veiculoDao->addVaga($_POST['andar'], $_POST['numero'], $_POST['tipos']);
header('location: templateMenuAdmin.php');
<?php

require_once "../lib/Template.php";
use raelgc\view\Template;
include "../dao/VeiculoDao.php";
include "../lib/sessions.php";
$tipoSession = checkSession();
if (!$tipoSession) {
    header('location: ../view/index.php');
} else {
    if ($tipoSession == "funcionario") {
        header('location: ../view/menu.php');
    }
}
$tpl = new Template("../view/menuAdmin.html");
$veiculoDao = new VeiculoDao();
$tabela_precos = $veiculoDao->getPrecos();
if ($tabela_precos) {
    foreach ($tabela_precos as $item) {
        $tpl->NOME_VAGA = $item['nome'];
        $tpl->VALOR_VAGA = $item['valor'];
        $tpl->ID_PRECO = $item['id'];
        $tpl->block("BLOCK_PRECOS");
    }
}
$vagas = $veiculoDao->getVagas();
if ($vagas) {
    foreach ($vagas as $vaga) {
        $tpl->ANDAR_VAGA = $vaga['andar'];
        $tpl->NUMERO_VAGA = $vaga['numero'];
        $tpl->TIPO_VAGA = $vaga['nome'];
<?php

include "../lib/sessions.php";
$tipoSession = checkSession();
if (!$tipoSession) {
    header('location: ../view/index.php');
} else {
    if ($tipoSession == "funcionario") {
        header('location: ../view/menu.php');
    } else {
        include_once "../dao/VeiculoDao.php";
        $veiculoDao = new VeiculoDao();
        $veiculoDao->alteraPreco($_POST['id'], $_POST['preco']);
        header("Location: templateMenuAdmin.php");
    }
}
<?php

error_reporting(E_ALL);
require_once "../lib/Template.php";
use raelgc\view\Template;
include "../dao/VeiculoDao.php";
include "../lib/sessions.php";
$tipoSession = checkSession();
if (!$tipoSession) {
    header('location: ../view/index.php');
} else {
    if ($tipoSession != "funcionario") {
        header('location: templateMenuAdmin.php');
    }
}
$tpl = new Template("../view/saidaVeiculo.html");
$veiculoDao = new VeiculoDao();
$entrada = $veiculoDao->getUltimaSaida($_SESSION['placa']);
$tpl->PLACA = $entrada[0]['placa_veiculo'];
$tpl->HORARIO_ENTRADA = $entrada[0]['hora_entrada'];
$tpl->HORARIO_SAIDA = $entrada[0]['hora_saida'];
$tpl->VALOR = $entrada[0]['valor'];
$tpl->show();