1,"nome"=>"admin","descricao"=>"admin"); retornaJSON($dados); exit; break; case "PEGADADOSOPERACAO": retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geousr_operacoes WHERE id_operacao = $id_operacao")); exit; break; case "ADICIONAPAPELOPERACOES": adicionaPapelOperacoes(); $dados = pegaDados("SELECT P.id_papel, P.nome, P.descricao, OP.id_operacao FROM ".$esquemaadmin."i3geousr_operacoes AS O JOIN ".$esquemaadmin."i3geousr_operacoespapeis AS OP ON O.id_operacao = OP.id_operacao JOIN ".$esquemaadmin."i3geousr_papeis AS P ON OP.id_papel = P.id_papel WHERE O.id_operacao = $id_operacao AND P.id_papel = $id_papel"); retornaJSON($dados); exit; break; case "EXCLUIRPAPELOPERACAO": excluirPapelOperacao(); retornaJSON("ok"); exit; break; case "LISTAPAPEIS": retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geousr_papeis order by nome")); exit; break; } cpjson($retorno); function alterarOperacoes(){ global $id_operacao,$codigo,$descricao; try{ include(dirname(__FILE__)."/conexao.php"); if($convUTF){ $descricao = utf8_encode($descricao); } if($id_operacao != ""){ $dataCol = array( "codigo" => $codigo, "descricao" => $descricao ); i3GeoAdminUpdate($dbhw,"i3geousr_operacoes",$dataCol,"WHERE id_operacao = $id_operacao"); $retorna = $id_operacao; } else{ $dataCol = array( "descricao" => '' ); $retorna = i3GeoAdminInsertUnico($dbhw,"i3geousr_operacoes",$dataCol,"descricao","id_operacao"); } $dbhw = null; $dbh = null; return $retorna; } catch (PDOException $e){ return "Error!: "; } } function adicionaPapelOperacoes(){ global $id_operacao,$id_papel; try{ include(dirname(__FILE__)."/conexao.php"); $dataCol = array( "id_operacao" => $id_operacao, "id_papel" => $id_papel ); i3GeoAdminInsert($dbhw,"i3geousr_operacoespapeis",$dataCol); $dbhw = null; $dbh = null; return "ok"; } catch (PDOException $e){ return "Error!: "; } } function excluirPapelOperacao(){ global $id_operacao,$id_papel; try{ include(dirname(__FILE__)."/conexao.php"); $sql = "DELETE from ".$esquemaadmin."i3geousr_operacoespapeis WHERE id_operacao = $id_operacao AND id_papel = $id_papel"; $dbhw->query($sql); i3GeoAdminInsertLog($dbhw,$sql); $dbhw = null; $dbh = null; return "ok"; } catch (PDOException $e){ return "Error!: "; } } ?>