Commit 978500161721a61f8c214a811c9877085a4c3913

Authored by Eriksen Costa Paixão
1 parent 4cdcbd51
Exists in master

Corrigido bug no cadastro de Reserva de Vaga para alunos externos:

 * Detalhes da reserva de vaga para aluno externo são mostrados, inclusive com indicação "(aluno externo)" ao lado do nome
 * Listagem de reservas de vaga mostram aluno externo com indicação "(aluno externo)" ao lado do nome
 * Refactoring e documentação dos arquivos envolvidos
 * Melhoria na navegação: ao clicar em Vagas reservadas, lista-se agora apenas as vagas para a referida série e escola

ieducar/intranet/educar_reserva_vaga_det.php
1 1 <?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   - * *
4   - * @author Prefeitura Municipal de Itajaí *
5   - * @updated 29/03/2007 *
6   - * Pacote: i-PLB Software Público Livre e Brasileiro *
7   - * *
8   - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   - * ctima@itajai.sc.gov.br *
10   - * *
11   - * Este programa é software livre, você pode redistribuí-lo e/ou *
12   - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   - * publicada pela Free Software Foundation, tanto a versão 2 da *
14   - * Licença como (a seu critério) qualquer versão mais nova. *
15   - * *
16   - * Este programa é distribuído na expectativa de ser útil, mas SEM *
17   - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   - * sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   - * *
21   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   - * junto com este programa. Se não, escreva para a Free Software *
23   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   - * 02111-1307, USA. *
25   - * *
26   - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   -require_once ("include/clsBase.inc.php");
28   -require_once ("include/clsDetalhe.inc.php");
29   -require_once ("include/clsBanco.inc.php");
30   -require_once( "include/pmieducar/geral.inc.php" );
31   -
32   -class clsIndexBase extends clsBase
33   -{
34   - function Formular()
35   - {
36   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Reserva Vaga" );
37   - $this->processoAp = "639";
38   - }
  2 +
  3 +/**
  4 + * i-Educar - Sistema de gestão escolar
  5 + *
  6 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  7 + * <ctima@itajai.sc.gov.br>
  8 + *
  9 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  10 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  11 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  12 + * qualquer versão posterior.
  13 + *
  14 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  15 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  16 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  17 + * do GNU para mais detalhes.
  18 + *
  19 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  20 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  21 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  22 + *
  23 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  24 + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
  25 + * @package Core
  26 + * @subpackage ReservaVaga
  27 + * @since Arquivo disponível desde a versão 1.0.0
  28 + * @version $Id$
  29 + */
  30 +
  31 +require_once 'include/clsBase.inc.php';
  32 +require_once 'include/clsDetalhe.inc.php';
  33 +require_once 'include/clsBanco.inc.php';
  34 +require_once 'include/pmieducar/geral.inc.php';
  35 +
  36 +class clsIndexBase extends clsBase {
  37 + public function Formular() {
  38 + $this->SetTitulo($this->_instituicao . ' i-Educar - Reserva Vaga');
  39 + $this->processoAp = '639';
  40 + }
39 41 }
40 42  
41 43 class indice extends clsDetalhe
42 44 {
43   - /**
44   - * Titulo no topo da pagina
45   - *
46   - * @var int
47   - */
48   - var $titulo;
49   -
50   - var $pessoa_logada;
51   -
52   - var $ref_cod_escola;
53   - var $ref_cod_serie;
54   - var $ref_usuario_exc;
55   - var $ref_usuario_cad;
56   - var $data_cadastro;
57   - var $data_exclusao;
58   - var $ativo;
59   -
60   - function Gerar()
61   - {
62   - @session_start();
63   - $this->pessoa_logada = $_SESSION['id_pessoa'];
64   - session_write_close();
65   -
66   - $this->titulo = "Reserva Vaga - Detalhe";
67   - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" );
68   -
69   - $this->ref_cod_serie=$_GET["ref_cod_serie"];
70   - $this->ref_cod_escola=$_GET["ref_cod_escola"];
71   -
72   - $tmp_obj = new clsPmieducarEscolaSerie();
73   - $lst_obj = $tmp_obj->lista($this->ref_cod_escola, $this->ref_cod_serie);
74   - $registro = array_shift($lst_obj);
75   -
76   - if( ! $registro )
77   - {
78   - header( "location: educar_reserva_vaga_lst.php" );
79   - die();
80   - }
81   -
82   - if( class_exists( "clsPmieducarInstituicao" ) )
83   - {
84   - $obj_ref_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] );
85   - $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
86   - $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"];
87   - }
88   - else
89   - {
90   - $registro["ref_cod_escola"] = "Erro na gera&ccedil;&atilde;o";
91   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarEscola\n-->";
92   - }
93   - if( class_exists( "clsPmieducarEscola" ) )
94   - {
95   - $obj_ref_cod_escola = new clsPmieducarEscola( $registro["ref_cod_escola"] );
96   - $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
97   - $nm_escola = $det_ref_cod_escola["nome"];
98   - }
99   - else
100   - {
101   - $registro["ref_cod_escola"] = "Erro na geracao";
102   - echo "<!--\nErro\nClasse nao existente: clsPmieducarEscola\n-->";
103   - }
104   - if( class_exists( "clsPmieducarSerie" ) )
105   - {
106   - $obj_ref_cod_serie = new clsPmieducarSerie( $registro["ref_cod_serie"] );
107   - $det_ref_cod_serie = $obj_ref_cod_serie->detalhe();
108   - $nm_serie = $det_ref_cod_serie["nm_serie"];
109   - }
110   - else
111   - {
112   - $registro["ref_cod_serie"] = "Erro na gera&ccedil;&atilde;o";
113   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarSerie\n-->";
114   - }
115   - if( class_exists( "clsPmieducarCurso" ) )
116   - {
117   - $obj_curso = new clsPmieducarCurso( $registro["ref_cod_curso"] );
118   - $det_curso = $obj_curso->detalhe();
119   - $registro["ref_cod_curso"] = $det_curso["nm_curso"];
120   - }
121   - else
122   - {
123   - $registro["ref_cod_serie"] = "Erro na gera&ccedil;&atilde;o";
124   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarSerie\n-->";
125   - }
126   - //----------------------------------------------//
127   - if( class_exists( "clsPmieducarMatricula" ) )
128   - {
129   - $obj_matricula = new clsPmieducarMatricula();
130   - $lst_matricula = $obj_matricula->lista( null,null,$registro["ref_cod_escola"],$registro["ref_cod_serie"],null,null,null,3,null,null,null,null,1 );
131   - if (is_array($lst_matricula))
132   - {
133   - $matriculados = count($lst_matricula);
134   - }
135   - }
136   - else
137   - {
138   - $matriculados = "Erro na gera&ccedil;&atilde;o";
139   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarMatricula\n-->";
140   - }
141   -
142   - if( class_exists( "clsPmieducarReservaVaga" ) )
143   - {
144   - $obj_reserva_vaga = new clsPmieducarReservaVaga();
145   - $lst_reserva_vaga = $obj_reserva_vaga->lista( null,$registro["ref_cod_escola"],$registro["ref_cod_serie"],null,null,null,null,null,null,null,1 );
146   - if (is_array($lst_reserva_vaga))
147   - {
148   - $reservados = count($lst_reserva_vaga);
149   - }
150   - }
151   - else
152   - {
153   - $reservados = "Erro na gera&ccedil;&atilde;o";
154   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarReservaVaga\n-->";
155   - }
156   -
157   - $obj_permissao = new clsPermissoes();
158   - $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada);
159   - if ($nivel_usuario == 1)
160   - {
161   - if( $registro["ref_cod_instituicao"] )
162   - {
163   - $this->addDetalhe( array( "Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}") );
164   - }
165   - }
166   - if ($nivel_usuario == 1 || $nivel_usuario == 2)
167   - {
168   - if( $nm_escola )
169   - {
170   - $this->addDetalhe( array( "Escola", "{$nm_escola}") );
171   - }
172   - }
173   - if( $registro["ref_cod_curso"] )
174   - {
175   - $this->addDetalhe( array( "Curso", "{$registro["ref_cod_curso"]}") );
176   - }
177   - if( $nm_serie )
178   - {
179   - $this->addDetalhe( array( "S&eacute;rie", "{$nm_serie}") );
180   - }
181   -
182   - $obj_turmas = new clsPmieducarTurma();
183   - $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 );
184   -
185   -// echo "<pre>"; print_r($lst_turmas);
186   -
187   - if ( is_array($lst_turmas) )
188   - {
189   - $cont = 0;
190   - $total_vagas = 0;
191   - $html = "<table width='50%' cellspacing='0' cellpadding='0' border='0'>
192   - <tr>
193   - <td bgcolor=#A1B3BD>Nome</td>
194   - <td bgcolor=#A1B3BD>N&uacute;mero Vagas</td>";
195   - foreach ( $lst_turmas AS $turmas )
196   - {
197   - $total_vagas += $turmas["max_aluno"];
198   - if ( ($cont % 2) == 0 )
199   - {
200   - $class = " formmdtd ";
201   - }
202   - else
203   - {
204   - $class = " formlttd ";
205   - }
206   - $cont++;
207   -
208   - $html .="<tr>
209   - <td class=$class width='35%'>{$turmas["nm_turma"]}</td>
210   - <td class=$class width='15%'>{$turmas["max_aluno"]}</td>
211   - </tr>";
212   - }
213   - $html .="</tr></table>";
214   - $this->addDetalhe( array( "Turma", $html) );
215   -
216   - if( $total_vagas )
217   - {
218   - $this->addDetalhe( array( "Total Vagas", "{$total_vagas}") );
219   - }
220   - if( $matriculados )
221   - {
222   - $this->addDetalhe( array( "Matriculados", "{$matriculados}") );
223   - }
224   - if( $reservados )
225   - {
226   - $this->addDetalhe( array( "Reservados", "{$reservados}") );
227   - }
228   - $vagas_restantes = $total_vagas - ($matriculados + $reservados);
229   - $this->addDetalhe( array( "Vagas Restantes", "{$vagas_restantes}") );
230   - }
231   -
232   - if( $obj_permissao->permissao_cadastra( 639, $this->pessoa_logada,7 ) )
233   - {
234   - $this->array_botao = array("Reservar Vaga", "Vagas Reservadas");
235   - $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");
236   - }
237   - $this->url_cancelar = "educar_reserva_vaga_lst.php";
238   - $this->largura = "100%";
239   - }
  45 + /**
  46 + * Referência a usuário da sessão
  47 + * @var int
  48 + */
  49 + var $pessoa_logada = NULL;
  50 +
  51 + /**
  52 + * Título no topo da página
  53 + * @var string
  54 + */
  55 + var $titulo = '';
  56 +
  57 + // Atributos de mapeamento da tabela pmieducar.reserva_vaga
  58 + var
  59 + $ref_cod_escola,
  60 + $ref_cod_serie,
  61 + $ref_usuario_exc,
  62 + $ref_usuario_cad,
  63 + $data_cadastro,
  64 + $data_exclusao,
  65 + $ativo;
  66 +
  67 + function Gerar()
  68 + {
  69 + session_start();
  70 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  71 + session_write_close();
  72 +
  73 + $this->titulo = 'Reserva Vaga - Detalhe';
  74 + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet');
  75 +
  76 + $this->ref_cod_serie = $_GET['ref_cod_serie'];
  77 + $this->ref_cod_escola = $_GET['ref_cod_escola'];
  78 +
  79 + $tmp_obj = new clsPmieducarEscolaSerie();
  80 + $lst_obj = $tmp_obj->lista($this->ref_cod_escola, $this->ref_cod_serie);
  81 + $registro = array_shift($lst_obj);
  82 +
  83 + if (! $registro) {
  84 + header('Location: educar_reserva_vaga_lst.php');
  85 + die();
  86 + }
  87 +
  88 + // Instituição
  89 + $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
  90 + $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
  91 + $registro['ref_cod_instituicao'] = $det_ref_cod_instituicao['nm_instituicao'];
  92 +
  93 + // Escola
  94 + $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_cod_escola']);
  95 + $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
  96 + $nm_escola = $det_ref_cod_escola['nome'];
  97 +
  98 + // Série
  99 + $obj_ref_cod_serie = new clsPmieducarSerie($registro['ref_cod_serie']);
  100 + $det_ref_cod_serie = $obj_ref_cod_serie->detalhe();
  101 + $nm_serie = $det_ref_cod_serie['nm_serie'];
  102 +
  103 + // Curso
  104 + $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']);
  105 + $det_curso = $obj_curso->detalhe();
  106 + $registro['ref_cod_curso'] = $det_curso['nm_curso'];
  107 +
  108 + // Matrícula
  109 + $obj_matricula = new clsPmieducarMatricula();
  110 + $lst_matricula = $obj_matricula->lista(NULL, NULL, $registro['ref_cod_escola'],
  111 + $registro['ref_cod_serie'], NULL, NULL, NULL, 3, NULL, NULL, NULL, NULL, 1);
  112 +
  113 + if (is_array($lst_matricula)) {
  114 + $matriculados = count($lst_matricula);
  115 + }
  116 +
  117 + // Detalhes da reserva
  118 + $obj_reserva_vaga = new clsPmieducarReservaVaga();
  119 + $lst_reserva_vaga = $obj_reserva_vaga->lista(NULL, $registro['ref_cod_escola'],
  120 + $registro['ref_cod_serie'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  121 +
  122 + if (is_array($lst_reserva_vaga)) {
  123 + $reservados = count($lst_reserva_vaga);
  124 + }
  125 +
  126 + // Permissões
  127 + $obj_permissao = new clsPermissoes();
  128 + $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada);
  129 +
  130 + if ($nivel_usuario == 1) {
  131 + if ($registro['ref_cod_instituicao']) {
  132 + $this->addDetalhe(array('Institui&ccedil;&atilde;o', $registro['ref_cod_instituicao']));
  133 + }
  134 + }
  135 +
  136 + if ($nivel_usuario == 1 || $nivel_usuario == 2) {
  137 + if ($nm_escola) {
  138 + $this->addDetalhe(array('Escola', $nm_escola));
  139 + }
  140 + }
  141 +
  142 + if ($registro['ref_cod_curso']) {
  143 + $this->addDetalhe(array('Curso', $registro['ref_cod_curso']));
  144 + }
  145 +
  146 + if ($nm_serie) {
  147 + $this->addDetalhe(array('S&eacute;rie', $nm_serie));
  148 + }
  149 +
  150 + $obj_turmas = new clsPmieducarTurma();
  151 + $lst_turmas = $obj_turmas->lista(NULL, NULL, NULL, $this->ref_cod_serie,
  152 + $this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  153 +
  154 + if (is_array($lst_turmas)) {
  155 + $cont = 0;
  156 + $total_vagas = 0;
  157 + $html = "
  158 + <table width='50%' cellspacing='0' cellpadding='0' border='0'>
  159 + <tr>
  160 + <td bgcolor=#A1B3BD>Nome</td>
  161 + <td bgcolor=#A1B3BD>N&uacute;mero Vagas</td>
  162 + </tr>";
  163 +
  164 + foreach ($lst_turmas as $turmas) {
  165 + $total_vagas += $turmas['max_aluno'];
  166 + if (($cont % 2) == 0) {
  167 + $class = ' formmdtd ';
  168 + }
  169 + else {
  170 + $class = ' formlttd ';
  171 + }
  172 + $cont++;
  173 +
  174 + $html .="
  175 + <tr>
  176 + <td class=$class width='35%'>{$turmas["nm_turma"]}</td>
  177 + <td class=$class width='15%'>{$turmas["max_aluno"]}</td>
  178 + </tr>";
  179 + }
  180 +
  181 + $html .= '</tr></table>';
  182 + $this->addDetalhe(array('Turma', $html));
  183 +
  184 + if ($total_vagas) {
  185 + $this->addDetalhe(array('Total Vagas', $total_vagas));
  186 + }
  187 +
  188 + if ($matriculados) {
  189 + $this->addDetalhe(array('Matriculados', $matriculados));
  190 + }
  191 +
  192 + if ($reservados) {
  193 + $this->addDetalhe(array('Reservados', $reservados));
  194 + }
  195 +
  196 + $vagas_restantes = $total_vagas - ($matriculados + $reservados);
  197 + $this->addDetalhe(array('Vagas Restantes', $vagas_restantes));
  198 + }
  199 +
  200 + if ($obj_permissao->permissao_cadastra(639, $this->pessoa_logada, 7)) {
  201 + $this->array_botao = array('Reservar Vaga', 'Vagas Reservadas');
  202 + $this->array_botao_url = array("educar_reserva_vaga_cad.php?ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_serie={$registro["ref_cod_serie"]}",
  203 + 'educar_reservada_vaga_lst.php?ref_cod_escola=' . $registro['ref_cod_escola'] .
  204 + '&ref_cod_serie=' . $registro['ref_cod_serie']);
  205 + }
  206 +
  207 + $this->url_cancelar = 'educar_reserva_vaga_lst.php';
  208 + $this->largura = '100%';
  209 + }
240 210 }
241 211  
242   -// cria uma extensao da classe base
  212 +// Instancia objeto de página
243 213 $pagina = new clsIndexBase();
244   -// cria o conteudo
  214 +
  215 +// Instancia objeto de conteúdo
245 216 $miolo = new indice();
246   -// adiciona o conteudo na clsBase
247   -$pagina->addForm( $miolo );
248   -// gera o html
249   -$pagina->MakeAll();
250   -?>
251 217 \ No newline at end of file
  218 +
  219 +// Atribui o conteúdo à página
  220 +$pagina->addForm($miolo);
  221 +
  222 +// Gera o código HTML
  223 +$pagina->MakeAll();
252 224 \ No newline at end of file
... ...
ieducar/intranet/educar_reservada_vaga_det.php
1 1 <?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   - * *
4   - * @author Prefeitura Municipal de Itajaí *
5   - * @updated 29/03/2007 *
6   - * Pacote: i-PLB Software Público Livre e Brasileiro *
7   - * *
8   - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   - * ctima@itajai.sc.gov.br *
10   - * *
11   - * Este programa é software livre, você pode redistribuí-lo e/ou *
12   - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   - * publicada pela Free Software Foundation, tanto a versão 2 da *
14   - * Licença como (a seu critério) qualquer versão mais nova. *
15   - * *
16   - * Este programa é distribuído na expectativa de ser útil, mas SEM *
17   - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   - * sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   - * *
21   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   - * junto com este programa. Se não, escreva para a Free Software *
23   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   - * 02111-1307, USA. *
25   - * *
26   - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   -require_once ("include/clsBase.inc.php");
28   -require_once ("include/clsDetalhe.inc.php");
29   -require_once ("include/clsBanco.inc.php");
30   -require_once( "include/pmieducar/geral.inc.php" );
31   -
32   -class clsIndexBase extends clsBase
33   -{
34   - function Formular()
35   - {
36   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Vagas Reservadas" );
37   - $this->processoAp = "639";
38   - }
  2 +
  3 +/**
  4 + * i-Educar - Sistema de gestão escolar
  5 + *
  6 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  7 + * <ctima@itajai.sc.gov.br>
  8 + *
  9 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  10 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  11 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  12 + * qualquer versão posterior.
  13 + *
  14 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  15 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  16 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  17 + * do GNU para mais detalhes.
  18 + *
  19 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  20 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  21 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  22 + *
  23 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  24 + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
  25 + * @package Core
  26 + * @subpackage ReservaVaga
  27 + * @since Arquivo disponível desde a versão 1.0.0
  28 + * @version $Id$
  29 + */
  30 +
  31 +require_once 'include/clsBase.inc.php';
  32 +require_once 'include/clsDetalhe.inc.php';
  33 +require_once 'include/clsBanco.inc.php';
  34 +require_once 'include/pmieducar/geral.inc.php';
  35 +
  36 +class clsIndexBase extends clsBase {
  37 + public function Formular() {
  38 + $this->SetTitulo($this->_instituicao . 'i-Educar - Vagas Reservadas');
  39 + $this->processoAp = '639';
  40 + }
39 41 }
40 42  
41 43 class indice extends clsDetalhe
42 44 {
43   - /**
44   - * Titulo no topo da pagina
45   - *
46   - * @var int
47   - */
48   - var $titulo;
49   -
50   - var $pessoa_logada;
51   -
52   - var $cod_reserva_vaga;
53   - var $ref_ref_cod_escola;
54   - var $ref_ref_cod_serie;
55   - var $ref_usuario_exc;
56   - var $ref_usuario_cad;
57   - var $ref_cod_aluno;
58   - var $data_cadastro;
59   - var $data_exclusao;
60   - var $ativo;
61   -
62   - var $ref_cod_escola;
63   - var $ref_cod_curso;
64   - var $ref_cod_instituicao;
65   -
66   - function Gerar()
67   - {
68   - @session_start();
69   - $this->pessoa_logada = $_SESSION['id_pessoa'];
70   - session_write_close();
71   -
72   - $this->titulo = "Vagas Reservadas - Detalhe";
73   - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" );
74   -
75   - $this->cod_reserva_vaga=$_GET["cod_reserva_vaga"];
76   -
77   - if ($_GET["desativa"] == true)
78   - {
79   - $obj = new clsPmieducarReservaVaga( $this->cod_reserva_vaga,null,null,$this->pessoa_logada,null,null,null,null,0 );
80   - $excluiu = $obj->excluir();
81   - if( $excluiu )
82   - {
83   - $this->mensagem .= "Exclus&atilde;o efetuada com sucesso.<br>";
84   - header( "Location: educar_reservada_vaga_lst.php" );
85   - die();
86   - return true;
87   - }
88   - $this->mensagem = "Exclus&atilde;o n&atilde;o realizada.<br>";
89   - return false;
90   - }
91   -
92   - $obj_reserva_vaga = new clsPmieducarReservaVaga();
93   - $lst_reserva_vaga = $obj_reserva_vaga->lista($this->cod_reserva_vaga);
94   - if(is_array($lst_reserva_vaga))
95   - $registro = array_shift($lst_reserva_vaga);
96   -
97   - if( !$registro )
98   - {
99   - header( "location: educar_reservada_vaga_lst.php" );
100   - die();
101   - }
102   -
103   - if( class_exists( "clsPmieducarInstituicao" ) )
104   - {
105   - $obj_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] );
106   - $det_instituicao = $obj_instituicao->detalhe();
107   - $registro["ref_cod_instituicao"] = $det_instituicao["nm_instituicao"];
108   - }
109   - else
110   - {
111   - $registro["ref_cod_instituicao"] = "Erro na gera&ccedil;&atilde;o";
112   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarInstituicao\n-->";
113   - }
114   - if( class_exists( "clsPmieducarEscola" ) )
115   - {
116   - $obj_escola = new clsPmieducarEscola( $registro["ref_ref_cod_escola"] );
117   - $det_escola = $obj_escola->detalhe();
118   - $registro["ref_ref_cod_escola"] = $det_escola["nome"];
119   - }
120   - else
121   - {
122   - $registro["ref_ref_cod_escola"] = "Erro na geracao";
123   - echo "<!--\nErro\nClasse nao existente: clsPmieducarEscola\n-->";
124   - }
125   - if( class_exists( "clsPmieducarSerie" ) )
126   - {
127   - $obj_serie = new clsPmieducarSerie( $registro["ref_ref_cod_serie"] );
128   - $det_serie = $obj_serie->detalhe();
129   - $registro["ref_ref_cod_serie"] = $det_serie["nm_serie"];
130   - }
131   - else
132   - {
133   - $registro["ref_ref_cod_serie"] = "Erro na gera&ccedil;&atilde;o";
134   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarSerie\n-->";
135   - }
136   - if( class_exists( "clsPmieducarCurso" ) )
137   - {
138   - $obj_curso = new clsPmieducarCurso( $registro["ref_cod_curso"] );
139   - $det_curso = $obj_curso->detalhe();
140   - $registro["ref_cod_curso"] = $det_curso["nm_curso"];
141   - }
142   - else
143   - {
144   - $registro["ref_cod_curso"] = "Erro na gera&ccedil;&atilde;o";
145   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarCurso\n-->";
146   - }
147   -
148   - if( class_exists( "clsPmieducarAluno" ) )
149   - {
150   - $obj_aluno = new clsPmieducarAluno();
151   - $lst_aluno = $obj_aluno->lista( $registro["ref_cod_aluno"],null,null,null,null,null,null,null,null,null,1 );
152   - if ( is_array($lst_aluno) )
153   - {
154   - $det_aluno = array_shift($lst_aluno);
155   - $nm_aluno = $det_aluno["nome_aluno"];
156   - }
157   - }
158   - else
159   - {
160   - $reservados = "Erro na gera&ccedil;&atilde;o";
161   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarAluno\n-->";
162   - }
163   -
164   - if( $nm_aluno )
165   - {
166   - $this->addDetalhe( array( "Aluno", "{$nm_aluno}") );
167   - }
168   - if( $this->cod_reserva_vaga )
169   - {
170   - $this->addDetalhe( array( "N&uacute;mero Reserva Vaga", "{$this->cod_reserva_vaga}") );
171   - }
172   -
173   - $this->addDetalhe( array( "-", "Reserva Pretendida") );
174   -
175   - if( $registro["ref_cod_instituicao"] )
176   - {
177   - $this->addDetalhe( array( "Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}") );
178   - }
179   - if( $registro["ref_ref_cod_escola"] )
180   - {
181   - $this->addDetalhe( array( "Escola", "{$registro["ref_ref_cod_escola"]}") );
182   - }
183   - if( $registro["ref_cod_curso"] )
184   - {
185   - $this->addDetalhe( array( "Curso", "{$registro["ref_cod_curso"]}") );
186   - }
187   - if( $registro["ref_ref_cod_serie"] )
188   - {
189   - $this->addDetalhe( array( "S&eacute;rie", "{$registro["ref_ref_cod_serie"]}") );
190   - }
191   -
192   - $obj_permissao = new clsPermissoes();
193   - if( $obj_permissao->permissao_cadastra( 639, $this->pessoa_logada,7 ) )
194   - {
195   - $this->array_botao = array("Emiss&atilde;o de Documento de Reserva de Vaga", "Desativar Reserva");
196   - //$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");
197   - $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\")");
198   - }
199   - $this->url_cancelar = "educar_reservada_vaga_lst.php";
200   - $this->largura = "100%";
201   - }
  45 + /**
  46 + * Referência a usuário da sessão
  47 + * @var int
  48 + */
  49 + var $pessoa_logada = NULL;
  50 +
  51 + /**
  52 + * Título no topo da página
  53 + * @var string
  54 + */
  55 + var $titulo = '';
  56 +
  57 + // Atributos de mapeamento da tabela pmieducar.reserva_vaga
  58 + var
  59 + $cod_reserva_vaga,
  60 + $ref_ref_cod_escola,
  61 + $ref_ref_cod_serie,
  62 + $ref_usuario_exc,
  63 + $ref_usuario_cad,
  64 + $ref_cod_aluno,
  65 + $data_cadastro,
  66 + $data_exclusao,
  67 + $ativo;
  68 +
  69 + /**
  70 + * Identificação para pmieducar.escola.
  71 + * @var int
  72 + */
  73 + var $ref_cod_escola;
  74 +
  75 + /**
  76 + * Identificação para pmieducar.curso.
  77 + * @var int
  78 + */
  79 + var $ref_cod_curso;
  80 +
  81 + /**
  82 + * Identificação para pmieducar.serie.
  83 + * @var int
  84 + */
  85 + var $ref_cod_serie;
  86 +
  87 + /**
  88 + * Identificação para pmieducar.instituicao.
  89 + * @var int
  90 + */
  91 + var $ref_cod_instituicao;
  92 +
  93 + /**
  94 + * Sobrescreve clsDetalhe::Gerar().
  95 + * @see clsDetalhe::Gerar()
  96 + */
  97 + function Gerar()
  98 + {
  99 + session_start();
  100 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  101 + session_write_close();
  102 +
  103 + $this->titulo = 'Vagas Reservadas - Detalhe';
  104 + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet');
  105 +
  106 + $this->cod_reserva_vaga = $_GET['cod_reserva_vaga'];
  107 +
  108 + if ($_GET['desativa'] == true) {
  109 + $obj = new clsPmieducarReservaVaga($this->cod_reserva_vaga, NULL, NULL,
  110 + $this->pessoa_logada, NULL, NULL, NULL, NULL, 0);
  111 + $excluiu = $obj->excluir();
  112 +
  113 + if ($excluiu) {
  114 + $this->mensagem .= 'Exclus&atilde;o efetuada com sucesso.<br>';
  115 + header('Location: educar_reservada_vaga_lst.php');
  116 + die();
  117 + }
  118 +
  119 + $this->mensagem = 'Exclus&atilde;o n&atilde;o realizada.<br>';
  120 + return FALSE;
  121 + }
  122 +
  123 + $obj_reserva_vaga = new clsPmieducarReservaVaga();
  124 + $lst_reserva_vaga = $obj_reserva_vaga->lista($this->cod_reserva_vaga);
  125 +
  126 + if (is_array($lst_reserva_vaga)) {
  127 + $registro = array_shift($lst_reserva_vaga);
  128 + }
  129 +
  130 + if (!$registro) {
  131 + header('Location: educar_reservada_vaga_lst.php');
  132 + die();
  133 + }
  134 +
  135 + // Atribui códigos a variáveis de instância
  136 + $this->ref_cod_escola = $registro['ref_ref_cod_escola'];
  137 + $this->ref_cod_curso = $registro['ref_cod_curso'];
  138 + $this->ref_cod_serie = $registro['ref_ref_cod_serie'];
  139 + $this->ref_cod_instituicao = $registro['ref_cod_instituicao'];
  140 +
  141 + // Instituição
  142 + $obj_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
  143 + $det_instituicao = $obj_instituicao->detalhe();
  144 + $registro['ref_cod_instituicao'] = $det_instituicao['nm_instituicao'];
  145 +
  146 + // Escola
  147 + $obj_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']);
  148 + $det_escola = $obj_escola->detalhe();
  149 + $registro['ref_ref_cod_escola'] = $det_escola['nome'];
  150 +
  151 + // Série
  152 + $obj_serie = new clsPmieducarSerie($registro['ref_ref_cod_serie']);
  153 + $det_serie = $obj_serie->detalhe();
  154 + $registro['ref_ref_cod_serie'] = $det_serie['nm_serie'];
  155 +
  156 + // Curso
  157 + $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']);
  158 + $det_curso = $obj_curso->detalhe();
  159 + $registro['ref_cod_curso'] = $det_curso['nm_curso'];
  160 +
  161 + if ($registro['nm_aluno']) {
  162 + $nm_aluno = $registro['nm_aluno'] . ' (aluno externo)';
  163 + }
  164 +
  165 + if ($registro["ref_cod_aluno"]) {
  166 + $obj_aluno = new clsPmieducarAluno();
  167 + $lst_aluno = $obj_aluno->lista($registro['ref_cod_aluno'], NULL, NULL,
  168 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  169 +
  170 + if (is_array($lst_aluno)) {
  171 + $det_aluno = array_shift($lst_aluno);
  172 + $nm_aluno = $det_aluno['nome_aluno'];
  173 + }
  174 + }
  175 +
  176 + if ($nm_aluno) {
  177 + $this->addDetalhe(array('Aluno', $nm_aluno));
  178 + }
  179 +
  180 + if ($this->cod_reserva_vaga) {
  181 + $this->addDetalhe(array('N&uacute;mero Reserva Vaga', $this->cod_reserva_vaga));
  182 + }
  183 +
  184 + $this->addDetalhe(array('-', 'Reserva Pretendida'));
  185 +
  186 + if ($registro['ref_cod_instituicao']) {
  187 + $this->addDetalhe(array('Institui&ccedil;&atilde;o', $registro['ref_cod_instituicao']));
  188 + }
  189 +
  190 + if ($registro['ref_ref_cod_escola']) {
  191 + $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola']));
  192 + }
  193 +
  194 + if ($registro['ref_cod_curso']) {
  195 + $this->addDetalhe(array('Curso', $registro['ref_cod_curso']));
  196 + }
  197 +
  198 + if ($registro['ref_ref_cod_serie']) {
  199 + $this->addDetalhe(array('S&eacute;rie', $registro['ref_ref_cod_serie']));
  200 + }
  201 +
  202 + $obj_permissao = new clsPermissoes();
  203 + if ($obj_permissao->permissao_cadastra(639, $this->pessoa_logada,7)) {
  204 + $this->array_botao = array('Emiss&atilde;o de Documento de Reserva de Vaga', 'Desativar Reserva');
  205 + $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\")");
  206 + }
  207 +
  208 + $this->url_cancelar = 'educar_reservada_vaga_lst.php?ref_cod_escola=' .
  209 + $this->ref_cod_escola . '&ref_cod_serie=' . $this->ref_cod_serie;
  210 + $this->largura = '100%';
  211 + }
