From d66262201c905bb1793d1b0d930ab36be67908a6 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Date: Sun, 19 Dec 2010 17:07:21 -0200 Subject: [PATCH] Refactoring para coding standards. --- ieducar/intranet/educar_serie_xml.php | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------- 1 file changed, 76 insertions(+), 62 deletions(-) diff --git a/ieducar/intranet/educar_serie_xml.php b/ieducar/intranet/educar_serie_xml.php index ede4b45..9b989d5 100644 --- a/ieducar/intranet/educar_serie_xml.php +++ b/ieducar/intranet/educar_serie_xml.php @@ -1,65 +1,79 @@ \n\n"; - if( is_numeric( $_GET["esc"] ) && is_numeric( $_GET["cur"] ) ) - { - $db = new clsBanco(); - $db->Consulta( "SELECT cod_serie, nm_serie FROM pmieducar.serie WHERE ref_cod_curso = {$_GET["cur"]} AND ativo = 1 ORDER BY nm_serie ASC" ); - while ( $db->ProximoRegistro() ) - { - list( $cod, $nome ) = $db->Tupla(); - echo " {$nome}\n"; - } - } - elseif( is_numeric( $_GET["cur"] ) ) - { - $db = new clsBanco(); - $db->Consulta( " - SELECT - cod_serie - , nm_serie - FROM - pmieducar.serie - WHERE - ref_cod_curso = {$_GET["cur"]} - AND ativo = 1 - ORDER BY - nm_serie ASC - " ); +/** + * i-Educar - Sistema de gestão escolar + * + * Copyright (C) 2006 Prefeitura Municipal de Itajaí + * + * + * 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 posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Arquivo disponível desde a versão 1.0.0 + * @todo As duas queries são idênticas, o parâmetro 'esc' nunca é usado. + * Verificar e refatorar. + * @version $Id$ + */ - while ( $db->ProximoRegistro() ) - { - list( $cod, $nome ) = $db->Tupla(); - echo " {$nome}\n"; - } - } - echo ""; -?> \ No newline at end of file +header('Content-type: text/xml'); + +require_once 'include/clsBanco.inc.php'; +require_once 'include/funcoes.inc.php'; + +echo "\n\n"; + +if (is_numeric($_GET['esc']) && is_numeric($_GET['cur'])) +{ + $db = new clsBanco(); + $db->Consulta(sprintf('SELECT + cod_serie, nm_serie + FROM + pmieducar.serie + WHERE + ref_cod_curso = %d AND ativo = 1 + ORDER BY + nm_serie ASC', $_GET['cur'] + )); + + while ($db->ProximoRegistro()) + { + list($cod, $nome) = $db->Tupla(); + print sprintf(' %s%s', $cod, $nome, PHP_EOL); + } +} +elseif (is_numeric($_GET['cur'])) +{ + $db = new clsBanco(); + $db->Consulta(sprintf('SELECT + cod_serie, nm_serie + FROM + pmieducar.serie + WHERE + ref_cod_curso = %d AND ativo = 1 + ORDER BY + nm_serie ASC', $_GET["cur"] + )); + + while ($db->ProximoRegistro()) + { + list($cod, $nome) = $db->Tupla(); + print sprintf(' %s%s', $cod, $nome, PHP_EOL); + } +} + +echo ''; -- libgit2 0.21.2