educar_escola_ano_letivo_xml.php
1.07 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
<?php
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=\"UTF-8\"?>\n<query xmlns=\"sugestoes\">\n";
if( is_numeric( $_GET["esc"] ) )
{
$db = new clsBanco();
if($_GET["lim"])
$lim = "limit 5";
if($_GET["ano_atual"])
$ano_tual = " AND ano >= {$_GET['ano_atual']} ";
$db->Consulta( "
SELECT
ano
FROM
pmieducar.escola_ano_letivo
WHERE
ref_cod_escola = {$_GET["esc"]} $ano_tual
AND ativo = 1
ORDER BY
ano asc $lim
" );
while ( $db->ProximoRegistro() )
{
list( $ano ) = $db->Tupla();
echo " <ano>{$ano}</ano>\n";
}
}
echo "</query>";
?>