From 978500161721a61f8c214a811c9877085a4c3913 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Thu, 30 Jul 2009 18:19:17 +0000 Subject: [PATCH] Corrigido bug no cadastro de Reserva de Vaga para alunos externos: --- ieducar/intranet/educar_reserva_vaga_det.php | 454 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/intranet/educar_reservada_vaga_det.php | 418 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/intranet/educar_reservada_vaga_lst.php | 57 +++++++++++++++++++++++++++++---------------------------- 3 files changed, 457 insertions(+), 472 deletions(-) diff --git a/ieducar/intranet/educar_reserva_vaga_det.php b/ieducar/intranet/educar_reserva_vaga_det.php index 7d43359..63619f1 100644 --- a/ieducar/intranet/educar_reserva_vaga_det.php +++ b/ieducar/intranet/educar_reserva_vaga_det.php @@ -1,250 +1,222 @@ SetTitulo( "{$this->_instituicao} i-Educar - Reserva Vaga" ); - $this->processoAp = "639"; - } + +/** + * 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í + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL + * @package Core + * @subpackage ReservaVaga + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ + */ + +require_once 'include/clsBase.inc.php'; +require_once 'include/clsDetalhe.inc.php'; +require_once 'include/clsBanco.inc.php'; +require_once 'include/pmieducar/geral.inc.php'; + +class clsIndexBase extends clsBase { + public function Formular() { + $this->SetTitulo($this->_instituicao . ' i-Educar - Reserva Vaga'); + $this->processoAp = '639'; + } } class indice extends clsDetalhe { - /** - * Titulo no topo da pagina - * - * @var int - */ - var $titulo; - - var $pessoa_logada; - - var $ref_cod_escola; - var $ref_cod_serie; - var $ref_usuario_exc; - var $ref_usuario_cad; - var $data_cadastro; - var $data_exclusao; - var $ativo; - - function Gerar() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - session_write_close(); - - $this->titulo = "Reserva Vaga - Detalhe"; - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); - - $this->ref_cod_serie=$_GET["ref_cod_serie"]; - $this->ref_cod_escola=$_GET["ref_cod_escola"]; - - $tmp_obj = new clsPmieducarEscolaSerie(); - $lst_obj = $tmp_obj->lista($this->ref_cod_escola, $this->ref_cod_serie); - $registro = array_shift($lst_obj); - - if( ! $registro ) - { - header( "location: educar_reserva_vaga_lst.php" ); - die(); - } - - if( class_exists( "clsPmieducarInstituicao" ) ) - { - $obj_ref_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] ); - $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); - $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"]; - } - else - { - $registro["ref_cod_escola"] = "Erro na geração"; - echo ""; - } - if( class_exists( "clsPmieducarEscola" ) ) - { - $obj_ref_cod_escola = new clsPmieducarEscola( $registro["ref_cod_escola"] ); - $det_ref_cod_escola = $obj_ref_cod_escola->detalhe(); - $nm_escola = $det_ref_cod_escola["nome"]; - } - else - { - $registro["ref_cod_escola"] = "Erro na geracao"; - echo ""; - } - if( class_exists( "clsPmieducarSerie" ) ) - { - $obj_ref_cod_serie = new clsPmieducarSerie( $registro["ref_cod_serie"] ); - $det_ref_cod_serie = $obj_ref_cod_serie->detalhe(); - $nm_serie = $det_ref_cod_serie["nm_serie"]; - } - else - { - $registro["ref_cod_serie"] = "Erro na geração"; - echo ""; - } - if( class_exists( "clsPmieducarCurso" ) ) - { - $obj_curso = new clsPmieducarCurso( $registro["ref_cod_curso"] ); - $det_curso = $obj_curso->detalhe(); - $registro["ref_cod_curso"] = $det_curso["nm_curso"]; - } - else - { - $registro["ref_cod_serie"] = "Erro na geração"; - echo ""; - } - //----------------------------------------------// - if( class_exists( "clsPmieducarMatricula" ) ) - { - $obj_matricula = new clsPmieducarMatricula(); - $lst_matricula = $obj_matricula->lista( null,null,$registro["ref_cod_escola"],$registro["ref_cod_serie"],null,null,null,3,null,null,null,null,1 ); - if (is_array($lst_matricula)) - { - $matriculados = count($lst_matricula); - } - } - else - { - $matriculados = "Erro na geração"; - echo ""; - } - - if( class_exists( "clsPmieducarReservaVaga" ) ) - { - $obj_reserva_vaga = new clsPmieducarReservaVaga(); - $lst_reserva_vaga = $obj_reserva_vaga->lista( null,$registro["ref_cod_escola"],$registro["ref_cod_serie"],null,null,null,null,null,null,null,1 ); - if (is_array($lst_reserva_vaga)) - { - $reservados = count($lst_reserva_vaga); - } - } - else - { - $reservados = "Erro na geração"; - echo ""; - } - - $obj_permissao = new clsPermissoes(); - $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada); - if ($nivel_usuario == 1) - { - if( $registro["ref_cod_instituicao"] ) - { - $this->addDetalhe( array( "Instituição", "{$registro["ref_cod_instituicao"]}") ); - } - } - if ($nivel_usuario == 1 || $nivel_usuario == 2) - { - if( $nm_escola ) - { - $this->addDetalhe( array( "Escola", "{$nm_escola}") ); - } - } - if( $registro["ref_cod_curso"] ) - { - $this->addDetalhe( array( "Curso", "{$registro["ref_cod_curso"]}") ); - } - if( $nm_serie ) - { - $this->addDetalhe( array( "Série", "{$nm_serie}") ); - } - - $obj_turmas = new clsPmieducarTurma(); - $lst_turmas = $obj_turmas->lista( null,null,null,$this->ref_cod_serie, $this->ref_cod_escola,null,null,null,null,null,null,null,null,null,1 ); - -// echo "
"; print_r($lst_turmas);
-
-		if ( is_array($lst_turmas) )
-		{
-			$cont = 0;
-			$total_vagas = 0;
-			$html = "
-					
-						
-						";
-			foreach ( $lst_turmas AS $turmas )
-			{
-				$total_vagas += $turmas["max_aluno"];
-				if ( ($cont % 2) == 0 )
-				{
-					$class = " formmdtd ";
-				}
-				else
-				{
-					$class = " formlttd ";
-				}
-				$cont++;
-
-				$html .="
-							
-							
-						";
-			}
-			$html .="
NomeNúmero Vagas
{$turmas["nm_turma"]}{$turmas["max_aluno"]}
"; - $this->addDetalhe( array( "Turma", $html) ); - - if( $total_vagas ) - { - $this->addDetalhe( array( "Total Vagas", "{$total_vagas}") ); - } - if( $matriculados ) - { - $this->addDetalhe( array( "Matriculados", "{$matriculados}") ); - } - if( $reservados ) - { - $this->addDetalhe( array( "Reservados", "{$reservados}") ); - } - $vagas_restantes = $total_vagas - ($matriculados + $reservados); - $this->addDetalhe( array( "Vagas Restantes", "{$vagas_restantes}") ); - } - - if( $obj_permissao->permissao_cadastra( 639, $this->pessoa_logada,7 ) ) - { - $this->array_botao = array("Reservar Vaga", "Vagas Reservadas"); - $this->array_botao_url = array("educar_reserva_vaga_cad.php?ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_serie={$registro["ref_cod_serie"]}", "educar_reservada_vaga_lst.php"); - } - $this->url_cancelar = "educar_reserva_vaga_lst.php"; - $this->largura = "100%"; - } + /** + * Referência a usuário da sessão + * @var int + */ + var $pessoa_logada = NULL; + + /** + * Título no topo da página + * @var string + */ + var $titulo = ''; + + // Atributos de mapeamento da tabela pmieducar.reserva_vaga + var + $ref_cod_escola, + $ref_cod_serie, + $ref_usuario_exc, + $ref_usuario_cad, + $data_cadastro, + $data_exclusao, + $ativo; + + function Gerar() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $this->titulo = 'Reserva Vaga - Detalhe'; + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); + + $this->ref_cod_serie = $_GET['ref_cod_serie']; + $this->ref_cod_escola = $_GET['ref_cod_escola']; + + $tmp_obj = new clsPmieducarEscolaSerie(); + $lst_obj = $tmp_obj->lista($this->ref_cod_escola, $this->ref_cod_serie); + $registro = array_shift($lst_obj); + + if (! $registro) { + header('Location: educar_reserva_vaga_lst.php'); + die(); + } + + // Instituição + $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']); + $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); + $registro['ref_cod_instituicao'] = $det_ref_cod_instituicao['nm_instituicao']; + + // Escola + $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_cod_escola']); + $det_ref_cod_escola = $obj_ref_cod_escola->detalhe(); + $nm_escola = $det_ref_cod_escola['nome']; + + // Série + $obj_ref_cod_serie = new clsPmieducarSerie($registro['ref_cod_serie']); + $det_ref_cod_serie = $obj_ref_cod_serie->detalhe(); + $nm_serie = $det_ref_cod_serie['nm_serie']; + + // Curso + $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']); + $det_curso = $obj_curso->detalhe(); + $registro['ref_cod_curso'] = $det_curso['nm_curso']; + + // Matrícula + $obj_matricula = new clsPmieducarMatricula(); + $lst_matricula = $obj_matricula->lista(NULL, NULL, $registro['ref_cod_escola'], + $registro['ref_cod_serie'], NULL, NULL, NULL, 3, NULL, NULL, NULL, NULL, 1); + + if (is_array($lst_matricula)) { + $matriculados = count($lst_matricula); + } + + // Detalhes da reserva + $obj_reserva_vaga = new clsPmieducarReservaVaga(); + $lst_reserva_vaga = $obj_reserva_vaga->lista(NULL, $registro['ref_cod_escola'], + $registro['ref_cod_serie'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); + + if (is_array($lst_reserva_vaga)) { + $reservados = count($lst_reserva_vaga); + } + + // Permissões + $obj_permissao = new clsPermissoes(); + $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada); + + if ($nivel_usuario == 1) { + if ($registro['ref_cod_instituicao']) { + $this->addDetalhe(array('Instituição', $registro['ref_cod_instituicao'])); + } + } + + if ($nivel_usuario == 1 || $nivel_usuario == 2) { + if ($nm_escola) { + $this->addDetalhe(array('Escola', $nm_escola)); + } + } + + if ($registro['ref_cod_curso']) { + $this->addDetalhe(array('Curso', $registro['ref_cod_curso'])); + } + + if ($nm_serie) { + $this->addDetalhe(array('Série', $nm_serie)); + } + + $obj_turmas = new clsPmieducarTurma(); + $lst_turmas = $obj_turmas->lista(NULL, NULL, NULL, $this->ref_cod_serie, + $this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); + + if (is_array($lst_turmas)) { + $cont = 0; + $total_vagas = 0; + $html = " + + + + + "; + + foreach ($lst_turmas as $turmas) { + $total_vagas += $turmas['max_aluno']; + if (($cont % 2) == 0) { + $class = ' formmdtd '; + } + else { + $class = ' formlttd '; + } + $cont++; + + $html .=" + + + + "; + } + + $html .= '
NomeNúmero Vagas
{$turmas["nm_turma"]}{$turmas["max_aluno"]}
'; + $this->addDetalhe(array('Turma', $html)); + + if ($total_vagas) { + $this->addDetalhe(array('Total Vagas', $total_vagas)); + } + + if ($matriculados) { + $this->addDetalhe(array('Matriculados', $matriculados)); + } + + if ($reservados) { + $this->addDetalhe(array('Reservados', $reservados)); + } + + $vagas_restantes = $total_vagas - ($matriculados + $reservados); + $this->addDetalhe(array('Vagas Restantes', $vagas_restantes)); + } + + if ($obj_permissao->permissao_cadastra(639, $this->pessoa_logada, 7)) { + $this->array_botao = array('Reservar Vaga', 'Vagas Reservadas'); + $this->array_botao_url = array("educar_reserva_vaga_cad.php?ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_serie={$registro["ref_cod_serie"]}", + 'educar_reservada_vaga_lst.php?ref_cod_escola=' . $registro['ref_cod_escola'] . + '&ref_cod_serie=' . $registro['ref_cod_serie']); + } + + $this->url_cancelar = 'educar_reserva_vaga_lst.php'; + $this->largura = '100%'; + } } -// cria uma extensao da classe base +// Instancia objeto de página $pagina = new clsIndexBase(); -// cria o conteudo + +// Instancia objeto de conteúdo $miolo = new indice(); -// adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); -// gera o html -$pagina->MakeAll(); -?> \ No newline at end of file + +// Atribui o conteúdo à página +$pagina->addForm($miolo); + +// Gera o código HTML +$pagina->MakeAll(); \ No newline at end of file diff --git a/ieducar/intranet/educar_reservada_vaga_det.php b/ieducar/intranet/educar_reservada_vaga_det.php index 37a34a9..9f2b739 100644 --- a/ieducar/intranet/educar_reservada_vaga_det.php +++ b/ieducar/intranet/educar_reservada_vaga_det.php @@ -1,212 +1,224 @@ SetTitulo( "{$this->_instituicao} i-Educar - Vagas Reservadas" ); - $this->processoAp = "639"; - } + +/** + * 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í + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL + * @package Core + * @subpackage ReservaVaga + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ + */ + +require_once 'include/clsBase.inc.php'; +require_once 'include/clsDetalhe.inc.php'; +require_once 'include/clsBanco.inc.php'; +require_once 'include/pmieducar/geral.inc.php'; + +class clsIndexBase extends clsBase { + public function Formular() { + $this->SetTitulo($this->_instituicao . 'i-Educar - Vagas Reservadas'); + $this->processoAp = '639'; + } } class indice extends clsDetalhe { - /** - * Titulo no topo da pagina - * - * @var int - */ - var $titulo; - - var $pessoa_logada; - - var $cod_reserva_vaga; - var $ref_ref_cod_escola; - var $ref_ref_cod_serie; - var $ref_usuario_exc; - var $ref_usuario_cad; - var $ref_cod_aluno; - var $data_cadastro; - var $data_exclusao; - var $ativo; - - var $ref_cod_escola; - var $ref_cod_curso; - var $ref_cod_instituicao; - - function Gerar() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - session_write_close(); - - $this->titulo = "Vagas Reservadas - Detalhe"; - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); - - $this->cod_reserva_vaga=$_GET["cod_reserva_vaga"]; - - if ($_GET["desativa"] == true) - { - $obj = new clsPmieducarReservaVaga( $this->cod_reserva_vaga,null,null,$this->pessoa_logada,null,null,null,null,0 ); - $excluiu = $obj->excluir(); - if( $excluiu ) - { - $this->mensagem .= "Exclusão efetuada com sucesso.
"; - header( "Location: educar_reservada_vaga_lst.php" ); - die(); - return true; - } - $this->mensagem = "Exclusão não realizada.
"; - return false; - } - - $obj_reserva_vaga = new clsPmieducarReservaVaga(); - $lst_reserva_vaga = $obj_reserva_vaga->lista($this->cod_reserva_vaga); - if(is_array($lst_reserva_vaga)) - $registro = array_shift($lst_reserva_vaga); - - if( !$registro ) - { - header( "location: educar_reservada_vaga_lst.php" ); - die(); - } - - if( class_exists( "clsPmieducarInstituicao" ) ) - { - $obj_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] ); - $det_instituicao = $obj_instituicao->detalhe(); - $registro["ref_cod_instituicao"] = $det_instituicao["nm_instituicao"]; - } - else - { - $registro["ref_cod_instituicao"] = "Erro na geração"; - echo ""; - } - if( class_exists( "clsPmieducarEscola" ) ) - { - $obj_escola = new clsPmieducarEscola( $registro["ref_ref_cod_escola"] ); - $det_escola = $obj_escola->detalhe(); - $registro["ref_ref_cod_escola"] = $det_escola["nome"]; - } - else - { - $registro["ref_ref_cod_escola"] = "Erro na geracao"; - echo ""; - } - if( class_exists( "clsPmieducarSerie" ) ) - { - $obj_serie = new clsPmieducarSerie( $registro["ref_ref_cod_serie"] ); - $det_serie = $obj_serie->detalhe(); - $registro["ref_ref_cod_serie"] = $det_serie["nm_serie"]; - } - else - { - $registro["ref_ref_cod_serie"] = "Erro na geração"; - echo ""; - } - if( class_exists( "clsPmieducarCurso" ) ) - { - $obj_curso = new clsPmieducarCurso( $registro["ref_cod_curso"] ); - $det_curso = $obj_curso->detalhe(); - $registro["ref_cod_curso"] = $det_curso["nm_curso"]; - } - else - { - $registro["ref_cod_curso"] = "Erro na geração"; - echo ""; - } - - if( class_exists( "clsPmieducarAluno" ) ) - { - $obj_aluno = new clsPmieducarAluno(); - $lst_aluno = $obj_aluno->lista( $registro["ref_cod_aluno"],null,null,null,null,null,null,null,null,null,1 ); - if ( is_array($lst_aluno) ) - { - $det_aluno = array_shift($lst_aluno); - $nm_aluno = $det_aluno["nome_aluno"]; - } - } - else - { - $reservados = "Erro na geração"; - echo ""; - } - - if( $nm_aluno ) - { - $this->addDetalhe( array( "Aluno", "{$nm_aluno}") ); - } - if( $this->cod_reserva_vaga ) - { - $this->addDetalhe( array( "Número Reserva Vaga", "{$this->cod_reserva_vaga}") ); - } - - $this->addDetalhe( array( "-", "Reserva Pretendida") ); - - if( $registro["ref_cod_instituicao"] ) - { - $this->addDetalhe( array( "Instituição", "{$registro["ref_cod_instituicao"]}") ); - } - if( $registro["ref_ref_cod_escola"] ) - { - $this->addDetalhe( array( "Escola", "{$registro["ref_ref_cod_escola"]}") ); - } - if( $registro["ref_cod_curso"] ) - { - $this->addDetalhe( array( "Curso", "{$registro["ref_cod_curso"]}") ); - } - if( $registro["ref_ref_cod_serie"] ) - { - $this->addDetalhe( array( "Série", "{$registro["ref_ref_cod_serie"]}") ); - } - - $obj_permissao = new clsPermissoes(); - if( $obj_permissao->permissao_cadastra( 639, $this->pessoa_logada,7 ) ) - { - $this->array_botao = array("Emissão de Documento de Reserva de Vaga", "Desativar Reserva"); - //$this->array_botao_url = array("educar_relatorio_solicitacao_transferencia.php?cod_reserva_vaga={$this->cod_reserva_vaga}", "educar_reservada_vaga_det.php?cod_reserva_vaga={$this->cod_reserva_vaga}&desativa=true"); - $this->array_botao_url_script = array("showExpansivelImprimir(400, 200, \"educar_relatorio_solicitacao_transferencia.php?cod_reserva_vaga={$this->cod_reserva_vaga}\",[], \"Relatório de Solicitação de transferência\")","go(\"educar_reservada_vaga_det.php?cod_reserva_vaga={$this->cod_reserva_vaga}&desativa=true\")"); - } - $this->url_cancelar = "educar_reservada_vaga_lst.php"; - $this->largura = "100%"; - } + /** + * Referência a usuário da sessão + * @var int + */ + var $pessoa_logada = NULL; + + /** + * Título no topo da página + * @var string + */ + var $titulo = ''; + + // Atributos de mapeamento da tabela pmieducar.reserva_vaga + var + $cod_reserva_vaga, + $ref_ref_cod_escola, + $ref_ref_cod_serie, + $ref_usuario_exc, + $ref_usuario_cad, + $ref_cod_aluno, + $data_cadastro, + $data_exclusao, + $ativo; + + /** + * Identificação para pmieducar.escola. + * @var int + */ + var $ref_cod_escola; + + /** + * Identificação para pmieducar.curso. + * @var int + */ + var $ref_cod_curso; + + /** + * Identificação para pmieducar.serie. + * @var int + */ + var $ref_cod_serie; + + /** + * Identificação para pmieducar.instituicao. + * @var int + */ + var $ref_cod_instituicao; + + /** + * Sobrescreve clsDetalhe::Gerar(). + * @see clsDetalhe::Gerar() + */ + function Gerar() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $this->titulo = 'Vagas Reservadas - Detalhe'; + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); + + $this->cod_reserva_vaga = $_GET['cod_reserva_vaga']; + + if ($_GET['desativa'] == true) { + $obj = new clsPmieducarReservaVaga($this->cod_reserva_vaga, NULL, NULL, + $this->pessoa_logada, NULL, NULL, NULL, NULL, 0); + $excluiu = $obj->excluir(); + + if ($excluiu) { + $this->mensagem .= 'Exclusão efetuada com sucesso.
'; + header('Location: educar_reservada_vaga_lst.php'); + die(); + } + + $this->mensagem = 'Exclusão não realizada.
'; + return FALSE; + } + + $obj_reserva_vaga = new clsPmieducarReservaVaga(); + $lst_reserva_vaga = $obj_reserva_vaga->lista($this->cod_reserva_vaga); + + if (is_array($lst_reserva_vaga)) { + $registro = array_shift($lst_reserva_vaga); + } + + if (!$registro) { + header('Location: educar_reservada_vaga_lst.php'); + die(); + } + + // Atribui códigos a variáveis de instância + $this->ref_cod_escola = $registro['ref_ref_cod_escola']; + $this->ref_cod_curso = $registro['ref_cod_curso']; + $this->ref_cod_serie = $registro['ref_ref_cod_serie']; + $this->ref_cod_instituicao = $registro['ref_cod_instituicao']; + + // Instituição + $obj_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']); + $det_instituicao = $obj_instituicao->detalhe(); + $registro['ref_cod_instituicao'] = $det_instituicao['nm_instituicao']; + + // Escola + $obj_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']); + $det_escola = $obj_escola->detalhe(); + $registro['ref_ref_cod_escola'] = $det_escola['nome']; + + // Série + $obj_serie = new clsPmieducarSerie($registro['ref_ref_cod_serie']); + $det_serie = $obj_serie->detalhe(); + $registro['ref_ref_cod_serie'] = $det_serie['nm_serie']; + + // Curso + $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']); + $det_curso = $obj_curso->detalhe(); + $registro['ref_cod_curso'] = $det_curso['nm_curso']; + + if ($registro['nm_aluno']) { + $nm_aluno = $registro['nm_aluno'] . ' (aluno externo)'; + } + + if ($registro["ref_cod_aluno"]) { + $obj_aluno = new clsPmieducarAluno(); + $lst_aluno = $obj_aluno->lista($registro['ref_cod_aluno'], NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); + + if (is_array($lst_aluno)) { + $det_aluno = array_shift($lst_aluno); + $nm_aluno = $det_aluno['nome_aluno']; + } + } + + if ($nm_aluno) { + $this->addDetalhe(array('Aluno', $nm_aluno)); + } + + if ($this->cod_reserva_vaga) { + $this->addDetalhe(array('Número Reserva Vaga', $this->cod_reserva_vaga)); + } + + $this->addDetalhe(array('-', 'Reserva Pretendida')); + + if ($registro['ref_cod_instituicao']) { + $this->addDetalhe(array('Instituição', $registro['ref_cod_instituicao'])); + } + + if ($registro['ref_ref_cod_escola']) { + $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola'])); + } + + if ($registro['ref_cod_curso']) { + $this->addDetalhe(array('Curso', $registro['ref_cod_curso'])); + } + + if ($registro['ref_ref_cod_serie']) { + $this->addDetalhe(array('Série', $registro['ref_ref_cod_serie'])); + } + + $obj_permissao = new clsPermissoes(); + if ($obj_permissao->permissao_cadastra(639, $this->pessoa_logada,7)) { + $this->array_botao = array('Emissão de Documento de Reserva de Vaga', 'Desativar Reserva'); + $this->array_botao_url_script = array("showExpansivelImprimir(400, 200, \"educar_relatorio_solicitacao_transferencia.php?cod_reserva_vaga={$this->cod_reserva_vaga}\",[], \"Relatório de Solicitação de transferência\")","go(\"educar_reservada_vaga_det.php?cod_reserva_vaga={$this->cod_reserva_vaga}&desativa=true\")"); + } + + $this->url_cancelar = 'educar_reservada_vaga_lst.php?ref_cod_escola=' . + $this->ref_cod_escola . '&ref_cod_serie=' . $this->ref_cod_serie; + $this->largura = '100%'; + } } -// cria uma extensao da classe base +// Instancia objeto de página $pagina = new clsIndexBase(); -// cria o conteudo + +// Instancia objeto de conteúdo $miolo = new indice(); -// adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); -// gera o html -$pagina->MakeAll(); -?> \ No newline at end of file + +// Atribui o conteúdo à página +$pagina->addForm($miolo); + +// Gera o código HTML +$pagina->MakeAll(); \ No newline at end of file diff --git a/ieducar/intranet/educar_reservada_vaga_lst.php b/ieducar/intranet/educar_reservada_vaga_lst.php index d9b116f..25044e3 100644 --- a/ieducar/intranet/educar_reservada_vaga_lst.php +++ b/ieducar/intranet/educar_reservada_vaga_lst.php @@ -1,6 +1,6 @@ + * @author Prefeitura Municipal de Itajaí * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL * @package Core * @subpackage ReservaVaga @@ -37,7 +33,6 @@ require_once 'include/clsListagem.inc.php'; require_once 'include/clsBanco.inc.php'; require_once 'include/pmieducar/geral.inc.php'; - class clsIndexBase extends clsBase { public function Formular() { $this->SetTitulo($this->_instituicao . ' i-Educar - Vagas Reservadas'); @@ -45,38 +40,34 @@ class clsIndexBase extends clsBase { } } - -class indice extends clsListagem { - +class indice extends clsListagem +{ /** * Referência a usuário da sessão * @var int */ - public $pessoa_logada = NULL; + var $pessoa_logada = NULL; /** - * Título no topo da paágina + * Título no topo da página * @var string */ - public $titulo = ''; + var $titulo = ''; /** * Limite de registros por página * @var int */ - public $limite = 0; + var $limite = 0; /** * Início dos registros a serem exibidos (limit) * @var int */ - public $offset = 0; + var $offset = 0; - /** - * Atributos de mapeamento da tabela pmieducar.reserva_vaga - * @var mixed - */ - public + // Atributos de mapeamento da tabela pmieducar.reserva_vaga + var $cod_reserva_vaga = NULL, $ref_ref_cod_escola = NULL, $ref_ref_cod_serie = NULL, @@ -91,19 +82,18 @@ class indice extends clsListagem { * Atributos para apresentação * @var mixed */ - public + var $ref_cod_escola = NULL, $ref_cod_curso = NULL, $ref_cod_instituicao = NULL, $nm_aluno = NULL; - - /** - * Implementação de clsListagem::Gerar() - * @see ieducar/intranet/include/clsListagem#Gerar() + * Sobrescreve clsListagem::Gerar(). + * @see clsListagem::Gerar() */ - public function Gerar() { + function Gerar() + { session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); @@ -138,7 +128,7 @@ class indice extends clsListagem { // Lista de opçõees para o formulário de pesquisa rápida $get_escola = TRUE; - $get_curso = TRUE; + $get_curso = TRUE; $get_escola_curso_serie = TRUE; include 'include/pmieducar/educar_campo_lista.php'; @@ -146,6 +136,17 @@ class indice extends clsListagem { if ($this->ref_cod_escola) { $this->ref_ref_cod_escola = $this->ref_cod_escola; } + elseif (isset($_GET['ref_cod_escola'])) { + $this->ref_ref_cod_escola = intval($_GET['ref_cod_escola']); + } + + // Referência de série + if ($this->ref_cod_serie) { + $this->ref_ref_cod_serie = $this->ref_cod_serie; + } + elseif (isset($_GET['ref_cod_serie'])) { + $this->ref_ref_cod_serie = intval($_GET['ref_cod_serie']); + } // Campos do formulário $this->campoTexto('nm_aluno', 'Aluno', $this->nm_aluno, 30, 255, FALSE, FALSE, @@ -225,7 +226,7 @@ class indice extends clsListagem { $registro['ref_cod_aluno'] = $det_pessoa['nome']; } else { - $registro['ref_cod_aluno'] = $registro['nm_aluno']; + $registro['ref_cod_aluno'] = $registro['nm_aluno'] . ' (aluno externo)'; } // Array de dados formatados para apresentação -- libgit2 0.21.2