Commit 8b09b141e2d7abd972df5a194c06599c0fb5d173

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

--no commit message

Showing 1 changed file with 268 additions and 264 deletions   Show diff stats
ieducar/intranet/educar_reservada_vaga_lst.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/clsListagem.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 +
  24 +/**
  25 + * Listagem de reserva de vagas.
  26 + *
  27 + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
  28 + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
  29 + * @package Core
  30 + * @subpackage ReservaVaga
  31 + * @since Arquivo disponível desde a versão 1.0.0
  32 + * @version $Id$
  33 + */
  34 +
  35 +require_once 'include/clsBase.inc.php';
  36 +require_once 'include/clsListagem.inc.php';
  37 +require_once 'include/clsBanco.inc.php';
  38 +require_once 'include/pmieducar/geral.inc.php';
  39 +
  40 +
  41 +class clsIndexBase extends clsBase {
  42 + public function Formular() {
  43 + $this->SetTitulo($this->_instituicao . ' i-Educar - Vagas Reservadas');
  44 + $this->processoAp = '639';
  45 + }
39 46 }
40 47  
41   -class indice extends clsListagem
42   -{
43   - /**
44   - * Referencia pega da session para o idpes do usuario atual
45   - *
46   - * @var int
47   - */
48   - var $pessoa_logada;
49   -
50   - /**
51   - * Titulo no topo da pagina
52   - *
53   - * @var int
54   - */
55   - var $titulo;
56   -
57   - /**
58   - * Quantidade de registros a ser apresentada em cada pagina
59   - *
60   - * @var int
61   - */
62   - var $limite;
63   -
64   - /**
65   - * Inicio dos registros a serem exibidos (limit)
66   - *
67   - * @var int
68   - */
69   - var $offset;
70   -
71   - var $cod_reserva_vaga;
72   - var $ref_ref_cod_escola;
73   - var $ref_ref_cod_serie;
74   - var $ref_usuario_exc;
75   - var $ref_usuario_cad;
76   - var $ref_cod_aluno;
77   - var $data_cadastro;
78   - var $data_exclusao;
79   - var $ativo;
80   -
81   - var $ref_cod_escola;
82   - var $ref_cod_curso;
83   - var $ref_cod_instituicao;
84   - var $nm_aluno;
85   -
86   - function Gerar()
87   - {
88   - @session_start();
89   - $this->pessoa_logada = $_SESSION['id_pessoa'];
90   - session_write_close();
91   -
92   - $this->titulo = "Vagas Reservadas - Listagem";
93   -
94   - foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto
95   - $this->$var = ( $val === "" ) ? null: $val;
96   -
97   - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" );
98   -
99   - $lista_busca = array(
100   - "Aluno",
101   - "S&eacute;rie",
102   - "Curso"
103   - );
104   -
105   - $obj_permissao = new clsPermissoes();
106   - $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada);
107   - if ($nivel_usuario == 1)
108   - {
109   - $lista_busca[] = "Escola";
110   - $lista_busca[] = "Institui&ccedil;&atilde;o";
111   - }
112   - else if ($nivel_usuario == 2)
113   - {
114   - $lista_busca[] = "Escola";
115   - }
116   - $this->addCabecalhos($lista_busca);
117   -
118   - $get_escola = true;
119   -// $get_escola_curso = true;
120   - $get_curso = true;
121   - $get_escola_curso_serie = true;
122   - include("include/pmieducar/educar_campo_lista.php");
123   -
124   - if ( $this->ref_cod_escola )
125   - {
126   - $this->ref_ref_cod_escola = $this->ref_cod_escola;
127   - }
128   -
129   - $this->campoTexto("nm_aluno", "Aluno", $this->nm_aluno, 30, 255, false, false, false, "", "<img border=\"0\" onclick=\"pesquisa_aluno();\" id=\"ref_cod_aluno_lupa\" name=\"ref_cod_aluno_lupa\" src=\"imagens/lupa.png\"\/>");
130   - $this->campoOculto("ref_cod_aluno", $this->ref_cod_aluno);
131   -
132   - // Paginador
133   - $this->limite = 20;
134   - $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0;
135   -
136   - $obj_reserva_vaga = new clsPmieducarReservaVaga();
137   - $obj_reserva_vaga->setOrderby( "data_cadastro ASC" );
138   - $obj_reserva_vaga->setLimite( $this->limite, $this->offset );
139   -
140   - $lista = $obj_reserva_vaga->lista(
141   - $this->cod_reserva_vaga,
142   - $this->ref_ref_cod_escola,
143   - $this->ref_ref_cod_serie,
144   - null,
145   - null,
146   - $this->ref_cod_aluno,
147   - null,
148   - null,
149   - null,
150   - null,
151   - 1,
152   - $this->ref_cod_instituicao,
153   - $this->ref_cod_curso
154   - );
155   -
156   - $total = $obj_reserva_vaga->_total;
157   -
158   - // monta a lista
159   - if( is_array( $lista ) && count( $lista ) )
160   - {
161   - foreach ( $lista AS $registro )
162   - {
163   - if( class_exists( "clsPmieducarSerie" ) )
164   - {
165   - $obj_serie = new clsPmieducarSerie( $registro["ref_ref_cod_serie"] );
166   - $det_serie = $obj_serie->detalhe();
167   - $nm_serie = $det_serie["nm_serie"];
168   - }
169   - else
170   - {
171   - $registro["ref_ref_cod_serie"] = "Erro na gera&ccedil;&atilde;o";
172   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarSerie\n-->";
173   - }
174   - if( class_exists( "clsPmieducarCurso" ) )
175   - {
176   - $obj_curso = new clsPmieducarCurso( $registro["ref_cod_curso"] );
177   - $det_curso = $obj_curso->detalhe();
178   - $registro["ref_cod_curso"] = $det_curso["nm_curso"];
179   - }
180   - else
181   - {
182   - $registro["ref_cod_serie"] = "Erro na gera&ccedil;&atilde;o";
183   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarSerie\n-->";
184   - }
185   - if( class_exists( "clsPmieducarEscola" ) )
186   - {
187   - $obj_escola = new clsPmieducarEscola( $registro["ref_ref_cod_escola"] );
188   - $det_escola = $obj_escola->detalhe();
189   - $nm_escola = $det_escola["nome"];
190   - }
191   - else
192   - {
193   - $registro["ref_ref_cod_escola"] = "Erro na gera&ccedil;&atilde;o";
194   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarEscola\n-->";
195   - }
196   - if( class_exists( "clsPmieducarInstituicao" ) )
197   - {
198   - $obj_ref_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] );
199   - $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
200   - $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"];
201   - }
202   - else
203   - {
204   - $registro["ref_cod_escola"] = "Erro na gera&ccedil;&atilde;o";
205   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarEscola\n-->";
206   - }
207   - if( class_exists( "clsPmieducarAluno" ) )
208   - {
209   - $obj_aluno = new clsPmieducarAluno( $registro["ref_cod_aluno"] );
210   - $det_aluno = $obj_aluno->detalhe();
211   - $ref_idpes = $det_aluno["ref_idpes"];
212   -
213   - if( class_exists( "clsPessoa_" ) )
214   - {
215   - $obj_pessoa = new clsPessoa_( $ref_idpes );
216   - $det_pessoa = $obj_pessoa->detalhe();
217   - $registro["ref_cod_aluno"] = $det_pessoa["nome"];
218   - }
219   - else
220   - {
221   - $registro["ref_cod_aluno"] = "Erro na gera&ccedil;&atilde;o";
222   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPessoa_\n-->";
223   - }
224   - }
225   - else
226   - {
227   - $registro["ref_cod_aluno"] = "Erro na gera&ccedil;&atilde;o";
228   - echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarAluno\n-->";
229   - }
230   -
231   - $lista_busca = array(
232   - "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$registro["ref_cod_aluno"]}</a>",
233   - "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$nm_serie}</a>",
234   - "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$registro["ref_cod_curso"]}</a>"
235   - );
236   -
237   - if ($nivel_usuario == 1)
238   - {
239   - $lista_busca[] = "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$nm_escola}</a>";
240   - $lista_busca[] = "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$registro["ref_cod_instituicao"]}</a>";
241   - }
242   - else if ($nivel_usuario == 2)
243   - {
244   - $lista_busca[] = "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$nm_escola}</a>";
245   - }
246   - $this->addLinhas($lista_busca);
247   - }
248   - }
249   - $this->addPaginador2( "educar_reservada_vaga_lst.php", $total, $_GET, $this->nome, $this->limite );
250   - $this->largura = "100%";
251   - }
  48 +
  49 +class indice extends clsListagem {
  50 +
  51 + /**
  52 + * Referência a usuário da sessão
  53 + * @var int
  54 + */
  55 + public $pessoa_logada = NULL;
  56 +
  57 + /**
  58 + * Título no topo da paágina
  59 + * @var string
  60 + */
  61 + public $titulo = '';
  62 +
  63 + /**
  64 + * Limite de registros por página
  65 + * @var int
  66 + */
  67 + public $limite = 0;
  68 +
  69 + /**
  70 + * Início dos registros a serem exibidos (limit)
  71 + * @var int
  72 + */
  73 + public $offset = 0;
  74 +
  75 + /**
  76 + * Atributos de mapeamento da tabela pmieducar.reserva_vaga
  77 + * @var mixed
  78 + */
  79 + public
  80 + $cod_reserva_vaga = NULL,
  81 + $ref_ref_cod_escola = NULL,
  82 + $ref_ref_cod_serie = NULL,
  83 + $ref_usuario_exc = NULL,
  84 + $ref_usuario_cad = NULL,
  85 + $ref_cod_aluno = NULL,
  86 + $data_cadastro = NULL,
  87 + $data_exclusao = NULL,
  88 + $ativo = NULL;
  89 +
  90 + /**
  91 + * Atributos para apresentação
  92 + * @var mixed
  93 + */
  94 + public
  95 + $ref_cod_escola = NULL,
  96 + $ref_cod_curso = NULL,
  97 + $ref_cod_instituicao = NULL,
  98 + $nm_aluno = NULL;
  99 +
  100 +
  101 +
  102 + /**
  103 + * Implementação de clsListagem::Gerar()
  104 + * @see ieducar/intranet/include/clsListagem#Gerar()
  105 + */
  106 + public function Gerar() {
  107 + session_start();
  108 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  109 + session_write_close();
  110 +
  111 + $this->titulo = 'Vagas Reservadas - Listagem';
  112 +
  113 + // Passa todos os valores obtidos no GET para atributos do objeto
  114 + foreach ($_GET as $var => $val) {
  115 + $this->$var = ($val === '') ? NULL : $val;
  116 + }
  117 +
  118 + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet');
  119 +
  120 + $lista_busca = array(
  121 + 'Aluno',
  122 + 'S&eacute;rie',
  123 + 'Curso'
  124 + );
  125 +
  126 + // Recupera ní­vel de acesso do usuário logado
  127 + $obj_permissao = new clsPermissoes();
  128 + $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada);
  129 +
  130 + if ($nivel_usuario == 1) {
  131 + $lista_busca[] = 'Escola';
  132 + $lista_busca[] = 'Institui&ccedil;&atilde;o';
  133 + }
  134 + elseif ($nivel_usuario == 2) {
  135 + $lista_busca[] = 'Escola';
  136 + }
  137 + $this->addCabecalhos($lista_busca);
  138 +
  139 + // Lista de opçõees para o formulário de pesquisa rápida
  140 + $get_escola = TRUE;
  141 + $get_curso = TRUE;
  142 + $get_escola_curso_serie = TRUE;
  143 + include 'include/pmieducar/educar_campo_lista.php';
  144 +
  145 + // Referência de escola
  146 + if ($this->ref_cod_escola) {
  147 + $this->ref_ref_cod_escola = $this->ref_cod_escola;
  148 + }
  149 +
  150 + // Campos do formulário
  151 + $this->campoTexto('nm_aluno', 'Aluno', $this->nm_aluno, 30, 255, FALSE, FALSE,
  152 + FALSE, '', '<img border="0" onclick="pesquisa_aluno();" id="ref_cod_aluno_lupa" name="ref_cod_aluno_lupa" src="imagens/lupa.png" />');
  153 +
  154 + // Código do aluno (retornado de pop-up de busca da pesquisa de alunos - lupa)
  155 + $this->campoOculto('ref_cod_aluno', $this->ref_cod_aluno);
  156 +
  157 + // Paginador
  158 + $this->limite = 20;
  159 + $this->offset = $_GET["pagina_{$this->nome}"] ?
  160 + ($_GET["pagina_{$this->nome}"] * $this->limite - $this->limite)
  161 + : 0;
  162 +
  163 + // Instância objeto de mapeamento relacional com o tabela pmieducar.reserva_vaga
  164 + $obj_reserva_vaga = new clsPmieducarReservaVaga();
  165 + $obj_reserva_vaga->setOrderby('data_cadastro ASC');
  166 + $obj_reserva_vaga->setLimite($this->limite, $this->offset);
  167 +
  168 + // Lista os registros usando os valores passados pelos filtros
  169 + $lista = $obj_reserva_vaga->lista(
  170 + $this->cod_reserva_vaga,
  171 + $this->ref_ref_cod_escola,
  172 + $this->ref_ref_cod_serie,
  173 + NULL,
  174 + NULL,
  175 + $this->ref_cod_aluno,
  176 + NULL,
  177 + NULL,
  178 + NULL,
  179 + NULL,
  180 + 1,
  181 + $this->ref_cod_instituicao,
  182 + $this->ref_cod_curso
  183 + );
  184 +
  185 + // Pega o total de registros encontrados
  186 + $total = $obj_reserva_vaga->_total;
  187 +
  188 + // Itera sobre resultados montando a lista de apresentação
  189 + if (is_array($lista) && count($lista)) {
  190 + foreach ($lista as $registro) {
  191 + // Recupera nome da série da reserva de vaga
  192 + $obj_serie = new clsPmieducarSerie($registro['ref_ref_cod_serie']);
  193 + $det_serie = $obj_serie->detalhe();
  194 + $nm_serie = $det_serie['nm_serie'];
  195 +
  196 + // Recupera o nome do curso da reserva de vaga
  197 + $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']);
  198 + $det_curso = $obj_curso->detalhe();
  199 + $registro['ref_cod_curso'] = $det_curso['nm_curso'];
  200 +
  201 + // Recupera o nome da escola da reserva de vaga
  202 + $obj_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']);
  203 + $det_escola = $obj_escola->detalhe();
  204 + $nm_escola = $det_escola['nome'];
  205 +
  206 + // Recupera o nome da instituição da reserva de vaga
  207 + $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
  208 + $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
  209 + $registro['ref_cod_instituicao'] = $det_ref_cod_instituicao['nm_instituicao'];
  210 +
  211 + /*
  212 + * Se for um aluno previamente cadastrado, procuramos seu nome, primeiro
  213 + * buscando a referência de Pessoa e depois pesquisando a tabela para
  214 + * carregar o nome
  215 + */
  216 + if ($registro['ref_cod_aluno']) {
  217 + // Pesquisa por aluno para pegar o identificador de Pessoa
  218 + $obj_aluno = new clsPmieducarAluno($registro['ref_cod_aluno']);
  219 + $det_aluno = $obj_aluno->detalhe();
  220 + $ref_idpes = $det_aluno['ref_idpes'];
  221 +
  222 + // Pesquisa a tabela de pessoa para recuperar o nome
  223 + $obj_pessoa = new clsPessoa_($ref_idpes);
  224 + $det_pessoa = $obj_pessoa->detalhe();
  225 + $registro['ref_cod_aluno'] = $det_pessoa['nome'];
  226 + }
  227 + else {
  228 + $registro['ref_cod_aluno'] = $registro['nm_aluno'];
  229 + }
  230 +
  231 + // Array de dados formatados para apresentação
  232 + $lista_busca = array(
  233 + "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$registro["ref_cod_aluno"]}</a>",
  234 + "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$nm_serie}</a>",
  235 + "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$registro["ref_cod_curso"]}</a>"
  236 + );
  237 +
  238 + // Verifica por permissões
  239 + if ($nivel_usuario == 1) {
  240 + $lista_busca[] = "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$nm_escola}</a>";
  241 + $lista_busca[] = "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$registro["ref_cod_instituicao"]}</a>";
  242 + }
  243 + elseif ($nivel_usuario == 2) {
  244 + $lista_busca[] = "<a href=\"educar_reservada_vaga_det.php?cod_reserva_vaga={$registro["cod_reserva_vaga"]}\">{$nm_escola}</a>";
  245 + }
  246 +
  247 + $this->addLinhas($lista_busca);
  248 + }
  249 + }
  250 +
  251 + $this->addPaginador2('educar_reservada_vaga_lst.php', $total, $_GET,
  252 + $this->nome, $this->limite);
  253 +
  254 + $this->largura = '100%';
  255 + }
