include_once '../../includes.sys/ini.php'; include_once '../../includes.sys/metodos.php'; include_once '../DAO/FuncionalidadeDAO.php'; include_once '../Funcionalidade.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once '../../head.php'; $funcionalidade = new Funcionalidade(); $DAO = new FuncionalidadeDAO(); $funcionalidade->setId(limpaTexto($_GET['id'])); // Verifica se a opcao de salvar foi iniciada if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') { // Verifica se o campo nome foi digitado if (!empty($_POST['nome'])) { $funcionalidade->setNome(limpaTexto($_POST['nome'])); $funcionalidade->setUsuario(userId()); $retorno = $DAO->Atualizar($funcionalidade); if ($retorno == true) { echo '<script language= "JavaScript">alert("Funcionalidade alterada com sucesso");</script>'; echo '<script language= "JavaScript">location.href="index.php";</script>'; } else { print_r($retorno); } } } else { $retorno = $DAO->Listar("SELECT * FROM " . MYSQL_BASE_FUNCIONALIDADES . " WHERE ativo='S' AND id=" . $funcionalidade->getId()); if ($retorno) { foreach ($retorno as $item) { $funcionalidade->setNome($item['nome']); } } else {