educar_alunos_beneficios_xml.php
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* @author Prefeitura Municipal de Itaja� *
* @updated 29/03/2007 *
* Pacote: i-PLB Software P�blico Livre e Brasileiro *
* *
* Copyright (C) 2006 PMI - Prefeitura Municipal de Itaja� *
* ctima@itajai.sc.gov.br *
* *
* Este programa � software livre, voc� pode redistribu�-lo e/ou *
* modific�-lo sob os termos da Licen�a P�blica Geral GNU, conforme *
* publicada pela Free Software Foundation, tanto a vers�o 2 da *
* Licen�a como (a seu crit�rio) qualquer vers�o mais nova. *
* *
* Este programa � distribu�do na expectativa de ser �til, mas SEM *
* QUALQUER GARANTIA. Sem mesmo a garantia impl�cita de COMERCIALI- *
* ZA��O ou de ADEQUA��O A QUALQUER PROP�SITO EM PARTICULAR. Con- *
* sulte a Licen�a P�blica Geral GNU para obter mais detalhes. *
* *
* Voc� deve ter recebido uma c�pia da Licen�a P�blica Geral GNU *
* junto com este programa. Se n�o, escreva para a Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
* 02111-1307, USA. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
header( 'Content-type: text/xml' );
require_once( "include/clsBanco.inc.php" );
require_once( "include/funcoes.inc.php" );
require_once 'Portabilis/Utils/DeprecatedXmlApi.php';
Portabilis_Utils_DeprecatedXmlApi::returnEmptyQueryUnlessUserIsLoggedIn();
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n<query xmlns=\"sugestoes\">\n";
if( is_numeric( $_GET["inst"] ) )
{
if(is_numeric( $_GET["ano"] ))
$ano = " AND ano = {$_GET['ano']} ";
$where = "";
if (is_numeric($_GET['esc']))
$where .= "AND ref_ref_cod_escola = {$_GET['esc']} ";
if (is_numeric($_GET['curso']))
$where .= "AND m.ref_cod_curso = {$_GET['curso']} ";
if (is_numeric($_GET['serie']))
$where .= "AND m.ref_ref_cod_serie = {$_GET['serie']} ";
if (is_numeric($_GET['turma']))
$where = "AND mt.ref_cod_turma = {$_GET["turma"]} ";
$db = new clsBanco();
$db->Consulta( "
SELECT m.cod_matricula
,p.nome
FROM
pmieducar.matricula_turma mt
, pmieducar.matricula m
, pmieducar.aluno a
, cadastro.pessoa p
, pmieducar.instituicao i
, pmieducar.escola e
WHERE
i.cod_instituicao = {$_GET['inst']}
AND i.cod_instituicao = e.ref_cod_instituicao
AND e.cod_escola = m.ref_ref_cod_escola
AND m.cod_matricula = mt.ref_cod_matricula
AND m.ref_cod_aluno = a.cod_aluno
AND a.ref_idpes = p.idpes
AND mt.ativo = 1
AND m.ativo = 1
AND a.ref_cod_aluno_beneficio IS NOT NULL
{$where}
ORDER BY
to_ascii(p.nome) ASC
");
if ($db->numLinhas())
{
while ( $db->ProximoRegistro() )
{
list( $cod, $nome ) = $db->Tupla();
echo " <matricula cod_matricula=\"{$cod}\">{$nome}</matricula>\n";
}
}
}
echo "</query>";
?>