<?php include_once '../../includes.sys/ini.php'; include_once '../../includes.sys/metodos.php'; include_once '../DAO/ListagemProjetoDAO.php'; include_once '../ListagemProjeto.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once '../../head.php'; $listagemProjeto = new ListagemProjeto(); $DAO = new ListagemProjetoDao(); //Verifica se a opcao de salvar foi iniciada if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') { $listagemProjeto->setNome(limpaTexto($_POST['nome'])); $listagemProjeto->setUsuario(userId()); $listagemProjeto->setArquivos($_POST['arquivos']); //Verifica se o nome foi preenchido if ($listagemProjeto->getNome() != null || $listagemProjeto->getArquivos() != null) { $retorno = $DAO->Gravar($listagemProjeto); if ($retorno > 0) { $listagemProjeto->setId($retorno); foreach ($listagemProjeto->getArquivos() as $arquivo) { $retorno = $DAO->GravarArquivos($arquivo, userId(), $listagemProjeto->getId()); if ($retorno == false) { break; } } if ($retorno == false) { echo '<script language= "JavaScript">alert("Erro ao cadastrar os documentos");</script>'; } else { echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>'; echo '<script language= "JavaScript">location.href="new.php";</script>';