202 212 }
203 213  
204   -// cria uma extensao da classe base
  214 +// Instancia objeto de página
205 215 $pagina = new clsIndexBase();
206   -// cria o conteudo
  216 +
  217 +// Instancia objeto de conteúdo
207 218 $miolo = new indice();
208   -// adiciona o conteudo na clsBase
209   -$pagina->addForm( $miolo );
210   -// gera o html
211   -$pagina->MakeAll();
212   -?>
213 219 \ No newline at end of file
  220 +
  221 +// Atribui o conteúdo à página
  222 +$pagina->addForm($miolo);
  223 +
  224 +// Gera o código HTML
  225 +$pagina->MakeAll();
214 226 \ No newline at end of file
... ...
ieducar/intranet/educar_reservada_vaga_lst.php
1 1 <?php
2 2  
3   -/*
  3 +/**
4 4 * i-Educar - Sistema de gestão escolar
5 5 *
6 6 * Copyright (C) 2006 Prefeitura Municipal de Itajaí
... ... @@ -19,12 +19,8 @@
19 19 * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
20 20 * com este programa; se não, escreva para a Free Software Foundation, Inc., no
21 21 * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
22   - */
23   -
24   -/**
25   - * Listagem de reserva de vagas.
26 22 *
27   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
  23 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
28 24 * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
29 25 * @package Core
30 26 * @subpackage ReservaVaga
... ... @@ -37,7 +33,6 @@ require_once &#39;include/clsListagem.inc.php&#39;;
37 33 require_once 'include/clsBanco.inc.php';
38 34 require_once 'include/pmieducar/geral.inc.php';
39 35  
40   -
41 36 class clsIndexBase extends clsBase {
42 37 public function Formular() {
43 38 $this->SetTitulo($this->_instituicao . ' i-Educar - Vagas Reservadas');
... ... @@ -45,38 +40,34 @@ class clsIndexBase extends clsBase {
45 40 }
46 41 }
47 42  
48   -
49   -class indice extends clsListagem {
50   -
  43 +class indice extends clsListagem
  44 +{
51 45 /**
52 46 * Referência a usuário da sessão
53 47 * @var int
54 48 */
55   - public $pessoa_logada = NULL;
  49 + var $pessoa_logada = NULL;
