set_data(verificaEditores($editores)); $cp->return_data(); break; case "pegaSistemas": $sis = pegaDados('SELECT * from i3geoadmin_sistemas order by nome_sistema'); for($i=0;$iquery("INSERT INTO i3geoadmin_sistemas (nome_sistema,perfil_sistema) VALUES ('','')"); $dbh = null; return "ok"; } catch (PDOException $e) { return "Error!: " . $e->getMessage(); } } function alterarFuncoes() { global $id_sistema,$id_funcao,$perfil,$nomefuncao,$w,$h,$abrir; try { require_once("conexao.php"); $nomefuncao = mb_convert_encoding($nomefuncao,"UTF-8","ISO-8859-1"); if($id_funcao != "") $dbh->query("UPDATE i3geoadmin_sistemasf SET nome_funcao = '$nomefuncao',perfil_funcao = '$perfil', w_funcao = '$w',h_funcao = '$h', abrir_funcao = '$abrir' WHERE id_sistema = $id_sistema and id_funcao = $id_funcao"); else $dbh->query("INSERT INTO i3geoadmin_sistemasf (id_sistema,nome_funcao,perfil_funcao,w_funcao,h_funcao,abrir_funcao) VALUES ('$id_sistema','','','$w','$h','')"); $dbh = null; return "ok"; } catch (PDOException $e) { return "Error!: " . $e->getMessage(); } } function excluirFuncoes() { global $id; try { include("conexao.php"); $dbh->query("DELETE from i3geoadmin_sistemasf WHERE id_sistema = $id"); $dbh = null; return "ok"; } catch (PDOException $e) { return "Error!: " . $e->getMessage(); } } function excluirSistemas() { global $id; try { include("conexao.php"); $dbh->query("DELETE from i3geoadmin_sistemas WHERE id_sistema = $id"); $dbh = null; return "ok"; } catch (PDOException $e) { return "Error!: " . $e->getMessage(); } } function importarXmlSistemas() { global $xml,$tipo; if(!file_exists($xml)) {return "
Arquivo $xml não encontrado";} include_once("../../classesphp/funcoes_gerais.php"); include("conexao.php"); $xml = simplexml_load_file($xml); // //importa os grupos // $sistemasExistentes = array(); $q = $dbh->query("select * from i3geoadmin_sistemas"); $resultado = $q->fetchAll(); foreach($resultado as $r) {$sistemasExistentes[$r["nome_sistema"]] = 0;} foreach($xml->SISTEMA as $item) { $nome = ixml($item,"NOMESIS"); $perfil = ixml($item,"PERFIL"); if(!isset($sistemasExistentes[$nome])) $dbh->query("INSERT INTO i3geoadmin_sistemas (nome_sistema,perfil_sistema) VALUES ('$nome','$perfil')"); $sistemasExistentes[$nome] = 0; $id_sistema = $dbh->lastInsertId("id_sistema"); foreach ($item->FUNCAO as $funcao) { $abrir_funcao = ixml($funcao,"ABRIR"); $nome_funcao = ixml($funcao,"NOMEFUNCAO"); $w_funcao = ixml($funcao,"JANELAW"); $h_funcao = ixml($funcao,"JANELAH"); $perfil_funcao = ixml($funcao,"PERFIL"); $dbh->query("INSERT INTO i3geoadmin_sistemasf (nome_funcao,abrir_funcao,perfil_funcao,w_funcao,h_funcao,id_sistema) VALUES ('$nome_funcao','$abrir_funcao','$perfil_funcao','$w_funcao','$h_funcao','$id_sistema')"); } } $dbh = null; return "Dados importados."; } function verificaFilhos() { try { global $id; $res = false; $r = pegaDados("select * from i3geoadmin_sistemasf where id_sistema=$id"); if(count($r) > 0) $res = true; return $res; } catch (PDOException $e) { return "Error!: " . $e->getMessage(); } } ?>