Commit fdda87850fd74c282c2ba58db2642e496088e835

Authored by Edmar Moretti
1 parent dd4db11e

Inclusão doprograma para geração do XML para montagem da árvorehiperbolica

Showing 2 changed files with 101 additions and 1 deletions   Show diff stats
admin/hiperbolica.php 0 → 100644
... ... @@ -0,0 +1,100 @@
  1 +<?php
  2 +error_reporting(E_ALL);
  3 +$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
  4 +$xml .= "<capa>";
  5 +include("../ms_configura.php");
  6 +include("$locaplic/admin/php/admin.php");
  7 +$menus = pegaDados("SELECT * from i3geoadmin_menus order by nome_menu ",$locaplic);
  8 +$xml .= '<termo id="00" nome="i3Geo">';
  9 +$contador = 0;
  10 +$xml .= '<item id="'.$contador.'" tipo="TE1" nome="Menus" familia="1" /> '."\n";
  11 +foreach ($menus as $menu)
  12 +{
  13 + $id = $menu["id_menu"];
  14 + $nome = str_replace("&","&amp;",$menu["nome_menu"]);
  15 + $xml .= '<item id="'.$contador.'" tipo="TE2" nome="'.$nome.'" familia="'.$id.'" /> '."\n";
  16 + $grupos = pegaDados("select i3geoadmin_grupos.nome_grupo,id_n1,id_menu from i3geoadmin_n1 LEFT JOIN i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo where id_menu='$id' order by ordem",$locaplic);
  17 + for($i=0;$i < count($grupos);++$i)
  18 + {
  19 + $contador++;
  20 + $nome = str_replace("&","&amp;",$grupos[$i]["nome_grupo"]);
  21 + $idgrupo = $grupos[$i]["id_n1"];
  22 + $xml .= '<item id="'.$contador.'" tipo="TE3" nome="'.$nome.'" familia="'.$id.'" /> '."\n";
  23 + $subgrupos = pegaDados("select i3geoadmin_subgrupos.nome_subgrupo,i3geoadmin_n2.id_n2 from i3geoadmin_n2 LEFT JOIN i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo where i3geoadmin_n2.id_n1='$idgrupo' order by ordem",$locaplic);
  24 + for($j=0;$j < count($subgrupos);++$j)
  25 + {
  26 + $contador++;
  27 + $nome = str_replace("&","&amp;",$subgrupos[$j]["nome_subgrupo"]);
  28 + $xml .= '<item id="'.$contador.'" tipo="TE4" nome="'.$nome.'" familia="'.$id.'" /> '."\n";
  29 + $id_n2 = $subgrupos[$j]["id_n2"];
  30 + $temas = pegaDados("select i3geoadmin_temas.tags_tema,i3geoadmin_temas.nome_tema,i3geoadmin_n3.id_n3 from i3geoadmin_n3 LEFT JOIN i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema where i3geoadmin_n3.id_n2='$id_n2' order by ordem",$locaplic);
  31 + for($k=0;$k < count($temas);++$k)
  32 + {
  33 + $contador++;
  34 + $nome = str_replace("&","&amp;",$temas[$k]["nome_tema"]);
  35 + $xml .= '<item id="'.$contador.'" tipo="TE5" nome="'.$nome.'" familia="'.$id.'" /> '."\n";
  36 + $tags = explode(" ",$temas[$k]["tags_tema"]);
  37 + foreach($tags as $tag)
  38 + {
  39 + $contador++;
  40 + $tag = str_replace("&","&amp;",$tag);
  41 + if($tag != "")
  42 + $xml .= '<item id="'.$contador.'" tipo="TE6" nome="'.$tag.'" familia="'.$id.'" /> '."\n";
  43 + }
  44 + }
  45 + }
  46 + }
  47 +}
  48 +$contador++;
  49 +$id = $contador;
  50 +$xml .= '<item id="'.$contador.'" tipo="TE1" nome="GRUPOS" familia="2" /> '."\n";
  51 +$grupos = pegaDados("select i3geoadmin_grupos.nome_grupo,id_n1,id_menu from i3geoadmin_n1 LEFT JOIN i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo order by ordem",$locaplic);
  52 +for($i=0;$i < count($grupos);++$i)
  53 +{
  54 + $contador++;
  55 + $nome = str_replace("&","&amp;",$grupos[$i]["nome_grupo"]);
  56 + $idgrupo = $grupos[$i]["id_n1"];
  57 + $xml .= '<item id="'.$contador.'" tipo="TE2" nome="'.$nome.'" familia="'.$id.'" /> '."\n";
  58 + $temastag = pegaDados("select d.tags_tema as tags,d.id_tema as tema from i3geoadmin_n2 as b,i3geoadmin_n1 as a,i3geoadmin_n3 as c,i3geoadmin_temas as d where a.id_grupo = '$idgrupo' and a.id_n1 = b.id_n1 and c.id_n2 = b.id_n2 and c.id_tema = d.id_tema group by tema",$locaplic);
  59 + $arrayTag = array();
  60 + foreach($temastag as $tematag)
  61 + {
  62 + $arrayTag = array_merge($arrayTag,explode(" ",$tematag["tags"]));
  63 + }
  64 + $arrayTag = array_unique($arrayTag);
  65 + //var_dump($arrayTag);
  66 + foreach($arrayTag as $tag)
  67 + {
  68 + $tag = str_replace("&","&amp;",$tag);
  69 + $contador++;
  70 + if($tag != "")
  71 + $xml .= '<item id="'.$contador.'" tipo="TE3" nome="'.$tag.'" familia="'.$id.'" /> '."\n";
  72 + }
  73 +}
  74 +$id = $contador;
  75 +$xml .= '<item id="'.$contador.'" tipo="TE1" nome="Web Services" familia="3" /> '."\n";
  76 +$tipos = pegaDados("select tipo_ws from i3geoadmin_ws group by tipo_ws",$locaplic);
  77 +foreach ($tipos as $tipo)
  78 +{
  79 + $contador++;
  80 + $xml .= '<item id="'.$contador.'" tipo="TE2" nome="'.$tipo["tipo_ws"].'" familia="'.$id.'" /> '."\n";
  81 + $ws = pegaDados("select nome_ws from i3geoadmin_ws where tipo_ws = '".$tipo["tipo_ws"]."'",$locaplic);
  82 + foreach($ws as $w)
  83 + {
  84 + $contador++;
  85 + $nome = str_replace("&","&amp;",$w["nome_ws"]);
  86 + if($nome != "")
  87 + $xml .= '<item id="'.$contador.'" tipo="TE3" nome="'.$nome.'" familia="'.$tipo["tipo_ws"].'" /> '."\n";
  88 + }
  89 +}
  90 +
  91 +
  92 +$xml .= "</termo>";
  93 +$xml .= "</capa>";
  94 +//header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
  95 +//header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
  96 +//header('Cache-Control: no-cache, must-revalidate');
  97 +//header('Pragma: no-cache');
  98 +header("Content-type: text/xml; charset=ISO-8859-1");
  99 +echo $xml;
  100 +?>
... ...
admin/index.html
... ... @@ -182,7 +182,7 @@ que por sua vez contém temas.&lt;/p&gt;
182 182 <tr onclick="abre('xmlservicosws.php')"><td><div class=aplicar ></div></td><td>Ver xml com a lista de serviços WS (webservices convencionais)</td></tr>
183 183 <tr onclick="abre('xmlsistemas.php')"><td><div class=aplicar ></div></td><td>Ver xml com a lista de sistemas que adicionam temas especiais</td></tr>
184 184 <tr onclick="abre('rssgrupos.php')"><td><div class=aplicar ></div></td><td>Ver RSS com os grupos, subgrupos e temas</td></tr>
185   -
  185 +<tr onclick="abre('hiperbolica.php')"><td><div class=aplicar ></div></td><td>Ver XML para árvorehiperbólica</td></tr>
186 186 </table>
187 187 </fieldset>
188 188 <br>
... ...