56 50  
57 51 /**
58   - * Título no topo da paágina
  52 + * Título no topo da página
59 53 * @var string
60 54 */
61   - public $titulo = '';
  55 + var $titulo = '';
62 56  
63 57 /**
64 58 * Limite de registros por página
65 59 * @var int
66 60 */
67   - public $limite = 0;
  61 + var $limite = 0;
68 62  
69 63 /**
70 64 * Início dos registros a serem exibidos (limit)
71 65 * @var int
72 66 */
73   - public $offset = 0;
  67 + var $offset = 0;
74 68  
75   - /**
76   - * Atributos de mapeamento da tabela pmieducar.reserva_vaga
77   - * @var mixed
78   - */
79   - public
  69 + // Atributos de mapeamento da tabela pmieducar.reserva_vaga
  70 + var
80 71 $cod_reserva_vaga = NULL,
81 72 $ref_ref_cod_escola = NULL,
82 73 $ref_ref_cod_serie = NULL,
... ... @@ -91,19 +82,18 @@ class indice extends clsListagem {
91 82 * Atributos para apresentação
92 83 * @var mixed
93 84 */
94   - public
  85 + var
95 86 $ref_cod_escola = NULL,
96 87 $ref_cod_curso = NULL,
97 88 $ref_cod_instituicao = NULL,
98 89 $nm_aluno = NULL;
99 90  
100   -
101   -
102 91 /**
103   - * Implementação de clsListagem::Gerar()
104   - * @see ieducar/intranet/include/clsListagem#Gerar()
  92 + * Sobrescreve clsListagem::Gerar().
  93 + * @see clsListagem::Gerar()
105 94 */
106   - public function Gerar() {
  95 + function Gerar()
  96 + {
107 97 session_start();
108 98 $this->pessoa_logada = $_SESSION['id_pessoa'];
109 99 session_write_close();
... ... @@ -138,7 +128,7 @@ class indice extends clsListagem {
138 128  
139 129 // Lista de opçõees para o formulário de pesquisa rápida
140 130 $get_escola = TRUE;
141   - $get_curso = TRUE;
  131 + $get_curso = TRUE;
142 132 $get_escola_curso_serie = TRUE;
143 133 include 'include/pmieducar/educar_campo_lista.php';
144 134  
... ... @@ -146,6 +136,17 @@ class indice extends clsListagem {
146 136 if ($this->ref_cod_escola) {
147 137 $this->ref_ref_cod_escola = $this->ref_cod_escola;
148 138 }
  139 + elseif (isset($_GET['ref_cod_escola'])) {
  140 + $this->ref_ref_cod_escola = intval($_GET['ref_cod_escola']);
  141 + }
  142 +
  143 + // Referência de série
  144 + if ($this->ref_cod_serie) {
  145 + $this->ref_ref_cod_serie = $this->ref_cod_serie;
  146 + }
  147 + elseif (isset($_GET['ref_cod_serie'])) {
  148 + $this->ref_ref_cod_serie = intval($_GET['ref_cod_serie']);
  149 + }
149 150  
150 151 // Campos do formulário
151 152 $this->campoTexto('nm_aluno', 'Aluno', $this->nm_aluno, 30, 255, FALSE, FALSE,
... ... @@ -225,7 +226,7 @@ class indice extends clsListagem {
225 226 $registro['ref_cod_aluno'] = $det_pessoa['nome'];
226 227 }
227 228 else {
228   - $registro['ref_cod_aluno'] = $registro['nm_aluno'];
  229 + $registro['ref_cod_aluno'] = $registro['nm_aluno'] . ' (aluno externo)';
229 230 }
230 231  
231 232 // Array de dados formatados para apresentação
... ...