Commit fd0f399f33c9e2a31999f39a827ed688d871dc12
1 parent
fca05b92
Exists in
master
Refactoring para coding standards
Showing
1 changed file
with
165 additions
and
175 deletions
Show diff stats
ieducar/intranet/educar_servidor_curso_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 | - | |
| 28 | -require_once ("include/clsBase.inc.php"); | |
| 29 | -require_once ("include/clsCadastro.inc.php"); | |
| 30 | -require_once ("include/clsBanco.inc.php"); | |
| 31 | -require_once( "include/pmieducar/geral.inc.php" ); | |
| 32 | 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/clsCadastro.inc.php'; | |
| 33 | +require_once 'include/clsBanco.inc.php'; | |
| 34 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 35 | + | |
| 36 | +/** | |
| 37 | + * clsIndexBase class. | |
| 38 | + * | |
| 39 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 40 | + * @category i-Educar | |
| 41 | + * @license @@license@@ | |
| 42 | + * @package iEd_Pmieducar | |
| 43 | + * @since Classe disponível desde a versão 1.0.0 | |
| 44 | + * @version @@package_version@@ | |
| 45 | + */ | |
| 33 | 46 | class clsIndexBase extends clsBase |
| 34 | 47 | { |
| 35 | - function Formular() | |
| 36 | - { | |
| 37 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Servidor Curso" ); | |
| 38 | - $this->processoAp = "0"; | |
| 39 | - $this->renderBanner = false; | |
| 40 | - $this->renderMenu = false; | |
| 41 | - $this->renderMenuSuspenso = false; | |
| 42 | - | |
| 43 | - } | |
| 48 | + function Formular() | |
| 49 | + { | |
| 50 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Servidor Curso'); | |
| 51 | + $this->processoAp = 0; | |
| 52 | + $this->renderBanner = FALSE; | |
| 53 | + $this->renderMenu = FALSE; | |
| 54 | + $this->renderMenuSuspenso = FALSE; | |
| 55 | + } | |
| 44 | 56 | } |
| 45 | 57 | |
| 58 | +/** | |
| 59 | + * indice class. | |
| 60 | + * | |
| 61 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 62 | + * @category i-Educar | |
| 63 | + * @license @@license@@ | |
| 64 | + * @package iEd_Pmieducar | |
| 65 | + * @since Classe disponível desde a versão 1.0.0 | |
| 66 | + * @version @@package_version@@ | |
| 67 | + */ | |
| 46 | 68 | class indice extends clsCadastro |
| 47 | 69 | { |
| 48 | - /** | |
| 49 | - * Referencia pega da session para o idpes do usuario atual | |
| 50 | - * | |
| 51 | - * @var int | |
| 52 | - */ | |
| 53 | - var $pessoa_logada; | |
| 54 | - | |
| 55 | - var $cod_servidor; | |
| 56 | - var $ref_cod_instituicao; | |
| 57 | - var $ref_cod_deficiencia; | |
| 58 | - var $ref_idesco; | |
| 59 | - var $ref_cod_funcao; | |
| 60 | - var $carga_horaria; | |
| 61 | - var $data_cadastro; | |
| 62 | - var $data_exclusao; | |
| 63 | - var $ativo; | |
| 64 | - var $ref_cod_curso; | |
| 65 | - var $ref_cod_disciplina; | |
| 66 | - var $cursos_servidor; | |
| 67 | - | |
| 68 | - | |
| 69 | - function Inicializar() | |
| 70 | - { | |
| 71 | - $retorno = "Novo"; | |
| 72 | - @session_start(); | |
| 73 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 74 | - @session_write_close(); | |
| 75 | - | |
| 76 | - $this->cod_servidor = $_GET["ref_cod_servidor"]; | |
| 77 | - $this->ref_cod_instituicao = $_GET["ref_cod_instituicao"]; | |
| 78 | - | |
| 79 | - $obj_permissoes = new clsPermissoes(); | |
| 80 | - | |
| 81 | - $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 3, "educar_servidor_lst.php" ); | |
| 82 | - | |
| 83 | - if( is_numeric( $this->cod_servidor ) && is_numeric( $this->ref_cod_instituicao ) ) | |
| 84 | - { | |
| 85 | - | |
| 86 | - $obj = new clsPmieducarServidor( $this->cod_servidor, null, null, null, null, null, null, $this->ref_cod_instituicao ); | |
| 87 | - $registro = $obj->detalhe(); | |
| 88 | - if( $registro ) | |
| 89 | - { | |
| 90 | - //foreach( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto | |
| 91 | - //$this->$campo = $val; | |
| 92 | - | |
| 93 | - /*$obj_permissoes = new clsPermissoes(); | |
| 94 | - if( $obj_permissoes->permissao_excluir( 635, $this->pessoa_logada, 3 ) ) | |
| 95 | - { | |
| 96 | - $this->fexcluir = true; | |
| 97 | - }*/ | |
| 98 | - | |
| 99 | - $retorno = "Editar"; | |
| 100 | - } | |
| 101 | - } | |
| 70 | + var $pessoa_logada; | |
| 102 | 71 | |
| 103 | - @session_start(); | |
| 104 | - $this->cursos_servidor = $_SESSION['cursos_servidor']; | |
| 105 | - @session_write_close(); | |
| 72 | + var $cod_servidor; | |
| 73 | + var $ref_cod_instituicao; | |
| 74 | + var $ref_cod_deficiencia; | |
| 75 | + var $ref_idesco; | |
| 76 | + var $ref_cod_funcao; | |
| 77 | + var $carga_horaria; | |
| 78 | + var $data_cadastro; | |
| 79 | + var $data_exclusao; | |
| 80 | + var $ativo; | |
| 81 | + var $ref_cod_curso; | |
| 82 | + var $ref_cod_disciplina; | |
| 83 | + var $cursos_servidor; | |
| 106 | 84 | |
| 107 | - if(!$this->cursos_servidor) | |
| 108 | - { | |
| 109 | - $obj_servidor_curso = new clsPmieducarServidorCursoMinistra(); | |
| 110 | - $lst_servidor_curso = $obj_servidor_curso->lista(null,$this->ref_cod_instituicao,$this->cod_servidor); | |
| 111 | 85 | |
| 112 | - if($lst_servidor_curso) | |
| 113 | - { | |
| 114 | - foreach ($lst_servidor_curso as $curso) | |
| 115 | - { | |
| 116 | - $this->cursos_servidor[$curso['ref_cod_curso']] = $curso['ref_cod_curso']; | |
| 117 | - } | |
| 118 | - } | |
| 86 | + function Inicializar() | |
| 87 | + { | |
| 88 | + $retorno = 'Novo'; | |
| 89 | + @session_start(); | |
| 90 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 91 | + @session_write_close(); | |
| 119 | 92 | |
| 120 | - } | |
| 93 | + $this->cod_servidor = $_GET['ref_cod_servidor']; | |
| 94 | + $this->ref_cod_instituicao = $_GET['ref_cod_instituicao']; | |
| 121 | 95 | |
| 96 | + $obj_permissoes = new clsPermissoes(); | |
| 122 | 97 | |
| 123 | - //$this->script_cancelar = "parent.fechaExpansivel( \"{$_GET['div']}\");"; | |
| 124 | - //$this->nome_url_cancelar = "Cancelar"; | |
| 125 | - return $retorno; | |
| 126 | - } | |
| 98 | + $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 3, 'educar_servidor_lst.php'); | |
| 127 | 99 | |
| 128 | - function Gerar() | |
| 129 | - { | |
| 130 | - // foreign keys | |
| 131 | - //$obrigatorio = true; | |
| 132 | - // $get_instituicao = true; | |
| 133 | - //$get_funcao = true; | |
| 134 | - //include("include/pmieducar/educar_campo_lista.php"); | |
| 100 | + if (is_numeric($this->cod_servidor) && is_numeric($this->ref_cod_instituicao)) { | |
| 101 | + $obj = new clsPmieducarServidor($this->cod_servidor, NULL, NULL, NULL, NULL, | |
| 102 | + NULL, NULL, $this->ref_cod_instituicao); | |
| 135 | 103 | |
| 104 | + $registro = $obj->detalhe(); | |
| 136 | 105 | |
| 137 | - $this->campoOculto("ref_cod_instituicao",$this->ref_cod_instituicao); | |
| 138 | - $opcoes = $opcoes_curso = array('' => "Selecione"); | |
| 106 | + if ($registro) { | |
| 107 | + $retorno = 'Editar'; | |
| 108 | + } | |
| 109 | + } | |
| 139 | 110 | |
| 140 | - $obj_cursos = new clsPmieducarCurso(); | |
| 141 | - $obj_cursos->setOrderby("nm_curso"); | |
| 142 | - $lst_cursos = $obj_cursos->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,$this->ref_cod_instituicao); | |
| 143 | - if ($lst_cursos) | |
| 144 | - { | |
| 145 | - foreach ($lst_cursos as $curso) | |
| 146 | - { | |
| 147 | - $opcoes_curso[$curso['cod_curso']] = $curso['nm_curso']; | |
| 148 | - } | |
| 149 | - } | |
| 111 | + @session_start(); | |
| 112 | + $this->cursos_servidor = $_SESSION['cursos_servidor']; | |
| 113 | + @session_write_close(); | |
| 150 | 114 | |
| 151 | - $arr_valores = array(); | |
| 115 | + if (!$this->cursos_servidor) { | |
| 116 | + $obj_servidor_curso = new clsPmieducarServidorCursoMinistra(); | |
| 152 | 117 | |
| 118 | + $lst_servidor_curso = $obj_servidor_curso->lista(NULL, | |
| 119 | + $this->ref_cod_instituicao, $this->cod_servidor); | |
| 153 | 120 | |
| 154 | - if($this->cursos_servidor) | |
| 155 | - { | |
| 156 | - foreach ($this->cursos_servidor as $curso) | |
| 157 | - { | |
| 158 | - $arr_valores[] = array($curso); | |
| 159 | - } | |
| 160 | - } | |
| 121 | + if ($lst_servidor_curso) { | |
| 122 | + foreach ($lst_servidor_curso as $curso) { | |
| 123 | + $this->cursos_servidor[$curso['ref_cod_curso']] = $curso['ref_cod_curso']; | |
| 124 | + } | |
| 125 | + } | |
| 126 | + } | |
| 161 | 127 | |
| 128 | + return $retorno; | |
| 129 | + } | |
| 162 | 130 | |
| 163 | - $this->campoTabelaInicio("cursos_ministra","Cursos Ministrados",array("Curso"),$arr_valores,""); | |
| 164 | - | |
| 165 | - $this->campoLista( "ref_cod_curso", "Curso", $opcoes_curso, $this->ref_cod_curso,"","","","" ); | |
| 166 | - | |
| 167 | - $this->campoTabelaFim(); | |
| 131 | + function Gerar() | |
| 132 | + { | |
| 133 | + $this->campoOculto('ref_cod_instituicao', $this->ref_cod_instituicao); | |
| 134 | + $opcoes = $opcoes_curso = array('' => 'Selecione'); | |
| 168 | 135 | |
| 136 | + $obj_cursos = new clsPmieducarCurso(); | |
| 137 | + $obj_cursos->setOrderby('nm_curso'); | |
| 169 | 138 | |
| 139 | + $lst_cursos = $obj_cursos->lista( NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
| 140 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
| 141 | + NULL, NULL, NULL, 1, NULL, $this->ref_cod_instituicao); | |
| 170 | 142 | |
| 171 | - } | |
| 143 | + if ($lst_cursos) { | |
| 144 | + foreach ($lst_cursos as $curso) { | |
| 145 | + $opcoes_curso[$curso['cod_curso']] = $curso['nm_curso']; | |
| 146 | + } | |
| 147 | + } | |
| 172 | 148 | |
| 173 | - function Novo() | |
| 174 | - { | |
| 149 | + $arr_valores = array(); | |
| 175 | 150 | |
| 176 | - $curso_servidor = array(); | |
| 177 | - if($this->ref_cod_curso) | |
| 178 | - { | |
| 179 | - foreach ($this->ref_cod_curso as $curso) | |
| 180 | - { | |
| 181 | - $curso_servidor[$curso] = $curso; | |
| 182 | - } | |
| 183 | - } | |
| 151 | + if ($this->cursos_servidor) { | |
| 152 | + foreach ($this->cursos_servidor as $curso) { | |
| 153 | + $arr_valores[] = array($curso); | |
| 154 | + } | |
| 155 | + } | |
| 184 | 156 | |
| 185 | - @session_start(); | |
| 186 | - $_SESSION['cursos_servidor'] = $curso_servidor; | |
| 187 | - $_SESSION['cod_servidor'] = $this->cod_servidor; | |
| 188 | - @session_write_close(); | |
| 157 | + $this->campoTabelaInicio('cursos_ministra', 'Cursos Ministrados', | |
| 158 | + array('Curso'), $arr_valores, ''); | |
| 189 | 159 | |
| 190 | - echo "<script>parent.fechaExpansivel( '{$_GET['div']}');</script>"; | |
| 191 | - die; | |
| 160 | + $this->campoLista('ref_cod_curso', 'Curso', $opcoes_curso, $this->ref_cod_curso, | |
| 161 | + '', '', '', ''); | |
| 192 | 162 | |
| 163 | + $this->campoTabelaFim(); | |
| 164 | + } | |
| 193 | 165 | |
| 194 | - return true; | |
| 195 | - } | |
| 166 | + function Novo() | |
| 167 | + { | |
| 168 | + $curso_servidor = array(); | |
| 169 | + if ($this->ref_cod_curso) { | |
| 170 | + foreach ($this->ref_cod_curso as $curso) { | |
| 171 | + $curso_servidor[$curso] = $curso; | |
| 172 | + } | |
| 173 | + } | |
| 174 | + | |
| 175 | + @session_start(); | |
| 176 | + $_SESSION['cursos_servidor'] = $curso_servidor; | |
| 177 | + $_SESSION['cod_servidor'] = $this->cod_servidor; | |
| 178 | + @session_write_close(); | |
| 179 | + | |
| 180 | + echo "<script>parent.fechaExpansivel( '{$_GET['div']}');</script>"; | |
| 181 | + die(); | |
| 182 | + } | |
| 196 | 183 | |
| 197 | - public function Editar() { | |
| 184 | + public function Editar() | |
| 185 | + { | |
| 198 | 186 | return $this->Novo(); |
| 199 | 187 | } |
| 200 | 188 | |
| 201 | - function Excluir() | |
| 202 | - { | |
| 203 | - return false; | |
| 204 | - } | |
| 189 | + function Excluir() | |
| 190 | + { | |
| 191 | + return FALSE; | |
| 192 | + } | |
| 205 | 193 | } |
| 206 | 194 | |
| 207 | -// cria uma extensao da classe base | |
| 195 | +// Instancia objeto de página | |
| 208 | 196 | $pagina = new clsIndexBase(); |
| 209 | -// cria o conteudo | |
| 197 | + | |
| 198 | +// Instancia objeto de conteúdo | |
| 210 | 199 | $miolo = new indice(); |
| 211 | -// adiciona o conteudo na clsBase | |
| 212 | -$pagina->addForm( $miolo ); | |
| 213 | -// gera o html | |
| 214 | -$pagina->MakeAll(); | |
| 215 | -?> | |
| 200 | + | |
| 201 | +// Atribui o conteúdo à página | |
| 202 | +$pagina->addForm($miolo); | |
| 203 | + | |
| 204 | +// Gera o código HTML | |
| 205 | +$pagina->MakeAll(); | |
| 216 | 206 | \ No newline at end of file | ... | ... |