Commit a3f8b4ab193439c0425d422e195615e1f0ccba6c
1 parent
311492f6
Exists in
master
#23 by Eriksen: Corrigido bug que não permitia afastar servidor
Showing
6 changed files
with
704 additions
and
490 deletions
Show diff stats
ieducar/intranet/educar_servidor_afastamento_cad.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 | /** | 2 | /** |
| 28 | - * @author Adriano Erik Weiguert Nagasava | 3 | + * |
| 4 | + * @author Prefeitura Municipal de Itajaí | ||
| 5 | + * @version $Id$ | ||
| 6 | + * | ||
| 7 | + * Pacote: i-PLB Software Público Livre e Brasileiro | ||
| 8 | + * | ||
| 9 | + * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí | ||
| 10 | + * ctima@itajai.sc.gov.br | ||
| 11 | + * | ||
| 12 | + * Este programa é software livre, você pode redistribuí-lo e/ou | ||
| 13 | + * modificá-lo sob os termos da Licença Pública Geral GNU, conforme | ||
| 14 | + * publicada pela Free Software Foundation, tanto a versão 2 da | ||
| 15 | + * Licença como (a seu critério) qualquer versão mais nova. | ||
| 16 | + * | ||
| 17 | + * Este programa é distribuído na expectativa de ser útil, mas SEM | ||
| 18 | + * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- | ||
| 19 | + * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- | ||
| 20 | + * sulte a Licença Pública Geral GNU para obter mais detalhes. | ||
| 21 | + * | ||
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU | ||
| 23 | + * junto com este programa. Se não, escreva para a Free Software | ||
| 24 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 25 | + * 02111-1307, USA. | ||
| 26 | + * | ||
| 29 | */ | 27 | */ |
| 30 | -require_once ("include/clsBase.inc.php"); | ||
| 31 | -require_once ("include/clsCadastro.inc.php"); | ||
| 32 | -require_once ("include/clsBanco.inc.php"); | ||
| 33 | -require_once( "include/pmieducar/geral.inc.php" ); | ||
| 34 | - | ||
| 35 | -class clsIndexBase extends clsBase | ||
| 36 | -{ | ||
| 37 | - function Formular() | ||
| 38 | - { | ||
| 39 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Servidor Afastamento" ); | ||
| 40 | - $this->processoAp = "635"; | ||
| 41 | - } | 28 | + |
| 29 | +require_once 'include/clsBase.inc.php'; | ||
| 30 | +require_once 'include/clsCadastro.inc.php'; | ||
| 31 | +require_once 'include/clsBanco.inc.php'; | ||
| 32 | +require_once 'include/pmieducar/geral.inc.php'; | ||
| 33 | + | ||
| 34 | + | ||
| 35 | +class clsIndexBase extends clsBase { | ||
| 36 | + | ||
| 37 | + public function Formular() { | ||
| 38 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Servidor Afastamento'); | ||
| 39 | + $this->processoAp = '635'; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | -class indice extends clsCadastro | ||
| 45 | -{ | ||
| 46 | - /** | ||
| 47 | - * Referencia pega da session para o idpes do usuario atual | ||
| 48 | - * | ||
| 49 | - * @var int | ||
| 50 | - */ | ||
| 51 | - var $pessoa_logada; | ||
| 52 | - | ||
| 53 | - var $ref_cod_servidor; | ||
| 54 | - var $sequencial; | ||
| 55 | - var $ref_cod_instituicao; | ||
| 56 | - var $ref_cod_motivo_afastamento; | ||
| 57 | - var $ref_usuario_exc; | ||
| 58 | - var $ref_usuario_cad; | ||
| 59 | - var $data_cadastro; | ||
| 60 | - var $data_exclusao; | ||
| 61 | - var $data_retorno; | ||
| 62 | - var $data_saida; | ||
| 63 | - var $ativo; | ||
| 64 | - var $status; | ||
| 65 | - var $alocacao_array; | ||
| 66 | - var $dias_da_semana = array( '' => 'Selecione', 1 => 'Domingo', 2 => 'Segunda', 3 => 'Terça', 4 => 'Quarta', 5 => 'Quinta', 6 => 'Sexta', 7 => 'Sábado' ); | ||
| 67 | - var $parametros; | ||
| 68 | - | ||
| 69 | - function Inicializar() | ||
| 70 | - { | ||
| 71 | - $retorno = "Novo"; | ||
| 72 | - $this->status = "N"; | ||
| 73 | - @session_start(); | ||
| 74 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 75 | - @session_write_close(); | ||
| 76 | 44 | ||
| 77 | - $this->ref_cod_instituicao = $_GET["ref_cod_instituicao"]; | ||
| 78 | - $this->ref_cod_servidor = $_GET["ref_cod_servidor"]; | ||
| 79 | - $this->sequencial = $_GET["sequencial"]; | 45 | +class indice extends clsCadastro { |
| 80 | 46 | ||
| 81 | - $obj_permissoes = new clsPermissoes(); | ||
| 82 | - $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 7, "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | 47 | + /** |
| 48 | + * Referência a usuário da sessão | ||
| 49 | + * | ||
| 50 | + * @var int | ||
| 51 | + */ | ||
| 52 | + public $pessoa_logada = NULL; | ||
| 83 | 53 | ||
| 84 | - if( is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->sequencial ) && is_numeric( $this->ref_cod_instituicao ) ) | ||
| 85 | - { | ||
| 86 | - $obj = new clsPmieducarServidorAfastamento( $this->ref_cod_servidor, $this->sequencial, null, null, null, null, null, null, null, 1, $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 | - if ( $this->data_retorno ) | ||
| 93 | - $this->data_retorno = dataFromPgToBr( $this->data_retorno ); | ||
| 94 | - if ( $this->data_saida ) | ||
| 95 | - $this->data_saida = dataFromPgToBr( $this->data_saida ); | ||
| 96 | - | ||
| 97 | - $obj_permissoes = new clsPermissoes(); | ||
| 98 | - if( $obj_permissoes->permissao_excluir( 635, $this->pessoa_logada, 7 ) ) | ||
| 99 | - { | ||
| 100 | - //$this->fexcluir = true; | ||
| 101 | - } | 54 | + public |
| 55 | + $ref_cod_servidor = NULL, | ||
| 56 | + $sequencial = NULL, | ||
| 57 | + $ref_cod_instituicao = NULL, | ||
| 58 | + $ref_cod_motivo_afastamento = NULL, | ||
| 59 | + $ref_usuario_exc = NULL, | ||
| 60 | + $ref_usuario_cad = NULL, | ||
| 61 | + $data_cadastro = NULL, | ||
| 62 | + $data_exclusao = NULL, | ||
| 63 | + $data_retorno = NULL, | ||
| 64 | + $data_saida = NULL, | ||
| 65 | + $ativo = NULL, | ||
| 66 | + $status = NULL, | ||
| 67 | + $alocacao_array = NULL, | ||
| 68 | + $parametros = NULL; | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * Array dos dias da semana | ||
| 72 | + * | ||
| 73 | + * @var Array | ||
| 74 | + */ | ||
| 75 | + public $dias_da_semana = array( | ||
| 76 | + '' => 'Selecione', | ||
| 77 | + 1 => 'Domingo', | ||
| 78 | + 2 => 'Segunda', | ||
| 79 | + 3 => 'Terça', | ||
| 80 | + 4 => 'Quarta', | ||
| 81 | + 5 => 'Quinta', | ||
| 82 | + 6 => 'Sexta', | ||
| 83 | + 7 => 'Sábado' | ||
| 84 | + ); | ||
| 85 | + | ||
| 86 | + | ||
| 87 | + | ||
| 88 | + public function Inicializar() { | ||
| 89 | + session_start(); | ||
| 90 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 91 | + session_write_close(); | ||
| 92 | + | ||
| 93 | + $retorno = "Novo"; | ||
| 94 | + $this->status = "N"; | ||
| 95 | + | ||
| 96 | + $this->ref_cod_instituicao = $_GET['ref_cod_instituicao']; | ||
| 97 | + $this->ref_cod_servidor = $_GET['ref_cod_servidor']; | ||
| 98 | + $this->sequencial = $_GET['sequencial']; | ||
| 99 | + | ||
| 100 | + $urlPermite = sprintf('educar_servidor_det.php?cod_servidor=%s&ref_cod_instituicao=%s', | ||
| 101 | + $this->ref_cod_servidor, $this->ref_cod_instituicao); | ||
| 102 | + | ||
| 103 | + $obj_permissoes = new clsPermissoes(); | ||
| 104 | + $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, $urlPemite); | ||
| 105 | + | ||
| 106 | + if (is_numeric($this->ref_cod_servidor) && is_numeric($this->sequencial) && | ||
| 107 | + is_numeric($this->ref_cod_instituicao)) { | ||
| 108 | + | ||
| 109 | + $obj = new clsPmieducarServidorAfastamento( | ||
| 110 | + $this->ref_cod_servidor, $this->sequencial, NULL, NULL, NULL, NULL, | ||
| 111 | + NULL, NULL, NULL, 1, $this->ref_cod_instituicao); | ||
| 112 | + | ||
| 113 | + $registro = $obj->detalhe(); | ||
| 114 | + | ||
| 115 | + if ($registro) { | ||
| 116 | + | ||
| 117 | + // passa todos os valores obtidos no registro para atributos do objeto | ||
| 118 | + foreach ($registro as $campo => $val) { | ||
| 119 | + $this->$campo = $val; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + if ($this->data_retorno) { | ||
| 123 | + $this->data_retorno = dataFromPgToBr($this->data_retorno); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + if ($this->data_saida) { | ||
| 127 | + $this->data_saida = dataFromPgToBr($this->data_saida); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + $retorno = "Editar"; | ||
| 131 | + $this->status = "E"; | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + $this->url_cancelar = sprintf( | ||
| 136 | + 'educar_servidor_det.php?cod_servidor=%s&ref_cod_instituicao=%s', | ||
| 137 | + $this->ref_cod_servidor, $this->ref_cod_instituicao); | ||
| 138 | + | ||
| 139 | + $this->nome_url_cancelar = "Cancelar"; | ||
| 140 | + | ||
| 141 | + return $retorno; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + | ||
| 146 | + public function Gerar() { | ||
| 147 | + $this->campoOculto('ref_cod_servidor', $this->ref_cod_servidor); | ||
| 148 | + $this->campoOculto('sequencial', $this->sequencial); | ||
| 149 | + $this->campoOculto('ref_cod_instituicao', $this->ref_cod_instituicao); | ||
| 150 | + | ||
| 151 | + $opcoes = array('' => 'Selecione'); | ||
| 152 | + | ||
| 153 | + $objTemp = new clsPmieducarMotivoAfastamento(); | ||
| 154 | + $lista = $objTemp->lista(); | ||
| 155 | + | ||
| 156 | + if (is_array($lista) && count($lista)) { | ||
| 157 | + foreach ($lista as $registro) { | ||
| 158 | + $opcoes[$registro['cod_motivo_afastamento']] = $registro['nm_motivo']; | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | + else { | ||
| 162 | + $opcoes = array('' => 'Erro na geracao'); | ||
| 163 | + } | ||
| 102 | 164 | ||
| 103 | - $retorno = "Editar"; | ||
| 104 | - $this->status = "E"; | ||
| 105 | - } | ||
| 106 | - } | ||
| 107 | - $this->url_cancelar = ($retorno == "Editar") ? "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" : "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}"; | ||
| 108 | - $this->nome_url_cancelar = "Cancelar"; | ||
| 109 | - return $retorno; | ||
| 110 | - } | 165 | + if ($this->status == 'N') { |
| 166 | + $this->campoLista('ref_cod_motivo_afastamento', 'Motivo Afastamento', | ||
| 167 | + $opcoes, $this->ref_cod_motivo_afastamento); | ||
| 168 | + } | ||
| 169 | + elseif ($this->status == 'E') { | ||
| 170 | + $this->campoLista('ref_cod_motivo_afastamento', 'Motivo Afastamento', | ||
| 171 | + $opcoes, $this->ref_cod_motivo_afastamento, '', FALSE, '', '', TRUE); | ||
| 172 | + } | ||
| 111 | 173 | ||
| 112 | - function Gerar() | ||
| 113 | - { | ||
| 114 | - // primary keys | ||
| 115 | - $this->campoOculto( "ref_cod_servidor", $this->ref_cod_servidor ); | ||
| 116 | - $this->campoOculto( "sequencial", $this->sequencial ); | ||
| 117 | - $this->campoOculto( "ref_cod_instituicao", $this->ref_cod_instituicao ); | ||
| 118 | - | ||
| 119 | - // foreign keys | ||
| 120 | - $opcoes = array( "" => "Selecione" ); | ||
| 121 | - if( class_exists( "clsPmieducarMotivoAfastamento" ) ) | ||
| 122 | - { | ||
| 123 | - $objTemp = new clsPmieducarMotivoAfastamento(); | ||
| 124 | - $lista = $objTemp->lista(); | ||
| 125 | - if ( is_array( $lista ) && count( $lista ) ) | ||
| 126 | - { | ||
| 127 | - foreach ( $lista as $registro ) | ||
| 128 | - { | ||
| 129 | - $opcoes["{$registro['cod_motivo_afastamento']}"] = "{$registro['nm_motivo']}"; | ||
| 130 | - } | ||
| 131 | - } | ||
| 132 | - } | ||
| 133 | - else | ||
| 134 | - { | ||
| 135 | - echo "<!--\nErro\nClasse clsPmieducarMotivoAfastamento nao encontrada\n-->"; | ||
| 136 | - $opcoes = array( "" => "Erro na geracao" ); | ||
| 137 | - } | ||
| 138 | - if ( $this->status == "N" ) | ||
| 139 | - $this->campoLista( "ref_cod_motivo_afastamento", "Motivo Afastamento", $opcoes, $this->ref_cod_motivo_afastamento ); | ||
| 140 | - elseif ( $this->status == "E" ) | ||
| 141 | - $this->campoLista( "ref_cod_motivo_afastamento", "Motivo Afastamento", $opcoes, $this->ref_cod_motivo_afastamento, "", false, "", "", true ); | ||
| 142 | - | ||
| 143 | - // text | ||
| 144 | - | ||
| 145 | - // data | ||
| 146 | - if ( $this->status == "N" ) | ||
| 147 | - $this->campoData( "data_saida", "Data de Afastamento", $this->data_saida, true ); | ||
| 148 | - elseif ( $this->status == "E" ) | ||
| 149 | - $this->campoRotulo( "data_saida", "Data de Afastamento", $this->data_saida ); | ||
| 150 | - | ||
| 151 | - if ( $this->status == "E" ) | ||
| 152 | - $this->campoData( "data_retorno", "Data de Retorno", $this->data_retorno, false ); | ||
| 153 | - if ( "clsPmieducarServidor" ) { | ||
| 154 | - $obj_servidor = new clsPmieducarServidor( $this->ref_cod_servidor, null, null, null, null, null, 1, $this->ref_cod_instituicao ); | ||
| 155 | - $det_servidor = $obj_servidor->detalhe(); | ||
| 156 | - if ( $det_servidor ) { | ||
| 157 | - if ( "clsPmieducarFuncao" ) { | ||
| 158 | - $obj_funcao = new clsPmieducarFuncao( $det_servidor["ref_cod_funcao"], null, null, null, null, null, null, null, 1, $this->ref_cod_instituicao ); | ||
| 159 | - $det_funcao = $obj_funcao->detalhe(); | ||
| 160 | - if ( $det_funcao["professor"] == 1 ) | ||
| 161 | - { | ||
| 162 | - //$obj = new clsPmieducarQuadroHorarioHorarios( null, null, null, null, null, null, null, $this->ref_cod_instituicao, null, $this->ref_cod_servidor, null, null, null, null, 1, null ); | ||
| 163 | - //$obj = new clsPmieducarServidorAlocacao(); | ||
| 164 | - $obj = new clsPmieducarQuadroHorarioHorarios(); | ||
| 165 | - $lista = $obj->lista( null, null, null, null, null, null, null, $this->ref_cod_instituicao, null, $this->ref_cod_servidor, null, null, null, null, null, null, null, null, 1, null ); | ||
| 166 | - //$lista = $obj->lista( null, $this->ref_cod_instituicao, null, null, null, $this->ref_cod_servidor, null, null, null, null, null, null, null, null, null, 1 ); | ||
| 167 | - if( $lista ) | ||
| 168 | - { | ||
| 169 | - foreach( $lista AS $campo => $val ){ // passa todos os valores obtidos no registro para atributos do objeto | ||
| 170 | - $temp = array(); | ||
| 171 | - $temp['hora_inicial'] = $val['hora_inicial']; | ||
| 172 | - $temp['hora_final'] = $val['hora_final']; | ||
| 173 | - $temp['dia_semana'] = $val['dia_semana']; | ||
| 174 | - $temp['ref_cod_escola'] = $val['ref_cod_escola']; | ||
| 175 | - $temp['ref_cod_substituto'] = $val['ref_servidor_substituto'] ; | ||
| 176 | - $this->alocacao_array[] = $temp; | ||
| 177 | - } | ||
| 178 | - if ( $this->alocacao_array ){ | ||
| 179 | - $tamanho = sizeof( $alocacao ); | ||
| 180 | - $script = "<script>\nvar num_alocacao = {$tamanho};\n"; | ||
| 181 | - $script .= "var array_servidores = Array();\n"; | ||
| 182 | - | ||
| 183 | - foreach ( $this->alocacao_array as $key => $alocacao ) { | ||
| 184 | - $script .= "array_servidores[{$key}] = new Array();\n"; | ||
| 185 | - | ||
| 186 | - $hora_ini = explode(":",$alocacao['hora_inicial']); | ||
| 187 | - $hora_fim = explode(":",$alocacao['hora_final']); | ||
| 188 | - | ||
| 189 | - $horas_utilizadas = ( $hora_fim[0] - $hora_ini[0] ); | ||
| 190 | - $minutos_utilizados = ( $hora_fim[1] - $hora_ini[1] ); | ||
| 191 | - $horas = sprintf("%02d",(int)$horas_utilizadas); | ||
| 192 | - $minutos = sprintf("%02d",(int)$minutos_utilizados); | ||
| 193 | - $str_horas_utilizadas = "{$horas}:{$minutos}"; | ||
| 194 | - $script .= "array_servidores[{$key}][0] = '{$str_horas_utilizadas}'; \n"; | ||
| 195 | - $script .= "array_servidores[{$key}][1] = ''; \n\n"; | ||
| 196 | - | ||
| 197 | - | ||
| 198 | - $obj_escola = new clsPmieducarEscola($alocacao['ref_cod_escola']); | ||
| 199 | - $det_escola = $obj_escola->detalhe(); | ||
| 200 | - $det_escola = $det_escola["nome"]; | ||
| 201 | - $nm_dia_semana = $this->dias_da_semana[$alocacao["dia_semana"]]; | ||
| 202 | - | ||
| 203 | - $obj_subst = new clsPessoa_( $alocacao["ref_cod_substituto"] ); | ||
| 204 | - $det_subst = $obj_subst->detalhe(); | ||
| 205 | - | ||
| 206 | - if($this->status == "N"){ | ||
| 207 | - $this->campoTextoInv( "dia_semana_{$key}_", "", $nm_dia_semana, 8, 8, false, false, true,"","","","","dia_semana" ); | ||
| 208 | - $this->campoTextoInv( "hora_inicial_{$key}_", "", $alocacao['hora_inicial'], 5, 5, false, false, true, "","","","","ds_hora_inicial_" ); | ||
| 209 | - $this->campoTextoInv( "hora_final_{$key}_", "", $alocacao['hora_final'], 5, 5, false, false, true, "", "","","","ds_hora_final_" ); | ||
| 210 | - $this->campoTextoInv( "ref_cod_escola_{$key}", "", $det_escola, 30, 255, false, false, true, "", "","","","ref_cod_escola_" ); | ||
| 211 | - $this->campoTextoInv( "ref_cod_servidor_substituto_{$key}_", "", $det_subst["nome"], 30, 255, false, false, false, "", "<span name=\"ref_cod_servidor_substituto\" id=\"ref_cod_servidor_substituicao_{$key}\"><img border='0' onclick=\"pesquisa_valores_popless('educar_pesquisa_servidor_lst.php?campo1=ref_cod_servidor_substituto[{$key}]&campo2=ref_cod_servidor_substituto_{$key}_&ref_cod_instituicao={$this->ref_cod_instituicao}&dia_semana={$alocacao["dia_semana"]}&hora_inicial={$alocacao["hora_inicial"]}&hora_final={$alocacao["hora_final"]}&ref_cod_servidor={$this->ref_cod_servidor}&professor=1&ref_cod_escola={$alocacao['ref_cod_escola']}&horario=S', 'nome')\" src=\"imagens/lupa.png\" ></span>","","","ref_cod_servidor_substituto" ); | ||
| 212 | - } | ||
| 213 | - $this->campoOculto( "dia_semana_{$key}", $alocacao["dia_semana"] ); | ||
| 214 | - $this->campoOculto( "hora_inicial_{$key}", $alocacao['hora_inicial'] ); | ||
| 215 | - $this->campoOculto( "hora_final_{$key}", $alocacao['hora_final'] ); | ||
| 216 | - $this->campoOculto( "ref_cod_escola_{$key}", $alocacao['ref_cod_escola'] ); | ||
| 217 | - $this->campoOculto( "ref_cod_servidor_substituto[{$key}]", $alocacao["ref_cod_substituto"] ); | ||
| 218 | - | ||
| 219 | - } | ||
| 220 | - | ||
| 221 | - /*nao esta sendo utilizado em lugar algum =o | ||
| 222 | - if($this->status == "N"){ | ||
| 223 | - $db = new clsBanco(); | ||
| 224 | - $consulta = "SELECT ref_cod_servidor | ||
| 225 | - ,ref_ref_cod_instituicao | ||
| 226 | - ,sum( carga_horaria ) as horas | ||
| 227 | - FROM pmieducar.servidor_alocacao | ||
| 228 | - WHERE ativo = 1 | ||
| 229 | - GROUP BY ref_cod_servidor,ref_ref_cod_instituicao"; | ||
| 230 | - $registros = $db->Consulta($consulta); | ||
| 231 | - if($registros) | ||
| 232 | - { | ||
| 233 | - $ct = 0; | ||
| 234 | - $script .="array_horas_utilizadas_servidor = new Array();\n"; | ||
| 235 | - | ||
| 236 | - while($db->ProximoRegistro()){ | ||
| 237 | - $registro = $db->Tupla(); | ||
| 238 | - | ||
| 239 | - $script .= "array_horas_utilizadas_servidor['{$registro['ref_cod_servidor']}_'] = new Array('{$registro['horas']}'); \n"; | ||
| 240 | - $ct++; | ||
| 241 | - } | ||
| 242 | - } | ||
| 243 | - | ||
| 244 | - | ||
| 245 | - $consulta = "SELECT DISTINCT cod_servidor | ||
| 246 | - ,ref_cod_instituicao | ||
| 247 | - ,coalesce(s.carga_horaria , '0') as carga_horaria | ||
| 248 | - FROM pmieducar.servidor s | ||
| 249 | - ,pmieducar.servidor_alocacao a | ||
| 250 | - WHERE s.ativo = 1 | ||
| 251 | - AND a.ativo = 1 | ||
| 252 | - AND s.ref_cod_instituicao = a.ref_ref_cod_instituicao"; | ||
| 253 | - $registros = $db->Consulta( $consulta ); | ||
| 254 | - if ( $registros ) { | ||
| 255 | - $ct = 0; | ||
| 256 | - $script .="array_horas_servidor = new Array();\n"; | ||
| 257 | - | ||
| 258 | - while($db->ProximoRegistro()){ | ||
| 259 | - $registro = $db->Tupla(); | ||
| 260 | - $carga_horaria = $registro['carga_horaria']; | ||
| 261 | - $total_horas = sprintf("%02d",(int)floor($carga_horaria)); | ||
| 262 | - $total_minutos = sprintf("%02d",(int)(floatval($carga_horaria) - floatval($total_horas)) * 60); | ||
| 263 | - $carga_horaria = "{$total_horas}:{$total_minutos}";//date("H:i",mktime($total_horas, $total_minutos, 0, 1, 1, 1970)); | ||
| 264 | - $script .= "array_horas_servidor['{$registro['cod_servidor']}_'] = new Array('{$carga_horaria}'); \n"; | ||
| 265 | - $ct++; | ||
| 266 | - } | ||
| 267 | - } | ||
| 268 | - | ||
| 269 | - $script .= "\n</script>"; | ||
| 270 | - echo $script; | ||
| 271 | - }*/ | ||
| 272 | - $script .= "\n</script>"; | ||
| 273 | - echo $script; | ||
| 274 | - } | ||
| 275 | - } | ||
| 276 | - } | ||
| 277 | - } | ||
| 278 | - } | ||
| 279 | - } | ||
| 280 | - } | 174 | + // data |
| 175 | + if ($this->status == 'N') { | ||
| 176 | + $this->campoData('data_saida', 'Data de Afastamento', $this->data_saida, TRUE); | ||
| 177 | + } | ||
| 178 | + elseif ($this->status == 'E') { | ||
| 179 | + $this->campoRotulo('data_saida', 'Data de Afastamento', $this->data_saida); | ||
| 180 | + } | ||
| 281 | 181 | ||
| 282 | - function Novo() | ||
| 283 | - { | ||
| 284 | - @session_start(); | ||
| 285 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 286 | - @session_write_close(); | ||
| 287 | - | ||
| 288 | - $obj_permissoes = new clsPermissoes(); | ||
| 289 | - $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 7, "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | ||
| 290 | -//echo '<pre>';print_r($_POST);die; | ||
| 291 | - $obj = new clsPmieducarServidorAfastamento( $this->ref_cod_servidor, null, $this->ref_cod_motivo_afastamento, null, $this->pessoa_logada, null, null, $this->data_retorno, $this->data_saida, 1, $this->ref_cod_instituicao ); | ||
| 292 | - $cadastrou = $obj->cadastra(); | ||
| 293 | - if( $cadastrou ) | ||
| 294 | - { | ||
| 295 | - if(is_array($_POST['ref_cod_servidor_substituto'])) | ||
| 296 | - foreach ( $_POST['ref_cod_servidor_substituto'] as $key => $valor ) | ||
| 297 | - { | ||
| 298 | - //if ( substr( $campo, 0, 28 ) == 'ref_cod_servidor_substituto_' ) | ||
| 299 | - // { | ||
| 300 | - $ref_cod_servidor_substituto = $valor; | ||
| 301 | - // } | ||
| 302 | - //if ( substr( $campo, 0, 15 ) == 'ref_cod_escola_' ) | ||
| 303 | - $ref_cod_escola = $_POST["ref_cod_escola_{$key}"]; | ||
| 304 | - //if ( substr( $campo, 0, 11 ) == 'dia_semana_' ) | ||
| 305 | - $dia_semana = $_POST["dia_semana_{$key}"]; | ||
| 306 | - //if ( substr( $campo, 0, 13 ) == 'hora_inicial_' ) | ||
| 307 | - $hora_inicial = urldecode( $_POST["hora_inicial_{$key}"] ); | ||
| 308 | - // if ( substr( $campo, 0, 11 ) == 'hora_final_' ) | ||
| 309 | - $hora_final = urldecode( $_POST["hora_final_{$key}"] ); | ||
| 310 | - | ||
| 311 | - if ( is_numeric( $ref_cod_servidor_substituto ) && is_numeric( $ref_cod_escola ) && is_numeric( $dia_semana ) && is_string( $hora_inicial ) && is_string( $hora_final ) ) | ||
| 312 | - { | ||
| 313 | - | ||
| 314 | - //if ( substr( $campo, 0, 28 ) == 'ref_cod_servidor_substituto_' ) | ||
| 315 | - //{die; | ||
| 316 | - $obj_horarios = new clsPmieducarQuadroHorarioHorarios( null, null, $ref_cod_escola,null, null,null, $this->ref_cod_instituicao,$ref_cod_servidor_substituto, $this->ref_cod_servidor, $hora_inicial, $hora_final, null, null, 1, $dia_semana ); | ||
| 317 | - $det_horarios = $obj_horarios->detalhe($ref_cod_escola); | ||
| 318 | - //echo " = new clsPmieducarQuadroHorarioHorarios( {$det_horarios["ref_cod_quadro_horario"]}, {$det_horarios["ref_cod_serie"]}, {$det_horarios["ref_cod_escola"]}, {$det_horarios["ref_cod_disciplina"]}, {$det_horarios["ref_ref_cod_turma"]}, {$det_horarios["sequencial"]}, {$det_horarios["ref_cod_instituicao_servidor"]}, null, {$ref_cod_servidor_substituto}, null, null, null, null, null, null, null );";die; | ||
| 319 | - $obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_cod_serie"], $det_horarios["ref_cod_escola"], $det_horarios["ref_cod_disciplina"], $det_horarios["sequencial"], $det_horarios["ref_cod_instituicao_servidor"],$det_horarios["ref_cod_instituicao_servidor"], $ref_cod_servidor_substituto, $this->ref_cod_servidor, null, null, null, null, null, null ); | ||
| 320 | - if( !$obj_horario->edita() ) | ||
| 321 | - { | ||
| 322 | - $this->mensagem = "Cadastro não realizado.<br>"; | ||
| 323 | - return false; | ||
| 324 | - } | ||
| 325 | - //} | ||
| 326 | - } | ||
| 327 | - } | ||
| 328 | - $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; | ||
| 329 | - header( "Location: educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | ||
| 330 | - die(); | ||
| 331 | - return true; | ||
| 332 | - } | ||
| 333 | - else | ||
| 334 | - { | ||
| 335 | - $this->mensagem = "Cadastro não realizado.<br>"; | ||
| 336 | - return false; | ||
| 337 | - } | ||
| 338 | - $this->mensagem = "Cadastro não realizado.<br>"; | ||
| 339 | - echo "<!--\nErro ao cadastrar clsPmieducarServidorAfastamento\nvalores obrigatorios\nis_numeric( $this->ref_cod_servidor ) && is_numeric( $this->sequencial ) && is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_cod_motivo_afastamento ) && is_numeric( $this->ref_usuario_cad ) && is_string( $this->data_saida )\n-->"; | ||
| 340 | - return false; | ||
| 341 | - } | 182 | + if ($this->status == 'E') { |
| 183 | + $this->campoData('data_retorno', 'Data de Retorno', $this->data_retorno, FALSE); | ||
| 184 | + } | ||
| 342 | 185 | ||
| 343 | - function Editar() | ||
| 344 | - { | ||
| 345 | - @session_start(); | ||
| 346 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 347 | - @session_write_close(); | 186 | + if (class_exists('clsPmieducarServidor')) { |
| 187 | + $obj_servidor = new clsPmieducarServidor($this->ref_cod_servidor, | ||
| 188 | + NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); | ||
| 348 | 189 | ||
| 349 | - $obj_permissoes = new clsPermissoes(); | ||
| 350 | - $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 7, "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | 190 | + $det_servidor = $obj_servidor->detalhe(); |
| 351 | 191 | ||
| 352 | - $obj = new clsPmieducarServidorAfastamento( $this->ref_cod_servidor, $this->sequencial, $this->ref_cod_motivo_afastamento, $this->pessoa_logada, null, null, null, $this->data_retorno, unserialize( $this->data_saida ), 1, $this->ref_cod_instituicao ); | ||
| 353 | - $editou = $obj->edita(); | ||
| 354 | - if( $editou ) | ||
| 355 | - { | ||
| 356 | - if(is_array($_POST['ref_cod_servidor_substituto'])) | ||
| 357 | - foreach ( $_POST['ref_cod_servidor_substituto'] as $key => $valor ) | ||
| 358 | - { | ||
| 359 | - $ref_cod_servidor_substituto = $valor; | ||
| 360 | - | ||
| 361 | - //if ( substr( $campo, 0, 15 ) == 'ref_cod_escola_' ) | ||
| 362 | - $ref_cod_escola = $_POST["ref_cod_escola_{$key}"]; | ||
| 363 | - //if ( substr( $campo, 0, 11 ) == 'dia_semana_' ) | ||
| 364 | - $dia_semana = $_POST["dia_semana_{$key}"]; | ||
| 365 | - //if ( substr( $campo, 0, 13 ) == 'hora_inicial_' ) | ||
| 366 | - $hora_inicial = urldecode( $_POST["hora_inicial_{$key}"] ); | ||
| 367 | - // if ( substr( $campo, 0, 11 ) == 'hora_final_' ) | ||
| 368 | - $hora_final = urldecode( $_POST["hora_final_{$key}"] ); | ||
| 369 | - | ||
| 370 | - if ( is_numeric( $ref_cod_servidor_substituto ) && is_numeric( $ref_cod_escola ) && is_numeric( $dia_semana ) && is_string( $hora_inicial ) && is_string( $hora_final ) ) | ||
| 371 | - { | ||
| 372 | - //if ( substr( $campo, 0, 28 ) == 'ref_cod_servidor_substituto_' ) | ||
| 373 | - //{ | ||
| 374 | - $obj_horarios = new clsPmieducarQuadroHorarioHorarios( null, null, $ref_cod_escola,null, null,null, $this->ref_cod_instituicao,$ref_cod_servidor_substituto, $this->ref_cod_servidor, $hora_inicial, $hora_final, null, null, 1, $dia_semana ); | ||
| 375 | - $det_horarios = $obj_horarios->detalhe($ref_cod_escola); | ||
| 376 | - //if ( is_string( $this->data_retorno ) && $this->data_retorno != '' ) | ||
| 377 | - //{ | ||
| 378 | - //$obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_ref_cod_serie"], $det_horarios["ref_ref_cod_escola"], $det_horarios["ref_ref_cod_disciplina"], $det_horarios["ref_ref_cod_turma"], $det_horarios["sequencial"], null, null, null, null, null, null, null, null, null, null ); | ||
| 379 | - $obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_cod_serie"], $det_horarios["ref_cod_escola"], $det_horarios["ref_cod_disciplina"], $det_horarios["sequencial"], null,$det_horarios["ref_cod_instituicao_servidor"], null, $this->ref_cod_servidor, null, null, null, null, null, null ); | ||
| 380 | - //} | ||
| 381 | - /* else | ||
| 382 | - { | ||
| 383 | - // $obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_ref_cod_serie"], $det_horarios["ref_ref_cod_escola"], $det_horarios["ref_ref_cod_disciplina"], $det_horarios["ref_ref_cod_turma"], $det_horarios["sequencial"], $det_horarios["ref_cod_instituicao_servidor"], null, $ref_cod_servidor_substituto, null, null, null, null, null, null, null ); | ||
| 384 | - $obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_cod_serie"], $det_horarios["ref_cod_escola"], $det_horarios["ref_cod_disciplina"], $det_horarios["sequencial"], $det_horarios["ref_cod_instituicao_servidor"],$det_horarios["ref_cod_instituicao_servidor"], $ref_cod_servidor_substituto, $this->ref_cod_servidor, null, null, null, null, null, null ); | ||
| 385 | - }*/ | ||
| 386 | - if( !$obj_horario->edita() ) | ||
| 387 | - { | ||
| 388 | - $this->mensagem = "Cadastro não realizado.<br>"; | ||
| 389 | - return false; | ||
| 390 | - } | ||
| 391 | - //} | ||
| 392 | - } | ||
| 393 | - } | ||
| 394 | - $this->mensagem .= "Edição efetuada com sucesso.<br>"; | ||
| 395 | - header( "Location: educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | ||
| 396 | - die(); | ||
| 397 | - return true; | ||
| 398 | - } | ||
| 399 | - | ||
| 400 | - $this->mensagem = "Edição não realizada.<br>"; | ||
| 401 | - echo "<!--\nErro ao editar clsPmieducarServidorAfastamento\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->sequencial ) && is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_usuario_exc ) )\n-->"; | ||
| 402 | - return false; | ||
| 403 | - } | 192 | + if ($det_servidor) { |
| 404 | 193 | ||
| 405 | - function Excluir() | ||
| 406 | - { | ||
| 407 | - @session_start(); | ||
| 408 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 409 | - @session_write_close(); | 194 | + if (class_exists('clsPmieducarFuncao')) { |
| 195 | + $obj_funcao = new clsPmieducarFuncao($det_servidor['ref_cod_funcao'], | ||
| 196 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); | ||
| 410 | 197 | ||
| 411 | - $obj_permissoes = new clsPermissoes(); | ||
| 412 | - $obj_permissoes->permissao_excluir( 635, $this->pessoa_logada, 7, "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | 198 | + $det_funcao = $obj_funcao->detalhe(); |
| 413 | 199 | ||
| 200 | + if ($det_funcao['professor'] == 1) { | ||
| 201 | + $obj = new clsPmieducarQuadroHorarioHorarios(); | ||
| 202 | + $lista = $obj->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
| 203 | + $this->ref_cod_instituicao, NULL, $this->ref_cod_servidor, NULL, | ||
| 204 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL); | ||
| 414 | 205 | ||
| 415 | - $obj = new clsPmieducarServidorAfastamento($this->ref_cod_servidor, $this->sequencial, $this->ref_ref_cod_instituicao, $this->ref_cod_motivo_afastamento, $this->pessoa_logada, $this->pessoa_logada, $this->data_cadastro, $this->data_exclusao, $this->data_retorno, $this->data_saida, 0); | ||
| 416 | - $excluiu = $obj->excluir(); | ||
| 417 | - if( $excluiu ) | ||
| 418 | - { | ||
| 419 | - $this->mensagem .= "Exclusão efetuada com sucesso.<br>"; | ||
| 420 | - header( "Location: educar_servidor_afastamento_lst.php" ); | ||
| 421 | - die(); | ||
| 422 | - return true; | ||
| 423 | - } | ||
| 424 | - | ||
| 425 | - $this->mensagem = "Exclusão não realizada.<br>"; | ||
| 426 | - echo "<!--\nErro ao excluir clsPmieducarServidorAfastamento\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->sequencial ) && is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_usuario_exc ) )\n-->"; | ||
| 427 | - return false; | ||
| 428 | - } | 206 | + if ($lista) { |
| 207 | + | ||
| 208 | + // Passa todos os valores obtidos no registro para atributos do objeto | ||
| 209 | + foreach ($lista as $campo => $val) { | ||
| 210 | + $temp = array(); | ||
| 211 | + $temp['hora_inicial'] = $val['hora_inicial']; | ||
| 212 | + $temp['hora_final'] = $val['hora_final']; | ||
| 213 | + $temp['dia_semana'] = $val['dia_semana']; | ||
| 214 | + $temp['ref_cod_escola'] = $val['ref_cod_escola']; | ||
| 215 | + $temp['ref_cod_substituto'] = $val['ref_servidor_substituto']; | ||
| 216 | + $this->alocacao_array[] = $temp; | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + if ($this->alocacao_array) { | ||
| 220 | + $tamanho = sizeof($alocacao); | ||
| 221 | + $script = "<script>\nvar num_alocacao = {$tamanho};\n"; | ||
| 222 | + $script .= "var array_servidores = Array();\n"; | ||
| 223 | + | ||
| 224 | + foreach ($this->alocacao_array as $key => $alocacao) { | ||
| 225 | + $script .= "array_servidores[{$key}] = new Array();\n"; | ||
| 226 | + | ||
| 227 | + $hora_ini = explode(":", $alocacao['hora_inicial']); | ||
| 228 | + $hora_fim = explode(":", $alocacao['hora_final']); | ||
| 229 | + | ||
| 230 | + $horas_utilizadas = ($hora_fim[0] - $hora_ini[0]); | ||
| 231 | + $minutos_utilizados = ($hora_fim[1] - $hora_ini[1]); | ||
| 232 | + | ||
| 233 | + $horas = sprintf('%02d', (int) $horas_utilizadas); | ||
| 234 | + $minutos = sprintf('%02d', (int) $minutos_utilizados); | ||
| 235 | + | ||
| 236 | + $str_horas_utilizadas = "{$horas}:{$minutos}"; | ||
| 237 | + | ||
| 238 | + $script .= "array_servidores[{$key}][0] = '{$str_horas_utilizadas}';\n"; | ||
| 239 | + $script .= "array_servidores[{$key}][1] = '';\n\n"; | ||
| 240 | + | ||
| 241 | + $obj_escola = new clsPmieducarEscola($alocacao['ref_cod_escola']); | ||
| 242 | + $det_escola = $obj_escola->detalhe(); | ||
| 243 | + $det_escola = $det_escola['nome']; | ||
| 244 | + $nm_dia_semana = $this->dias_da_semana[$alocacao['dia_semana']]; | ||
| 245 | + | ||
| 246 | + $obj_subst = new clsPessoa_($alocacao['ref_cod_substituto']); | ||
| 247 | + $det_subst = $obj_subst->detalhe(); | ||
| 248 | + | ||
| 249 | + if ($this->status == 'N') { | ||
| 250 | + $this->campoTextoInv("dia_semana_{$key}_", '', $nm_dia_semana, | ||
| 251 | + 8, 8, FALSE, FALSE, TRUE, '', '', '', '', 'dia_semana'); | ||
| 252 | + | ||
| 253 | + $this->campoTextoInv("hora_inicial_{$key}_", '', $alocacao['hora_inicial'], | ||
| 254 | + 5, 5, FALSE, FALSE, TRUE, '', '', '', '', 'ds_hora_inicial_'); | ||
| 255 | + | ||
| 256 | + $this->campoTextoInv("hora_final_{$key}_", '', $alocacao['hora_final'], | ||
| 257 | + 5, 5, FALSE, FALSE, TRUE, '', '', '', '', 'ds_hora_final_'); | ||
| 258 | + | ||
| 259 | + $this->campoTextoInv("ref_cod_escola_{$key}", '', $det_escola, | ||
| 260 | + 30, 255, FALSE, FALSE, TRUE, '', '', '', '', 'ref_cod_escola_'); | ||
| 261 | + | ||
| 262 | + $this->campoTextoInv("ref_cod_servidor_substituto_{$key}_", | ||
| 263 | + '', $det_subst['nome'], 30, 255, FALSE, FALSE, FALSE, '', | ||
| 264 | + "<span name=\"ref_cod_servidor_substituto\" id=\"ref_cod_servidor_substituicao_{$key}\"><img border='0' onclick=\"pesquisa_valores_popless('educar_pesquisa_servidor_lst.php?campo1=ref_cod_servidor_substituto[{$key}]&campo2=ref_cod_servidor_substituto_{$key}_&ref_cod_instituicao={$this->ref_cod_instituicao}&dia_semana={$alocacao["dia_semana"]}&hora_inicial={$alocacao["hora_inicial"]}&hora_final={$alocacao["hora_final"]}&ref_cod_servidor={$this->ref_cod_servidor}&professor=1&ref_cod_escola={$alocacao['ref_cod_escola']}&horario=S', 'nome')\" src=\"imagens/lupa.png\" ></span>", | ||
| 265 | + '', '', 'ref_cod_servidor_substituto'); | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + $this->campoOculto("dia_semana_{$key}", $alocacao['dia_semana']); | ||
| 269 | + $this->campoOculto("hora_inicial_{$key}", $alocacao['hora_inicial']); | ||
| 270 | + $this->campoOculto("hora_final_{$key}", $alocacao['hora_final']); | ||
| 271 | + $this->campoOculto("ref_cod_escola_{$key}", $alocacao['ref_cod_escola']); | ||
| 272 | + $this->campoOculto("ref_cod_servidor_substituto[{$key}]", $alocacao['ref_cod_substituto']); | ||
| 273 | + | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + $script .= "\n</script>"; | ||
| 277 | + | ||
| 278 | + // Print do Javascript | ||
| 279 | + print $script; | ||
| 280 | + } | ||
| 281 | + } | ||
| 282 | + } | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + } | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + | ||
| 290 | + | ||
| 291 | + public function Novo() { | ||
| 292 | + session_start(); | ||
| 293 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 294 | + session_write_close(); | ||
| 295 | + | ||
| 296 | + $this->ref_cod_servidor = isset($_POST['ref_cod_servidor']) ? | ||
| 297 | + $_POST['ref_cod_servidor'] : NULL; | ||
| 298 | + | ||
| 299 | + $obj_permissoes = new clsPermissoes(); | ||
| 300 | + $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, | ||
| 301 | + "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}"); | ||
| 302 | + | ||
| 303 | + $obj = new clsPmieducarServidorAfastamento($this->ref_cod_servidor, NULL, | ||
| 304 | + $this->ref_cod_motivo_afastamento, NULL, $this->pessoa_logada, NULL, NULL, | ||
| 305 | + $this->data_retorno, $this->data_saida, 1, $this->ref_cod_instituicao); | ||
| 306 | + | ||
| 307 | + $cadastrou = $obj->cadastra(); | ||
| 308 | + if ($cadastrou) { | ||
| 309 | + | ||
| 310 | + if(is_array($_POST['ref_cod_servidor_substituto'])) | ||
| 311 | + foreach ( $_POST['ref_cod_servidor_substituto'] as $key => $valor ) | ||
| 312 | + { | ||
| 313 | + //if ( substr( $campo, 0, 28 ) == 'ref_cod_servidor_substituto_' ) | ||
| 314 | + // { | ||
| 315 | + $ref_cod_servidor_substituto = $valor; | ||
| 316 | + // } | ||
| 317 | + //if ( substr( $campo, 0, 15 ) == 'ref_cod_escola_' ) | ||
| 318 | + $ref_cod_escola = $_POST["ref_cod_escola_{$key}"]; | ||
| 319 | + //if ( substr( $campo, 0, 11 ) == 'dia_semana_' ) | ||
| 320 | + $dia_semana = $_POST["dia_semana_{$key}"]; | ||
| 321 | + //if ( substr( $campo, 0, 13 ) == 'hora_inicial_' ) | ||
| 322 | + $hora_inicial = urldecode( $_POST["hora_inicial_{$key}"] ); | ||
| 323 | + // if ( substr( $campo, 0, 11 ) == 'hora_final_' ) | ||
| 324 | + $hora_final = urldecode( $_POST["hora_final_{$key}"] ); | ||
| 325 | + | ||
| 326 | + if ( is_numeric( $ref_cod_servidor_substituto ) && is_numeric( $ref_cod_escola ) && is_numeric( $dia_semana ) && is_string( $hora_inicial ) && is_string( $hora_final ) ) | ||
| 327 | + { | ||
| 328 | + | ||
| 329 | + //if ( substr( $campo, 0, 28 ) == 'ref_cod_servidor_substituto_' ) | ||
| 330 | + //{die; | ||
| 331 | + $obj_horarios = new clsPmieducarQuadroHorarioHorarios( null, null, $ref_cod_escola,null, null,null, $this->ref_cod_instituicao,$ref_cod_servidor_substituto, $this->ref_cod_servidor, $hora_inicial, $hora_final, null, null, 1, $dia_semana ); | ||
| 332 | + $det_horarios = $obj_horarios->detalhe($ref_cod_escola); | ||
| 333 | + //echo " = new clsPmieducarQuadroHorarioHorarios( {$det_horarios["ref_cod_quadro_horario"]}, {$det_horarios["ref_cod_serie"]}, {$det_horarios["ref_cod_escola"]}, {$det_horarios["ref_cod_disciplina"]}, {$det_horarios["ref_ref_cod_turma"]}, {$det_horarios["sequencial"]}, {$det_horarios["ref_cod_instituicao_servidor"]}, null, {$ref_cod_servidor_substituto}, null, null, null, null, null, null, null );";die; | ||
| 334 | + $obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_cod_serie"], $det_horarios["ref_cod_escola"], $det_horarios["ref_cod_disciplina"], $det_horarios["sequencial"], $det_horarios["ref_cod_instituicao_servidor"],$det_horarios["ref_cod_instituicao_servidor"], $ref_cod_servidor_substituto, $this->ref_cod_servidor, null, null, null, null, null, null ); | ||
| 335 | + if( !$obj_horario->edita() ) | ||
| 336 | + { | ||
| 337 | + $this->mensagem = "Cadastro não realizado.<br>"; | ||
| 338 | + return false; | ||
| 339 | + } | ||
| 340 | + //} | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; | ||
| 344 | + header( "Location: educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | ||
| 345 | + die(); | ||
| 346 | + return true; | ||
| 347 | + } | ||
| 348 | + else | ||
| 349 | + { | ||
| 350 | + $this->mensagem = "Cadastro não realizado.<br>"; | ||
| 351 | + return false; | ||
| 352 | + } | ||
| 353 | + $this->mensagem = "Cadastro não realizado.<br>"; | ||
| 354 | + echo "<!--\nErro ao cadastrar clsPmieducarServidorAfastamento\nvalores obrigatorios\nis_numeric( $this->ref_cod_servidor ) && is_numeric( $this->sequencial ) && is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_cod_motivo_afastamento ) && is_numeric( $this->ref_usuario_cad ) && is_string( $this->data_saida )\n-->"; | ||
| 355 | + return false; | ||
| 356 | + } | ||
| 357 | + | ||
| 358 | + function Editar() | ||
| 359 | + { | ||
| 360 | + @session_start(); | ||
| 361 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 362 | + @session_write_close(); | ||
| 363 | + | ||
| 364 | + $obj_permissoes = new clsPermissoes(); | ||
| 365 | + $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 7, "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | ||
| 366 | + | ||
| 367 | + $obj = new clsPmieducarServidorAfastamento( $this->ref_cod_servidor, $this->sequencial, $this->ref_cod_motivo_afastamento, $this->pessoa_logada, null, null, null, $this->data_retorno, unserialize( $this->data_saida ), 1, $this->ref_cod_instituicao ); | ||
| 368 | + $editou = $obj->edita(); | ||
| 369 | + if( $editou ) | ||
| 370 | + { | ||
| 371 | + if(is_array($_POST['ref_cod_servidor_substituto'])) | ||
| 372 | + foreach ( $_POST['ref_cod_servidor_substituto'] as $key => $valor ) | ||
| 373 | + { | ||
| 374 | + $ref_cod_servidor_substituto = $valor; | ||
| 375 | + | ||
| 376 | + //if ( substr( $campo, 0, 15 ) == 'ref_cod_escola_' ) | ||
| 377 | + $ref_cod_escola = $_POST["ref_cod_escola_{$key}"]; | ||
| 378 | + //if ( substr( $campo, 0, 11 ) == 'dia_semana_' ) | ||
| 379 | + $dia_semana = $_POST["dia_semana_{$key}"]; | ||
| 380 | + //if ( substr( $campo, 0, 13 ) == 'hora_inicial_' ) | ||
| 381 | + $hora_inicial = urldecode( $_POST["hora_inicial_{$key}"] ); | ||
| 382 | + // if ( substr( $campo, 0, 11 ) == 'hora_final_' ) | ||
| 383 | + $hora_final = urldecode( $_POST["hora_final_{$key}"] ); | ||
| 384 | + | ||
| 385 | + if ( is_numeric( $ref_cod_servidor_substituto ) && is_numeric( $ref_cod_escola ) && is_numeric( $dia_semana ) && is_string( $hora_inicial ) && is_string( $hora_final ) ) | ||
| 386 | + { | ||
| 387 | + //if ( substr( $campo, 0, 28 ) == 'ref_cod_servidor_substituto_' ) | ||
| 388 | + //{ | ||
| 389 | + $obj_horarios = new clsPmieducarQuadroHorarioHorarios( null, null, $ref_cod_escola,null, null,null, $this->ref_cod_instituicao,$ref_cod_servidor_substituto, $this->ref_cod_servidor, $hora_inicial, $hora_final, null, null, 1, $dia_semana ); | ||
| 390 | + $det_horarios = $obj_horarios->detalhe($ref_cod_escola); | ||
| 391 | + //if ( is_string( $this->data_retorno ) && $this->data_retorno != '' ) | ||
| 392 | + //{ | ||
| 393 | + //$obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_ref_cod_serie"], $det_horarios["ref_ref_cod_escola"], $det_horarios["ref_ref_cod_disciplina"], $det_horarios["ref_ref_cod_turma"], $det_horarios["sequencial"], null, null, null, null, null, null, null, null, null, null ); | ||
| 394 | + $obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_cod_serie"], $det_horarios["ref_cod_escola"], $det_horarios["ref_cod_disciplina"], $det_horarios["sequencial"], null,$det_horarios["ref_cod_instituicao_servidor"], null, $this->ref_cod_servidor, null, null, null, null, null, null ); | ||
| 395 | + //} | ||
| 396 | + /* else | ||
| 397 | + { | ||
| 398 | + // $obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_ref_cod_serie"], $det_horarios["ref_ref_cod_escola"], $det_horarios["ref_ref_cod_disciplina"], $det_horarios["ref_ref_cod_turma"], $det_horarios["sequencial"], $det_horarios["ref_cod_instituicao_servidor"], null, $ref_cod_servidor_substituto, null, null, null, null, null, null, null ); | ||
| 399 | + $obj_horario = new clsPmieducarQuadroHorarioHorarios( $det_horarios["ref_cod_quadro_horario"], $det_horarios["ref_cod_serie"], $det_horarios["ref_cod_escola"], $det_horarios["ref_cod_disciplina"], $det_horarios["sequencial"], $det_horarios["ref_cod_instituicao_servidor"],$det_horarios["ref_cod_instituicao_servidor"], $ref_cod_servidor_substituto, $this->ref_cod_servidor, null, null, null, null, null, null ); | ||
| 400 | + }*/ | ||
| 401 | + if( !$obj_horario->edita() ) | ||
| 402 | + { | ||
| 403 | + $this->mensagem = "Cadastro não realizado.<br>"; | ||
| 404 | + return false; | ||
| 405 | + } | ||
| 406 | + //} | ||
| 407 | + } | ||
| 408 | + } | ||
| 409 | + $this->mensagem .= "Edição efetuada com sucesso.<br>"; | ||
| 410 | + header( "Location: educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | ||
| 411 | + die(); | ||
| 412 | + return true; | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + $this->mensagem = "Edição não realizada.<br>"; | ||
| 416 | + echo "<!--\nErro ao editar clsPmieducarServidorAfastamento\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->sequencial ) && is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_usuario_exc ) )\n-->"; | ||
| 417 | + return false; | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + function Excluir() | ||
| 421 | + { | ||
| 422 | + @session_start(); | ||
| 423 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 424 | + @session_write_close(); | ||
| 425 | + | ||
| 426 | + $obj_permissoes = new clsPermissoes(); | ||
| 427 | + $obj_permissoes->permissao_excluir( 635, $this->pessoa_logada, 7, "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" ); | ||
| 428 | + | ||
| 429 | + | ||
| 430 | + $obj = new clsPmieducarServidorAfastamento($this->ref_cod_servidor, $this->sequencial, $this->ref_ref_cod_instituicao, $this->ref_cod_motivo_afastamento, $this->pessoa_logada, $this->pessoa_logada, $this->data_cadastro, $this->data_exclusao, $this->data_retorno, $this->data_saida, 0); | ||
| 431 | + $excluiu = $obj->excluir(); | ||
| 432 | + if( $excluiu ) | ||
| 433 | + { | ||
| 434 | + $this->mensagem .= "Exclusão efetuada com sucesso.<br>"; | ||
| 435 | + header( "Location: educar_servidor_afastamento_lst.php" ); | ||
| 436 | + die(); | ||
| 437 | + return true; | ||
| 438 | + } | ||
| 439 | + | ||
| 440 | + $this->mensagem = "Exclusão não realizada.<br>"; | ||
| 441 | + echo "<!--\nErro ao excluir clsPmieducarServidorAfastamento\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->sequencial ) && is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_usuario_exc ) )\n-->"; | ||
| 442 | + return false; | ||
| 443 | + } | ||
| 429 | } | 444 | } |
| 430 | 445 | ||
| 431 | // cria uma extensao da classe base | 446 | // cria uma extensao da classe base |
ieducar/intranet/include/pmieducar/clsPmieducarServidor.inc.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 | /** | 2 | /** |
| 28 | -* @author Prefeitura Municipal de Itajaí | ||
| 29 | -* | ||
| 30 | -* Criado em 26/06/2006 16:19 pelo gerador automatico de classes | ||
| 31 | -*/ | ||
| 32 | - | ||
| 33 | -require_once( "include/pmieducar/geral.inc.php" ); | 3 | + * |
| 4 | + * @author Prefeitura Municipal de Itajaí | ||
| 5 | + * @version $Id$ | ||
| 6 | + * | ||
| 7 | + * Pacote: i-PLB Software Público Livre e Brasileiro | ||
| 8 | + * | ||
| 9 | + * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí | ||
| 10 | + * ctima@itajai.sc.gov.br | ||
| 11 | + * | ||
| 12 | + * Este programa é software livre, você pode redistribuí-lo e/ou | ||
| 13 | + * modificá-lo sob os termos da Licença Pública Geral GNU, conforme | ||
| 14 | + * publicada pela Free Software Foundation, tanto a versão 2 da | ||
| 15 | + * Licença como (a seu critério) qualquer versão mais nova. | ||
| 16 | + * | ||
| 17 | + * Este programa é distribuído na expectativa de ser útil, mas SEM | ||
| 18 | + * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- | ||
| 19 | + * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- | ||
| 20 | + * sulte a Licença Pública Geral GNU para obter mais detalhes. | ||
| 21 | + * | ||
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU | ||
| 23 | + * junto com este programa. Se não, escreva para a Free Software | ||
| 24 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 25 | + * 02111-1307, USA. | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | +require_once 'include/pmieducar/geral.inc.php'; | ||
| 34 | 30 | ||
| 35 | class clsPmieducarServidor | 31 | class clsPmieducarServidor |
| 36 | { | 32 | { |
| @@ -110,9 +106,12 @@ class clsPmieducarServidor | @@ -110,9 +106,12 @@ class clsPmieducarServidor | ||
| 110 | * | 106 | * |
| 111 | * @return object | 107 | * @return object |
| 112 | */ | 108 | */ |
| 113 | - function clsPmieducarServidor( $cod_servidor = null, $ref_cod_deficiencia = null, $ref_idesco = null, $carga_horaria = null, $data_cadastro = null, $data_exclusao = null, $ativo = null, $ref_cod_instituicao = null, $ref_cod_subnivel = null ) | ||
| 114 | - { | ||
| 115 | - $db = new clsBanco(); | 109 | + public function clsPmieducarServidor( |
| 110 | + $cod_servidor = NULL, $ref_cod_deficiencia = NULL, $ref_idesco = NULL, | ||
| 111 | + $carga_horaria = NULL, $data_cadastro = NULL, $data_exclusao = NULL, | ||
| 112 | + $ativo = NULL, $ref_cod_instituicao = NULL, $ref_cod_subnivel = NULL) { | ||
| 113 | + | ||
| 114 | + $db = new clsBanco(); | ||
| 116 | $this->_schema = "pmieducar."; | 115 | $this->_schema = "pmieducar."; |
| 117 | $this->_tabela = "{$this->_schema}servidor"; | 116 | $this->_tabela = "{$this->_schema}servidor"; |
| 118 | 117 | ||
| @@ -409,8 +408,19 @@ class clsPmieducarServidor | @@ -409,8 +408,19 @@ class clsPmieducarServidor | ||
| 409 | * | 408 | * |
| 410 | * @return array | 409 | * @return array |
| 411 | */ | 410 | */ |
| 412 | - function lista( $int_cod_servidor = null, $int_ref_cod_deficiencia = null, $int_ref_idesco = null, $int_carga_horaria = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_instituicao = null, $str_tipo = null, $array_horario = null, $str_not_in_servidor = null, $str_nome_servidor = null, $boo_professor = false, $str_horario = null, $bool_ordena_por_nome = false, $lst_matriculas = null, $matutino = false, $vespertino = false, $noturno = false, $int_ref_cod_escola = null, $str_hr_mat = nul, $str_hr_ves = null, $str_hr_not = null, $int_dia_semana = null,$alocacao_escola_instituicao = null, $int_identificador = null, $int_ref_cod_curso = null, $int_ref_cod_disciplina = null, $int_ref_cod_subnivel = null ) | ||
| 413 | - { | 411 | + public function lista($int_cod_servidor = NULL, $int_ref_cod_deficiencia = NULL, |
| 412 | + $int_ref_idesco = null, $int_carga_horaria = NULL, $date_data_cadastro_ini = NULL, | ||
| 413 | + $date_data_cadastro_fim = NULL, $date_data_exclusao_ini = NULL, | ||
| 414 | + $date_data_exclusao_fim = NULL, $int_ativo = NULL, | ||
| 415 | + $int_ref_cod_instituicao = NULL, $str_tipo = NULL, $array_horario = NULL, | ||
| 416 | + $str_not_in_servidor = NULL, $str_nome_servidor = NULL, $boo_professor = FALSE, | ||
| 417 | + $str_horario = NULL, $bool_ordena_por_nome = FALSE, $lst_matriculas = NULL, | ||
| 418 | + $matutino = FALSE, $vespertino = FALSE, $noturno = FALSE, | ||
| 419 | + $int_ref_cod_escola = NULL, $str_hr_mat = NULL, $str_hr_ves = NULL, | ||
| 420 | + $str_hr_not = NULL, $int_dia_semana = NULL, | ||
| 421 | + $alocacao_escola_instituicao = NULL, $int_identificador = NULL, | ||
| 422 | + $int_ref_cod_curso = NULL, $int_ref_cod_disciplina = NULL, | ||
| 423 | + $int_ref_cod_subnivel = NULL) { | ||
| 414 | 424 | ||
| 415 | $whereAnd = " WHERE "; | 425 | $whereAnd = " WHERE "; |
| 416 | $filtros = ""; | 426 | $filtros = ""; |
| @@ -425,7 +435,7 @@ class clsPmieducarServidor | @@ -425,7 +435,7 @@ class clsPmieducarServidor | ||
| 425 | { | 435 | { |
| 426 | $tabela_compl .= ", cadastro.pessoa p"; | 436 | $tabela_compl .= ", cadastro.pessoa p"; |
| 427 | $this->_campos_lista2 .= ",p.nome"; | 437 | $this->_campos_lista2 .= ",p.nome"; |
| 428 | - $filtros .= "{$whereAnd} cod_servidor = idpes "; | 438 | + $filtros .= "{$whereAnd} s.cod_servidor = p.idpes "; |
| 429 | $whereAnd = " AND "; | 439 | $whereAnd = " AND "; |
| 430 | $this->setOrderby( "nome" ); | 440 | $this->setOrderby( "nome" ); |
| 431 | } | 441 | } |
| @@ -540,9 +550,14 @@ class clsPmieducarServidor | @@ -540,9 +550,14 @@ class clsPmieducarServidor | ||
| 540 | { | 550 | { |
| 541 | $filtros .= "{$whereAnd} s.cod_servidor IN ( SELECT a.ref_cod_servidor | 551 | $filtros .= "{$whereAnd} s.cod_servidor IN ( SELECT a.ref_cod_servidor |
| 542 | FROM pmieducar.servidor_alocacao a | 552 | FROM pmieducar.servidor_alocacao a |
| 543 | - WHERE a.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}' | ||
| 544 | - and ref_cod_escola = '{$int_ref_cod_escola}' )"; | ||
| 545 | - | 553 | + WHERE "; |
| 554 | + if (is_numeric($int_ref_cod_instituicao)) { | ||
| 555 | + $filtros .= " a.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; | ||
| 556 | + } | ||
| 557 | + if (is_numeric($int_ref_cod_escola)) { | ||
| 558 | + $filtros .= " and ref_cod_escola = '{$int_ref_cod_escola}' "; | ||
| 559 | + } | ||
| 560 | + $filtros .= ') '; | ||
| 546 | } | 561 | } |
| 547 | 562 | ||
| 548 | if ( is_array( $array_horario ) ) | 563 | if ( is_array( $array_horario ) ) |
| @@ -791,7 +806,7 @@ class clsPmieducarServidor | @@ -791,7 +806,7 @@ class clsPmieducarServidor | ||
| 791 | $sql = "SELECT {$this->_campos_lista2} FROM {$this->_schema}servidor s{$tabela_compl} {$filtros}".$this->getOrderby().$this->getLimite(); | 806 | $sql = "SELECT {$this->_campos_lista2} FROM {$this->_schema}servidor s{$tabela_compl} {$filtros}".$this->getOrderby().$this->getLimite(); |
| 792 | 807 | ||
| 793 | $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_schema}servidor s{$tabela_compl} {$filtros}" ); | 808 | $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_schema}servidor s{$tabela_compl} {$filtros}" ); |
| 794 | - | 809 | +print '<pre>'.$sql.'</pre>'; |
| 795 | $db->Consulta( $sql ); | 810 | $db->Consulta( $sql ); |
| 796 | 811 | ||
| 797 | if( $countCampos > 1 ) | 812 | if( $countCampos > 1 ) |
| @@ -976,5 +991,4 @@ class clsPmieducarServidor | @@ -976,5 +991,4 @@ class clsPmieducarServidor | ||
| 976 | return $db->Tupla(); | 991 | return $db->Tupla(); |
| 977 | } | 992 | } |
| 978 | 993 | ||
| 979 | -} | ||
| 980 | -?> | ||
| 981 | \ No newline at end of file | 994 | \ No newline at end of file |
| 995 | +} | ||
| 982 | \ No newline at end of file | 996 | \ No newline at end of file |
ieducar/intranet/include/pmieducar/clsPmieducarServidorAfastamento.inc.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 | /** | 2 | /** |
| 28 | -* @author Prefeitura Municipal de Itajaí | ||
| 29 | -* | ||
| 30 | -* Criado em 26/06/2006 16:19 pelo gerador automatico de classes | ||
| 31 | -*/ | ||
| 32 | - | ||
| 33 | -require_once( "include/pmieducar/geral.inc.php" ); | 3 | + * |
| 4 | + * @author Prefeitura Municipal de Itajaí | ||
| 5 | + * @version $Id$ | ||
| 6 | + * | ||
| 7 | + * Pacote: i-PLB Software Público Livre e Brasileiro | ||
| 8 | + * | ||
| 9 | + * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí | ||
| 10 | + * ctima@itajai.sc.gov.br | ||
| 11 | + * | ||
| 12 | + * Este programa é software livre, você pode redistribuí-lo e/ou | ||
| 13 | + * modificá-lo sob os termos da Licença Pública Geral GNU, conforme | ||
| 14 | + * publicada pela Free Software Foundation, tanto a versão 2 da | ||
| 15 | + * Licença como (a seu critério) qualquer versão mais nova. | ||
| 16 | + * | ||
| 17 | + * Este programa é distribuído na expectativa de ser útil, mas SEM | ||
| 18 | + * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- | ||
| 19 | + * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- | ||
| 20 | + * sulte a Licença Pública Geral GNU para obter mais detalhes. | ||
| 21 | + * | ||
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU | ||
| 23 | + * junto com este programa. Se não, escreva para a Free Software | ||
| 24 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 25 | + * 02111-1307, USA. | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | +require_once 'include/pmieducar/geral.inc.php'; | ||
| 34 | 30 | ||
| 35 | class clsPmieducarServidorAfastamento | 31 | class clsPmieducarServidorAfastamento |
| 36 | { | 32 | { |
| @@ -112,7 +108,7 @@ class clsPmieducarServidorAfastamento | @@ -112,7 +108,7 @@ class clsPmieducarServidorAfastamento | ||
| 112 | */ | 108 | */ |
| 113 | function clsPmieducarServidorAfastamento( $ref_cod_servidor = null, $sequencial = null, $ref_cod_motivo_afastamento = null, $ref_usuario_exc = null, $ref_usuario_cad = null, $data_cadastro = null, $data_exclusao = null, $data_retorno = null, $data_saida = null, $ativo = null, $ref_cod_instituicao = null ) | 109 | function clsPmieducarServidorAfastamento( $ref_cod_servidor = null, $sequencial = null, $ref_cod_motivo_afastamento = null, $ref_usuario_exc = null, $ref_usuario_cad = null, $data_cadastro = null, $data_exclusao = null, $data_retorno = null, $data_saida = null, $ativo = null, $ref_cod_instituicao = null ) |
| 114 | { | 110 | { |
| 115 | - $db = new clsBanco(); | 111 | + $db = new clsBanco(); |
| 116 | $this->_schema = "pmieducar."; | 112 | $this->_schema = "pmieducar."; |
| 117 | $this->_tabela = "{$this->_schema}servidor_afastamento"; | 113 | $this->_tabela = "{$this->_schema}servidor_afastamento"; |
| 118 | 114 | ||
| @@ -206,7 +202,7 @@ class clsPmieducarServidorAfastamento | @@ -206,7 +202,7 @@ class clsPmieducarServidorAfastamento | ||
| 206 | { | 202 | { |
| 207 | if( class_exists( "clsPmieducarServidor" ) ) | 203 | if( class_exists( "clsPmieducarServidor" ) ) |
| 208 | { | 204 | { |
| 209 | - $tmp_obj = new clsPmieducarServidor( $ref_cod_servidor, null, null, null, null, null, null, 1, $ref_cod_instituicao ); | 205 | + $tmp_obj = new clsPmieducarServidor( $ref_cod_servidor, null, null, null, null, null, 1, $ref_cod_instituicao ); |
| 210 | if( method_exists( $tmp_obj, "existe") ) | 206 | if( method_exists( $tmp_obj, "existe") ) |
| 211 | { | 207 | { |
| 212 | if( $tmp_obj->existe() ) | 208 | if( $tmp_obj->existe() ) |
| @@ -710,5 +706,4 @@ class clsPmieducarServidorAfastamento | @@ -710,5 +706,4 @@ class clsPmieducarServidorAfastamento | ||
| 710 | } | 706 | } |
| 711 | return false; | 707 | return false; |
| 712 | } | 708 | } |
| 713 | -} | ||
| 714 | -?> | ||
| 715 | \ No newline at end of file | 709 | \ No newline at end of file |
| 710 | +} | ||
| 716 | \ No newline at end of file | 711 | \ No newline at end of file |
ieducar/intranet/include/pmieducar/clsPmieducarServidorFuncao.inc.php
| @@ -291,11 +291,21 @@ class clsPmieducarServidorFuncao | @@ -291,11 +291,21 @@ class clsPmieducarServidorFuncao | ||
| 291 | */ | 291 | */ |
| 292 | function detalhe() | 292 | function detalhe() |
| 293 | { | 293 | { |
| 294 | - if( is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->ref_cod_funcao ) ) | 294 | + if( is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_cod_servidor ) ) #&& is_numeric( $this->ref_cod_funcao ) ) |
| 295 | { | 295 | { |
| 296 | + $sql = sprintf( | ||
| 297 | + "SELECT %s FROM %s WHERE ref_ref_cod_instituicao = '%d' AND ref_cod_servidor = '%d'", | ||
| 298 | + $this->_todos_campos, $this->_tabela, $this->ref_ref_cod_instituicao, | ||
| 299 | + $this->ref_cod_servidor | ||
| 300 | + ); | ||
| 301 | + | ||
| 302 | + if (is_numeric($this->ref_cod_funcao)) { | ||
| 303 | + $sql .= sprintf(" AND ref_cod_funcao = '%d'", $this->ref_cod_funcao); | ||
| 304 | + } | ||
| 296 | 305 | ||
| 297 | $db = new clsBanco(); | 306 | $db = new clsBanco(); |
| 298 | - $db->Consulta( "SELECT {$this->_todos_campos} FROM {$this->_tabela} WHERE ref_ref_cod_instituicao = '{$this->ref_ref_cod_instituicao}' AND ref_cod_servidor = '{$this->ref_cod_servidor}' AND ref_cod_funcao = '{$this->ref_cod_funcao}'" ); | 307 | + #$db->Consulta( "SELECT {$this->_todos_campos} FROM {$this->_tabela} WHERE ref_ref_cod_instituicao = '{$this->ref_ref_cod_instituicao}' AND ref_cod_servidor = '{$this->ref_cod_servidor}' AND ref_cod_funcao = '{$this->ref_cod_funcao}'" ); |
| 308 | + $db->Consulta($sql); | ||
| 299 | $db->ProximoRegistro(); | 309 | $db->ProximoRegistro(); |
| 300 | return $db->Tupla(); | 310 | return $db->Tupla(); |
| 301 | } | 311 | } |
ieducar/tests/functional/ServidorAfastarWebTest.class.php
0 → 100644
| @@ -0,0 +1,142 @@ | @@ -0,0 +1,142 @@ | ||
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * ServidorAfastarWebTest class. | ||
| 5 | + * | ||
| 6 | + * Esse teste precisa ser executado com o banco de dados distribuído na | ||
| 7 | + * versão 1.0.0. | ||
| 8 | + * | ||
| 9 | + * @author Eriksen Costa <eriksen.paixao_bs@cobra.com.br> | ||
| 10 | + * @since 1.0.1 | ||
| 11 | + * @version $Id$ | ||
| 12 | + */ | ||
| 13 | + | ||
| 14 | +require_once realpath(dirname(__FILE__) . '/../') . '/FunctionalBaseTest.class.php'; | ||
| 15 | + | ||
| 16 | +class ServidorAfastarWebTest extends FunctionalBaseTest { | ||
| 17 | + | ||
| 18 | + private | ||
| 19 | + $slPessoaNome = 'Selenese Test User', | ||
| 20 | + $slPessoaMatricula = 'selen_tuser', | ||
| 21 | + $slPessoaID = NULL; | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + protected function setUp() { | ||
| 26 | + parent::setUp(); | ||
| 27 | + | ||
| 28 | + $db = new clsBanco(); | ||
| 29 | + | ||
| 30 | + // Cria uma nova pessoa e guarda o ID gerado | ||
| 31 | + $db->Consulta(sprintf("INSERT INTO cadastro.pessoa (nome, data_cad,tipo,situacao,origem_gravacao, idsis_cad, operacao , idpes_cad) VALUES ('%s', NOW(), 'F', 'P', 'U', 17, 'I' , '1')", $this->slPessoaNome)); | ||
| 32 | + $this->slPessoaID = $id = $db->InsertId('cadastro.seq_pessoa'); | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + // Cria pessoa física | ||
| 36 | + $db->Consulta(sprintf("INSERT INTO cadastro.fisica (idpes, origem_gravacao, idsis_cad, data_cad, operacao, idpes_cad , sexo) VALUES ( '%d', 'M', 17, NOW(), 'I', '1' , 'M')", $id)); | ||
| 37 | + | ||
| 38 | + // Cria novo funcionário no sistema | ||
| 39 | + $db->Consulta( | ||
| 40 | + sprintf( | ||
| 41 | + "INSERT INTO portal.funcionario | ||
| 42 | + (ref_cod_pessoa_fj, matricula, senha, ativo, ramal, ref_cod_funcionario_vinculo, tempo_expira_senha, tempo_expira_conta, data_troca_senha, data_reativa_conta, ref_ref_cod_pessoa_fj, proibido, ref_cod_setor_new, matricula_permanente) | ||
| 43 | + VALUES | ||
| 44 | + ('%d', '%s', '25d55ad283aa400af464c76d713c07ad', '1', '', '4', '30', '365', NOW(), NOW(), '28', '0', '1', '1')", $id, $this->slPessoaMatricula) | ||
| 45 | + ); | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + // Cria um novo servidor, com a função de professor | ||
| 49 | + $sql = sprintf("INSERT INTO pmieducar.servidor (cod_servidor, ref_idesco, carga_horaria, data_cadastro, ativo, ref_cod_instituicao ) VALUES( '%d', '14', '40', NOW(), '1', '2' )", $id); | ||
| 50 | + $db->Consulta($sql); | ||
| 51 | + | ||
| 52 | + $sql = sprintf("INSERT INTO pmieducar.servidor_funcao (ref_ref_cod_instituicao, ref_cod_servidor, ref_cod_funcao ) VALUES( '2', '%d', '2')", $id); | ||
| 53 | + $db->Consulta($sql); | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + // Atribue disciplinas ao servidor e o curso em que ministra | ||
| 57 | + $sql = sprintf("INSERT INTO pmieducar.servidor_disciplina (ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('6', '2', '%d')", $id); | ||
| 58 | + $db->Consulta($sql); | ||
| 59 | + $sql = sprintf("INSERT INTO pmieducar.servidor_disciplina (ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('3', '2', '%d')", $id); | ||
| 60 | + $db->Consulta($sql); | ||
| 61 | + $sql = sprintf("INSERT INTO pmieducar.servidor_disciplina (ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('4', '2', '%d')", $id); | ||
| 62 | + $db->Consulta($sql); | ||
| 63 | + | ||
| 64 | + $sql = sprintf("INSERT INTO pmieducar.servidor_curso_ministra (ref_cod_curso, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('1', '2', '%d')", $id); | ||
| 65 | + $db->Consulta($sql); | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + // Aloca tempo de trabalho para o servidor | ||
| 69 | + $sql = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '1', '%d', '10:00', '1', NOW(), '1')", $id); | ||
| 70 | + $db->Consulta($sql); | ||
| 71 | + $sql = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '1', '%d', '06:00', '2', NOW(), '1')", $id); | ||
| 72 | + $db->Consulta($sql); | ||
| 73 | + $sql = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '2', '%d', '14:00', '1', NOW(), '1')", $id); | ||
| 74 | + $db->Consulta($sql); | ||
| 75 | + $sql = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '2', '%d', '05:00', '2', NOW(), '1')", $id); | ||
| 76 | + $db->Consulta($sql); | ||
| 77 | + | ||
| 78 | + // Aloca horas aula ao servidor | ||
| 79 | + $sql = sprintf("INSERT INTO pmieducar.quadro_horario_horarios ( ref_cod_quadro_horario, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, sequencial, ref_cod_instituicao_servidor, ref_servidor, hora_inicial, hora_final, data_cadastro, ativo, dia_semana ) VALUES( '2', '2', '1', '6', '3', '2', '%d', '09:00', '10:00', NOW(), '1', '3')", $id); | ||
| 80 | + $db->Consulta($sql); | ||
| 81 | + | ||
| 82 | + $sql = sprintf("INSERT INTO pmieducar.quadro_horario_horarios ( ref_cod_quadro_horario, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, sequencial, ref_cod_instituicao_servidor, ref_servidor, hora_inicial, hora_final, data_cadastro, ativo, dia_semana ) VALUES( '2', '2', '1', '3', '4', '2', '%d', '08:00', '09:00', NOW(), '1', '5' )", $id); | ||
| 83 | + $db->Consulta($sql); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + | ||
| 87 | + | ||
| 88 | + protected function tearDown() { | ||
| 89 | + $db = new clsBanco(); | ||
| 90 | + | ||
| 91 | + // ID da pessoa/servidor | ||
| 92 | + $id = $this->slPessoaID; | ||
| 93 | + | ||
| 94 | + // Array com instruções SQL para limpar os registros | ||
| 95 | + $sqls = array(); | ||
| 96 | + | ||
| 97 | + $sqls[] = sprintf("DELETE FROM pmieducar.quadro_horario_horarios WHERE ref_servidor = '%d'", $id); | ||
| 98 | + $sqls[] = sprintf("DELETE FROM pmieducar.servidor_alocacao WHERE ref_cod_servidor = '%d'", $id); | ||
| 99 | + $sqls[] = sprintf("DELETE FROM pmieducar.servidor_curso_ministra WHERE ref_cod_servidor = '%d'", $id); | ||
| 100 | + $sqls[] = sprintf("DELETE FROM pmieducar.servidor_disciplina WHERE ref_cod_servidor = '%d'", $id); | ||
| 101 | + $sqls[] = sprintf("DELETE FROM pmieducar.servidor_funcao WHERE ref_cod_servidor = '%d'", $id); | ||
| 102 | + $sqls[] = sprintf("DELETE FROM pmieducar.servidor_afastamento WHERE ref_cod_servidor = '%d'", $id); // Criado na interface, apenas para não ter problemas com alguma restrição referencial | ||
| 103 | + $sqls[] = sprintf("DELETE FROM pmieducar.servidor WHERE cod_servidor = '%d'", $id); | ||
| 104 | + $sqls[] = sprintf("DELETE FROM portal.menu_funcionario WHERE ref_ref_cod_pessoa_fj = '%d'", $id); // Não é criado mas apenas para não ser surpreendido por alguma restrição referencial | ||
| 105 | + $sqls[] = sprintf("DELETE FROM portal.funcionario WHERE ref_cod_pessoa_fj = '%d'", $id); | ||
| 106 | + $sqls[] = sprintf("DELETE FROM cadastro.fisica WHERE idpes = '%d'", $id); | ||
| 107 | + $sqls[] = sprintf("DELETE FROM cadastro.pessoa WHERE idpes = '%d'", $id); | ||
| 108 | + | ||
| 109 | + foreach ($sqls as $sql) { | ||
| 110 | + $db->Consulta($sql); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * Testa a ação afastar servidor. | ||
| 119 | + * | ||
| 120 | + * Verifica pelo nome de matrícula que aparece na página de detalhes logo após | ||
| 121 | + * a requisição enviada ao servidor. | ||
| 122 | + */ | ||
| 123 | + public function testServidorAfastar() { | ||
| 124 | + $this->doLogin(); | ||
| 125 | + | ||
| 126 | + $this->open('/intranet/educar_servidor_lst.php'); | ||
| 127 | + $this->clickAndWait('link=' . $this->slPessoaNome); | ||
| 128 | + $this->clickAndWait("//input[@value='Afastar Servidor']"); | ||
| 129 | + | ||
| 130 | + $this->select('ref_cod_motivo_afastamento', 'label=Capacitação'); | ||
| 131 | + | ||
| 132 | + // Cria data daqui a 10 dias | ||
| 133 | + $data = date('d/m/Y', (time() + (60 * 60 * 24 * 10))); | ||
| 134 | + $this->type('data_saida', $data); | ||
| 135 | + | ||
| 136 | + $this->clickAndWait('btn_enviar'); | ||
| 137 | + $this->assertTrue($this->isTextPresent($this->slPessoaMatricula)); | ||
| 138 | + | ||
| 139 | + $this->doLogout(); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | +} | ||
| 0 | \ No newline at end of file | 143 | \ No newline at end of file |
| @@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * ClsPmieducarServidorTest class. | ||
| 5 | + * | ||
| 6 | + * @author Eriksen Costa <eriksen.paixao_bs@cobra.com.br> | ||
| 7 | + * @version $Id$ | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +require_once realpath(dirname(__FILE__) . '/../') . '/UnitBaseTest.class.php'; | ||
| 11 | +require_once 'include/pmieducar/clsPmieducarServidor.inc.php'; | ||
| 12 | + | ||
| 13 | +class ClsPmieducarServidorTest extends UnitBaseTest { | ||
| 14 | + | ||
| 15 | + private | ||
| 16 | + $codServidor = NULL, | ||
| 17 | + $codInstituicao = NULL; | ||
| 18 | + | ||
| 19 | + protected function setUp() { | ||
| 20 | + $db = new clsBanco(); | ||
| 21 | + $sql = 'SELECT cod_servidor, ref_cod_instituicao FROM pmieducar.servidor WHERE ativo = 1 LIMIT 1'; | ||
| 22 | + | ||
| 23 | + $db->Consulta($sql); | ||
| 24 | + $db->ProximoRegistro(); | ||
| 25 | + list($this->codServidor, $this->codInstituicao) = $db->Tupla(); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public function testPmieducarServidorExists() { | ||
| 29 | + $codServidor = $this->codServidor; | ||
| 30 | + $codInstituicao = $this->codInstituicao; | ||
| 31 | + | ||
| 32 | + $servidor = new clsPmieducarServidor( | ||
| 33 | + $codServidor, NULL, NULL, NULL, NULL, NULL, 1, $codInstituicao); | ||
| 34 | + | ||
| 35 | + $this->assertTrue((boolean) $servidor->existe()); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | +} | ||
| 0 | \ No newline at end of file | 39 | \ No newline at end of file |