educar_turma_sala_xml.php 2.67 KB
<?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"]  ) && is_numeric( $_GET["esc"]  ) && is_numeric( $_GET["com"]) && is_numeric( $_GET['cur'])&& is_numeric( $_GET['ser'])  )
	{
		if(is_numeric( $_GET["not_tur"]))
			$not_turma = " AND t.cod_turma != {$_GET['not_tur']} ";

		$db = new clsBanco();
		$consulta = "SELECT to_char(hora_inicial,'hh24:mm') as hora_inicial
							,to_char(hora_final,'hh24:mm')  as hora_final
 				 	   FROM pmieducar.turma t
				 	  WHERE t.ref_cod_instituicao = {$_GET["inst"]}
				 	    AND t.ref_ref_cod_escola = {$_GET['esc']}
				 	    AND t.ref_ref_cod_serie = {$_GET['ser']}
				 	    AND t.ref_cod_infra_predio_comodo = {$_GET['com']}
				 	    AND t.ref_cod_curso = {$_GET['cur']}
				 	   	$not_turma
					    AND t.ativo = 1
					  ORDER BY 2
						";

		$db->Consulta( $consulta );
		while ( $db->ProximoRegistro() )
		{
			list( $hora_inicial,$hora_final) = $db->Tupla();
			echo "	<item>{$hora_inicial}</item>\n";
			echo "	<item>{$hora_final}</item>\n";

		}
	}
	echo "</query>";
?>