Commit dd7da5bf545b48de57b743aff442dfc5b8b586dd
1 parent
23fef579
Exists in
master
Refactoring para coding standards do CRUD de cadastro de bairro (Endereçamento > Bairro)
Showing
3 changed files
with
457 additions
and
414 deletions
Show diff stats
ieducar/intranet/public_bairro_cad.php
@@ -20,14 +20,12 @@ | @@ -20,14 +20,12 @@ | ||
20 | * com este programa; se não, escreva para a Free Software Foundation, Inc., no | 20 | * com este programa; se não, escreva para a Free Software Foundation, Inc., no |
21 | * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | 21 | * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
22 | * | 22 | * |
23 | - * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
24 | - * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | ||
25 | - * @package Core | ||
26 | - * @subpackage public | ||
27 | - * @subpackage Enderecamento | ||
28 | - * @subpackage Bairro | ||
29 | - * @since Arquivo disponível desde a versão 1.0.0 | ||
30 | - * @version $Id$ | 23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> |
24 | + * @category i-Educar | ||
25 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | ||
26 | + * @package Ied_Public | ||
27 | + * @since Arquivo disponível desde a versão 1.0.0 | ||
28 | + * @version $Id$ | ||
31 | */ | 29 | */ |
32 | 30 | ||
33 | require_once 'include/clsBase.inc.php'; | 31 | require_once 'include/clsBase.inc.php'; |
@@ -35,15 +33,35 @@ require_once 'include/clsCadastro.inc.php'; | @@ -35,15 +33,35 @@ require_once 'include/clsCadastro.inc.php'; | ||
35 | require_once 'include/clsBanco.inc.php'; | 33 | require_once 'include/clsBanco.inc.php'; |
36 | require_once 'include/public/geral.inc.php'; | 34 | require_once 'include/public/geral.inc.php'; |
37 | 35 | ||
36 | +/** | ||
37 | + * clsIndexBase class. | ||
38 | + * | ||
39 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
40 | + * @category i-Educar | ||
41 | + * @license @@license@@ | ||
42 | + * @package iEd_Public | ||
43 | + * @since Classe disponível desde a versão 1.0.0 | ||
44 | + * @version @@package_version@@ | ||
45 | + */ | ||
38 | class clsIndexBase extends clsBase | 46 | class clsIndexBase extends clsBase |
39 | { | 47 | { |
40 | function Formular() | 48 | function Formular() |
41 | { | 49 | { |
42 | $this->SetTitulo($this->_instituicao . ' Bairro'); | 50 | $this->SetTitulo($this->_instituicao . ' Bairro'); |
43 | - $this->processoAp = '756'; | 51 | + $this->processoAp = 756; |
44 | } | 52 | } |
45 | } | 53 | } |
46 | 54 | ||
55 | +/** | ||
56 | + * indice class. | ||
57 | + * | ||
58 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
59 | + * @category i-Educar | ||
60 | + * @license @@license@@ | ||
61 | + * @package iEd_Public | ||
62 | + * @since Classe disponível desde a versão 1.0.0 | ||
63 | + * @version @@package_version@@ | ||
64 | + */ | ||
47 | class indice extends clsCadastro | 65 | class indice extends clsCadastro |
48 | { | 66 | { |
49 | /** | 67 | /** |
@@ -79,7 +97,7 @@ class indice extends clsCadastro | @@ -79,7 +97,7 @@ class indice extends clsCadastro | ||
79 | 97 | ||
80 | if (is_numeric($this->idbai)) { | 98 | if (is_numeric($this->idbai)) { |
81 | $obj_bairro = new clsPublicBairro(); | 99 | $obj_bairro = new clsPublicBairro(); |
82 | - $lst_bairro = $obj_bairro->lista( NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 100 | + $lst_bairro = $obj_bairro->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
83 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->idbai); | 101 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->idbai); |
84 | if ($lst_bairro) { | 102 | if ($lst_bairro) { |
85 | $registro = $lst_bairro[0]; | 103 | $registro = $lst_bairro[0]; |
@@ -176,7 +194,7 @@ class indice extends clsCadastro | @@ -176,7 +194,7 @@ class indice extends clsCadastro | ||
176 | $this->pessoa_logada = $_SESSION['id_pessoa']; | 194 | $this->pessoa_logada = $_SESSION['id_pessoa']; |
177 | session_write_close(); | 195 | session_write_close(); |
178 | 196 | ||
179 | - $obj = new clsPublicBairro( $this->idmun, NULL, NULL, $this->nome, NULL, | 197 | + $obj = new clsPublicBairro($this->idmun, NULL, NULL, $this->nome, NULL, |
180 | NULL, 'U', $this->pessoa_logada, NULL, 'I', NULL, 9); | 198 | NULL, 'U', $this->pessoa_logada, NULL, 'I', NULL, 9); |
181 | 199 | ||
182 | $cadastrou = $obj->cadastra(); | 200 | $cadastrou = $obj->cadastra(); |
@@ -240,15 +258,15 @@ $pagina = new clsIndexBase(); | @@ -240,15 +258,15 @@ $pagina = new clsIndexBase(); | ||
240 | // Instancia objeto de conteúdo | 258 | // Instancia objeto de conteúdo |
241 | $miolo = new indice(); | 259 | $miolo = new indice(); |
242 | 260 | ||
243 | -// Atribui o conteúdo à página | 261 | +// Atribui o conteúdo à página |
244 | $pagina->addForm($miolo); | 262 | $pagina->addForm($miolo); |
245 | 263 | ||
246 | // Gera o código HTML | 264 | // Gera o código HTML |
247 | $pagina->MakeAll(); | 265 | $pagina->MakeAll(); |
248 | ?> | 266 | ?> |
249 | - | ||
250 | <script type='text/javascript'> | 267 | <script type='text/javascript'> |
251 | -document.getElementById('idpais').onchange = function() { | 268 | +document.getElementById('idpais').onchange = function() |
269 | +{ | ||
252 | var campoPais = document.getElementById('idpais').value; | 270 | var campoPais = document.getElementById('idpais').value; |
253 | 271 | ||
254 | var campoUf= document.getElementById('sigla_uf'); | 272 | var campoUf= document.getElementById('sigla_uf'); |
@@ -260,7 +278,8 @@ document.getElementById('idpais').onchange = function() { | @@ -260,7 +278,8 @@ document.getElementById('idpais').onchange = function() { | ||
260 | xml_uf.envia('public_uf_xml.php?pais=' + campoPais); | 278 | xml_uf.envia('public_uf_xml.php?pais=' + campoPais); |
261 | } | 279 | } |
262 | 280 | ||
263 | -function getUf(xml_uf) { | 281 | +function getUf(xml_uf) |
282 | +{ | ||
264 | var campoUf = document.getElementById('sigla_uf'); | 283 | var campoUf = document.getElementById('sigla_uf'); |
265 | var DOM_array = xml_uf.getElementsByTagName('estado'); | 284 | var DOM_array = xml_uf.getElementsByTagName('estado'); |
266 | 285 | ||
@@ -279,7 +298,8 @@ function getUf(xml_uf) { | @@ -279,7 +298,8 @@ function getUf(xml_uf) { | ||
279 | } | 298 | } |
280 | } | 299 | } |
281 | 300 | ||
282 | -document.getElementById('sigla_uf').onchange = function() { | 301 | +document.getElementById('sigla_uf').onchange = function() |
302 | +{ | ||
283 | var campoUf = document.getElementById('sigla_uf').value; | 303 | var campoUf = document.getElementById('sigla_uf').value; |
284 | 304 | ||
285 | var campoMunicipio= document.getElementById('idmun'); | 305 | var campoMunicipio= document.getElementById('idmun'); |
@@ -291,7 +311,8 @@ document.getElementById('sigla_uf').onchange = function() { | @@ -291,7 +311,8 @@ document.getElementById('sigla_uf').onchange = function() { | ||
291 | xml_municipio.envia('public_municipio_xml.php?uf=' + campoUf); | 311 | xml_municipio.envia('public_municipio_xml.php?uf=' + campoUf); |
292 | } | 312 | } |
293 | 313 | ||
294 | -function getMunicipio(xml_municipio) { | 314 | +function getMunicipio(xml_municipio) |
315 | +{ | ||
295 | var campoMunicipio = document.getElementById('idmun'); | 316 | var campoMunicipio = document.getElementById('idmun'); |
296 | var DOM_array = xml_municipio.getElementsByTagName('municipio'); | 317 | var DOM_array = xml_municipio.getElementsByTagName('municipio'); |
297 | 318 | ||
@@ -309,5 +330,4 @@ function getMunicipio(xml_municipio) { | @@ -309,5 +330,4 @@ function getMunicipio(xml_municipio) { | ||
309 | campoMunicipio.options[0].text = 'O estado não possui nenhum município'; | 330 | campoMunicipio.options[0].text = 'O estado não possui nenhum município'; |
310 | } | 331 | } |
311 | } | 332 | } |
312 | - | ||
313 | </script> | 333 | </script> |
314 | \ No newline at end of file | 334 | \ No newline at end of file |
ieducar/intranet/public_bairro_det.php
1 | <?php | 1 | <?php |
2 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
3 | - * * | ||
4 | - * @author Prefeitura Municipal de Itajaí * | ||
5 | - * @updated 29/03/2007 * | ||
6 | - * Pacote: i-PLB Software Público Livre e Brasileiro * | ||
7 | - * * | ||
8 | - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | ||
9 | - * ctima@itajai.sc.gov.br * | ||
10 | - * * | ||
11 | - * Este programa é software livre, você pode redistribuí-lo e/ou * | ||
12 | - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | ||
13 | - * publicada pela Free Software Foundation, tanto a versão 2 da * | ||
14 | - * Licença como (a seu critério) qualquer versão mais nova. * | ||
15 | - * * | ||
16 | - * Este programa é distribuído na expectativa de ser útil, mas SEM * | ||
17 | - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | ||
18 | - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | ||
19 | - * sulte a Licença Pública Geral GNU para obter mais detalhes. * | ||
20 | - * * | ||
21 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU * | ||
22 | - * junto com este programa. Se não, escreva para a Free Software * | ||
23 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | ||
24 | - * 02111-1307, USA. * | ||
25 | - * * | ||
26 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
27 | -require_once ("include/clsBase.inc.php"); | ||
28 | -require_once ("include/clsDetalhe.inc.php"); | ||
29 | -require_once ("include/clsBanco.inc.php"); | ||
30 | -require_once( "include/public/geral.inc.php" ); | ||
31 | 2 | ||
3 | +/** | ||
4 | + * i-Educar - Sistema de gestão escolar | ||
5 | + * | ||
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | ||
7 | + * <ctima@itajai.sc.gov.br> | ||
8 | + * | ||
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | ||
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | ||
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | ||
12 | + * qualquer versão posterior. | ||
13 | + * | ||
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | ||
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | ||
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | ||
17 | + * do GNU para mais detalhes. | ||
18 | + * | ||
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | ||
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | ||
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
22 | + * | ||
23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
24 | + * @category i-Educar | ||
25 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | ||
26 | + * @package Ied_Public | ||
27 | + * @since Arquivo disponível desde a versão 1.0.0 | ||
28 | + * @version $Id$ | ||
29 | + */ | ||
30 | + | ||
31 | +require_once 'include/clsBase.inc.php'; | ||
32 | +require_once 'include/clsDetalhe.inc.php'; | ||
33 | +require_once 'include/clsBanco.inc.php'; | ||
34 | +require_once 'include/public/geral.inc.php'; | ||
35 | + | ||
36 | +/** | ||
37 | + * clsIndexBase class. | ||
38 | + * | ||
39 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
40 | + * @category i-Educar | ||
41 | + * @license @@license@@ | ||
42 | + * @package iEd_Public | ||
43 | + * @since Classe disponível desde a versão 1.0.0 | ||
44 | + * @version @@package_version@@ | ||
45 | + */ | ||
32 | class clsIndexBase extends clsBase | 46 | class clsIndexBase extends clsBase |
33 | { | 47 | { |
34 | - function Formular() | ||
35 | - { | ||
36 | - $this->SetTitulo( "{$this->_instituicao} Bairro" ); | ||
37 | - $this->processoAp = "756"; | ||
38 | - } | 48 | + function Formular() |
49 | + { | ||
50 | + $this->SetTitulo($this->_instituicao . ' Bairro'); | ||
51 | + $this->processoAp = 756; | ||
52 | + } | ||
39 | } | 53 | } |
40 | 54 | ||
55 | +/** | ||
56 | + * indice class. | ||
57 | + * | ||
58 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
59 | + * @category i-Educar | ||
60 | + * @license @@license@@ | ||
61 | + * @package iEd_Public | ||
62 | + * @since Classe disponível desde a versão 1.0.0 | ||
63 | + * @version @@package_version@@ | ||
64 | + */ | ||
41 | class indice extends clsDetalhe | 65 | class indice extends clsDetalhe |
42 | { | 66 | { |
43 | - /** | ||
44 | - * Titulo no topo da pagina | ||
45 | - * | ||
46 | - * @var int | ||
47 | - */ | ||
48 | - var $titulo; | ||
49 | - | ||
50 | - var $idmun; | ||
51 | - var $geom; | ||
52 | - var $idbai; | ||
53 | - var $nome; | ||
54 | - var $idpes_rev; | ||
55 | - var $data_rev; | ||
56 | - var $origem_gravacao; | ||
57 | - var $idpes_cad; | ||
58 | - var $data_cad; | ||
59 | - var $operacao; | ||
60 | - var $idsis_rev; | ||
61 | - var $idsis_cad; | ||
62 | - | ||
63 | - function Gerar() | ||
64 | - { | ||
65 | - @session_start(); | ||
66 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
67 | - session_write_close(); | ||
68 | - | ||
69 | - $this->titulo = "Bairro - Detalhe"; | ||
70 | - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | ||
71 | - | ||
72 | - $this->idbai=$_GET["idbai"]; | ||
73 | - | ||
74 | - $tmp_obj = new clsPublicBairro(); | ||
75 | - $lst_bairro = $tmp_obj->lista( null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, $this->idbai ); | ||
76 | - | ||
77 | - if( ! $lst_bairro ) | ||
78 | - { | ||
79 | - header( "location: public_bairro_lst.php" ); | ||
80 | - die(); | ||
81 | - } | ||
82 | - else | ||
83 | - { | ||
84 | - $registro = $lst_bairro[0]; | ||
85 | - } | ||
86 | - | ||
87 | - | ||
88 | - if( $registro["nome"] ) | ||
89 | - { | ||
90 | - $this->addDetalhe( array( "Nome", "{$registro["nome"]}") ); | ||
91 | - } | ||
92 | - if( $registro["nm_municipio"] ) | ||
93 | - { | ||
94 | - $this->addDetalhe( array( "Município", "{$registro["nm_municipio"]}") ); | ||
95 | - } | ||
96 | - if( $registro["nm_estado"] ) | ||
97 | - { | ||
98 | - $this->addDetalhe( array( "Estado", "{$registro["nm_estado"]}") ); | ||
99 | - } | ||
100 | - if( $registro["nm_pais"] ) | ||
101 | - { | ||
102 | - $this->addDetalhe( array( "Pais", "{$registro["nm_pais"]}") ); | ||
103 | - } | ||
104 | - if( $registro["origem_gravacao"] ) | ||
105 | - { | ||
106 | - $this->addDetalhe( array( "Origem Gravacão", "{$registro["origem_gravacao"]}") ); | ||
107 | - } | ||
108 | - if( $registro["operacao"] ) | ||
109 | - { | ||
110 | - $this->addDetalhe( array( "Operacão", "{$registro["operacao"]}") ); | ||
111 | - } | ||
112 | - | ||
113 | - | ||
114 | - $this->url_novo = "public_bairro_cad.php"; | ||
115 | - $this->url_editar = "public_bairro_cad.php?idbai={$registro["idbai"]}"; | ||
116 | - | ||
117 | - $this->url_cancelar = "public_bairro_lst.php"; | ||
118 | - $this->largura = "100%"; | ||
119 | - } | 67 | + var $titulo; |
68 | + | ||
69 | + var $idmun; | ||
70 | + var $geom; | ||
71 | + var $idbai; | ||
72 | + var $nome; | ||
73 | + var $idpes_rev; | ||
74 | + var $data_rev; | ||
75 | + var $origem_gravacao; | ||
76 | + var $idpes_cad; | ||
77 | + var $data_cad; | ||
78 | + var $operacao; | ||
79 | + var $idsis_rev; | ||
80 | + var $idsis_cad; | ||
81 | + | ||
82 | + function Gerar() | ||
83 | + { | ||
84 | + @session_start(); | ||
85 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
86 | + session_write_close(); | ||
87 | + | ||
88 | + $this->titulo = 'Bairro - Detalhe'; | ||
89 | + $this->addBanner('imagens/nvp_top_intranet.jpg', | ||
90 | + 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | ||
91 | + | ||
92 | + $this->idbai = $_GET['idbai']; | ||
93 | + | ||
94 | + $tmp_obj = new clsPublicBairro(); | ||
95 | + $lst_bairro = $tmp_obj->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
96 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->idbai); | ||
97 | + | ||
98 | + if (! $lst_bairro) { | ||
99 | + header('Location: public_bairro_lst.php'); | ||
100 | + die(); | ||
101 | + } | ||
102 | + else { | ||
103 | + $registro = $lst_bairro[0]; | ||
104 | + } | ||
105 | + | ||
106 | + if ($registro['nome']) { | ||
107 | + $this->addDetalhe(array('Nome', $registro['nome'])); | ||
108 | + } | ||
109 | + | ||
110 | + if ($registro['nm_municipio']) { | ||
111 | + $this->addDetalhe(array("Município", $registro['nm_municipio'])); | ||
112 | + } | ||
113 | + | ||
114 | + if ($registro['nm_estado']) { | ||
115 | + $this->addDetalhe(array('Estado', $registro['nm_estado'])); | ||
116 | + } | ||
117 | + | ||
118 | + if ($registro['nm_pais']) { | ||
119 | + $this->addDetalhe(array('Pais', $registro['nm_pais'])); | ||
120 | + } | ||
121 | + | ||
122 | + if ($registro['origem_gravacao']) { | ||
123 | + $this->addDetalhe(array('Origem Gravação', $registro['origem_gravacao'])); | ||
124 | + } | ||
125 | + | ||
126 | + if ($registro['operacao']) { | ||
127 | + $this->addDetalhe(array('Operação', $registro['operacao'])); | ||
128 | + } | ||
129 | + | ||
130 | + $this->url_novo = 'public_bairro_cad.php'; | ||
131 | + $this->url_editar = 'public_bairro_cad.php?idbai=' . $registro['idbai']; | ||
132 | + | ||
133 | + $this->url_cancelar = 'public_bairro_lst.php'; | ||
134 | + $this->largura = '100%'; | ||
135 | + } | ||
120 | } | 136 | } |
121 | 137 | ||
122 | -// cria uma extensao da classe base | 138 | +// Instancia objeto de página |
123 | $pagina = new clsIndexBase(); | 139 | $pagina = new clsIndexBase(); |
124 | -// cria o conteudo | 140 | + |
141 | +// Instancia objeto de conteúdo | ||
125 | $miolo = new indice(); | 142 | $miolo = new indice(); |
126 | -// adiciona o conteudo na clsBase | ||
127 | -$pagina->addForm( $miolo ); | ||
128 | -// gera o html | ||
129 | -$pagina->MakeAll(); | ||
130 | -?> | ||
131 | \ No newline at end of file | 143 | \ No newline at end of file |
144 | + | ||
145 | +// Atribui o conteúdo à página | ||
146 | +$pagina->addForm($miolo); | ||
147 | + | ||
148 | +// Gera o código HTML | ||
149 | +$pagina->MakeAll(); | ||
132 | \ No newline at end of file | 150 | \ No newline at end of file |
ieducar/intranet/public_bairro_lst.php
1 | <?php | 1 | <?php |
2 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
3 | - * * | ||
4 | - * @author Prefeitura Municipal de Itajaí * | ||
5 | - * @updated 29/03/2007 * | ||
6 | - * Pacote: i-PLB Software Público Livre e Brasileiro * | ||
7 | - * * | ||
8 | - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | ||
9 | - * ctima@itajai.sc.gov.br * | ||
10 | - * * | ||
11 | - * Este programa é software livre, você pode redistribuí-lo e/ou * | ||
12 | - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | ||
13 | - * publicada pela Free Software Foundation, tanto a versão 2 da * | ||
14 | - * Licença como (a seu critério) qualquer versão mais nova. * | ||
15 | - * * | ||
16 | - * Este programa é distribuído na expectativa de ser útil, mas SEM * | ||
17 | - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | ||
18 | - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | ||
19 | - * sulte a Licença Pública Geral GNU para obter mais detalhes. * | ||
20 | - * * | ||
21 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU * | ||
22 | - * junto com este programa. Se não, escreva para a Free Software * | ||
23 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | ||
24 | - * 02111-1307, USA. * | ||
25 | - * * | ||
26 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
27 | -require_once ("include/clsBase.inc.php"); | ||
28 | -require_once ("include/clsListagem.inc.php"); | ||
29 | -require_once ("include/clsBanco.inc.php"); | ||
30 | -require_once( "include/public/geral.inc.php" ); | ||
31 | 2 | ||
3 | +/** | ||
4 | + * i-Educar - Sistema de gestão escolar | ||
5 | + * | ||
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | ||
7 | + * <ctima@itajai.sc.gov.br> | ||
8 | + * | ||
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | ||
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | ||
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | ||
12 | + * qualquer versão posterior. | ||
13 | + * | ||
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | ||
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | ||
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | ||
17 | + * do GNU para mais detalhes. | ||
18 | + * | ||
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | ||
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | ||
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
22 | + * | ||
23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
24 | + * @category i-Educar | ||
25 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | ||
26 | + * @package Ied_Public | ||
27 | + * @since Arquivo disponível desde a versão 1.0.0 | ||
28 | + * @version $Id$ | ||
29 | + */ | ||
30 | + | ||
31 | +require_once 'include/clsBase.inc.php'; | ||
32 | +require_once 'include/clsListagem.inc.php'; | ||
33 | +require_once 'include/clsBanco.inc.php'; | ||
34 | +require_once 'include/public/geral.inc.php'; | ||
35 | + | ||
36 | +/** | ||
37 | + * clsIndexBase class. | ||
38 | + * | ||
39 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
40 | + * @category i-Educar | ||
41 | + * @license @@license@@ | ||
42 | + * @package iEd_Public | ||
43 | + * @since Classe disponível desde a versão 1.0.0 | ||
44 | + * @version @@package_version@@ | ||
45 | + */ | ||
32 | class clsIndexBase extends clsBase | 46 | class clsIndexBase extends clsBase |
33 | { | 47 | { |
34 | - function Formular() | ||
35 | - { | ||
36 | - $this->SetTitulo( "{$this->_instituicao} Bairro" ); | ||
37 | - $this->processoAp = "756"; | ||
38 | - } | 48 | + function Formular() |
49 | + { | ||
50 | + $this->SetTitulo($this->_instituicao . ' Bairro'); | ||
51 | + $this->processoAp = 756; | ||
52 | + } | ||
39 | } | 53 | } |
40 | 54 | ||
55 | +/** | ||
56 | + * indice class. | ||
57 | + * | ||
58 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
59 | + * @category i-Educar | ||
60 | + * @license @@license@@ | ||
61 | + * @package iEd_Public | ||
62 | + * @since Classe disponível desde a versão 1.0.0 | ||
63 | + * @version @@package_version@@ | ||
64 | + */ | ||
41 | class indice extends clsListagem | 65 | class indice extends clsListagem |
42 | { | 66 | { |
43 | - /** | ||
44 | - * Referencia pega da session para o idpes do usuario atual | ||
45 | - * | ||
46 | - * @var int | ||
47 | - */ | ||
48 | - var $__pessoa_logada; | ||
49 | - | ||
50 | - /** | ||
51 | - * Titulo no topo da pagina | ||
52 | - * | ||
53 | - * @var int | ||
54 | - */ | ||
55 | - var $__titulo; | ||
56 | - | ||
57 | - /** | ||
58 | - * Quantidade de registros a ser apresentada em cada pagina | ||
59 | - * | ||
60 | - * @var int | ||
61 | - */ | ||
62 | - var $__limite; | ||
63 | - | ||
64 | - /** | ||
65 | - * Inicio dos registros a serem exibidos (limit) | ||
66 | - * | ||
67 | - * @var int | ||
68 | - */ | ||
69 | - var $__offset; | ||
70 | - | ||
71 | - var $idmun; | ||
72 | - var $geom; | ||
73 | - var $idbai; | ||
74 | - var $nome; | ||
75 | - var $idpes_rev; | ||
76 | - var $data_rev; | ||
77 | - var $origem_gravacao; | ||
78 | - var $idpes_cad; | ||
79 | - var $data_cad; | ||
80 | - var $operacao; | ||
81 | - var $idsis_rev; | ||
82 | - var $idsis_cad; | ||
83 | - | ||
84 | - var $idpais; | ||
85 | - var $sigla_uf; | ||
86 | - | ||
87 | - function Gerar() | ||
88 | - { | ||
89 | - @session_start(); | ||
90 | - $this->__pessoa_logada = $_SESSION['id_pessoa']; | ||
91 | - session_write_close(); | ||
92 | - | ||
93 | - $this->__titulo = "Bairro - Listagem"; | ||
94 | - | ||
95 | - foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto | ||
96 | - $this->$var = ( $val === "" ) ? null: $val; | ||
97 | - | ||
98 | - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | ||
99 | - | ||
100 | - $this->addCabecalhos( array( | ||
101 | - "Nome", | ||
102 | - "Município", | ||
103 | - "Estado", | ||
104 | - "Pais" | ||
105 | - ) ); | ||
106 | - | ||
107 | - // Filtros de Foreign Keys | ||
108 | - $opcoes = array( "" => "Selecione" ); | ||
109 | - if( class_exists( "clsPais" ) ) | ||
110 | - { | ||
111 | - $objTemp = new clsPais(); | ||
112 | - $lista = $objTemp->lista( false, false, false, false, false, "nome ASC" ); | ||
113 | - if ( is_array( $lista ) && count( $lista ) ) | ||
114 | - { | ||
115 | - foreach ( $lista as $registro ) | ||
116 | - { | ||
117 | - $opcoes["{$registro['idpais']}"] = "{$registro['nome']}"; | ||
118 | - } | ||
119 | - } | ||
120 | - } | ||
121 | - else | ||
122 | - { | ||
123 | - echo "<!--\nErro\nClasse clsPais nao encontrada\n-->"; | ||
124 | - $opcoes = array( "" => "Erro na geracao" ); | ||
125 | - } | ||
126 | - $this->campoLista( "idpais", "Pais", $opcoes, $this->idpais, "", false, "", "", false, false ); | ||
127 | - | ||
128 | - $opcoes = array( "" => "Selecione" ); | ||
129 | - if( class_exists( "clsUf" ) ) | ||
130 | - { | ||
131 | - if( $this->idpais ) | ||
132 | - { | ||
133 | - $objTemp = new clsUf(); | ||
134 | - $lista = $objTemp->lista( false, false, $this->idpais, false, false, "nome ASC" ); | ||
135 | - if ( is_array( $lista ) && count( $lista ) ) | ||
136 | - { | ||
137 | - foreach ( $lista as $registro ) | ||
138 | - { | ||
139 | - $opcoes["{$registro['sigla_uf']}"] = "{$registro['nome']}"; | ||
140 | - } | ||
141 | - } | ||
142 | - } | ||
143 | - } | ||
144 | - else | ||
145 | - { | ||
146 | - echo "<!--\nErro\nClasse clsUf nao encontrada\n-->"; | ||
147 | - $opcoes = array( "" => "Erro na geracao" ); | ||
148 | - } | ||
149 | - $this->campoLista( "sigla_uf", "Estado", $opcoes, $this->sigla_uf, "", false, "", "", false, false ); | ||
150 | - | ||
151 | - $opcoes = array( "" => "Selecione" ); | ||
152 | - if( class_exists( "clsMunicipio" ) ) | ||
153 | - { | ||
154 | - if( $this->sigla_uf ) | ||
155 | - { | ||
156 | - $objTemp = new clsMunicipio(); | ||
157 | - $lista = $objTemp->lista( false, $this->sigla_uf, false, false, false, false, false, false, false, false, false, "nome ASC" ); | ||
158 | - if ( is_array( $lista ) && count( $lista ) ) | ||
159 | - { | ||
160 | - foreach ( $lista as $registro ) | ||
161 | - { | ||
162 | - $opcoes["{$registro['idmun']}"] = "{$registro['nome']}"; | ||
163 | - } | ||
164 | - } | ||
165 | - } | ||
166 | - } | ||
167 | - else | ||
168 | - { | ||
169 | - echo "<!--\nErro\nClasse clsMunicipio nao encontrada\n-->"; | ||
170 | - $opcoes = array( "" => "Erro na geracao" ); | ||
171 | - } | ||
172 | - $this->campoLista( "idmun", "Município", $opcoes, $this->idmun, "", false, "", "", false, false ); | ||
173 | - | ||
174 | - | ||
175 | - // outros Filtros | ||
176 | - $this->campoTexto( "nome", "Nome", $this->nome, 30, 255, false ); | ||
177 | - | ||
178 | - | ||
179 | - // Paginador | ||
180 | - $this->__limite = 20; | ||
181 | - $this->__offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->__limite-$this->__limite: 0; | ||
182 | - | ||
183 | - $obj_bairro = new clsPublicBairro(); | ||
184 | - $obj_bairro->setOrderby( "nome ASC" ); | ||
185 | - $obj_bairro->setLimite( $this->__limite, $this->__offset ); | ||
186 | - | ||
187 | - $lista = $obj_bairro->lista( | ||
188 | - $this->idmun, | ||
189 | - null, | ||
190 | - $this->nome, | ||
191 | - null, | ||
192 | - null, | ||
193 | - null, | ||
194 | - null, | ||
195 | - null, | ||
196 | - null, | ||
197 | - null, | ||
198 | - null, | ||
199 | - null, | ||
200 | - null, | ||
201 | - $this->idpais, | ||
202 | - $this->sigla_uf | ||
203 | - ); | ||
204 | - | ||
205 | - $total = $obj_bairro->_total; | ||
206 | - | ||
207 | - // monta a lista | ||
208 | - if( is_array( $lista ) && count( $lista ) ) | ||
209 | - { | ||
210 | - foreach ( $lista AS $registro ) | ||
211 | - { | ||
212 | - $this->addLinhas( array( | ||
213 | - "<a href=\"public_bairro_det.php?idbai={$registro["idbai"]}\">{$registro["nome"]}</a>", | ||
214 | - "<a href=\"public_bairro_det.php?idbai={$registro["idbai"]}\">{$registro["nm_municipio"]}</a>", | ||
215 | - "<a href=\"public_bairro_det.php?idbai={$registro["idbai"]}\">{$registro["nm_estado"]}</a>", | ||
216 | - "<a href=\"public_bairro_det.php?idbai={$registro["idbai"]}\">{$registro["nm_pais"]}</a>" | ||
217 | - ) ); | ||
218 | - } | ||
219 | - } | ||
220 | - $this->addPaginador2( "public_bairro_lst.php", $total, $_GET, $this->nome, $this->__limite ); | ||
221 | - | ||
222 | - $this->acao = "go(\"public_bairro_cad.php\")"; | ||
223 | - $this->nome_acao = "Novo"; | ||
224 | - | ||
225 | - $this->largura = "100%"; | ||
226 | - } | 67 | + var $__pessoa_logada; |
68 | + var $__titulo; | ||
69 | + var $__limite; | ||
70 | + var $__offset; | ||
71 | + | ||
72 | + var $idmun; | ||
73 | + var $geom; | ||
74 | + var $idbai; | ||
75 | + var $nome; | ||
76 | + var $idpes_rev; | ||
77 | + var $data_rev; | ||
78 | + var $origem_gravacao; | ||
79 | + var $idpes_cad; | ||
80 | + var $data_cad; | ||
81 | + var $operacao; | ||
82 | + var $idsis_rev; | ||
83 | + var $idsis_cad; | ||
84 | + | ||
85 | + var $idpais; | ||
86 | + var $sigla_uf; | ||
87 | + | ||
88 | + function Gerar() | ||
89 | + { | ||
90 | + @session_start(); | ||
91 | + $this->__pessoa_logada = $_SESSION['id_pessoa']; | ||
92 | + session_write_close(); | ||
93 | + | ||
94 | + $this->__titulo = 'Bairro - Listagem'; | ||
95 | + | ||
96 | + // Passa todos os valores obtidos no GET para atributos do objeto | ||
97 | + foreach ($_GET as $var => $val) { | ||
98 | + $this->$var = ($val === '') ? NULL : $val; | ||
99 | + } | ||
100 | + | ||
101 | + $this->addBanner('imagens/nvp_top_intranet.jpg', | ||
102 | + 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | ||
103 | + | ||
104 | + $this->addCabecalhos(array( | ||
105 | + 'Nome', | ||
106 | + 'Município', | ||
107 | + 'Estado', | ||
108 | + 'Pais' | ||
109 | + )); | ||
110 | + | ||
111 | + // Filtros de Foreign Keys | ||
112 | + $opcoes = array('' => 'Selecione'); | ||
113 | + | ||
114 | + if (class_exists('clsPais')) { | ||
115 | + $objTemp = new clsPais(); | ||
116 | + $lista = $objTemp->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'nome ASC'); | ||
117 | + | ||
118 | + if (is_array($lista) && count($lista)) { | ||
119 | + foreach ($lista as $registro) { | ||
120 | + $opcoes[$registro['idpais']] = $registro['nome']; | ||
121 | + } | ||
122 | + } | ||
123 | + } | ||
124 | + else { | ||
125 | + echo "<!--\nErro\nClasse clsPais nao encontrada\n-->"; | ||
126 | + $opcoes = array('' => 'Erro na geração'); | ||
127 | + } | ||
128 | + | ||
129 | + $this->campoLista('idpais', 'Pais', $opcoes, $this->idpais, '', FALSE, '', | ||
130 | + '', FALSE, FALSE); | ||
131 | + | ||
132 | + $opcoes = array('' => 'Selecione'); | ||
133 | + | ||
134 | + if (class_exists('clsUf')) { | ||
135 | + if ($this->idpais) { | ||
136 | + $objTemp = new clsUf(); | ||
137 | + $lista = $objTemp->lista(FALSE, FALSE, $this->idpais, FALSE, FALSE, | ||
138 | + 'nome ASC'); | ||
139 | + | ||
140 | + if (is_array($lista) && count($lista)) { | ||
141 | + foreach ($lista as $registro) { | ||
142 | + $opcoes[$registro['sigla_uf']] = $registro['nome']; | ||
143 | + } | ||
144 | + } | ||
145 | + } | ||
146 | + } | ||
147 | + else { | ||
148 | + echo "<!--\nErro\nClasse clsUf nao encontrada\n-->"; | ||
149 | + $opcoes = array('' => 'Erro na geração'); | ||
150 | + } | ||
151 | + | ||
152 | + $this->campoLista('sigla_uf', 'Estado', $opcoes, $this->sigla_uf, '', FALSE, | ||
153 | + '', '', FALSE, FALSE); | ||
154 | + | ||
155 | + $opcoes = array('' => 'Selecione'); | ||
156 | + | ||
157 | + if (class_exists('clsMunicipio')) { | ||
158 | + if ($this->sigla_uf) { | ||
159 | + $objTemp = new clsMunicipio(); | ||
160 | + $lista = $objTemp->lista(FALSE, $this->sigla_uf, FALSE, FALSE, FALSE, | ||
161 | + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 'nome ASC'); | ||
162 | + | ||
163 | + if (is_array($lista) && count($lista)) { | ||
164 | + foreach ($lista as $registro) { | ||
165 | + $opcoes[$registro['idmun']] = $registro['nome']; | ||
166 | + } | ||
167 | + } | ||
168 | + } | ||
169 | + } | ||
170 | + else { | ||
171 | + echo "<!--\nErro\nClasse clsMunicipio nao encontrada\n-->"; | ||
172 | + $opcoes = array('' => 'Erro na geração'); | ||
173 | + } | ||
174 | + | ||
175 | + $this->campoLista('idmun', 'Município', $opcoes, $this->idmun, '', FALSE, | ||
176 | + '', '', FALSE, FALSE); | ||
177 | + | ||
178 | + // Outros filtros | ||
179 | + $this->campoTexto('nome', 'Nome', $this->nome, 30, 255, FALSE); | ||
180 | + | ||
181 | + // Paginador | ||
182 | + $this->__limite = 20; | ||
183 | + $this->__offset = ($_GET['pagina_' . $this->nome]) ? | ||
184 | + ($_GET['pagina_' . $this->nome] * $this->__limite - $this->__limite) : 0; | ||
185 | + | ||
186 | + $obj_bairro = new clsPublicBairro(); | ||
187 | + $obj_bairro->setOrderby('nome ASC'); | ||
188 | + $obj_bairro->setLimite($this->__limite, $this->__offset); | ||
189 | + | ||
190 | + $lista = $obj_bairro->lista( | ||
191 | + $this->idmun, | ||
192 | + NULL, | ||
193 | + $this->nome, | ||
194 | + NULL, | ||
195 | + NULL, | ||
196 | + NULL, | ||
197 | + NULL, | ||
198 | + NULL, | ||
199 | + NULL, | ||
200 | + NULL, | ||
201 | + NULL, | ||
202 | + NULL, | ||
203 | + NULL, | ||
204 | + $this->idpais, | ||
205 | + $this->sigla_uf | ||
206 | + ); | ||
207 | + | ||
208 | + $total = $obj_bairro->_total; | ||
209 | + | ||
210 | + // Monta a lista | ||
211 | + if (is_array($lista) && count($lista)) { | ||
212 | + foreach ($lista as $registro) { | ||
213 | + $this->addLinhas(array( | ||
214 | + "<a href=\"public_bairro_det.php?idbai={$registro["idbai"]}\">{$registro["nome"]}</a>", | ||
215 | + "<a href=\"public_bairro_det.php?idbai={$registro["idbai"]}\">{$registro["nm_municipio"]}</a>", | ||
216 | + "<a href=\"public_bairro_det.php?idbai={$registro["idbai"]}\">{$registro["nm_estado"]}</a>", | ||
217 | + "<a href=\"public_bairro_det.php?idbai={$registro["idbai"]}\">{$registro["nm_pais"]}</a>" | ||
218 | + )); | ||
219 | + } | ||
220 | + } | ||
221 | + | ||
222 | + $this->addPaginador2('public_bairro_lst.php', $total, $_GET, $this->nome, $this->__limite); | ||
223 | + | ||
224 | + $this->acao = 'go("public_bairro_cad.php")'; | ||
225 | + $this->nome_acao = 'Novo'; | ||
226 | + | ||
227 | + $this->largura = '100%'; | ||
228 | + } | ||
227 | } | 229 | } |
228 | -// cria uma extensao da classe base | 230 | + |
231 | +// Instancia objeto de página | ||
229 | $pagina = new clsIndexBase(); | 232 | $pagina = new clsIndexBase(); |
230 | -// cria o conteudo | 233 | + |
234 | +// Instancia objeto de conteúdo | ||
231 | $miolo = new indice(); | 235 | $miolo = new indice(); |
232 | -// adiciona o conteudo na clsBase | ||
233 | -$pagina->addForm( $miolo ); | ||
234 | -// gera o html | 236 | + |
237 | +// Atribui o conteúdo à página | ||
238 | +$pagina->addForm($miolo); | ||
239 | + | ||
240 | +// Gera o código HTML | ||
235 | $pagina->MakeAll(); | 241 | $pagina->MakeAll(); |
236 | ?> | 242 | ?> |
237 | -<script> | ||
238 | - | 243 | +<script type="text/javascript"> |
239 | document.getElementById('idpais').onchange = function() | 244 | document.getElementById('idpais').onchange = function() |
240 | { | 245 | { |
241 | - var campoPais = document.getElementById('idpais').value; | 246 | + var campoPais = document.getElementById('idpais').value; |
242 | 247 | ||
243 | - var campoUf= document.getElementById('sigla_uf'); | ||
244 | - campoUf.length = 1; | ||
245 | - campoUf.disabled = true; | ||
246 | - campoUf.options[0].text = 'Carregando estado...'; | 248 | + var campoUf= document.getElementById('sigla_uf'); |
249 | + campoUf.length = 1; | ||
250 | + campoUf.disabled = true; | ||
251 | + campoUf.options[0].text = 'Carregando estado...'; | ||
247 | 252 | ||
248 | - var xml_uf = new ajax( getUf ); | ||
249 | - xml_uf.envia( "public_uf_xml.php?pais="+campoPais ); | 253 | + var xml_uf = new ajax(getUf); |
254 | + xml_uf.envia('public_uf_xml.php?pais=' + campoPais); | ||
250 | } | 255 | } |
251 | 256 | ||
252 | -function getUf( xml_uf ) | 257 | +function getUf(xml_uf) |
253 | { | 258 | { |
254 | - var campoUf = document.getElementById('sigla_uf'); | ||
255 | - var DOM_array = xml_uf.getElementsByTagName( "uf" ); | ||
256 | - | ||
257 | - if(DOM_array.length) | ||
258 | - { | ||
259 | - campoUf.length = 1; | ||
260 | - campoUf.options[0].text = 'Selecione um estado'; | ||
261 | - campoUf.disabled = false; | ||
262 | - | ||
263 | - for( var i = 0; i < DOM_array.length; i++ ) | ||
264 | - { | ||
265 | - campoUf.options[campoUf.options.length] = new Option( DOM_array[i].firstChild.data, DOM_array[i].getAttribute("sigla_uf"),false,false); | ||
266 | - } | ||
267 | - } | ||
268 | - else | ||
269 | - { | ||
270 | - campoUf.options[0].text = 'O pais não possui nenhum estado'; | ||
271 | - } | 259 | + var campoUf = document.getElementById('sigla_uf'); |
260 | + var DOM_array = xml_uf.getElementsByTagName('estado'); | ||
261 | + | ||
262 | + if (DOM_array.length) { | ||
263 | + campoUf.length = 1; | ||
264 | + campoUf.options[0].text = 'Selecione um estado'; | ||
265 | + campoUf.disabled = false; | ||
266 | + | ||
267 | + for (var i = 0; i < DOM_array.length; i++) { | ||
268 | + campoUf.options[campoUf.options.length] = new Option( | ||
269 | + DOM_array[i].firstChild.data, DOM_array[i].getAttribute('sigla_uf'), | ||
270 | + false, false | ||
271 | + ); | ||
272 | + } | ||
273 | + } | ||
274 | + else { | ||
275 | + campoUf.options[0].text = 'O pais não possui nenhum estado'; | ||
276 | + } | ||
272 | } | 277 | } |
273 | 278 | ||
274 | document.getElementById('sigla_uf').onchange = function() | 279 | document.getElementById('sigla_uf').onchange = function() |
275 | { | 280 | { |
276 | - var campoUf = document.getElementById('sigla_uf').value; | 281 | + var campoUf = document.getElementById('sigla_uf').value; |
282 | + | ||
283 | + var campoMunicipio = document.getElementById('idmun'); | ||
284 | + campoMunicipio.length = 1; | ||
285 | + campoMunicipio.disabled = true; | ||
277 | 286 | ||
278 | - var campoMunicipio= document.getElementById('idmun'); | ||
279 | - campoMunicipio.length = 1; | ||
280 | - campoMunicipio.disabled = true; | ||
281 | - campoMunicipio.options[0].text = 'Carregando município...'; | 287 | + campoMunicipio.options[0].text = 'Carregando município...'; |
282 | 288 | ||
283 | - var xml_municipio = new ajax( getMunicipio ); | ||
284 | - xml_municipio.envia( "public_municipio_xml.php?uf="+campoUf ); | 289 | + var xml_municipio = new ajax(getMunicipio); |
290 | + xml_municipio.envia('public_municipio_xml.php?uf=' + campoUf); | ||
285 | } | 291 | } |
286 | 292 | ||
287 | -function getMunicipio( xml_municipio ) | 293 | +function getMunicipio(xml_municipio) |
288 | { | 294 | { |
289 | - var campoMunicipio = document.getElementById('idmun'); | ||
290 | - var DOM_array = xml_municipio.getElementsByTagName( "municipio" ); | ||
291 | - | ||
292 | - if(DOM_array.length) | ||
293 | - { | ||
294 | - campoMunicipio.length = 1; | ||
295 | - campoMunicipio.options[0].text = 'Selecione um município'; | ||
296 | - campoMunicipio.disabled = false; | ||
297 | - | ||
298 | - for( var i = 0; i < DOM_array.length; i++ ) | ||
299 | - { | ||
300 | - campoMunicipio.options[campoMunicipio.options.length] = new Option( DOM_array[i].firstChild.data, DOM_array[i].getAttribute("idmun"),false,false); | ||
301 | - } | ||
302 | - } | ||
303 | - else | ||
304 | - { | ||
305 | - campoMunicipio.options[0].text = 'O estado não possui nenhum município'; | ||
306 | - } | 295 | + var campoMunicipio = document.getElementById('idmun'); |
296 | + var DOM_array = xml_municipio.getElementsByTagName( "municipio" ); | ||
297 | + | ||
298 | + if (DOM_array.length) { | ||
299 | + campoMunicipio.length = 1; | ||
300 | + campoMunicipio.options[0].text = 'Selecione um município'; | ||
301 | + campoMunicipio.disabled = false; | ||
302 | + | ||
303 | + for (var i = 0; i < DOM_array.length; i++) { | ||
304 | + campoMunicipio.options[campoMunicipio.options.length] = new Option( | ||
305 | + DOM_array[i].firstChild.data, DOM_array[i].getAttribute('idmun'), | ||
306 | + false, false | ||
307 | + ); | ||
308 | + } | ||
309 | + } | ||
310 | + else { | ||
311 | + campoMunicipio.options[0].text = 'O estado não possui nenhum município'; | ||
312 | + } | ||
307 | } | 313 | } |
308 | - | ||
309 | </script> | 314 | </script> |
310 | \ No newline at end of file | 315 | \ No newline at end of file |