Commit 0a146c35b4cf51d756747b4675edf9a702666ee8
1 parent
0f50bf7d
Exists in
master
Refactoring para coding standards
Showing
1 changed file
with
451 additions
and
420 deletions
Show diff stats
ieducar/intranet/educar_aluno_cad_xml.php
1 | 1 | <?php |
2 | 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 @@license@@ | |
26 | + * @package iEd_Pmieducar | |
27 | + * @since Arquivo disponível desde a versão 1.0.0 | |
28 | + * @version $Id$ | |
29 | + */ | |
3 | 30 | |
4 | -header( 'Content-type: text/xml' ); | |
5 | - | |
6 | -require_once( "include/clsBanco.inc.php" ); | |
7 | -require_once( "include/funcoes.inc.php" ); | |
8 | -require_once( "include/pmieducar/geral.inc.php" ); | |
9 | -if ($_GET['cpf'] || $_GET['idpes']) | |
10 | -{ | |
11 | - $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n<query xmlns=\"sugestoes\">\n"; | |
12 | - $xml .= "<dados>\n"; | |
13 | - | |
14 | - $cpf = $_GET['cpf']; | |
15 | - | |
16 | - if ($_GET['idpes']) | |
17 | - { | |
18 | - $ref_idpes = $_GET['idpes']; | |
19 | - } | |
20 | - else | |
21 | - { | |
22 | - $cpf = idFederal2int($_GET['cpf']); | |
23 | - $obj_pessoa_fisica = new clsPessoaFisica(null, $cpf); | |
24 | - $lst_pessoa_fisica = $obj_pessoa_fisica->lista(null, $cpf); | |
25 | - | |
26 | - if (!$lst_pessoa_fisica) | |
27 | - { | |
28 | - echo $xml."</dados>\n</query>"; | |
29 | - die(); | |
30 | - } | |
31 | - | |
32 | - $ref_idpes = $lst_pessoa_fisica[0]['idpes']; | |
33 | - | |
34 | - $xml .= "<ref_idpes>{$ref_idpes}</ref_idpes>\n"; | |
35 | - $xml .= "<cpf>{$cpf}</cpf>\n"; | |
36 | - | |
37 | - } | |
38 | - | |
39 | - if( $cod_aluno) | |
40 | - { | |
41 | - $obj_matricula = new clsPmieducarMatricula(); | |
42 | - $lst_matricula = $obj_matricula->lista( null, null, null, null, null, null, $cod_aluno ); | |
43 | - } | |
44 | - if(!empty($ref_idpes)) | |
45 | - { | |
46 | - $obj_aluno = new clsPmieducarAluno(); | |
47 | - $lista_aluno = $obj_aluno->lista(null,null,null,null,null,$ref_idpes,null,null,null,null); | |
48 | - if($lista_aluno) | |
49 | - { | |
50 | - $det_aluno = array_shift($lista_aluno); | |
51 | - } | |
52 | - } | |
53 | - if($det_aluno['cod_aluno'] ) | |
54 | - { | |
55 | - $cod_aluno = $det_aluno['cod_aluno']; | |
56 | - $ref_cod_aluno_beneficio = $det_aluno['ref_cod_aluno_beneficio']; | |
57 | - $ref_cod_religiao = $det_aluno['ref_cod_religiao']; | |
58 | - $caminho_foto = $det_aluno['caminho_foto']; | |
59 | - } | |
60 | - | |
61 | - $xml .= "<cod_aluno>{$cod_aluno}</cod_aluno>\n"; | |
62 | - $xml .= "<ref_cod_aluno_beneficio>{$ref_cod_aluno_beneficio}</ref_cod_aluno_beneficio>\n"; | |
63 | - $xml .= "<ref_cod_religiao>{$ref_cod_religiao}</ref_cod_religiao>\n"; | |
64 | - $xml .= "<caminho_foto>{$caminho_foto}</caminho_foto>\n"; | |
65 | - $xml .= "<idpes>{$ref_idpes}</idpes>\n"; | |
66 | - | |
67 | - if($ref_idpes != "NULL") | |
68 | - { | |
69 | - if( $ref_idpes) | |
70 | - { | |
71 | - $obj_pessoa = new clsPessoaFj($ref_idpes); | |
72 | - $det_pessoa = $obj_pessoa->detalhe(); | |
73 | - | |
74 | - $obj_fisica = new clsFisica($ref_idpes); | |
75 | - $det_fisica = $obj_fisica->detalhe(); | |
76 | - | |
77 | - $obj_fisica_raca = new clsCadastroFisicaRaca( $ref_idpes ); | |
78 | - $det_fisica_raca = $obj_fisica_raca->detalhe(); | |
79 | - $ref_cod_raca = $det_fisica_raca['ref_cod_raca']; | |
80 | - | |
81 | - $nome = $det_pessoa["nome"]; | |
82 | - | |
83 | - $email = $det_pessoa["email"]; | |
84 | - | |
85 | - $ideciv = $det_fisica["ideciv"]->ideciv; | |
86 | - | |
87 | - $data_nascimento = dataToBrasil($det_fisica["data_nasc"]); | |
88 | - | |
89 | - $cpf = $det_fisica["cpf"]; | |
90 | - | |
91 | - $xml .= "<ref_cod_raca>{$ref_cod_raca}</ref_cod_raca>\n"; | |
92 | - $xml .= "<nome>{$nome}</nome>\n"; | |
93 | - $xml .= "<email>{$email}</email>\n"; | |
94 | - $xml .= "<ideciv>{$ideciv}</ideciv>\n"; | |
95 | - $xml .= "<data_nascimento>{$data_nascimento}</data_nascimento>\n"; | |
96 | - $xml .= "<cpf>{$cpf}</cpf>\n"; | |
97 | - $cpf2 = int2CPF($cpf); | |
98 | - $xml .= "<cpf_2>{$cpf2}</cpf_2>\n"; | |
99 | - | |
100 | - $obj_documento = new clsDocumento($ref_idpes); | |
101 | - $obj_documento_det = $obj_documento->detalhe(); | |
102 | - | |
103 | - $ddd_fone_1 = $det_pessoa["ddd_1"]; | |
104 | - $fone_1 = $det_pessoa["fone_1"]; | |
105 | - | |
106 | - $ddd_mov = $det_pessoa["ddd_mov"]; | |
107 | - $fone_mov = $det_pessoa["fone_mov"]; | |
108 | - | |
109 | - $email = $det_pessoa["email"]; | |
110 | - $url = $det_pessoa["url"]; | |
111 | - | |
112 | - $sexo = $det_fisica["sexo"]; | |
113 | - | |
114 | - $nacionalidade = $det_fisica["nacionalidade"]; | |
115 | - $idmun_nascimento = $det_fisica["idmun_nascimento"]->idmun; | |
116 | - | |
117 | - $xml .= "<ddd_fone_1>{$ddd_fone_1}</ddd_fone_1>\n"; | |
118 | - $xml .= "<fone_1>{$fone_1}</fone_1>\n"; | |
119 | - $xml .= "<ddd_mov>{$ddd_mov}</ddd_mov>\n"; | |
120 | - $xml .= "<fone_mov>{$fone_mov}</fone_mov>\n"; | |
121 | - $xml .= "<email>{$email}</email>\n"; | |
122 | - $xml .= "<url>{$url}</url>\n"; | |
123 | - $xml .= "<sexo>{$sexo}</sexo>\n"; | |
124 | - $xml .= "<nacionalidade>{$nacionalidade}</nacionalidade>\n"; | |
125 | - $xml .= "<idmun_nascimento>{$idmun_nascimento}</idmun_nascimento>\n"; | |
126 | - | |
127 | - $detalhe_pais_origem = $det_fisica["idpais_estrangeiro"]->detalhe(); | |
128 | - $pais_origem = $detalhe_pais_origem["idpais"]; | |
129 | - | |
130 | - $ref_idpes_responsavel = $det_fisica["idpes_responsavel"]; | |
131 | - $idpes_pai = $det_fisica["idpes_pai"]; | |
132 | - $idpes_mae = $det_fisica["idpes_mae"]; | |
133 | - | |
134 | - $xml .= "<idpes_pai>{$idpes_pai}</idpes_pai>\n"; | |
135 | - $xml .= "<idpes_mae>{$idpes_mae}</idpes_mae>\n"; | |
136 | - | |
137 | - $obj_aluno = new clsPmieducarAluno(null,null,null,null,null,$ref_idpes ); | |
138 | - $detalhe_aluno = $obj_aluno->detalhe(); | |
139 | - if( $detalhe_aluno ) | |
140 | - { | |
141 | - $nm_pai = $detalhe_aluno["nm_pai"]; | |
142 | - $nm_mae = $detalhe_aluno["nm_mae"]; | |
143 | - | |
144 | - $xml .= "<nm_pai>{$nm_pai}</nm_pai>\n"; | |
145 | - $xml .= "<nm_mae>{$nm_mae}</nm_mae>\n"; | |
146 | - } | |
147 | - | |
148 | - $obj_endereco = new clsPessoaEndereco($ref_idpes); | |
149 | - | |
150 | - if($obj_endereco_det = $obj_endereco->detalhe()) | |
151 | - { | |
152 | - | |
153 | - $isEnderecoExterno = 0; | |
154 | - | |
155 | - $id_cep = $obj_endereco_det['cep']->cep; | |
156 | - $id_bairro = $obj_endereco_det['idbai']->idbai; | |
157 | - $id_logradouro = $obj_endereco_det['idlog']->idlog; | |
158 | - $numero = $obj_endereco_det['numero']; | |
159 | - $letra = $obj_endereco_det['letra']; | |
160 | - $complemento = $obj_endereco_det['complemento']; | |
161 | - $andar = $obj_endereco_det['andar']; | |
162 | - $apartamento = $obj_endereco_det['apartamento']; | |
163 | - $bloco = $obj_endereco_det['bloco']; | |
164 | - | |
165 | - $ref_idtlog = $obj_endereco_det['idtlog']; | |
166 | - | |
167 | - $nm_bairro = $obj_endereco_det['bairro']; | |
168 | - $nm_logradouro = $obj_endereco_det['logradouro']; | |
169 | - | |
170 | - $cep_ = int2CEP($id_cep); | |
171 | - | |
172 | - $xml .= "<id_cep>{$id_cep}</id_cep>\n"; | |
173 | - $xml .= "<id_bairro>{$id_bairro}</id_bairro>\n"; | |
174 | - $xml .= "<id_logradouro>{$id_logradouro}</id_logradouro>\n"; | |
175 | - $xml .= "<numero>{$numero}</numero>\n"; | |
176 | - $xml .= "<letra>{$letra}</letra>\n"; | |
177 | - $xml .= "<complemento>{$complemento}</complemento>\n"; | |
178 | - $xml .= "<andar>{$andar}</andar>\n"; | |
179 | - $xml .= "<apartamento>{$apartamento}</apartamento>\n"; | |
180 | - $xml .= "<bloco>{$bloco}</bloco>\n";; | |
181 | - $xml .= "<ref_idtlog>{$ref_idtlog}</ref_idtlog>\n";; | |
182 | - $xml .= "<nm_bairro>{$nm_bairro}</nm_bairro>\n"; | |
183 | - $xml .= "<nm_logradouro>{$nm_logradouro}</nm_logradouro>\n"; | |
184 | - | |
185 | - | |
186 | - } | |
187 | - else | |
188 | - { | |
189 | - | |
190 | - $obj_endereco = new clsEnderecoExterno($ref_idpes); | |
191 | - | |
192 | - if($obj_endereco_det = $obj_endereco->detalhe()) | |
193 | - { | |
194 | - $isEnderecoExterno = 1; | |
195 | - | |
196 | - $id_cep = $obj_endereco_det['cep']; | |
197 | - $cidade = $obj_endereco_det['cidade']; | |
198 | - $nm_bairro = $obj_endereco_det['bairro']; | |
199 | - $nm_logradouro = $obj_endereco_det['logradouro']; | |
200 | - | |
201 | - $id_bairro = null; | |
202 | - $id_logradouro = null; | |
203 | - $numero = $obj_endereco_det['numero']; | |
204 | - $letra = $obj_endereco_det['letra']; | |
205 | - $complemento = $obj_endereco_det['complemento']; | |
206 | - $andar = $obj_endereco_det['andar']; | |
207 | - $apartamento = $obj_endereco_det['apartamento']; | |
208 | - $bloco = $obj_endereco_det['bloco']; | |
209 | - | |
210 | - $ref_idtlog = $idtlog = $obj_endereco_det['idtlog']->idtlog; | |
211 | - $ref_sigla_uf = $ref_sigla_uf_ = $obj_endereco_det['sigla_uf']->sigla_uf; | |
212 | - $cep_ = int2CEP($id_cep); | |
213 | - | |
214 | - $xml .= "<id_cep>{$id_cep}</id_cep>\n"; | |
215 | - $xml .= "<cidade>{$cidade}</cidade>\n"; | |
216 | - $xml .= "<nm_bairro>{$nm_bairro}</nm_bairro>\n"; | |
217 | - $xml .= "<nm_logradouro>{$nm_logradouro}</nm_logradouro>\n"; | |
218 | - $xml .= "<numero>{$numero}</numero>\n"; | |
219 | - $xml .= "<letra>{$letra}</letra>\n"; | |
220 | - $xml .= "<complemento>{$complemento}</complemento>\n"; | |
221 | - $xml .= "<andar>{$andar}</andar>\n"; | |
222 | - $xml .= "<apartamento>{$apartamento}</apartamento>\n"; | |
223 | - $xml .= "<bloco>{$bloco}</bloco>\n"; | |
224 | - $xml .= "<ref_idtlog>{$ref_idtlog}</ref_idtlog>\n"; | |
225 | - $xml .= "<idtlog>{$idtlog}</idtlog>\n"; | |
226 | - $xml .= "<ref_sigla_uf>{$ref_sigla_uf}</ref_sigla_uf>\n"; | |
227 | - $xml .= "<ref_sigla_uf_>{$ref_sigla_uf_}</ref_sigla_uf_>\n"; | |
228 | - $xml .= "<cep_>{$cep_}</cep_>\n"; | |
229 | - | |
230 | - } | |
231 | - } | |
232 | - } | |
233 | - } | |
234 | - | |
235 | - if($isEnderecoExterno == 0) | |
236 | - { | |
237 | - $obj_bairro = new clsBairro($id_bairro); | |
238 | - $cep_ = int2CEP($id_cep); | |
239 | - | |
240 | - $xml .= "<cep_>{$cep_}</cep_>\n"; | |
241 | - | |
242 | - $obj_bairro_det = $obj_bairro->detalhe(); | |
243 | - | |
244 | - if($obj_bairro_det) | |
245 | - { | |
246 | - | |
247 | - $nm_bairro = $obj_bairro_det["nome"]; | |
248 | - | |
249 | - $xml .= "<nm_bairro>{$nm_bairro}</nm_bairro>\n"; | |
250 | - | |
251 | - } | |
252 | - | |
253 | - $obj_log = new clsLogradouro($id_logradouro); | |
254 | - $obj_log_det = $obj_log->detalhe(); | |
255 | - | |
256 | - if($obj_log_det) | |
257 | - { | |
258 | - | |
259 | - $nm_logradouro = $obj_log_det["nome"]; | |
260 | - | |
261 | - $ref_idtlog = $obj_log_det["idtlog"]->idtlog; | |
262 | - $xml .= "<nm_logradouro>{$nm_logradouro}</nm_logradouro>\n"; | |
263 | - $xml .= "<ref_idtlog>{$ref_idtlog}</ref_idtlog>\n"; | |
264 | - | |
265 | - $obj_mun = new clsMunicipio( $obj_log_det["idmun"]); | |
266 | - $det_mun = $obj_mun->detalhe(); | |
267 | - | |
268 | - if($det_mun) | |
269 | - { | |
270 | - $cidade = ucfirst(strtolower($det_mun["nome"])); | |
271 | - | |
272 | - $xml .= "<cidade>{$cidade}</cidade>\n"; | |
273 | - } | |
274 | - | |
275 | - $ref_sigla_uf = $ref_sigla_uf_ = $det_mun['sigla_uf']->sigla_uf; | |
276 | - | |
277 | - $xml .= "<ref_sigla_uf>{$ref_sigla_uf}</ref_sigla_uf>\n"; | |
278 | - $xml .= "<ref_sigla_uf_>{$ref_sigla_uf_}</ref_sigla_uf_>\n"; | |
279 | - | |
280 | - } | |
281 | - | |
282 | - $obj_bairro = new clsBairro($obj_endereco_det["ref_idbai"]); | |
283 | - $obj_bairro_det = $obj_bairro->detalhe(); | |
284 | - | |
285 | - if($obj_bairro_det) | |
286 | - { | |
287 | - $nm_bairro = $obj_bairro_det["nome"]; | |
288 | - | |
289 | - $xml .= "<nm_bairro>{$nm_bairro}</nm_bairro>\n"; | |
290 | - | |
291 | - } | |
292 | - } | |
293 | - if($idpes_pai) | |
294 | - { | |
295 | - $obj_pessoa_pai = new clsPessoaFj($idpes_pai); | |
296 | - $det_pessoa_pai = $obj_pessoa_pai->detalhe(); | |
297 | - if($det_pessoa_pai) | |
298 | - { | |
299 | - $nm_pai = $det_pessoa_pai["nome"]; | |
300 | - | |
301 | - $xml .= "<nm_pai>{$nm_pai}</nm_pai>\n"; | |
302 | - | |
303 | - $obj_cpf = new clsFisica($idpes_pai); | |
304 | - $det_cpf = $obj_cpf->detalhe(); | |
305 | - if( $det_cpf["cpf"] ) | |
306 | - { | |
307 | - $cpf_pai = int2CPF( $det_cpf["cpf"] ); | |
308 | - | |
309 | - $xml .= "<cpf_pai>{$cpf_pai}</cpf_pai>\n"; | |
310 | - | |
311 | - } | |
312 | - | |
313 | - } | |
314 | - } | |
315 | - if($idpes_mae) | |
316 | - { | |
317 | - $obj_pessoa_mae = new clsPessoaFj($idpes_mae); | |
318 | - $det_pessoa_mae = $obj_pessoa_mae->detalhe(); | |
319 | - if($det_pessoa_mae) | |
320 | - { | |
321 | - $nm_mae = $det_pessoa_mae["nome"]; | |
322 | - | |
323 | - $xml .= "<nm_mae>{$nm_mae}</nm_mae>\n"; | |
324 | - | |
325 | - //cpf | |
326 | - $obj_cpf = new clsFisica($idpes_mae); | |
327 | - $det_cpf = $obj_cpf->detalhe(); | |
328 | - if( $det_cpf["cpf"] ) | |
329 | - { | |
330 | - $cpf_mae = int2CPF( $det_cpf["cpf"] ); | |
331 | - | |
332 | - $xml .= "<cpf_mae>{$cpf_mae}</cpf_mae>\n"; | |
333 | - | |
334 | - } | |
335 | - } | |
336 | - } | |
337 | - if(!$tipo_responsavel) | |
338 | - { | |
339 | - if($nm_pai) | |
340 | - $tipo_responsavel = 'p'; | |
341 | - elseif($nm_mae) | |
342 | - $tipo_responsavel = 'm'; | |
343 | - elseif($ref_idpes_responsavel) | |
344 | - $tipo_responsavel = 'r'; | |
345 | - | |
346 | - $xml .= "<tipo_responsavel>{$tipo_responsavel}</tipo_responsavel>\n"; | |
347 | - | |
348 | - } | |
349 | - | |
350 | - if($ref_idpes) | |
351 | - { | |
352 | - $ObjDocumento = new clsDocumento($ref_idpes); | |
353 | - $detalheDocumento = $ObjDocumento->detalhe(); | |
354 | - | |
355 | - $rg = $detalheDocumento['rg']; | |
356 | - | |
357 | - $xml.= "<rg>{$rg}</rg>\n"; | |
358 | - | |
359 | - if($detalheDocumento['data_exp_rg']) | |
360 | - { | |
361 | - $data_exp_rg = date( "d/m/Y", strtotime( substr($detalheDocumento['data_exp_rg'],0,19) ) ); | |
362 | - | |
363 | - $xml.= "<data_exp_rg>{$data_exp_rg}</data_exp_rg>\n"; | |
364 | - | |
365 | - } | |
366 | - | |
367 | - $sigla_uf_exp_rg = $detalheDocumento['sigla_uf_exp_rg']; | |
368 | - $tipo_cert_civil = $detalheDocumento['tipo_cert_civil']; | |
369 | - $num_termo = $detalheDocumento['num_termo']; | |
370 | - $num_livro = $detalheDocumento['num_livro']; | |
371 | - $num_folha = $detalheDocumento['num_folha']; | |
372 | - | |
373 | - $xml .= "<sigla_uf_exp_rg>{$sigla_uf_exp_rg}</sigla_uf_exp_rg>\n"; | |
374 | - $xml .= "<tipo_cert_civil>{$tipo_cert_civil}</tipo_cert_civil>\n"; | |
375 | - $xml .= "<num_termo>{$num_termo}</num_termo>\n"; | |
376 | - $xml .= "<num_livro>{$num_livro}</num_livro>\n"; | |
377 | - $xml .= "<num_folha>{$num_folha}</num_folha>\n"; | |
378 | - | |
379 | - if($detalheDocumento['data_emissao_cert_civil']) | |
380 | - { | |
381 | - $data_emissao_cert_civil = date( "d/m/Y", strtotime( substr($detalheDocumento['data_emissao_cert_civil'],0,19) ) ); | |
382 | - | |
383 | - $xml .= "<data_emissao_cert_civil>{$data_emissao_cert_civil}</data_emissao_cert_civil>\n"; | |
384 | - } | |
385 | - | |
386 | - $sigla_uf_cert_civil = $detalheDocumento['sigla_uf_cert_civil']; | |
387 | - | |
388 | - $cartorio_cert_civil = $detalheDocumento['cartorio_cert_civil']; | |
389 | - $num_cart_trabalho = $detalheDocumento['num_cart_trabalho']; | |
390 | - $serie_cart_trabalho = $detalheDocumento['serie_cart_trabalho']; | |
391 | - | |
392 | - $xml .= "<sigla_uf_cert_civil>{$sigla_uf_cert_civil}</sigla_uf_cert_civil>\n"; | |
393 | - $xml .= "<cartorio_cert_civil>{$cartorio_cert_civil}</cartorio_cert_civil>\n"; | |
394 | - $xml .= "<num_cart_trabalho>{$num_cart_trabalho}</num_cart_trabalho>\n"; | |
395 | - $xml .= "<serie_cart_trabalho>{$serie_cart_trabalho}</serie_cart_trabalho>\n"; | |
396 | - | |
397 | - if($detalheDocumento['data_emissao_cart_trabalho']) | |
398 | - { | |
399 | - $data_emissao_cart_trabalho = date( "d/m/Y", strtotime( substr($detalheDocumento['data_emissao_cart_trabalho'],0,19) ) ); | |
400 | - | |
401 | - $xml .= "<data_emissao_cart_trabalho>{$data_emissao_cart_trabalho}</data_emissao_cart_trabalho>\n"; | |
402 | - } | |
403 | - | |
404 | - $sigla_uf_cart_trabalho = $detalheDocumento['sigla_uf_cart_trabalho']; | |
405 | - $num_tit_eleitor = $detalheDocumento['num_tit_eleitor']; | |
406 | - $zona_tit_eleitor = $detalheDocumento['zona_tit_eleitor']; | |
407 | - $secao_tit_eleitor = $detalheDocumento['secao_tit_eleitor']; | |
408 | - $idorg_exp_rg = $detalheDocumento['idorg_exp_rg']; | |
409 | - | |
410 | - $xml .= "<sigla_uf_cart_trabalho>{$sigla_uf_cart_trabalho}</sigla_uf_cart_trabalho>\n"; | |
411 | - $xml .= "<num_tit_eleitor>{$num_tit_eleitor}</num_tit_eleitor>\n"; | |
412 | - $xml .= "<zona_tit_eleitor>{$zona_tit_eleitor}</zona_tit_eleitor>\n"; | |
413 | - $xml .= "<secao_tit_eleitor>{$secao_tit_eleitor}</secao_tit_eleitor>\n"; | |
414 | - $xml .= "<idorg_exp_rg>{$idorg_exp_rg}</idorg_exp_rg>\n"; | |
415 | - | |
416 | - } | |
417 | - | |
418 | - $xml .= "</dados>\n"; | |
419 | -$xml .= "</query>"; | |
420 | -echo $xml; | |
421 | -} | |
422 | - | |
423 | -?> | |
424 | 31 | \ No newline at end of file |
32 | +header('Content-type: text/xml'); | |
33 | + | |
34 | +require_once 'include/clsBanco.inc.php'; | |
35 | +require_once 'include/funcoes.inc.php'; | |
36 | +require_once 'include/pmieducar/geral.inc.php'; | |
37 | + | |
38 | +if ($_GET['cpf'] || $_GET['idpes']) { | |
39 | + $xml = '<?xml version="1.0" encoding="ISO-8859-15"?>' . PHP_EOL; | |
40 | + $xml .= '<query xmlns="sugestoes">' . PHP_EOL; | |
41 | + $xml .= '<dados>' . PHP_EOL; | |
42 | + | |
43 | + $cpf = $_GET['cpf']; | |
44 | + | |
45 | + if ($_GET['idpes']) { | |
46 | + $ref_idpes = $_GET['idpes']; | |
47 | + } | |
48 | + else { | |
49 | + $cpf = idFederal2int($_GET['cpf']); | |
50 | + | |
51 | + $obj_pessoa_fisica = new clsPessoaFisica(NULL, $cpf); | |
52 | + $lst_pessoa_fisica = $obj_pessoa_fisica->lista(NULL, $cpf); | |
53 | + | |
54 | + if (! $lst_pessoa_fisica) { | |
55 | + echo $xml . '</dados></query>'; | |
56 | + die(); | |
57 | + } | |
58 | + | |
59 | + $ref_idpes = $lst_pessoa_fisica[0]['idpes']; | |
60 | + | |
61 | + $xml .= sprintf('<ref_idpes>%d</ref_idpes>', $ref_idpes) . PHP_EOL; | |
62 | + $xml .= sprintf('<cpf>%s</cpf>', $cpf) . PHP_EOL; | |
63 | + } | |
64 | + | |
65 | + if ($cod_aluno) { | |
66 | + $obj_matricula = new clsPmieducarMatricula(); | |
67 | + $lst_matricula = $obj_matricula->lista(NULL, NULL, NULL, NULL, NULL, | |
68 | + NULL, $cod_aluno); | |
69 | + } | |
70 | + | |
71 | + if (! empty($ref_idpes)) { | |
72 | + $obj_aluno = new clsPmieducarAluno(); | |
73 | + $lista_aluno = $obj_aluno->lista(NULL, NULL, NULL, NULL, NULL, $ref_idpes, | |
74 | + NULL, NULL, NULL, NULL); | |
75 | + | |
76 | + if ($lista_aluno) { | |
77 | + $det_aluno = array_shift($lista_aluno); | |
78 | + } | |
79 | + } | |
80 | + | |
81 | + if ($det_aluno['cod_aluno']) { | |
82 | + $cod_aluno = $det_aluno['cod_aluno']; | |
83 | + $ref_cod_aluno_beneficio = $det_aluno['ref_cod_aluno_beneficio']; | |
84 | + $ref_cod_religiao = $det_aluno['ref_cod_religiao']; | |
85 | + $caminho_foto = $det_aluno['caminho_foto']; | |
86 | + } | |
87 | + | |
88 | + $xml .= sprintf('<cod_aluno>%d</cod_aluno>', $cod_aluno) . PHP_EOL; | |
89 | + $xml .= sprintf('<ref_cod_aluno_beneficio>%d</ref_cod_aluno_beneficio>', $ref_cod_aluno_beneficio) . PHP_EOL; | |
90 | + $xml .= sprintf('<ref_cod_religiao>%d</ref_cod_religiao>', $ref_cod_religiao) . PHP_EOL; | |
91 | + $xml .= sprintf('<caminho_foto>%s</caminho_foto>', $caminho_foto) . PHP_EOL; | |
92 | + $xml .= sprintf('<idpes>%d</idpes>', $ref_idpes) . PHP_EOL; | |
93 | + | |
94 | + if ($ref_idpes != 'NULL') { | |
95 | + if ($ref_idpes) { | |
96 | + $obj_pessoa = new clsPessoaFj($ref_idpes); | |
97 | + $det_pessoa = $obj_pessoa->detalhe(); | |
98 | + | |
99 | + $obj_fisica = new clsFisica($ref_idpes); | |
100 | + $det_fisica = $obj_fisica->detalhe(); | |
101 | + | |
102 | + $obj_fisica_raca = new clsCadastroFisicaRaca($ref_idpes); | |
103 | + $det_fisica_raca = $obj_fisica_raca->detalhe(); | |
104 | + $ref_cod_raca = $det_fisica_raca['ref_cod_raca']; | |
105 | + | |
106 | + $nome = $det_pessoa['nome']; | |
107 | + $email = $det_pessoa['email']; | |
108 | + $ideciv = $det_fisica['ideciv']->ideciv; | |
109 | + | |
110 | + $data_nascimento = dataToBrasil($det_fisica['data_nasc']); | |
111 | + | |
112 | + $cpf = $det_fisica['cpf']; | |
113 | + | |
114 | + $xml .= sprintf('<ref_cod_raca>%d</ref_cod_raca>', $ref_cod_raca) . PHP_EOL; | |
115 | + $xml .= sprintf('<nome>%s</nome>', $nome) . PHP_EOL; | |
116 | + $xml .= sprintf('<email>%s</email>', $email) . PHP_EOL; | |
117 | + $xml .= sprintf('<ideciv>%d</ideciv>', $ideciv) . PHP_EOL; | |
118 | + $xml .= sprintf('<data_nascimento>%s</data_nascimento>', $data_nascimento) . PHP_EOL; | |
119 | + $xml .= sprintf('<cpf>%s</cpf>', $cpf) . PHP_EOL; | |
120 | + | |
121 | + $cpf2 = int2CPF($cpf); | |
122 | + $xml .= sprintf('<cpf_2>%s</cpf_2>', $cpf2) . PHP_EOL; | |
123 | + | |
124 | + $obj_documento = new clsDocumento($ref_idpes); | |
125 | + $obj_documento_det = $obj_documento->detalhe(); | |
126 | + | |
127 | + $ddd_fone_1 = $det_pessoa['ddd_1']; | |
128 | + $fone_1 = $det_pessoa['fone_1']; | |
129 | + | |
130 | + $ddd_mov = $det_pessoa['ddd_mov']; | |
131 | + $fone_mov = $det_pessoa['fone_mov']; | |
132 | + | |
133 | + $email = $det_pessoa['email']; | |
134 | + $url = $det_pessoa['url']; | |
135 | + | |
136 | + $sexo = $det_fisica['sexo']; | |
137 | + | |
138 | + $nacionalidade = $det_fisica['nacionalidade']; | |
139 | + $idmun_nascimento = $det_fisica['idmun_nascimento']->idmun; | |
140 | + | |
141 | + $xml .= sprintf('<ddd_fone_1>%s</ddd_fone_1>', $ddd_fone1) . PHP_EOL; | |
142 | + $xml .= sprintf('<fone_1>%s</fone_1>', $fone_1) . PHP_EOL; | |
143 | + $xml .= sprintf('<ddd_mov>%s</ddd_mov>', $ddd_mov) . PHP_EOL; | |
144 | + $xml .= sprintf('<fone_mov>%s</fone_mov>', $fone_mov) . PHP_EOL; | |
145 | + $xml .= sprintf('<email>%s</email>', $email) . PHP_EOL; | |
146 | + $xml .= sprintf('<url>%s</url>', $url) . PHP_EOL; | |
147 | + $xml .= sprintf('<sexo>%s</sexo>', $sexo) . PHP_EOL; | |
148 | + $xml .= sprintf('<nacionalidade>%d</nacionalidade>', $nacionalidade) . PHP_EOL; | |
149 | + $xml .= sprintf('<idmun_nascimento>%d</idmun_nascimento>', $idmun_nascimento) . PHP_EOL; | |
150 | + | |
151 | + $detalhe_pais_origem = $det_fisica['idpais_estrangeiro']->detalhe(); | |
152 | + $pais_origem = $detalhe_pais_origem['idpais']; | |
153 | + | |
154 | + $ref_idpes_responsavel = $det_fisica['idpes_responsavel']; | |
155 | + $idpes_pai = $det_fisica['idpes_pai']; | |
156 | + $idpes_mae = $det_fisica['idpes_mae']; | |
157 | + | |
158 | + $xml .= sprintf('<idpes_pai>%d</idpes_pai>', $idpes_pai) . PHP_EOL; | |
159 | + $xml .= sprintf('<idpes_mae>%d</idpes_mae>', $idpes_mae) . PHP_EOL; | |
160 | + | |
161 | + $obj_aluno = new clsPmieducarAluno(NULL, NULL, NULL, NULL, NULL, $ref_idpes); | |
162 | + | |
163 | + $detalhe_aluno = $obj_aluno->detalhe(); | |
164 | + | |
165 | + if ($detalhe_aluno) { | |
166 | + $nm_pai = $detalhe_aluno['nm_pai']; | |
167 | + $nm_mae = $detalhe_aluno['nm_mae']; | |
168 | + | |
169 | + $xml .= sprintf('<nm_pai>%s</nm_pai>', $nm_pai) . PHP_EOL; | |
170 | + $xml .= sprintf('<nm_mae>%s</nm_mae>', $nm_mae) . PHP_EOL; | |
171 | + } | |
172 | + | |
173 | + $obj_endereco = new clsPessoaEndereco($ref_idpes); | |
174 | + | |
175 | + if ($obj_endereco_det = $obj_endereco->detalhe()) { | |
176 | + $isEnderecoExterno = 0; | |
177 | + | |
178 | + $id_cep = $obj_endereco_det['cep']->cep; | |
179 | + $id_bairro = $obj_endereco_det['idbai']->idbai; | |
180 | + $id_logradouro = $obj_endereco_det['idlog']->idlog; | |
181 | + $numero = $obj_endereco_det['numero']; | |
182 | + $letra = $obj_endereco_det['letra']; | |
183 | + $complemento = $obj_endereco_det['complemento']; | |
184 | + $andar = $obj_endereco_det['andar']; | |
185 | + $apartamento = $obj_endereco_det['apartamento']; | |
186 | + $bloco = $obj_endereco_det['bloco']; | |
187 | + $ref_idtlog = $obj_endereco_det['idtlog']; | |
188 | + $nm_bairro = $obj_endereco_det['bairro']; | |
189 | + $nm_logradouro = $obj_endereco_det['logradouro']; | |
190 | + | |
191 | + $cep_ = int2CEP($id_cep); | |
192 | + | |
193 | + $xml .= sprintf('<id_cep>%d</id_cep>', $id_cep) . PHP_EOL; | |
194 | + $xml .= sprintf('<id_bairro>%d</id_bairro>', $id_bairro) . PHP_EOL; | |
195 | + $xml .= sprintf('<id_logradouro>%d</id_logradouro>', $id_logradouro) . PHP_EOL; | |
196 | + $xml .= sprintf('<numero>%s</numero>', $numero) . PHP_EOL; | |
197 | + $xml .= sprintf('<letra>%s</letra>', $letra) . PHP_EOL; | |
198 | + $xml .= sprintf('<complemento>%s</complemento>', $complemento) . PHP_EOL; | |
199 | + $xml .= sprintf('<andar>%s</andar>', $andar) . PHP_EOL; | |
200 | + $xml .= sprintf('<apartamento>%s</apartamento>', $apartamento) . PHP_EOL; | |
201 | + $xml .= sprintf('<bloco>%s</bloco>', $bloco) . PHP_EOL; | |
202 | + $xml .= sprintf('<ref_idtlog>%s</ref_idtlog>', $ref_idtlog) . PHP_EOL; | |
203 | + $xml .= sprintf('<nm_bairro>%s</nm_bairro>', $nm_bairro) . PHP_EOL; | |
204 | + $xml .= sprintf('<nm_logradouro>%s</nm_logradouro>', $nm_logradouro) . PHP_EOL; | |
205 | + } | |
206 | + else { | |
207 | + $obj_endereco = new clsEnderecoExterno($ref_idpes); | |
208 | + | |
209 | + if ($obj_endereco_det = $obj_endereco->detalhe()) { | |
210 | + $isEnderecoExterno = 1; | |
211 | + | |
212 | + $id_cep = $obj_endereco_det['cep']; | |
213 | + $cidade = $obj_endereco_det['cidade']; | |
214 | + $nm_bairro = $obj_endereco_det['bairro']; | |
215 | + $nm_logradouro = $obj_endereco_det['logradouro']; | |
216 | + | |
217 | + $id_bairro = NULL; | |
218 | + $id_logradouro = NULL; | |
219 | + $numero = $obj_endereco_det['numero']; | |
220 | + $letra = $obj_endereco_det['letra']; | |
221 | + $complemento = $obj_endereco_det['complemento']; | |
222 | + $andar = $obj_endereco_det['andar']; | |
223 | + $apartamento = $obj_endereco_det['apartamento']; | |
224 | + $bloco = $obj_endereco_det['bloco']; | |
225 | + | |
226 | + $ref_idtlog = $idtlog = $obj_endereco_det['idtlog']->idtlog; | |
227 | + $ref_sigla_uf = $ref_sigla_uf_ = $obj_endereco_det['sigla_uf']->sigla_uf; | |
228 | + $cep_ = int2CEP($id_cep); | |
229 | + | |
230 | + $xml .= sprintf('<id_cep>%s</id_cep>', $id_cep) . PHP_EOL; | |
231 | + $xml .= sprintf('<cidade>%s</cidade>', $cidade) . PHP_EOL; | |
232 | + $xml .= sprintf('<nm_bairro>%s</nm_bairro>', $nm_bairro) . PHP_EOL; | |
233 | + $xml .= sprintf('<nm_logradouro>%s</nm_logradouro>', $nm_logradouro) . PHP_EOL; | |
234 | + $xml .= sprintf('<numero>%s</numero>', $numero) . PHP_EOL; | |
235 | + $xml .= sprintf('<letra>%s</letra>', $letra) . PHP_EOL; | |
236 | + $xml .= sprintf('<complemento>%s</complemento>', $complemento) . PHP_EOL; | |
237 | + $xml .= sprintf('<andar>%s</andar>', $andar) . PHP_EOL; | |
238 | + $xml .= sprintf('<apartamento>%s</apartamento>', $apartamento) . PHP_EOL; | |
239 | + $xml .= sprintf('<bloco>%s</bloco>', $bloco) . PHP_EOL; | |
240 | + $xml .= sprintf('<ref_idtlog>%s</ref_idtlog>', $ref_idtlog) . PHP_EOL; | |
241 | + $xml .= sprintf('<idtlog>%s</idtlog>', $idtlog) . PHP_EOL; | |
242 | + $xml .= sprintf('<ref_sigla_uf>%s</ref_sigla_uf>', $ref_sigla_uf) . PHP_EOL; | |
243 | + $xml .= sprintf('<ref_sigla_uf_>%s</ref_sigla_uf_>', $ref_sigla_uf_) . PHP_EOL; | |
244 | + $xml .= sprintf('<cep_>%s</cep_>', $cep_) . PHP_EOL; | |
245 | + } | |
246 | + } | |
247 | + } | |
248 | + } | |
249 | + | |
250 | + if ($isEnderecoExterno == 0) { | |
251 | + $obj_bairro = new clsBairro($id_bairro); | |
252 | + $cep_ = int2CEP($id_cep); | |
253 | + | |
254 | + $xml .= sprintf('<cep_>%s</cep_>', $cep_) . PHP_EOL; | |
255 | + | |
256 | + $obj_bairro_det = $obj_bairro->detalhe(); | |
257 | + | |
258 | + if ($obj_bairro_det) { | |
259 | + $nm_bairro = $obj_bairro_det['nome']; | |
260 | + $xml .= sprintf('<nm_bairro>%s</nm_bairro>', $nm_bairro) . PHP_EOL; | |
261 | + } | |
262 | + | |
263 | + $obj_log = new clsLogradouro($id_logradouro); | |
264 | + $obj_log_det = $obj_log->detalhe(); | |
265 | + | |
266 | + if ($obj_log_det) { | |
267 | + $nm_logradouro = $obj_log_det['nome']; | |
268 | + $ref_idtlog = $obj_log_det['idtlog']->idtlog; | |
269 | + | |
270 | + $xml .= sprintf('<nm_logradouro>%s</nm_logradouro>', $nm_logradouro) . PHP_EOL; | |
271 | + $xml .= sprintf('<ref_idtlog>%s</ref_idtlog>', $ref_idtlog) . PHP_EOL; | |
272 | + | |
273 | + $obj_mun = new clsMunicipio($obj_log_det['idmun']); | |
274 | + $det_mun = $obj_mun->detalhe(); | |
275 | + | |
276 | + if ($det_mun) { | |
277 | + $cidade = ucfirst(strtolower($det_mun['nome'])); | |
278 | + $xml .= sprintf('<cidade>%s</cidade>', $cidade) . PHP_EOL; | |
279 | + } | |
280 | + | |
281 | + $ref_sigla_uf = $ref_sigla_uf_ = $det_mun['sigla_uf']->sigla_uf; | |
282 | + | |
283 | + $xml .= sprintf('<ref_sigla_uf>%s</ref_sigla_uf>', $ref_sigla_uf) . PHP_EOL; | |
284 | + $xml .= sprintf('<ref_sigla_uf_>%s</ref_sigla_uf_>', $ref_sigla_uf_) . PHP_EOL; | |
285 | + } | |
286 | + | |
287 | + $obj_bairro = new clsBairro($obj_endereco_det['ref_idbai']); | |
288 | + $obj_bairro_det = $obj_bairro->detalhe(); | |
289 | + | |
290 | + if ($obj_bairro_det) { | |
291 | + $nm_bairro = $obj_bairro_det['nome']; | |
292 | + $xml .= sprintf('<nm_bairro>%s</nm_bairro>', $nm_bairro) . PHP_EOL; | |
293 | + } | |
294 | + } | |
295 | + | |
296 | + if ($idpes_pai) { | |
297 | + $obj_pessoa_pai = new clsPessoaFj($idpes_pai); | |
298 | + $det_pessoa_pai = $obj_pessoa_pai->detalhe(); | |
299 | + | |
300 | + if ($det_pessoa_pai) { | |
301 | + $nm_pai = $det_pessoa_pai['nome']; | |
302 | + $xml .= sprintf('<nm_pai>%s</nm_pai>', $nm_pai) . PHP_EOL; | |
303 | + | |
304 | + $obj_cpf = new clsFisica($idpes_pai); | |
305 | + $det_cpf = $obj_cpf->detalhe(); | |
306 | + | |
307 | + if ($det_cpf['cpf']) { | |
308 | + $cpf_pai = int2CPF($det_cpf['cpf']); | |
309 | + $xml .= sprintf('<cpf_pai>%s</cpf_pai>', $cpf_pai) . PHP_EOL; | |
310 | + } | |
311 | + } | |
312 | + } | |
313 | + | |
314 | + if ($idpes_mae) { | |
315 | + $obj_pessoa_mae = new clsPessoaFj($idpes_mae); | |
316 | + $det_pessoa_mae = $obj_pessoa_mae->detalhe(); | |
317 | + | |
318 | + if ($det_pessoa_mae) { | |
319 | + $nm_mae = $det_pessoa_mae['nome']; | |
320 | + $xml .= sprintf('<nm_mae>%s</nm_mae>', $nm_mae) . PHP_EOL; | |
321 | + | |
322 | + // CPF | |
323 | + $obj_cpf = new clsFisica($idpes_mae); | |
324 | + $det_cpf = $obj_cpf->detalhe(); | |
325 | + | |
326 | + if ($det_cpf['cpf']) { | |
327 | + $cpf_mae = int2CPF($det_cpf['cpf']); | |
328 | + $xml .= sprintf('<cpf_mae>%s</cpf_mae>', $cpf_mae) . PHP_EOL; | |
329 | + } | |
330 | + } | |
331 | + } | |
332 | + | |
333 | + if (! $tipo_responsavel) { | |
334 | + if ($nm_pai) { | |
335 | + $tipo_responsavel = 'p'; | |
336 | + } | |
337 | + elseif ($nm_mae) { | |
338 | + $tipo_responsavel = 'm'; | |
339 | + } | |
340 | + elseif ($ref_idpes_responsavel) { | |
341 | + $tipo_responsavel = 'r'; | |
342 | + } | |
343 | + | |
344 | + $xml .= sprintf('<tipo_responsavel>%s</tipo_responsavel>', $tipo_responsavel) . PHP_EOL; | |
345 | + } | |
346 | + | |
347 | + if ($ref_idpes) { | |
348 | + $ObjDocumento = new clsDocumento($ref_idpes); | |
349 | + $detalheDocumento = $ObjDocumento->detalhe(); | |
350 | + | |
351 | + $rg = $detalheDocumento['rg']; | |
352 | + | |
353 | + $xml .= sprintf('<rg>%s</rg>', $rg); | |
354 | + | |
355 | + if ($detalheDocumento['data_exp_rg']) { | |
356 | + $data_exp_rg = date( | |
357 | + 'd/m/Y', strtotime(substr($detalheDocumento['data_exp_rg'], 0, 19)) | |
358 | + ); | |
359 | + | |
360 | + $xml .= sprintf('<data_exp_rg>%s</data_exp_rg>', $data_exp_rg) . PHP_EOL; | |
361 | + } | |
362 | + | |
363 | + $sigla_uf_exp_rg = $detalheDocumento['sigla_uf_exp_rg']; | |
364 | + $tipo_cert_civil = $detalheDocumento['tipo_cert_civil']; | |
365 | + $num_termo = $detalheDocumento['num_termo']; | |
366 | + $num_livro = $detalheDocumento['num_livro']; | |
367 | + $num_folha = $detalheDocumento['num_folha']; | |
368 | + | |
369 | + $xml .= sprintf('<sigla_uf_exp_rg>%s</sigla_uf_exp_rg>', $sigla_uf_exp_rg) . PHP_EOL; | |
370 | + $xml .= sprintf('<tipo_cert_civil>%s</tipo_cert_civil>', $tipo_cert_civil) . PHP_EOL; | |
371 | + $xml .= sprintf('<num_termo>%s</num_termo>', $num_termo) . PHP_EOL; | |
372 | + $xml .= sprintf('<num_livro>%s</num_livro>', $num_livro) . PHP_EOL; | |
373 | + $xml .= sprintf('<num_folha>%s</num_folha>', $num_folha) . PHP_EOL; | |
374 | + | |
375 | + if ($detalheDocumento['data_emissao_cert_civil']) { | |
376 | + $data_emissao_cert_civil = date( | |
377 | + 'd/m/Y', strtotime( | |
378 | + substr($detalheDocumento['data_emissao_cert_civil'], 0, 19) | |
379 | + ) | |
380 | + ); | |
381 | + | |
382 | + $xml .= sprintf('<data_emissao_cert_civil>%s</data_emissao_cert_civil>', | |
383 | + $data_emissao_cert_civil) . PHP_EOL; | |
384 | + } | |
385 | + | |
386 | + $sigla_uf_cert_civil = $detalheDocumento['sigla_uf_cert_civil']; | |
387 | + $cartorio_cert_civil = $detalheDocumento['cartorio_cert_civil']; | |
388 | + $num_cart_trabalho = $detalheDocumento['num_cart_trabalho']; | |
389 | + $serie_cart_trabalho = $detalheDocumento['serie_cart_trabalho']; | |
390 | + | |
391 | + $xml .= sprintf( | |
392 | + '<sigla_uf_cert_civil>%s</sigla_uf_cert_civil>', | |
393 | + $sigla_uf_cert_civil | |
394 | + ) . PHP_EOL; | |
395 | + | |
396 | + $xml .= sprintf( | |
397 | + '<cartorio_cert_civil>%s</cartorio_cert_civil>', | |
398 | + $cartorio_cert_civil | |
399 | + ) . PHP_EOL; | |
400 | + | |
401 | + $xml .= sprintf( | |
402 | + '<num_cart_trabalho>%s</num_cart_trabalho>', | |
403 | + $num_cart_trabalho | |
404 | + ) . PHP_EOL; | |
405 | + | |
406 | + $xml .= sprintf( | |
407 | + '<serie_cart_trabalho>%s</serie_cart_trabalho>', | |
408 | + $serie_cart_trabalho | |
409 | + ) . PHP_EOL; | |
410 | + | |
411 | + if ($detalheDocumento['data_emissao_cart_trabalho']) { | |
412 | + $data_emissao_cart_trabalho = date('d/m/Y', | |
413 | + strtotime(substr($detalheDocumento['data_emissao_cart_trabalho'], 0, 19)) | |
414 | + ); | |
415 | + | |
416 | + $xml .= sprintf( | |
417 | + '<data_emissao_cart_trabalho>%s</data_emissao_cart_trabalho>', | |
418 | + $data_emissao_cart_trabalho | |
419 | + ) . PHP_EOL; | |
420 | + } | |
421 | + | |
422 | + $sigla_uf_cart_trabalho = $detalheDocumento['sigla_uf_cart_trabalho']; | |
423 | + $num_tit_eleitor = $detalheDocumento['num_tit_eleitor']; | |
424 | + $zona_tit_eleitor = $detalheDocumento['zona_tit_eleitor']; | |
425 | + $secao_tit_eleitor = $detalheDocumento['secao_tit_eleitor']; | |
426 | + $idorg_exp_rg = $detalheDocumento['idorg_exp_rg']; | |
427 | + | |
428 | + $xml .= sprintf( | |
429 | + '<sigla_uf_cart_trabalho>%s</sigla_uf_cart_trabalho>', | |
430 | + $sigla_uf_cart_trabalho | |
431 | + ) . PHP_EOL; | |
432 | + | |
433 | + $xml .= sprintf( | |
434 | + '<num_tit_eleitor>%s</num_tit_eleitor>', | |
435 | + $num_tit_eleitor | |
436 | + ) . PHP_EOL; | |
437 | + | |
438 | + $xml .= sprintf( | |
439 | + '<zona_tit_eleitor>%s</zona_tit_eleitor>', | |
440 | + $zona_tit_eleitor | |
441 | + ) . PHP_EOL; | |
442 | + | |
443 | + $xml .= sprintf( | |
444 | + '<secao_tit_eleitor>%s</secao_tit_eleitor>', | |
445 | + $secao_tit_eleitor | |
446 | + ) . PHP_EOL; | |
447 | + | |
448 | + $xml .= sprintf('<idorg_exp_rg>%s</idorg_exp_rg>', $idorg_exp_rg) . PHP_EOL; | |
449 | + } | |
450 | + | |
451 | + $xml .= '</dados>' . PHP_EOL; | |
452 | + $xml .= '</query>'; | |
453 | + | |
454 | + echo $xml; | |
455 | +} | |
425 | 456 | \ No newline at end of file | ... | ... |