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 { $msg = utf8_encode("O Código deve ser alfanumérico"); echo '<script language= "JavaScript">alert("' . $msg . '");</script>'; } } ?> <!-- topbar ends --> <div class="container-fluid">