Commit dfefcf11676a06a1a71c2c65ec7d118dec48a1a3
1 parent
06163685
Exists in
master
Refactoring para coding standards
Showing
1 changed file
with
211 additions
and
199 deletions
Show diff stats
ieducar/intranet/educar_servidor_lst.php
1 | <?php | 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 | 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 | + * @category i-Educar | ||
25 | + * @license @@license@@ | ||
26 | + * @package iEd_Pmieducar | ||
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/clsListagem.inc.php'; | ||
33 | +require_once 'include/clsBanco.inc.php'; | ||
34 | +require_once 'include/pmieducar/geral.inc.php'; | ||
35 | + | ||
36 | +require_once 'CoreExt/View/Helper/UrlHelper.php'; | ||
37 | + | ||
38 | +/** | ||
39 | + * clsIndexBase class. | ||
40 | + * | ||
41 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
42 | + * @category i-Educar | ||
43 | + * @license @@license@@ | ||
44 | + * @package iEd_Pmieducar | ||
45 | + * @since Classe disponível desde a versão 1.0.0 | ||
46 | + * @version @@package_version@@ | ||
47 | + */ | ||
32 | class clsIndexBase extends clsBase | 48 | class clsIndexBase extends clsBase |
33 | { | 49 | { |
34 | - function Formular() | ||
35 | - { | ||
36 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Servidor" ); | ||
37 | - $this->processoAp = "635"; | ||
38 | - } | 50 | + function Formular() |
51 | + { | ||
52 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Servidor'); | ||
53 | + $this->processoAp = 635; | ||
54 | + } | ||
39 | } | 55 | } |
40 | 56 | ||
57 | +/** | ||
58 | + * indice class. | ||
59 | + * | ||
60 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
61 | + * @category i-Educar | ||
62 | + * @license @@license@@ | ||
63 | + * @package iEd_Pmieducar | ||
64 | + * @since Classe disponível desde a versão 1.0.0 | ||
65 | + * @version @@package_version@@ | ||
66 | + */ | ||
41 | class indice extends clsListagem | 67 | class indice extends clsListagem |
42 | { | 68 | { |
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_servidor; | ||
72 | - var $ref_cod_deficiencia; | ||
73 | - var $ref_idesco; | ||
74 | - var $ref_cod_funcao; | ||
75 | - var $carga_horaria; | ||
76 | - var $data_cadastro; | ||
77 | - var $data_exclusao; | ||
78 | - var $ativo; | ||
79 | - | ||
80 | - var $ref_cod_instituicao; | ||
81 | - | ||
82 | - function Gerar() | ||
83 | - { | ||
84 | - @session_start(); | ||
85 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
86 | - session_write_close(); | ||
87 | - | ||
88 | - $this->titulo = "Servidor - Listagem"; | ||
89 | - | ||
90 | - foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto | ||
91 | - $this->$var = ( $val === "" ) ? null: $val; | ||
92 | - | ||
93 | - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | ||
94 | - | ||
95 | - $this->addCabecalhos( array( | ||
96 | - "Nome do Servidor", | ||
97 | - "Matrícula", | ||
98 | - "Instituição" | ||
99 | - ) ); | ||
100 | - | ||
101 | -// $get_escola = true; | ||
102 | - include("include/pmieducar/educar_campo_lista.php"); | ||
103 | - $opcoes = array( "" => "Pesquise o funcionario clicando na lupa ao lado" ); | ||
104 | - if( $this->cod_servidor ) | ||
105 | - { | ||
106 | - $objTemp = new clsFuncionario( $this->cod_servidor ); | ||
107 | - $detalhe = $objTemp->detalhe(); | ||
108 | - $detalhe = $detalhe["idpes"]->detalhe(); | ||
109 | - $opcoes["{$detalhe["idpes"]}"] = $detalhe["nome"]; | ||
110 | - } | ||
111 | - $parametros = new clsParametrosPesquisas(); | ||
112 | - $parametros->setSubmit( 0 ); | ||
113 | - $parametros->adicionaCampoSelect( "cod_servidor", "ref_cod_pessoa_fj", "nome" ); | ||
114 | - $this->campoListaPesq( "cod_servidor", "Servidor", $opcoes, $this->cod_servidor, "pesquisa_funcionario_lst.php", "", false, "", "", null, null, "", false, $parametros->serializaCampos()."&com_matricula=false", true ); | ||
115 | - | ||
116 | - | ||
117 | - // Paginador | ||
118 | - $this->limite = 20; | ||
119 | - $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0; | ||
120 | - | ||
121 | - $obj_servidor = new clsPmieducarServidor(); | ||
122 | - $obj_servidor->setOrderby( "carga_horaria ASC" ); | ||
123 | - $obj_servidor->setLimite( $this->limite, $this->offset ); | ||
124 | - | ||
125 | - $lista = $obj_servidor->lista( | ||
126 | - $this->cod_servidor, | ||
127 | - $this->ref_cod_deficiencia, | ||
128 | - $this->ref_idesco, | ||
129 | - $this->carga_horaria, | ||
130 | - null, | ||
131 | - null, | ||
132 | - null, | ||
133 | - null, | ||
134 | - 1, | ||
135 | - $this->ref_cod_instituicao | ||
136 | - ,null | ||
137 | - ,null | ||
138 | - ,null | ||
139 | - ,null | ||
140 | - ,null | ||
141 | - ,null | ||
142 | - ,true | ||
143 | - ); | ||
144 | - | ||
145 | - $total = $obj_servidor->_total; | ||
146 | - | ||
147 | - // monta a lista | ||
148 | - if( is_array( $lista ) && count( $lista ) ) | ||
149 | - { | ||
150 | - foreach ( $lista AS $registro ) | ||
151 | - { | ||
152 | - | ||
153 | - // pega detalhes de foreign_keys | ||
154 | - if( class_exists( "clsPmieducarInstituicao" ) ) | ||
155 | - { | ||
156 | - $obj_ref_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] ); | ||
157 | - $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); | ||
158 | - $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"]; | ||
159 | - } | ||
160 | - else | ||
161 | - { | ||
162 | - $registro["ref_cod_instituicao"] = "Erro na geração"; | ||
163 | - echo "<!--\nErro\nClasse não existente: clsPmieducarInstituicao\n-->"; | ||
164 | - } | ||
165 | - | ||
166 | - if( class_exists( "clsFuncionario" ) ) | ||
167 | - { | ||
168 | - $obj_cod_servidor = new clsFuncionario( $registro["cod_servidor"] ); | ||
169 | - $det_cod_servidor = $obj_cod_servidor->detalhe(); | ||
170 | - $registro["matricula"] = $det_cod_servidor['matricula']; | ||
171 | - $det_cod_servidor = $det_cod_servidor["idpes"]->detalhe(); | ||
172 | - $registro["nome"] = $det_cod_servidor["nome"]; | ||
173 | - | ||
174 | - } | ||
175 | - else | ||
176 | - { | ||
177 | - $registro["cod_servidor"] = "Erro na geracao"; | ||
178 | - echo "<!--\nErro\nClasse nao existente: clsFuncionario\n-->"; | ||
179 | - } | ||
180 | - | ||
181 | - $this->addLinhas( array( | ||
182 | - "<a href=\"educar_servidor_det.php?cod_servidor={$registro["cod_servidor"]}&ref_cod_instituicao={$det_ref_cod_instituicao["cod_instituicao"]}\">{$registro["nome"]}</a>", | ||
183 | - "<a href=\"educar_servidor_det.php?cod_servidor={$registro["cod_servidor"]}&ref_cod_instituicao={$det_ref_cod_instituicao["cod_instituicao"]}\">{$registro["matricula"]}</a>", | ||
184 | - "<a href=\"educar_servidor_det.php?cod_servidor={$registro["cod_servidor"]}&ref_cod_instituicao={$det_ref_cod_instituicao["cod_instituicao"]}\">{$registro["ref_cod_instituicao"]}</a>" | ||
185 | - | ||
186 | - ) ); | ||
187 | - } | ||
188 | - } | ||
189 | - $this->addPaginador2( "educar_servidor_lst.php", $total, $_GET, $this->nome, $this->limite ); | ||
190 | - $obj_permissoes = new clsPermissoes(); | ||
191 | - | ||
192 | - | ||
193 | - if( $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 3 ) ) | ||
194 | - { | ||
195 | - $this->acao = "go(\"educar_servidor_cad.php\")"; | ||
196 | - $this->nome_acao = "Novo"; | ||
197 | - } | ||
198 | - | ||
199 | - $this->largura = "100%"; | ||
200 | - } | 69 | + var $pessoa_logada; |
70 | + var $titulo; | ||
71 | + var $limite; | ||
72 | + var $offset; | ||
73 | + | ||
74 | + var $cod_servidor; | ||
75 | + var $ref_cod_deficiencia; | ||
76 | + var $ref_idesco; | ||
77 | + var $ref_cod_funcao; | ||
78 | + var $carga_horaria; | ||
79 | + var $data_cadastro; | ||
80 | + var $data_exclusao; | ||
81 | + var $ativo; | ||
82 | + | ||
83 | + var $ref_cod_instituicao; | ||
84 | + | ||
85 | + function Gerar() | ||
86 | + { | ||
87 | + @session_start(); | ||
88 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
89 | + session_write_close(); | ||
90 | + | ||
91 | + $this->titulo = 'Servidor - Listagem'; | ||
92 | + | ||
93 | + // passa todos os valores obtidos no GET para atributos do objeto | ||
94 | + foreach ($_GET AS $var => $val) { | ||
95 | + $this->$var = ($val === '') ? NULL : $val; | ||
96 | + } | ||
97 | + | ||
98 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | ||
99 | + | ||
100 | + $this->addCabecalhos( array( | ||
101 | + 'Nome do Servidor', | ||
102 | + 'Matrícula', | ||
103 | + 'Instituição' | ||
104 | + )); | ||
105 | + | ||
106 | + include 'include/pmieducar/educar_campo_lista.php'; | ||
107 | + | ||
108 | + $opcoes = array('' => 'Pesquise o funcionario clicando na lupa ao lado'); | ||
109 | + | ||
110 | + if ($this->cod_servidor) { | ||
111 | + $objTemp = new clsFuncionario($this->cod_servidor); | ||
112 | + $detalhe = $objTemp->detalhe(); | ||
113 | + $detalhe = $detalhe['idpes']->detalhe(); | ||
114 | + | ||
115 | + $opcoes[$detalhe['idpes']] = $detalhe['nome']; | ||
116 | + } | ||
117 | + | ||
118 | + $parametros = new clsParametrosPesquisas(); | ||
119 | + $parametros->setSubmit(0); | ||
120 | + $parametros->adicionaCampoSelect( 'cod_servidor', 'ref_cod_pessoa_fj', 'nome'); | ||
121 | + | ||
122 | + $this->campoListaPesq( 'cod_servidor', 'Servidor', $opcoes, $this->cod_servidor, | ||
123 | + 'pesquisa_funcionario_lst.php', '', FALSE, '', '', NULL, NULL, '', FALSE, | ||
124 | + $parametros->serializaCampos() . '&com_matricula=false', TRUE); | ||
125 | + | ||
126 | + // Paginador | ||
127 | + $this->limite = 20; | ||
128 | + $this->offset = ($_GET['pagina_' . $this->nome]) ? | ||
129 | + $_GET['pagina_' . $this->nome] * $this->limite - $this->limite : 0; | ||
130 | + | ||
131 | + $obj_servidor = new clsPmieducarServidor(); | ||
132 | + $obj_servidor->setOrderby('carga_horaria ASC'); | ||
133 | + $obj_servidor->setLimite($this->limite, $this->offset); | ||
134 | + | ||
135 | + $lista = $obj_servidor->lista( | ||
136 | + $this->cod_servidor, | ||
137 | + $this->ref_cod_deficiencia, | ||
138 | + $this->ref_idesco, | ||
139 | + $this->carga_horaria, | ||
140 | + NULL, | ||
141 | + NULL, | ||
142 | + NULL, | ||
143 | + NULL, | ||
144 | + 1, | ||
145 | + $this->ref_cod_instituicao, | ||
146 | + NULL, | ||
147 | + NULL, | ||
148 | + NULL, | ||
149 | + NULL, | ||
150 | + NULL, | ||
151 | + NULL, | ||
152 | + TRUE | ||
153 | + ); | ||
154 | + | ||
155 | + $total = $obj_servidor->_total; | ||
156 | + | ||
157 | + // UrlHelper | ||
158 | + $url = CoreExt_View_Helper_UrlHelper::getInstance(); | ||
159 | + | ||
160 | + // Monta a lista | ||
161 | + if (is_array($lista) && count($lista)) { | ||
162 | + foreach ($lista as $registro) { | ||
163 | + // Pega detalhes de foreign_keys | ||
164 | + if (class_exists('clsPmieducarInstituicao')) { | ||
165 | + $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']); | ||
166 | + $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); | ||
167 | + | ||
168 | + $registro['ref_cod_instituicao'] = $det_ref_cod_instituicao['nm_instituicao']; | ||
169 | + } | ||
170 | + else { | ||
171 | + $registro['ref_cod_instituicao'] = 'Erro na geração'; | ||
172 | + } | ||
173 | + | ||
174 | + if (class_exists('clsFuncionario')) { | ||
175 | + $obj_cod_servidor = new clsFuncionario($registro['cod_servidor']); | ||
176 | + $det_cod_servidor = $obj_cod_servidor->detalhe(); | ||
177 | + $registro['matricula'] = $det_cod_servidor['matricula']; | ||
178 | + $det_cod_servidor = $det_cod_servidor['idpes']->detalhe(); | ||
179 | + $registro['nome'] = $det_cod_servidor['nome']; | ||
180 | + } | ||
181 | + else { | ||
182 | + $registro['cod_servidor'] = 'Erro na geracao'; | ||
183 | + } | ||
184 | + | ||
185 | + $path = 'educar_servidor_det.php'; | ||
186 | + $options = array( | ||
187 | + 'query' => array( | ||
188 | + 'cod_servidor' => $registro['cod_servidor'], | ||
189 | + 'ref_cod_instituicao' => $det_ref_cod_instituicao['cod_instituicao'], | ||
190 | + )); | ||
191 | + | ||
192 | + $this->addLinhas(array( | ||
193 | + $url->l($registro['nome'], $path, $options), | ||
194 | + $url->l($registro['matricula'], $path, $options), | ||
195 | + $url->l($registro['ref_cod_instituicao'], $path, $options), | ||
196 | + )); | ||
197 | + } | ||
198 | + } | ||
199 | + | ||
200 | + $this->addPaginador2('educar_servidor_lst.php', $total, $_GET, $this->nome, $this->limite); | ||
201 | + $obj_permissoes = new clsPermissoes(); | ||
202 | + | ||
203 | + if ($obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 3)) { | ||
204 | + $this->acao = 'go("educar_servidor_cad.php")'; | ||
205 | + $this->nome_acao = 'Novo'; | ||
206 | + } | ||
207 | + | ||
208 | + $this->largura = '100%'; | ||
209 | + } | ||
201 | } | 210 | } |
202 | -// cria uma extensao da classe base | 211 | + |
212 | +// Instancia objeto de página | ||
203 | $pagina = new clsIndexBase(); | 213 | $pagina = new clsIndexBase(); |
204 | -// cria o conteudo | 214 | + |
215 | +// Instancia objeto de conteúdo | ||
205 | $miolo = new indice(); | 216 | $miolo = new indice(); |
206 | -// adiciona o conteudo na clsBase | ||
207 | -$pagina->addForm( $miolo ); | ||
208 | -// gera o html | ||
209 | -$pagina->MakeAll(); | ||
210 | -?> | ||
211 | \ No newline at end of file | 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(); | ||
212 | \ No newline at end of file | 224 | \ No newline at end of file |