Beispiel #1
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/FasesProjetoDAO.php';
include_once '../FasesProjeto.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
$acesso = listarAcesso();
if (!in_array(125, $acesso)) {
    echo '<script language= "JavaScript">location.href="' . EXTERNAL_ROOT_PORTAL . '/projeto/documentos/fase_projeto.php";</script>';
}
$DAO = new FasesProjetoDAO();
$fasesProjeto = new FasesProjeto();
//Verifica se foi executado a acao de salvar
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') {
    $id = limpaTexto($_POST['id']);
    $fasesProjeto->setNome(limpaTexto($_POST['nome']));
    $fasesProjeto->setCodigo(limpaTexto($_POST['codigo']));
    $fasesProjeto->setId($id);
    $nome = $fasesProjeto->getNome();
    if (!preg_match("/[0-9]/", $fasesProjeto->getCodigo())) {
        //Verifica se o nome esta em branco
        if ($fasesProjeto->getNome() != "" && $fasesProjeto->getCodigo() != "") {
            $retorno = $DAO->Atualizar($fasesProjeto);
            if ($retorno == true) {
                echo '<script language= "JavaScript">alert("Registro alterado com sucesso");</script>';
                echo '<script language= "JavaScript">location.href="index.php";</script>';
            } else {
                echo $retorno . 'asdasd';
            }
Beispiel #2
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/FasesProjetoDAO.php';
include_once '../FasesProjeto.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
$acesso = listarAcesso();
if (!in_array(124, $acesso)) {
    echo '<script language= "JavaScript">location.href="' . EXTERNAL_ROOT_PORTAL . '/projeto/documentos/fase_projeto.php";</script>';
}
//Verifica se a opcao de salvar foi iniciada
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') {
    $fasesProjeto = new FasesProjeto();
    $DAO = new FasesProjetoDAO();
    $fasesProjeto->setNome(limpaTexto($_POST['nome']));
    $fasesProjeto->setCodigo(strtoupper(limpaTexto($_POST['codigo'])));
    $fasesProjeto->setUsuario(userId());
    //Verifica se o nome foi preenchido
    if (!preg_match("/[0-9]/", $fasesProjeto->getCodigo())) {
        if ($fasesProjeto->getNome() != "" && $fasesProjeto->getCodigo() != "") {
            $retorno = $DAO->Gravar($fasesProjeto);
            if ($retorno == true) {
                echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>';
                echo '<script language= "JavaScript">location.href="new.php";</script>';
            }
        } else {
            echo '<script language= "JavaScript">alert("Preencha o(s) campo(s)");</script>';
        }
    } else {