252 256 }
253   -// cria uma extensao da classe base
  257 +
  258 +// Instancia objeto de página
254 259 $pagina = new clsIndexBase();
255   -// cria o conteudo
  260 +
  261 +// Instancia objeto de conteúdo
256 262 $miolo = new indice();
257   -// adiciona o conteudo na clsBase
258   -$pagina->addForm( $miolo );
259   -// gera o html
  263 +
  264 +// Atribui o conteúdo à  página
  265 +$pagina->addForm($miolo);
  266 +
  267 +// Gera o código HTML
260 268 $pagina->MakeAll();
261 269 ?>
262   -<script>
263 270  
264   -document.getElementById('ref_cod_escola').onchange = function()
265   -{
266   - getEscolaCurso();
  271 +<script type="text/javascript">
  272 +document.getElementById('ref_cod_escola').onchange = function() {
  273 + getEscolaCurso();
267 274 }
268 275  
269   -document.getElementById('ref_cod_curso').onchange = function()
270   -{
271   - getEscolaCursoSerie();
  276 +document.getElementById('ref_cod_curso').onchange = function() {
  277 + getEscolaCursoSerie();
272 278 }
273 279  
274   -function pesquisa_aluno()
275   -{
276   - pesquisa_valores_popless('educar_pesquisa_aluno.php')
  280 +function pesquisa_aluno() {
  281 + pesquisa_valores_popless('educar_pesquisa_aluno.php')
277 282 }
278   -
279 283 </script>
280 284 \ No newline at end of file
... ...