function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; $_SESSION['campo1'] = $_GET['campo1'] ? $_GET['campo1'] : $_SESSION['campo1']; $_SESSION['campo2'] = $_GET['campo2'] ? $_GET['campo2'] : $_SESSION['campo2']; $_SESSION['dia_semana'] = isset($_GET['dia_semana']) ? $_GET['dia_semana'] : $_SESSION['dia_semana']; $_SESSION['hora_inicial'] = $_GET['hora_inicial'] ? $_GET['hora_inicial'] : $_SESSION['hora_inicial']; $_SESSION['hora_final'] = $_GET['hora_final'] ? $_GET['hora_final'] : $_SESSION['hora_final']; $_SESSION['professor'] = $_GET['professor'] ? $_GET['professor'] : $_SESSION['professor']; $_SESSION['horario'] = $_GET['horario'] ? $_GET['horario'] : $_SESSION['horario']; $_SESSION['ref_cod_escola'] = $_GET['ref_cod_escola'] ? $_GET['ref_cod_escola'] : $_SESSION['ref_cod_escola']; $_SESSION['min_mat'] = $_GET['min_mat'] ? $_GET['min_mat'] : $_SESSION['min_mat']; $_SESSION['min_ves'] = $_GET['min_ves'] ? $_GET['min_ves'] : $_SESSION['min_ves']; $_SESSION['min_not'] = $_GET['min_not'] ? $_GET['min_not'] : $_SESSION['min_not']; $_SESSION['ref_cod_disciplina'] = $_GET['ref_cod_disciplina'] ? $_GET['ref_cod_disciplina'] : $_SESSION['ref_cod_disciplina']; $_SESSION['ref_cod_curso'] = $_GET['ref_cod_curso'] ? $_GET['ref_cod_curso'] : $_SESSION['ref_cod_curso']; /** * Controle para cálculo de horas */ $_SESSION['identificador'] = $_GET['identificador'] ? $_GET['identificador'] : $_SESSION['identificador']; if (isset($_GET['lst_matriculas'])) { $_SESSION['lst_matriculas'] = $_GET['lst_matriculas'] ? $_GET['lst_matriculas'] : $_SESSION['lst_matriculas']; } if (!isset($_GET['tipo'])) { $_SESSION['setAllField1'] = $_SESSION['setAllField2'] = $_SESSION['tipo'] = ''; } $this->ref_cod_instituicao = $_SESSION['ref_cod_instituicao'] = $_GET['ref_cod_instituicao'] ? $_GET['ref_cod_instituicao'] : $_SESSION['ref_cod_instituicao']; $this->ref_cod_servidor = $_SESSION['ref_cod_servidor'] = $_GET['ref_cod_servidor'] ? $_GET['ref_cod_servidor'] : $_SESSION['ref_cod_servidor']; $this->professor = $_SESSION['professor'] = $_GET['professor'] ? $_GET['professor'] : $_SESSION['professor']; $this->horario = $_SESSION['horario'] = $_GET['horario'] ? $_GET['horario'] : $_SESSION['horario']; $this->ref_cod_escola = $_GET['ref_cod_escola'] ? $_GET['ref_cod_escola'] : $_SESSION['ref_cod_escola']; $this->min_mat = $_SESSION['min_mat'] = $_GET['min_mat'] ? $_GET['min_mat'] : $_SESSION['min_mat']; $this->min_ves = $_SESSION['min_ves'] = $_GET['min_ves'] ? $_GET['min_ves'] : $_SESSION['min_ves']; $this->min_not = $_SESSION['min_not'] = $_GET['min_not'] ? $_GET['min_not'] : $_SESSION['min_not']; $this->ref_cod_disciplina = $_SESSION['ref_cod_disciplina'] = $_GET['ref_cod_disciplina'] ? $_GET['ref_cod_disciplina'] : $_SESSION['ref_cod_disciplina']; $this->ref_cod_curso = $_SESSION['ref_cod_curso'] = $_GET['ref_cod_curso'] ? $_GET['ref_cod_curso'] : $_SESSION['ref_cod_curso']; $this->identificador = $_SESSION['identificador'] = $_GET['identificador'] ? $_GET['identificador'] : $_SESSION['identificador']; if (isset($_GET['lst_matriculas']) && isset($_SESSION['lst_matriculas'])) { $this->lst_matriculas = $_GET['lst_matriculas'] ? $_GET['lst_matriculas'] : $_SESSION['lst_matriculas']; } $_SESSION['tipo'] = $_GET['tipo'] ? $_GET['tipo'] : $_SESSION['tipo']; session_write_close(); $this->titulo = 'Servidores Públicos - Listagem'; // Passa todos os valores obtidos no GET para atributos do objeto foreach ($_GET as $var => $val) { $this->{$var} = $val === '' ? NULL : $val; } if (isset($this->lst_matriculas)) { $this->lst_matriculas = urldecode($this->lst_matriculas); } $string1 = $this->min_mat - floor($this->min_mat / 60) * 60; $string1 = str_repeat(0, 2 - strlen($string1)) . $string1; $string2 = floor($this->min_mat / 60); $string2 = str_repeat(0, 2 - strlen($string2)) . $string2; $hr_mat = $string2 . ':' . $string1; $string1 = $this->min_ves - floor($this->min_ves / 60) * 60; $string1 = str_repeat(0, 2 - strlen($string1)) . $string1; $string2 = floor($this->min_ves / 60); $string2 = str_repeat(0, 2 - strlen($string2)) . $string2; $hr_ves = $string2 . ':' . $string1; $string1 = $this->min_not - floor($this->min_not / 60) * 60; $string1 = str_repeat(0, 2 - strlen($string1)) . $string1; $string2 = floor($this->min_not / 60); $string2 = str_repeat(0, 2 - strlen($string2)) . $string2; $hr_not = $string2 . ':' . $string1; $hora_inicial_ = explode(':', $_SESSION['hora_inicial']); $hora_final_ = explode(':', $_SESSION['hora_final']); $horas_ini = sprintf('%02d', (int) abs($hora_final_[0]) - abs($hora_inicial_[0])); $minutos_ini = sprintf('%02d', (int) abs($hora_final_[1]) - abs($hora_inicial_[1])); $h_m_ini = $hora_inicial_[0] * 60 + $hora_inicial_[1]; $h_m_fim = $hora_final_[0] * 60 + $hora_final_[1]; if ($h_m_ini >= 480 && $h_m_ini <= 720) { $this->matutino = TRUE; if ($h_m_fim >= 721 && $h_m_fim <= 1080) { $this->vespertino = TRUE; } elseif ($h_m_fim >= 1801 && $h_m_fim <= 1439 || $h_m_fim == 0) { $this->noturno = TRUE; } } elseif ($h_m_ini >= 721 && $h_m_ini <= 1080) { $this->vespertino = TRUE; if ($h_m_fim >= 1081 && $h_m_fim <= 1439) { $this->noturno = TRUE; } } elseif ($h_m_ini >= 1081 && $h_m_ini <= 1439 || $h_m_ini == 0) { $this->noturno = TRUE; } $this->addCabecalhos(array('Nome do Servidor', 'Matrícula', 'Instituição')); $this->campoTexto('nome_servidor', 'Nome Servidor', $this->nome_servidor, 30, 255, FALSE); $this->campoOculto('tipo', $_GET['tipo']); // Paginador $this->limite = 20; $this->offset = $_GET['pagina_{$this->nome}'] ? $_GET['pagina_{$this->nome}'] * $this->limite - $this->limite : 0; $obj_servidor = new clsPmieducarServidor(); $obj_servidor->setOrderby('carga_horaria ASC'); $obj_servidor->setLimite($this->limite, $this->offset); if ($_SESSION['dia_semana'] && $_SESSION['hora_inicial'] && $_SESSION['hora_final']) { $array_hora = array($_SESSION['dia_semana'], $_SESSION['hora_inicial'], $_SESSION['hora_final']); } // Marca a disciplina como NULL se não for informada, restringindo a busca // aos professores e não selecionar aqueles em que o curso não seja // globalizado e sem disciplinas cadastradas $this->ref_cod_disciplina = $this->ref_cod_disciplina ? $this->ref_cod_disciplina : NULL; // Passa NULL para $alocacao_escola_instituicao senão o seu filtro anula // um anterior (referente a selecionar somente servidores não alocados), // selecionando apenas servidores alocados na instituição $lista = $obj_servidor->lista(NULL, $this->ref_cod_deficiencia, $this->ref_idesco, $this->carga_horaria, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao, $_SESSION['tipo'], $array_hora, $this->ref_cod_servidor, $this->nome_servidor, $this->professor, $this->horario, FALSE, $this->lst_matriculas, $this->matutino, $this->vespertino, $this->noturno, $this->ref_cod_escola, $hr_mat, $hr_ves, $hr_not, $_SESSION['dia_semana'], $this->ref_cod_escola, $this->identificador, $this->ref_cod_curso, $this->ref_cod_disciplina); // Se for uma listagem de professores, recupera as disciplinas dadas para // comparação com a de outros professores (somente quando a busca é para // substituição de servidores) $disciplinas = array(); if ('true' == $this->professor) { $disciplinas = $obj_servidor->getServidorDisciplinasQuadroHorarioHorarios($this->ref_cod_servidor, $this->ref_cod_instituicao); } $total = $obj_servidor->_total; // pega detalhes de foreign_keys if (class_exists('clsPmieducarInstituicao')) { $obj_ref_cod_instituicao = new clsPmieducarInstituicao($lista[0]["ref_cod_instituicao"]); $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); $nm_instituicao = $det_ref_cod_instituicao["nm_instituicao"]; } // monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { if (class_exists('clsFuncionario')) { $obj_cod_servidor = new clsFuncionario($registro['cod_servidor']); $det_cod_servidor = $obj_cod_servidor->detalhe(); $registro['matricula'] = $det_cod_servidor['matricula']; // Se servidor for professor, verifica se possui as mesmas // disciplinas do servidor a ser substituido (este passo somente é // executado ao buscar um servidor substituto) if ($this->professor == 'true') { $disciplinasSubstituto = clsPmieducarServidor::getServidorDisciplinas($registro['cod_servidor'], $this->ref_cod_instituicao); // Se os arrays diferirem, passa para o próximo resultado if ($disciplinasSubstituto != $disciplinas) { continue; } } } else { $registro["cod_servidor"] = "Erro na geracao"; echo "<!--\nErro\nClasse nao existente: clsFuncionario\n-->"; } if ($_SESSION['tipo']) { if (is_string($_SESSION['campo1']) && is_string($_SESSION['campo2'])) { if (is_string($_SESSION['horario'])) { $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['nome']}','{$registro['cod_servidor']}'); addVal1('{$_SESSION['campo2']}','{$registro['cod_servidor']}','{$registro['nome']}'); {$setAll} fecha();\""; } else { $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_servidor']}', null); addVal1('{$_SESSION['campo2']}','{$registro['nome']}', null); {$setAll} fecha();\""; } } elseif (is_string($_SESSION['campo1'])) { $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_servidor']}','{$registro['nome']}'); {$setAll} fecha();\""; } } else { if (is_string($_SESSION['campo1']) && is_string($_SESSION['campo2'])) { $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_servidor']}','{$registro['nome']}'); addVal1('{$_SESSION['campo2']}','{$registro['nome']}','{$registro['cod_servidor']}'); {$setAll} fecha();\""; } elseif (is_string($_SESSION['campo2'])) { $script = " onclick=\"addVal1('{$_SESSION['campo2']}','{$registro['cod_servidor']}','{$registro['nome']}'); {$setAll} fecha();\""; } elseif (is_string($_SESSION['campo1'])) { $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_servidor']}','{$registro['nome']}'); {$setAll} fecha();\""; } } $this->addLinhas(array("<a href=\"javascript:void(0);\" {$script}>{$registro["nome"]}</a>", "<a href=\"javascript:void(0);\" {$script}>{$registro["matricula"]}</a>", "<a href=\"javascript:void(0);\" {$script}>{$nm_instituicao}</a>")); } } $this->addPaginador2('educar_pesquisa_servidor_lst.php', $total, $_GET, $this->nome, $this->limite); $obj_permissoes = new clsPermissoes(); $this->largura = '100%'; }
/** * Construtor. */ function clsPmieducarServidorDisciplina($ref_cod_disciplina = NULL, $ref_ref_cod_instituicao = NULL, $ref_cod_servidor = NULL, $ref_cod_curso = NULL) { $db = new clsBanco(); $this->_schema = 'pmieducar.'; $this->_tabela = $this->_schema . 'servidor_disciplina'; $this->_campos_lista = $this->_todos_campos = 'ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor, ref_cod_curso'; if (is_numeric($ref_cod_servidor) && is_numeric($ref_ref_cod_instituicao)) { $servidor = new clsPmieducarServidor($ref_cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, $ref_ref_cod_instituicao); if ($servidor->existe()) { $this->ref_cod_servidor = $ref_cod_servidor; $this->ref_ref_cod_instituicao = $ref_ref_cod_instituicao; } } if (is_numeric($ref_cod_disciplina)) { $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); try { $componenteMapper->find($ref_cod_disciplina); $this->ref_cod_disciplina = $ref_cod_disciplina; } catch (Exception $e) { } } if (is_numeric($ref_cod_curso)) { $curso = new clsPmieducarCurso($ref_cod_curso); if ($curso->existe()) { $this->ref_cod_curso = $ref_cod_curso; } } }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = 'Servidor - Listagem'; // passa todos os valores obtidos no GET para atributos do objeto foreach ($_GET as $var => $val) { $this->{$var} = $val === '' ? NULL : $val; } $this->addCabecalhos(array('Nome do Servidor', 'Matrícula', 'Instituição')); $get_escola = TRUE; $obrigatorio = TRUE; $exibe_nm_escola = TRUE; include 'include/pmieducar/educar_campo_lista.php'; $opcoes = array('' => 'Pesquise o funcionario clicando na lupa ao lado'); if ($this->cod_servidor) { $objTemp = new clsFuncionario($this->cod_servidor); $detalhe = $objTemp->detalhe(); $detalhe = $detalhe['idpes']->detalhe(); $opcoes[$detalhe['idpes']] = $detalhe['nome']; } $parametros = new clsParametrosPesquisas(); $parametros->setSubmit(0); $parametros->adicionaCampoSelect('cod_servidor', 'ref_cod_pessoa_fj', 'nome'); $this->campoListaPesq('cod_servidor', 'Servidor', $opcoes, $this->cod_servidor, 'pesquisa_funcionario_lst.php', '', FALSE, '', '', NULL, NULL, '', FALSE, $parametros->serializaCampos() . '&com_matricula=false', TRUE); // Paginador $this->limite = 20; $this->offset = $_GET['pagina_' . $this->nome] ? $_GET['pagina_' . $this->nome] * $this->limite - $this->limite : 0; $obj_servidor = new clsPmieducarServidor(); $obj_servidor->setOrderby('carga_horaria ASC'); $obj_servidor->setLimite($this->limite, $this->offset); $lista = $obj_servidor->lista($this->cod_servidor, $this->ref_cod_deficiencia, $this->ref_idesco, $this->carga_horaria, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao, NULL, NULL, NULL, NULL, NULL, NULL, TRUE, NULL, NULL, NULL, NULL, !isset($_GET['busca']) ? $this->ref_cod_escola : NULL, NULL, NULL, NULL, NULL, !isset($_GET['busca']) ? 1 : NULL); $total = $obj_servidor->_total; // UrlHelper $url = CoreExt_View_Helper_UrlHelper::getInstance(); // Monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { // Pega detalhes de foreign_keys if (class_exists('clsPmieducarInstituicao')) { $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']); $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); $registro['ref_cod_instituicao'] = $det_ref_cod_instituicao['nm_instituicao']; } else { $registro['ref_cod_instituicao'] = 'Erro na geração'; } if (class_exists('clsFuncionario')) { $obj_cod_servidor = new clsFuncionario($registro['cod_servidor']); $det_cod_servidor = $obj_cod_servidor->detalhe(); $registro['matricula'] = $det_cod_servidor['matricula']; $det_cod_servidor = $det_cod_servidor['idpes']->detalhe(); $registro['nome'] = $det_cod_servidor['nome']; } else { $registro['cod_servidor'] = 'Erro na geracao'; } $path = 'educar_servidor_det.php'; $options = array('query' => array('cod_servidor' => $registro['cod_servidor'], 'ref_cod_instituicao' => $det_ref_cod_instituicao['cod_instituicao'])); $this->addLinhas(array($url->l($registro['nome'], $path, $options), $url->l($registro['matricula'], $path, $options), $url->l($registro['ref_cod_instituicao'], $path, $options))); } } $this->addPaginador2('educar_servidor_lst.php', $total, $_GET, $this->nome, $this->limite); $obj_permissoes = new clsPermissoes(); if ($obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7)) { $this->acao = 'go("educar_servidor_cad.php")'; $this->nome_acao = 'Novo'; } $this->largura = '100%'; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "educar_index.php" => "i-Educar - Escola", "" => "Listagem de servidores")); $this->enviaLocalizacao($localizacao->montar()); }
/** * Implementação do método clsCadastro::Gerar() * @see ieducar/intranet/include/clsCadastro#Gerar() */ public function Gerar() { $this->campoOculto('ref_cod_servidor', $this->ref_cod_servidor); $this->campoOculto('sequencial', $this->sequencial); $this->campoOculto('ref_cod_instituicao', $this->ref_cod_instituicao); $opcoes = array('' => 'Selecione'); $objTemp = new clsPmieducarMotivoAfastamento(); $lista = $objTemp->lista(); if (is_array($lista) && count($lista) > 0) { foreach ($lista as $registro) { $opcoes[$registro['cod_motivo_afastamento']] = $registro['nm_motivo']; } } else { $opcoes = array('' => 'Nenhum motivo de afastamento cadastrado'); } if ($this->status == 'N') { $this->campoLista('ref_cod_motivo_afastamento', 'Motivo Afastamento', $opcoes, $this->ref_cod_motivo_afastamento); } elseif ($this->status == 'E') { $this->campoLista('ref_cod_motivo_afastamento', 'Motivo Afastamento', $opcoes, $this->ref_cod_motivo_afastamento, '', FALSE, '', '', TRUE); } // Datas para registro // Se novo registro if ($this->status == 'N') { $this->campoData('data_saida', 'Data de Afastamento', $this->data_saida, TRUE); } elseif ($this->status == 'E') { $this->campoRotulo('data_saida', 'Data de Afastamento', $this->data_saida); } // Se edição, mostra campo para entrar com data de retorno if ($this->status == 'E') { $this->campoData('data_retorno', 'Data de Retorno', $this->data_retorno, FALSE); } $obj_servidor = new clsPmieducarServidor($this->ref_cod_servidor, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); $det_servidor = $obj_servidor->detalhe(); if ($det_servidor) { $obj_funcao = new clsPmieducarFuncao($det_servidor['ref_cod_funcao'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); // Se for professor if (TRUE == $obj_servidor->isProfessor()) { $obj = new clsPmieducarQuadroHorarioHorarios(); // Pega a lista de aulas alocadas para este servidor $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); if ($lista) { // Passa todos os valores obtidos no registro para atributos do objeto foreach ($lista as $campo => $val) { $temp = array(); $temp['hora_inicial'] = $val['hora_inicial']; $temp['hora_final'] = $val['hora_final']; $temp['dia_semana'] = $val['dia_semana']; $temp['ref_cod_escola'] = $val['ref_cod_escola']; $temp['ref_cod_disciplina'] = $val['ref_cod_disciplina']; $temp['ref_cod_substituto'] = $val['ref_servidor_substituto']; $this->alocacao_array[] = $temp; } if ($this->alocacao_array) { $tamanho = sizeof($alocacao); $script = "<script>\nvar num_alocacao = {$tamanho};\n"; $script .= "var array_servidores = Array();\n"; foreach ($this->alocacao_array as $key => $alocacao) { $script .= "array_servidores[{$key}] = new Array();\n"; $hora_ini = explode(":", $alocacao['hora_inicial']); $hora_fim = explode(":", $alocacao['hora_final']); $horas_utilizadas = $hora_fim[0] - $hora_ini[0]; $minutos_utilizados = $hora_fim[1] - $hora_ini[1]; $horas = sprintf('%02d', (int) $horas_utilizadas); $minutos = sprintf('%02d', (int) $minutos_utilizados); $str_horas_utilizadas = "{$horas}:{$minutos}"; $script .= "array_servidores[{$key}][0] = '{$str_horas_utilizadas}';\n"; $script .= "array_servidores[{$key}][1] = '';\n\n"; $obj_escola = new clsPmieducarEscola($alocacao['ref_cod_escola']); $det_escola = $obj_escola->detalhe(); $det_escola = $det_escola['nome']; $nm_dia_semana = $this->dias_da_semana[$alocacao['dia_semana']]; $obj_subst = new clsPessoa_($alocacao['ref_cod_substituto']); $det_subst = $obj_subst->detalhe(); if ($this->status == 'N') { $this->campoTextoInv("dia_semana_{$key}_", '', $nm_dia_semana, 8, 8, FALSE, FALSE, TRUE, '', '', '', '', 'dia_semana'); $this->campoTextoInv("hora_inicial_{$key}_", '', $alocacao['hora_inicial'], 5, 5, FALSE, FALSE, TRUE, '', '', '', '', 'ds_hora_inicial_'); $this->campoTextoInv("hora_final_{$key}_", '', $alocacao['hora_final'], 5, 5, FALSE, FALSE, TRUE, '', '', '', '', 'ds_hora_final_'); $this->campoTextoInv("ref_cod_escola_{$key}", '', $det_escola, 30, 255, FALSE, FALSE, TRUE, '', '', '', '', 'ref_cod_escola_'); $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&ref_cod_disciplina={$alocacao['ref_cod_disciplina']}', 'nome')\" src=\"imagens/lupa.png\" ></span>", '', '', 'ref_cod_servidor_substituto'); } $this->campoOculto("dia_semana_{$key}", $alocacao['dia_semana']); $this->campoOculto("hora_inicial_{$key}", $alocacao['hora_inicial']); $this->campoOculto("hora_final_{$key}", $alocacao['hora_final']); $this->campoOculto("ref_cod_escola_{$key}", $alocacao['ref_cod_escola']); $this->campoOculto("ref_cod_servidor_substituto[{$key}]", $alocacao['ref_cod_substituto']); } $script .= "\n</script>"; // Print do Javascript print $script; } } } } }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->ref_cod_servidor = $_GET['ref_cod_servidor']; $this->ref_cod_instituicao = $_GET['ref_cod_instituicao']; $this->titulo = 'Servidor Formacao - Listagem'; // passa todos os valores obtidos no GET para atributos do objeto foreach ($_GET as $var => $val) { $this->{$var} = $val === '' ? NULL : $val; } $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); $this->addCabecalhos(array('Nome Formação', 'Tipo')); $this->campoOculto('ref_cod_servidor', $this->ref_cod_servidor); $this->campoOculto('ref_cod_instituicao', $this->ref_cod_instituicao); // Filtros $this->campoTexto('nm_formacao', 'Nome da Formação', $this->nm_formacao, 30, 255, FALSE); $opcoes = array('' => 'Selecione', 'C' => 'Cursos', 'T' => 'Títulos', 'O' => 'Concursos'); $this->campoLista('tipo', 'Tipo de Formação', $opcoes, $this->tipo); // Paginador $this->limite = 20; $this->offset = $_GET['pagina_' . $this->nome] ? $_GET['pagina_' . $this->nome] * $this->limite - $this->limite : 0; $obj_servidor_formacao = new clsPmieducarServidorFormacao(); $obj_servidor_formacao->setOrderby('nm_formacao ASC'); $obj_servidor_formacao->setLimite($this->limite, $this->offset); if (!isset($this->tipo)) { $this->tipo = NULL; } $lista = $obj_servidor_formacao->lista(NULL, NULL, NULL, $this->ref_cod_servidor, $this->nm_formacao, $this->tipo, NULL, NULL, NULL, 1); $total = $obj_servidor_formacao->_total; // UrlHelper $url = CoreExt_View_Helper_UrlHelper::getInstance(); $path = 'educar_servidor_formacao_det.php'; // Monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { // Pega detalhes de foreign_keys if (class_exists('clsPmieducarUsuario')) { $obj_ref_usuario_exc = new clsPmieducarUsuario($registro['ref_usuario_exc']); $det_ref_usuario_exc = $obj_ref_usuario_exc->detalhe(); $registro['ref_usuario_exc'] = $det_ref_usuario_exc['data_cadastro']; } else { $registro['ref_usuario_exc'] = 'Erro na geracao'; } if (class_exists('clsPmieducarServidor')) { $obj_ref_cod_servidor = new clsPmieducarServidor($registro['ref_cod_servidor']); $det_ref_cod_servidor = $obj_ref_cod_servidor->detalhe(); $registro['ref_cod_servidor'] = $det_ref_cod_servidor['cod_servidor']; } else { $registro['ref_cod_servidor'] = 'Erro na geracao'; } if ($registro['tipo'] == 'C') { $registro['tipo'] = 'Curso'; } elseif ($registro['tipo'] == 'T') { $registro['tipo'] = 'Título'; } else { $registro['tipo'] = 'Concurso'; } $options = array('query' => array('cod_formacao' => $registro['cod_formacao'])); $this->addLinhas(array($url->l($registro['nm_formacao'], $path, $options), $url->l($registro['tipo'], $path, $options))); $this->tipo = ''; } } $this->addPaginador2('educar_servidor_formacao_lst.php', $total, $_GET, $this->nome, $this->limite); $obj_permissoes = new clsPermissoes(); if ($obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7)) { $this->array_botao[] = 'Novo'; $this->array_botao_url[] = sprintf('educar_servidor_formacao_cad.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao); } $this->array_botao[] = 'Voltar'; $this->array_botao_url[] = sprintf('educar_servidor_det.php?cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao); $this->largura = '100%'; }
function renderHTML() { if ($_POST) { foreach ($_POST as $key => $value) { $this->{$key} = $value; } } if ($this->ref_ref_cod_serie) { $this->ref_cod_serie = $this->ref_ref_cod_serie; } if ($this->ref_cod_escola) { $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); $det_escola = $obj_escola->detalhe(); $this->nm_escola = $det_escola['nome']; } $obj_instituicao = new clsPmieducarInstituicao($this->ref_cod_instituicao); $det_instituicao = $obj_instituicao->detalhe(); $this->nm_instituicao = $det_instituicao['nm_instituicao']; $fonte = 'arial'; $corTexto = '#000000'; $obj_curso = new clsPmieducarCurso(); $obj_curso->setOrderby('nm_curso'); $lst_curso = $obj_curso->lista($this->ref_cod_curso, 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); if ($lst_curso) { foreach ($lst_curso as $curso) { $obj_serie = new clsPmieducarSerie(); $obj_serie->setOrderby('nm_serie'); $lst_serie = $obj_serie->lista($this->ref_cod_serie, NULL, NULL, $curso['cod_curso'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao, NULL, NULL, NULL, $this->ref_cod_escola); $quadro_horario = 0; if ($lst_serie) { foreach ($lst_serie as $serie) { $obj_turma = new clsPmieducarTurma(); $obj_turma->setOrderby('nm_turma'); $lst_turma = $obj_turma->lista($this->ref_cod_turma, NULL, NULL, $serie['cod_serie'], $this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $curso['cod_curso'], $this->ref_cod_instituicao); if ($lst_turma) { foreach ($lst_turma as $turma) { $obj_quadro = new clsPmieducarQuadroHorario(NULL, NULL, NULL, $turma['cod_turma'], NULL, NULL, 1); $det_quadro = $obj_quadro->detalhe(); if ($det_quadro) { if (!$this->pdf) { $this->pdf = new clsPDF('Quadro Horarios', 'Quadro Horarios', 'A4', '', FALSE, FALSE); } if ($quadro_horario % 3 == 0) { $this->page_y = 15; $this->pdf->OpenPage(); $this->addCabecalho(); $quadro_horario = 0; } $this->pdf->escreve_relativo($turma['nm_turma'] . ' - ' . $serie['nm_serie'], 20, $this->page_y - 7, 550, 20, $fonte, 11, $corTexto, 'center'); $this->page_y += 10; $this->pdf->quadrado_relativo(35, $this->page_y, 525, 20, 0.3, '#777777', '#777777'); $inicio_x = 35; for ($dia_semana = 1; $dia_semana <= 7; $dia_semana++) { $this->pdf->linha_relativa($inicio_x, $this->page_y, 0, 20); $this->pdf->escreve_relativo($this->array_dias_semana[$dia_semana], $inicio_x, $this->page_y + 3, 75, 20, $fonte, 11, $corTexto, 'center'); $inicio_x += 75; } $this->page_y += 20; $inicio_y = $this->page_y; $inicio_x = 35; $this->pdf->quadrado_relativo($inicio_x, $this->page_y, 525, 200, 0.3); for ($dia_semana = 1; $dia_semana <= 7; $dia_semana++) { $obj_horarios = new clsPmieducarQuadroHorarioHorarios(); $resultado = $obj_horarios->retornaHorario($this->ref_cod_instituicao, $this->ref_cod_escola, $serie['cod_serie'], $turma['cod_turma'], $dia_semana); if (is_array($resultado)) { foreach ($resultado as $registro) { $this->pdf->quadrado_relativo($inicio_x, $this->page_y, 75, 50, 0.3); $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); $componente = $componenteMapper->find($registro['ref_cod_disciplina']); $obj_servidor = new clsPmieducarServidor(); $det_servidor = array_shift($obj_servidor->lista($registro['ref_servidor'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)); $det_servidor['nome'] = array_shift(explode(' ', $det_servidor['nome'])); $texto = sprintf("%s - %s\n%s\n%s", substr($registro['hora_inicial'], 0, 5), substr($registro["hora_final"], 0, 5), $componente->abreviatura, $det_servidor['nome']); $this->pdf->escreve_relativo($texto, $inicio_x, $this->page_y + 12, 75, 50, $fonte, 10, $corTexto, 'center'); $this->page_y += 50; } } $inicio_x += 75; $this->page_y = $inicio_y; } $this->page_y += 220; } $quadro_horario++; } } } } } } if ($this->pdf) { $this->pdf->CloseFile(); $this->get_link = $this->pdf->GetLink(); } else { echo ' <script> alert("A(s) turma(s) não possui(em) quadro de horário(s)."); window.parent.fechaExpansivel("div_dinamico_" + (window.parent.DOM_divs.length-1)); </script>'; return; } echo sprintf(' <script> window.onload=function() { parent.EscondeDiv("LoadImprimir"); window.location="download.php?filename=%s" } </script>', $this->get_link); echo sprintf(' <html> <center>Se o download não iniciar automaticamente <br /> <a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br /><br /> <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br /> Clique na Imagem para Baixar o instalador<br /><br /> <a href="http://www.adobe.com.br/products/acrobat/readstep2.html" target="new"><br><img src="imagens/acrobat.gif" width="88" height="31" border="0"></a> </span> </center>', $this->get_link); }
function Inicializar() { $retorno = 'Novo'; @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $this->cod_servidor = $_GET['ref_cod_servidor']; $this->ref_cod_instituicao = $_GET['ref_cod_instituicao']; $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, 'educar_servidor_lst.php'); if (is_numeric($this->cod_servidor) && is_numeric($this->ref_cod_instituicao)) { $obj = new clsPmieducarServidor($this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao); $registro = $obj->detalhe(); if ($registro) { $retorno = 'Editar'; } } @session_start(); $this->cursos_disciplina = $_SESSION['cursos_disciplina']; @session_write_close(); if (!$this->cursos_disciplina) { $obj_servidor_disciplina = new clsPmieducarServidorDisciplina(); $lst_servidor_disciplina = $obj_servidor_disciplina->lista(NULL, $this->ref_cod_instituicao, $this->cod_servidor); if ($lst_servidor_disciplina) { foreach ($lst_servidor_disciplina as $disciplina) { $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); $componente = $componenteMapper->find($disciplina['ref_cod_disciplina']); $this->cursos_disciplina[$disciplina['ref_cod_curso']][$disciplina['ref_cod_disciplina']] = $disciplina['ref_cod_disciplina']; } } } if ($this->cursos_disciplina) { foreach ($this->cursos_disciplina as $curso => $disciplinas) { if ($disciplinas) { foreach ($disciplinas as $disciplina) { $this->ref_cod_curso[] = $curso; $this->ref_cod_disciplina[] = $disciplina; } } } } return $retorno; }
function renderHTML() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $obj_permissoes = new clsPermissoes(); if ($obj_permissoes->nivel_acesso($this->pessoa_logada) > 7) { $retorno .= ' <table width="100%" height="40%" cellspacing="1" cellpadding="2" border="0" class="tablelistagem"> <tbody> <tr> <td colspan="2" valig="center" height="50"> <center class="formdktd">Usuário sem permissão para acessar esta página</center> </td> </tr> </tbody> </table>'; return $retorno; } $retorno .= ' <table width="100%" cellspacing="1" cellpadding="2" border="0" class="tablelistagem"> <tbody>'; if ($_POST) { $this->ref_cod_turma = $_POST['ref_cod_turma'] ? $_POST['ref_cod_turma'] : NULL; $this->ref_cod_serie = $_POST['ref_cod_serie'] ? $_POST['ref_cod_serie'] : NULL; $this->ref_cod_curso = $_POST['ref_cod_curso'] ? $_POST['ref_cod_curso'] : NULL; $this->ref_cod_escola = $_POST['ref_cod_escola'] ? $_POST['ref_cod_escola'] : NULL; $this->ref_cod_instituicao = $_POST['ref_cod_instituicao'] ? $_POST['ref_cod_instituicao'] : NULL; $this->busca = $_GET['busca'] ? $_GET['busca'] : NULL; } else { if ($_GET) { // Passa todos os valores obtidos no GET para atributos do objeto foreach ($_GET as $var => $val) { $this->{$var} = $val === '' ? NULL : $val; } } } $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); if (!$this->ref_cod_escola) { $this->ref_cod_escola = $obj_permissoes->getEscola($this->pessoa_logada); } if (!is_numeric($this->ref_cod_instituicao)) { $this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada); } // Componente curricular $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); $obrigatorio = FALSE; $get_instituicao = TRUE; $get_escola = TRUE; $get_curso = TRUE; $get_serie = TRUE; $get_turma = TRUE; include 'educar_quadro_horarios_pesquisas.php'; if ($this->busca == 'S') { if (is_numeric($this->ref_cod_turma)) { $obj_turma = new clsPmieducarTurma($this->ref_cod_turma); $det_turma = $obj_turma->detalhe(); $obj_quadro = new clsPmieducarQuadroHorario(NULL, NULL, NULL, $this->ref_cod_turma, NULL, NULL, 1); $det_quadro = $obj_quadro->detalhe(); if (is_array($det_quadro)) { $quadro_horario = "<table class='calendar' cellspacing='0' cellpadding='0' border='0'><tr><td class='cal_esq' > </td><td background='imagens/i-educar/cal_bg.gif' width='100%' class='mes'>{$det_turma["nm_turma"]}</td><td align='right' class='cal_dir'> </td></tr><tr><td colspan='3' class='bordaM' style='border-bottom: 1px solid #8A959B;' align='center'><table cellspacing='0' cellpadding='0' border='0' ><tr class='header'><td style='border-right: 1px dotted #FFFFFF;width: 100px;'>DOM</td><td style='border-right: 1px dotted #FFFFFF;width: 100px;'>SEG</td><td style='border-right: 1px dotted #FFFFFF;width: 100px;'>TER</td><td style='border-right: 1px dotted #FFFFFF;width: 100px;'>QUA</td><td style='border-right: 1px dotted #FFFFFF;width: 100px;'>QUI</td><td style='border-right: 1px dotted #FFFFFF;width: 100px;'>SEX</td><td style='width: 100px;'>SAB</td></tr>"; $texto = '<tr>'; for ($c = 1; $c <= 7; $c++) { $obj_horarios = new clsPmieducarQuadroHorarioHorarios(); $resultado = $obj_horarios->retornaHorario($this->ref_cod_instituicao, $this->ref_cod_escola, $this->ref_cod_serie, $this->ref_cod_turma, $c); $texto .= "<td valign=top align='center' width='100' style='cursor: pointer; ' onclick='envia( this, {$this->ref_cod_turma}, {$this->ref_cod_serie}, {$this->ref_cod_curso}, {$this->ref_cod_escola}, {$this->ref_cod_instituicao}, {$det_quadro["cod_quadro_horario"]}, {$c} );'>"; if (is_array($resultado)) { foreach ($resultado as $registro) { // Componente curricular $componente = $componenteMapper->find($registro['ref_cod_disciplina']); // Servidor $obj_servidor = new clsPmieducarServidor(); $det_servidor = array_shift($obj_servidor->lista($registro['ref_servidor'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)); $det_servidor['nome'] = array_shift(explode(' ', $det_servidor['nome'])); //$texto .= "<div style='text-align: center;background-color: #F6F6F6;font-size: 11px; width: 100px; margin: 3px; border: 1px solid #CCCCCC; padding:5px; '>". substr($registro['hora_inicial'], 0, 5) . ' - ' . substr($registro['hora_final'], 0, 5) . " <br> {$componente->abreviatura} <br> {$det_servidor["nome"]}</div>"; $detalhes = sprintf("%s - %s<br />%s<br />%s", substr($registro['hora_inicial'], 0, 5), substr($registro['hora_final'], 0, 5), $componente->abreviatura, $det_servidor['nome']); $texto .= sprintf('<div style="text-align: center; background-color: #F6F6F6; font-size: 11px; width: 100px; margin: 3px; border: 1px solid #CCCCCC; padding:5px;">%s</div>', $detalhes); } } else { $texto .= "<div style='text-align: center;background-color: #F6F6F6;font-size: 11px; width: 100px; margin: 3px; border: 1px solid #CCCCCC; padding:5px; height: 85%;'></div>"; } $texto .= '</td>'; } $texto .= '<tr><td colspan="7"> </td></tr>'; $quadro_horario .= $texto; $quadro_horario .= '</table></td></tr></table>'; $retorno .= "<tr><td colspan='2' ><center><b></b>{$quadro_horario}</center></td></tr>"; } else { $retorno .= "<tr><td colspan='2' ><b><center>Não existe nenhum quadro de horário cadastrado para esta turma.</center></b></td></tr>"; } } } if ($obj_permissoes->permissao_cadastra(641, $this->pessoa_logada, 7)) { $retorno .= "<tr><td> </td></tr><tr>\n <td align=\"center\" colspan=\"2\">"; if (!$det_quadro) { $retorno .= "<input type=\"button\" value=\"Novo Quadro de Horários\" onclick=\"window.location='educar_quadro_horario_cad.php?ref_cod_turma={$this->ref_cod_turma}&ref_cod_serie={$this->ref_cod_serie}&ref_cod_curso={$this->ref_cod_curso}&ref_cod_escola={$this->ref_cod_escola}&ref_cod_instituicao={$this->ref_cod_instituicao};'\" class=\"botaolistagem\"/>"; } else { if ($obj_permissoes->permissao_excluir(641, $this->pessoa_logada, 7)) { $retorno .= "<input type=\"button\" value=\"Excluir Quadro de Horários\" onclick=\"window.location='educar_quadro_horario_cad.php?ref_cod_turma={$this->ref_cod_turma}&ref_cod_serie={$this->ref_cod_serie}&ref_cod_curso={$this->ref_cod_curso}&ref_cod_escola={$this->ref_cod_escola}&ref_cod_instituicao={$this->ref_cod_instituicao}&ref_cod_quadro_horario={$det_quadro["cod_quadro_horario"]}'\" class=\"botaolistagem\"/>"; } } $retorno .= "</td>\n </tr>"; } $retorno .= '</tbody> </table>'; return $retorno; }
function Editar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, sprintf('educar_falta_atraso_lst.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao)); if ($this->tipo == 1) { $obj = new clsPmieducarFaltaAtraso(NULL, $this->ref_cod_escola, $this->ref_cod_instituicao, $this->pessoa_logada, NULL, $this->ref_cod_servidor, $this->tipo, $this->data_falta_atraso, $this->qtd_horas, $this->qtd_min, $this->justificada, NULL, NULL, 1); } elseif ($this->tipo == 2) { $obj_ser = new clsPmieducarServidor($this->ref_cod_servidor, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); $det_ser = $obj_ser->detalhe(); $horas = floor($det_ser['carga_horaria']); $minutos = ($det_ser['carga_horaria'] - $horas) * 60; $obj = new clsPmieducarFaltaAtraso(NULL, $this->ref_cod_escola, $this->ref_cod_instituicao, $this->pessoa_logada, NULL, $this->ref_cod_servidor, $this->tipo, $this->data_falta_atraso, $horas, $minutos, $this->justificada, NULL, NULL, 1); } $editou = $obj->edita(); if ($editou) { $this->mensagem .= 'Edição efetuada com sucesso.<br />'; header('Location: ' . sprintf('educar_falta_atraso_lst.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao)); die; } $this->mensagem = 'Edição não realizada.<br />'; echo "<!--\nErro ao editar clsPmieducarFaltaAtraso\nvalores obrigatórios\nif(is_numeric({$this->cod_falta_atraso}) && is_numeric({$this->ref_usuario_exc}))\n-->"; return FALSE; }
/** * Substitui a alocação entre servidores no quadro de horários * * Substitui a alocação entre servidores, atualizando a tabela * pmieducar.servidor_quadro_horario_horarios. O servidor nesse caso é * de alguma função do tipo professor. Esse método não valida esse dado, * sendo de responsabilidade do código cliente * * @param int $int_ref_cod_servidor_substituto Código do servidor que substituirá o atual * @return bool TRUE em caso de sucesso, FALSE caso contrário */ public function substituir_servidor($int_ref_cod_servidor_substituto) { if (is_numeric($int_ref_cod_servidor_substituto) && is_numeric($this->ref_cod_instituicao_servidor)) { $servidor = new clsPmieducarServidor($int_ref_cod_servidor_substituto, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao_servidor); if (!$servidor->existe()) { return FALSE; } } if (is_numeric($this->ref_servidor) && is_numeric($this->ref_cod_instituicao_servidor)) { $sql = "UPDATE %s SET ref_servidor='%d', data_exclusao = NOW() "; $sql .= "WHERE ref_servidor = '%d' AND ref_cod_instituicao_servidor = '%d'"; $sql = sprintf($sql, $this->_tabela, $int_ref_cod_servidor_substituto, $this->ref_servidor, $this->ref_cod_instituicao_servidor); $db = new clsBanco(); $db->Consulta($sql); return TRUE; } return FALSE; }
/** * Substitui a alocação entre servidores * * Substitui a alocação entre servidores, atualizando a tabela * pmieducar.servidor_alocacao. A única atualização na tabela ocorre no * identificador do servidor, o campo ref_cod_servidor. Para usar este * método, um objeto desta classe precisa estar instanciado com os atributos * do servidor a ser substituido. * * @param int $int_ref_cod_servidor_substituto Código do servidor que substituirá o atual * @return bool TRUE em caso de sucesso, FALSE caso contrário */ function substituir_servidor($int_ref_cod_servidor_substituto) { if (is_numeric($int_ref_cod_servidor_substituto) && is_numeric($this->ref_ref_cod_instituicao)) { $servidor = new clsPmieducarServidor($int_ref_cod_servidor_substituto, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_ref_cod_instituicao); if (!$servidor->existe()) { return FALSE; } } if (is_numeric($this->ref_cod_servidor) && is_numeric($this->ref_ref_cod_instituicao) && is_numeric($this->ref_cod_escola) && is_numeric($this->periodo) && is_string($this->carga_horaria)) { $sql = "UPDATE %s SET ref_cod_servidor='%d' WHERE ref_cod_servidor = '%d' "; $sql .= "AND ref_ref_cod_instituicao = '%d' AND ref_cod_escola = '%d' AND "; $sql .= "carga_horaria = '%s' AND periodo = '%d'"; $sql = sprintf($sql, $this->_tabela, $int_ref_cod_servidor_substituto, $this->ref_cod_servidor, $this->ref_ref_cod_instituicao, $this->ref_cod_escola, $this->carga_horaria, $this->periodo); $db = new clsBanco(); $db->Consulta($sql); return TRUE; } return FALSE; }
function Inicializar() { $retorno = 'Novo'; @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $this->cod_servidor = $_GET['ref_cod_servidor']; $this->ref_cod_instituicao = $_GET['ref_cod_instituicao']; $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, 'educar_servidor_lst.php'); if (is_numeric($this->cod_servidor) && is_numeric($this->ref_cod_instituicao)) { $obj = new clsPmieducarServidor($this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao); $registro = $obj->detalhe(); if ($registro) { $retorno = 'Editar'; } } @session_start(); $this->cursos_servidor = $_SESSION['cursos_servidor']; @session_write_close(); if (!$this->cursos_servidor) { $obj_servidor_curso = new clsPmieducarServidorCursoMinistra(); $lst_servidor_curso = $obj_servidor_curso->lista(NULL, $this->ref_cod_instituicao, $this->cod_servidor); if ($lst_servidor_curso) { foreach ($lst_servidor_curso as $curso) { $this->cursos_servidor[$curso['ref_cod_curso']] = $curso['ref_cod_curso']; } } } return $retorno; }
/** * Implementação do método Gerar() */ function Gerar() { session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = 'Servidor - Detalhe'; $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); $this->cod_servidor = $_GET['cod_servidor']; $this->ref_cod_instituicao = $_GET['ref_cod_instituicao']; $tmp_obj = new clsPmieducarServidor($this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao); $registro = $tmp_obj->detalhe(); if (!$registro) { header('Location: educar_servidor_lst.php'); die; } // Deficiência $obj_ref_cod_deficiencia = new clsCadastroDeficiencia($registro['ref_cod_deficiencia']); $det_ref_cod_deficiencia = $obj_ref_cod_deficiencia->detalhe(); $registro['ref_cod_deficiencia'] = $det_ref_cod_deficiencia['nm_deficiencia']; // Escolaridade $obj_ref_idesco = new clsCadastroEscolaridade($registro['ref_idesco']); $det_ref_idesco = $obj_ref_idesco->detalhe(); $registro['ref_idesco'] = $det_ref_idesco['descricao']; // Função $obj_ref_cod_funcao = new clsPmieducarFuncao($registro['ref_cod_funcao'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao); $det_ref_cod_funcao = $obj_ref_cod_funcao->detalhe(); $registro['ref_cod_funcao'] = $det_ref_cod_funcao['nm_funcao']; // Nome $obj_cod_servidor = new clsFuncionario($registro['cod_servidor']); $det_cod_servidor = $obj_cod_servidor->detalhe(); $registro['matricula'] = $det_cod_servidor['matricula']; $det_cod_servidor = $det_cod_servidor['idpes']->detalhe(); $registro['nome'] = $det_cod_servidor['nome']; // Instituição $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']); $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); $registro['ref_cod_instituicao'] = $det_ref_cod_instituicao['nm_instituicao']; // Alocação do servidor $obj = new clsPmieducarServidorAlocacao(); $obj->setOrderby('periodo, carga_horaria'); $lista = $obj->lista(NULL, $this->ref_cod_instituicao, NULL, NULL, NULL, $this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if ($lista) { // Passa todos os valores do registro para atributos do objeto foreach ($lista as $campo => $val) { $temp = array(); $temp['carga_horaria'] = $val['carga_horaria']; $temp['periodo'] = $val['periodo']; $obj_escola = new clsPmieducarEscola($val['ref_cod_escola']); $det_escola = $obj_escola->detalhe(); $det_escola = $det_escola['nome']; $temp['ref_cod_escola'] = $det_escola; $this->alocacao_array[] = $temp; } } if ($registro['cod_servidor']) { $this->addDetalhe(array('Servidor', $registro['cod_servidor'])); } if ($registro['matricula']) { $this->addDetalhe(array('Matrícula', $registro['matricula'])); } if ($registro['nome']) { $this->addDetalhe(array('Nome', $registro['nome'])); } if ($registro['ref_cod_instituicao']) { $this->addDetalhe(array("Instituição", $registro['ref_cod_instituicao'])); } if ($registro['ref_cod_deficiencia']) { $this->addDetalhe(array('Deficiência', $registro['ref_cod_deficiencia'])); } if ($registro['ref_idesco']) { $this->addDetalhe(array('Escolaridade', $registro['ref_idesco'])); } if ($registro['ref_cod_subnivel']) { $obj_nivel = new clsPmieducarSubnivel($registro['ref_cod_subnivel']); $det_nivel = $obj_nivel->detalhe(); $this->addDetalhe(array('Nível', $det_nivel['nm_subnivel'])); } if ($registro['ref_cod_funcao']) { $this->addDetalhe(array('Função', $registro['ref_cod_funcao'])); } $obj_funcao = new clsPmieducarServidorFuncao(); $lst_funcao = $obj_funcao->lista($this->ref_cod_instituicao, $this->cod_servidor); // Inep. $docente = false; if ($lst_funcao) { $tabela .= "\n <table cellspacing='0' cellpadding='0' border='0'>\n <tr bgcolor='#A1B3BD' align='center'>\n <td width='150'>Função</td>\n </tr>"; $class = 'formlttd'; $tab_disc = NULL; $obj_disciplina_servidor = new clsPmieducarServidorDisciplina(); $lst_disciplina_servidor = $obj_disciplina_servidor->lista(NULL, $this->ref_cod_instituicao, $this->cod_servidor); if ($lst_disciplina_servidor) { $tab_disc .= "<table cellspacing='0' cellpadding='0' width='200' border='0' style='border:1px dotted #000000'>"; $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd"; $tab_disc .= "\n <tr>\n <td bgcolor='#A1B3BD' align='center'>Componentes Curriculares</td>\n </tr>"; $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); foreach ($lst_disciplina_servidor as $disciplina) { $componente = $componenteMapper->find($disciplina['ref_cod_disciplina']); $tab_disc .= "\n <tr class='{$class2}' align='center'>\n <td align='left'>{$componente->nome}</td>\n </tr>"; $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd"; } $tab_disc .= "</table>"; } $obj_servidor_curso = new clsPmieducarServidorCursoMinistra(); $lst_servidor_curso = $obj_servidor_curso->lista(NULL, $this->ref_cod_instituicao, $this->cod_servidor); if ($lst_servidor_curso) { $tab_curso .= "<table cellspacing='0' cellpadding='0' width='200' border='0' style='border:1px dotted #000000'>"; $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd"; $tab_curso .= "\n <tr>\n <td bgcolor='#A1B3BD' align='center'>Cursos Ministrados</td>\n </tr>"; foreach ($lst_servidor_curso as $curso) { $obj_curso = new clsPmieducarCurso($curso['ref_cod_curso']); $det_curso = $obj_curso->detalhe(); $tab_curso .= "\n <tr class='{$class2}' align='center'>\n <td align='left'>{$det_curso['nm_curso']}</td>\n </tr>"; $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd"; } $tab_curso .= "</table>"; } foreach ($lst_funcao as $funcao) { $obj_funcao = new clsPmieducarFuncao($funcao['ref_cod_funcao']); $det_funcao = $obj_funcao->detalhe(); $tabela .= "\n <tr class='{$class}' align='left'>\n <td><b>{$det_funcao['nm_funcao']}</b></td>\n </tr>"; $docente = (bool) $det_funcao['professor']; $class = $class == "formlttd" ? "formmdtd" : "formlttd"; } if ($tab_curso) { $tabela .= "\n <tr class='{$class}' align='center'>\n <td style='padding:5px'>{$tab_curso}</td>\n </tr>"; } if ($tab_disc) { $tabela .= "\n <tr class='{$class}' align='center'>\n <td style='padding:5px'>{$tab_disc}</td>\n </tr>"; } $tabela .= "</table>"; $this->addDetalhe(array('Função', "<a href='javascript:trocaDisplay(\"det_f\");' >Mostrar detalhe</a><div id='det_f' name='det_f' style='display:none;'>" . $tabela . "</div>")); } $tabela = NULL; /** * @todo Criar função de transformação de hora decimal. Ver educar_servidor_cad.php em 276 */ if ($registro['carga_horaria']) { $cargaHoraria = $registro['carga_horaria']; $horas = (int) $cargaHoraria; $minutos = round(($cargaHoraria - $horas) * 60); $cargaHoraria = sprintf('%02d:%02d', $horas, $minutos); $this->addDetalhe(array('Carga Horária', $cargaHoraria)); } $dias_da_semana = array('' => 'Selecione', 1 => 'Domingo', 2 => 'Segunda', 3 => 'Terça', 4 => 'Quarta', 5 => 'Quinta', 6 => 'Sexta', 7 => 'Sábado'); if ($this->alocacao_array) { $tabela .= "\n <table cellspacing='0' cellpadding='0' border='0'>\n <tr bgcolor='#A1B3BD' align='center'>\n <td width='150'>Carga Horária</td>\n <td width='80'>Período</td>\n <td width='150'>Escola</td>\n </tr>"; $class = "formlttd"; foreach ($this->alocacao_array as $alocacao) { switch ($alocacao['periodo']) { case 1: $nm_periodo = "Matutino"; break; case 2: $nm_periodo = "Vespertino"; break; case 3: $nm_periodo = "Noturno"; break; } $tabela .= "\n <tr class='{$class}' align='center'>\n <td>{$alocacao['carga_horaria']}</td>\n <td>{$nm_periodo}</td>\n <td>{$alocacao['ref_cod_escola']}</td>\n </tr>"; $class = $class == 'formlttd' ? 'formmdtd' : 'formlttd'; } $tabela .= "</table>"; $this->addDetalhe(array('Horários de trabalho', "<a href='javascript:trocaDisplay(\"det_pree\");' >Mostrar detalhe</a><div id='det_pree' name='det_pree' style='display:none;'>" . $tabela . "</div>")); } // Horários do professor $horarios = $tmp_obj->getHorariosServidor($registro['cod_servidor'], $this->ref_cod_instituicao); if ($horarios) { $tabela = "\n <table cellspacing='0' cellpadding='0' border='0'>\n <tr bgcolor='#A1B3BD' align='center'>\n <td width='150'>Escola</td>\n <td width='100'>Curso</td>\n <td width='70'>Série</td>\n <td width='70'>Turma</td>\n <td width='100'>Componente curricular</td>\n <td width='70'>Dia da semana</td>\n <td width='70'>Hora inicial</td>\n <td width='70'>Hora final</td>\n </tr>"; foreach ($horarios as $horario) { $class = $class == 'formlttd' ? 'formmdtd' : 'formlttd'; $tabela .= sprintf(' <tr class="%s" align="center"> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> </tr>', $class, $horario['nm_escola'], $horario['nm_curso'], $horario['nm_serie'], $horario['nm_turma'], $horario['nome'], $dias_da_semana[$horario['dia_semana']], $horario['hora_inicial'], $horario['hora_final']); } $tabela .= "</table>"; $this->addDetalhe(array('Horários de aula', "<a href='javascript:trocaDisplay(\"horarios\");' >Mostrar detalhes</a>" . "<div id='horarios' name='det_pree' style='display:none;'>" . $tabela . "</div>")); } // Dados do docente no Educacenso/Inep. if ($docente) { $docenteMapper = new Educacenso_Model_DocenteDataMapper(); $docenteInep = NULL; try { $docenteInep = $docenteMapper->find(array('docente' => $registro['cod_servidor'])); } catch (Exception $e) { } if (isset($docenteInep)) { $this->addDetalhe(array('Código do docente no Educacenso/Inep', $docenteInep->docenteInep)); if (isset($docenteInep->nomeInep)) { $this->addDetalhe(array('Nome do docente no Educacenso/Inep', $docenteInep->nomeInep)); } } } $obj_permissoes = new clsPermissoes(); if ($obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7)) { $this->url_novo = 'educar_servidor_cad.php'; $this->url_editar = "educar_servidor_cad.php?cod_servidor={$registro["cod_servidor"]}&ref_cod_instituicao={$this->ref_cod_instituicao}"; $get_padrao = "ref_cod_servidor={$registro["cod_servidor"]}&ref_cod_instituicao={$this->ref_cod_instituicao}"; $this->array_botao = array(); $this->array_botao_url_script = array(); $this->array_botao[] = 'Avaliação de Desempenho'; $this->array_botao_url_script[] = "go(\"educar_avaliacao_desempenho_lst.php?{$get_padrao}\");"; $this->array_botao[] = 'Formação'; $this->array_botao_url_script[] = "go(\"educar_servidor_formacao_lst.php?{$get_padrao}\");"; $this->array_botao[] = 'Cursos superiores/Licenciaturas'; $this->array_botao_url_script[] = sprintf("go(\"../module/Docente/index?servidor=%d&instituicao=%d\");", $registro['cod_servidor'], $this->ref_cod_instituicao); $this->array_botao[] = 'Faltas/Atrasos'; $this->array_botao_url_script[] = "go(\"educar_falta_atraso_lst.php?{$get_padrao}\");"; $this->array_botao[] = 'Alocar Servidor'; $this->array_botao_url_script[] = "go(\"educar_servidor_alocacao_cad.php?{$get_padrao}\");"; $this->array_botao[] = 'Alterar Nível'; $this->array_botao_url_script[] = "popless();"; $obj_servidor_alocacao = new clsPmieducarServidorAlocacao(); $lista_alocacao = $obj_servidor_alocacao->lista(NULL, $this->ref_cod_instituicao, NULL, NULL, NULL, $this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if ($lista) { $this->array_botao[] = 'Substituir Horário Servidor'; $this->array_botao_url_script[] = "go(\"educar_servidor_substituicao_cad.php?{$get_padrao}\");"; } $obj_afastamento = new clsPmieducarServidorAfastamento(); $afastamento = $obj_afastamento->afastado($this->cod_servidor, $this->ref_cod_instituicao); if (is_numeric($afastamento) && $afastamento == 0) { $this->array_botao[] = 'Afastar Servidor'; $this->array_botao_url_script[] = "go(\"educar_servidor_afastamento_cad.php?{$get_padrao}\");"; } elseif (is_numeric($afastamento)) { $this->array_botao[] = 'Retornar Servidor'; $this->array_botao_url_script[] = "go(\"educar_servidor_afastamento_cad.php?{$get_padrao}&sequencial={$afastamento}\");"; } } $this->url_cancelar = 'educar_servidor_lst.php'; $this->largura = '100%'; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "educar_index.php" => "i-Educar - Escola", "" => "Detalhe do servidor")); $this->enviaLocalizacao($localizacao->montar()); }
function Gerar() { if ($_POST) { foreach ($_POST as $campo => $val) { if (is_string($val)) { $val = urldecode($val); } $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val; } } $obj_inst = new clsPmieducarInstituicao($this->ref_ref_cod_instituicao); $inst_det = $obj_inst->detalhe(); $this->campoRotulo('nm_instituicao', 'Instituição', $inst_det['nm_instituicao']); $this->campoOculto('ref_ref_cod_instituicao', $this->ref_ref_cod_instituicao); // Dados do servidor $objTemp = new clsPmieducarServidor($this->ref_cod_servidor); $det = $objTemp->detalhe(); if ($det) { foreach ($det as $key => $registro) { $this->{$key} = $registro; } } if ($this->ref_cod_servidor) { $objTemp = new clsFuncionario($this->ref_cod_servidor); $detalhe = $objTemp->detalhe(); $detalhe = $detalhe['idpes']->detalhe(); $nm_servidor = $detalhe['nome']; } $this->campoRotulo('nm_servidor', 'Servidor', $nm_servidor); $this->campoOculto('ref_cod_servidor', $this->ref_cod_servidor); if ($_POST['alocacao_array']) { $this->alocacao_array = unserialize(urldecode($_POST['alocacao_array'])); } if ($_POST['alocacao_excluida_array']) { $this->alocacao_excluida_array = unserialize(urldecode($_POST['alocacao_excluida_array'])); } if ($_POST['carga_horaria_alocada'] && $_POST['periodo']) { $aux = array(); $aux['carga_horaria_alocada'] = $_POST['carga_horaria_alocada']; $aux['periodo'] = $_POST['periodo']; $aux['ref_cod_escola'] = $_POST['ref_cod_escola']; $aux['novo'] = 1; $this->alocacao_array[] = $aux; unset($this->periodo); unset($this->carga_horaria_alocada); unset($this->ref_cod_escola); } // Exclusão if ($this->alocacao_array) { foreach ($this->alocacao_array as $key => $alocacao) { if (is_numeric($_POST['excluir_periodo'])) { if ($_POST['excluir_periodo'] == $key) { $this->alocacao_excluida_array[] = $alocacao; unset($this->alocacao_array[$key]); unset($this->excluir_periodo); } } } } // Carga horária $carga = $this->carga_horaria_disponivel; $this->campoRotulo('carga_horaria_disponivel', 'Carga Horária', $carga . ':00'); foreach ($this->alocacao_array as $alocacao) { $carga_horaria_ = explode(':', $alocacao['carga_horaria_alocada']); $horas += (int) $carga_horaria_[0]; $minutos += (int) $carga_horaria_[1]; } $total = $horas * 60 + $minutos; $rest = $carga * 60 - $total; $total = sprintf('%02d:%02d', $total / 60, $total % 60); $rest = sprintf('%02d:%02d', $rest / 60, $rest % 60); $this->campoRotulo('horas_utilizadas', 'Horas Utilizadas', $total); $this->campoRotulo('horas_restantes', 'Horas Restantes', $rest); $this->campoOculto('horas_restantes_', $rest); $this->campoQuebra(); $this->campoOculto('excluir_periodo', ''); unset($aux); // Escolas $obj_escola = new clsPmieducarEscola(); $permissao = new clsPermissoes(); // Exibe apenas a escola ao qual o usuário de nível escola está alocado if (4 == $permissao->nivel_acesso($this->pessoa_logada)) { $lista_escola = $obj_escola->lista($permissao->getEscola($this->pessoa_logada), NULL, NULL, $this->ref_ref_cod_instituicao, NULL, NULL, NULL, NULL, NULL, NULL, 1); $nome_escola = $lista_escola[0]['nome']; $cod_escola = $lista_escola[0]['cod_escola']; $this->campoTextoInv('ref_cod_escola_label', 'Escola', $nome_escola, 100, 255, FALSE); $this->campoOculto('ref_cod_escola', $cod_escola); } else { $lista_escola = $obj_escola->lista(NULL, NULL, NULL, $this->ref_ref_cod_instituicao, NULL, NULL, NULL, NULL, NULL, NULL, 1); $opcoes = array('' => 'Selecione'); if ($lista_escola) { foreach ($lista_escola as $escola) { $opcoes[$escola['cod_escola']] = $escola['nome']; } } $this->campoLista('ref_cod_escola', 'Escola', $opcoes, $this->ref_cod_escola, '', FALSE, '', '', FALSE, FALSE); } $periodo = array(1 => 'Matutino', 2 => 'Vespertino', 3 => 'Noturno'); self::$periodos = $periodo; $this->campoLista('periodo', 'Período', $periodo, $this->periodo, NULL, FALSE, '', '', FALSE, FALSE); $this->campoHora('carga_horaria_alocada', 'Carga Horária', $this->carga_horaria_alocada, FALSE); // Altera a string de descrição original do campo hora $this->campos['carga_horaria_alocada'][6] = sprintf('Formato hh:mm (máximo de %d horas por período)', clsPmieducarServidorAlocacao::$cargaHorariaMax); $this->campoOculto('alocacao_array', serialize($this->alocacao_array)); $this->campoOculto('alocacao_excluida_array', serialize($this->alocacao_excluida_array)); $this->campoRotulo('bt_incluir_periodo', 'Período', "<a href='#' onclick=\"if(validaHora()) { document.getElementById('incluir_periodo').value = 'S'; document.getElementById('tipoacao').value = ''; document.{$this->__nome}.submit();}\"><img src='imagens/nvp_bot_adiciona.gif' title='Incluir' border=0></a>"); if ($this->alocacao_array) { $excluir_ok = FALSE; if ($_POST['excluir_periodo'] || $_POST['excluir_periodo'] == '0') { $excluir_ok = TRUE; } foreach ($this->alocacao_array as $key => $alocacao) { $obj_permissoes = new clsPermissoes(); $link_excluir = ''; $obj_escola = new clsPmieducarEscola($alocacao['ref_cod_escola']); $det_escola = $obj_escola->detalhe(); $det_escola = $det_escola['nome']; if ($obj_permissoes->permissao_excluir(635, $this->pessoa_logada, 7)) { $show = TRUE; if (4 == $permissao->nivel_acesso($this->pessoa_logada) && $alocacao['ref_cod_escola'] != $permissao->getEscola($this->pessoa_logada)) { $show = FALSE; } $link_excluir = $show ? "<a href='#' onclick=\"getElementById('excluir_periodo').value = '{$key}'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>" : ""; } // @todo CoreExt_Enum switch ($alocacao['periodo']) { case 1: $nm_periodo = 'Matutino'; break; case 2: $nm_periodo = 'Vespertino'; break; case 3: $nm_periodo = 'Noturno'; break; } // Períodos usados na escola self::$escolasPeriodos[$alocacao['ref_cod_escola']][$alocacao['periodo']] = $alocacao['periodo']; $this->campoTextoInv('periodo_' . $key, '', $nm_periodo, 10, 10, FALSE, FALSE, TRUE, '', '', '', '', 'periodo'); $this->campoTextoInv('carga_horaria_alocada_' . $key, '', substr($alocacao['carga_horaria_alocada'], 0, 5), 5, 5, FALSE, FALSE, TRUE, '', '', '', '', 'ds_carga_horaria_'); $this->campoTextoInv('ref_cod_escola_' . $key, '', $det_escola, 70, 255, FALSE, FALSE, FALSE, '', $link_excluir, '', '', 'ref_cod_escola_'); } } $this->campoOculto('incluir_periodo', ''); $this->campoQuebra(); }
function Gerar() { $obj_inst = new clsPmieducarInstituicao($this->ref_ref_cod_instituicao); $inst_det = $obj_inst->detalhe(); $this->campoRotulo('nm_instituicao', 'Instituição', $inst_det['nm_instituicao']); $this->campoOculto('ref_ref_cod_instituicao', $this->ref_ref_cod_instituicao); $opcoes = array('' => 'Selecione'); if (class_exists('clsPmieducarServidor')) { $objTemp = new clsPmieducarServidor($this->ref_cod_servidor); $det = $objTemp->detalhe(); if ($det) { foreach ($det as $key => $registro) { $this->{$key} = $registro; } } if ($this->ref_cod_servidor) { $objTemp = new clsFuncionario($this->ref_cod_servidor); $detalhe = $objTemp->detalhe(); $detalhe = $detalhe['idpes']->detalhe(); $nm_servidor = $detalhe['nome']; } } $this->campoRotulo('nm_servidor', 'Servidor', $nm_servidor); $this->campoOculto('ref_cod_servidor', $this->ref_cod_servidor); $this->campoOculto('professor', $this->professor); $url = sprintf('educar_pesquisa_servidor_lst.php?campo1=ref_cod_servidor_todos&campo2=ref_cod_servidor_todos_&ref_cod_instituicao=%d&ref_cod_servidor=%d&tipo=livre&professor=%d', $this->ref_ref_cod_instituicao, $this->ref_cod_servidor, $this->professor); $img = sprintf('<img border="0" onclick="pesquisa_valores_popless(\'%s\', \'nome\')" src="imagens/lupa.png">', $url); $this->campoTextoInv('ref_cod_servidor_todos_', 'Substituir por:', '', 30, 255, TRUE, FALSE, FALSE, '', $img, '', '', ''); $this->campoOculto('ref_cod_servidor_todos', ''); $this->campoOculto('alocacao_array', serialize($this->alocacao_array)); $this->acao_enviar = 'acao2()'; }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = 'Servidor Formacao - Detalhe'; $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); $this->cod_formacao = $_GET['cod_formacao']; $tmp_obj = new clsPmieducarServidorFormacao($this->cod_formacao); $registro = $tmp_obj->detalhe(); if (!$registro) { header('Location: educar_servidor_formacao_lst.php'); die; } if (class_exists('clsPmieducarServidor')) { $obj_ref_cod_servidor = new clsPmieducarServidor($registro['ref_cod_servidor'], null, null, null, null, null, 1, $registro['ref_ref_cod_instituicao']); $det_ref_cod_servidor = $obj_ref_cod_servidor->detalhe(); $registro['ref_cod_servidor'] = $det_ref_cod_servidor['cod_servidor']; } else { $registro['ref_cod_servidor'] = 'Erro na geracao'; } if ($registro['nm_formacao']) { $this->addDetalhe(array('Nome Formação', $registro['nm_formacao'])); } if ($registro['tipo'] == 'C') { $obj_curso = new clsPmieducarServidorCurso(null, $this->cod_formacao); $det_curso = $obj_curso->detalhe(); } elseif ($registro['tipo'] == 'T' || $registro['tipo'] == 'O') { $obj_titulo = new clsPmieducarServidorTituloConcurso(NULL, $this->cod_formacao); $det_titulo = $obj_titulo->detalhe(); } if ($registro['tipo']) { if ($registro['tipo'] == 'C') { $registro['tipo'] = 'Curso'; } elseif ($registro['tipo'] == 'T') { $registro['tipo'] = 'Título'; } else { $registro['tipo'] = 'Concurso'; } $this->addDetalhe(array('Tipo', $registro['tipo'])); } if ($registro['descricao']) { $this->addDetalhe(array('Descricção', $registro['descricao'])); } if ($det_curso['data_conclusao']) { $this->addDetalhe(array('Data de Conclusão', dataFromPgToBr($det_curso['data_conclusao']))); } if ($det_curso['data_registro']) { $this->addDetalhe(array('Data de Registro', dataFromPgToBr($det_curso['data_registro']))); } if ($det_curso['diplomas_registros']) { $this->addDetalhe(array('Diplomas e Registros', $det_curso['diplomas_registros'])); } if ($det_titulo['data_vigencia_homolog'] && $registro['tipo'] == 'Título') { $this->addDetalhe(array('Data de Vigência', dataFromPgToBr($det_titulo['data_vigencia_homolog']))); } elseif ($det_titulo['data_vigencia_homolog'] && $registro['tipo'] == 'Concurso') { $this->addDetalhe(array('Data de Homologação', dataFromPgToBr($det_titulo['data_vigencia_homolog']))); } if ($det_titulo['data_publicacao']) { $this->addDetalhe(array('Data de Publicação', dataFromPgToBr($det_titulo['data_publicacao']))); } $obj_permissoes = new clsPermissoes(); if ($obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7)) { $this->url_novo = 'educar_servidor_formacao_cad.php'; $this->url_editar = sprintf('educar_servidor_formacao_cad.php?cod_formacao=%d&ref_cod_instituicao=%d&ref_cod_servidor=%d', $registro['cod_formacao'], $registro['ref_ref_cod_instituicao'], $registro['ref_cod_servidor']); } $this->url_cancelar = sprintf('educar_servidor_formacao_lst.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $registro['ref_cod_servidor'], $registro['ref_ref_cod_instituicao']); $this->largura = '100%'; }
function Excluir() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_excluir(635, $this->pessoa_logada, 7, 'educar_servidor_lst.php'); $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(NULL, NULL, NULL, NULL, NULL, NULL, $this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); if ($obj_quadro_horario->detalhe()) { $this->mensagem = "Exclusão não realizada. O servidor está vinculado a um quadro de horários.<br>"; return FALSE; } else { $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->cod_servidor, NULL, NULL, NULL, NULL, NULL, 1, NULL, $this->ref_cod_instituicao); if ($obj_quadro_horario->detalhe()) { $this->mensagem = "Exclusão não realizada. O servidor está vinculado a um quadro de horários.<br>"; return FALSE; } else { $obj = new clsPmieducarServidor($this->cod_servidor, $this->ref_cod_deficiencia, $this->ref_idesco, $this->carga_horaria, NULL, NULL, 0, $this->ref_cod_instituicao_original); $excluiu = $obj->excluir(); if ($excluiu) { $this->excluiFuncoes(); $this->mensagem .= "Exclusão efetuada com sucesso.<br>"; header("Location: educar_servidor_lst.php"); die; } } } $this->mensagem = 'Exclusão não realizada.<br>'; return FALSE; }
function Editar() { $obj_servidor = new clsPmieducarServidor($this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao, $this->ref_cod_subnivel); $obj_servidor->edita(); echo sprintf('<script>parent.fechaExpansivel("%s");window.parent.location.reload(true);</script>', $_GET['div']); die; }
/** * Retorna a quantidade de horas compensadas. * @return array */ function ServidorHorasCompensadas($int_ref_cod_servidor = NULL, $int_ref_cod_escola = NULL, $int_ref_cod_instituicao) { if (is_numeric($int_ref_cod_servidor)) { /*strtotime( '2006-06-06' ); date( "Y-m-d", time );*/ $db = new clsBanco(); $db->Consulta("\n SELECT\n fac.data_inicio,\n fac.data_fim\n FROM\n pmieducar.falta_atraso_compensado fac\n WHERE\n fac.ref_cod_servidor = '{$int_ref_cod_servidor}'\n AND fac.ref_cod_escola = '{$int_ref_cod_escola}'\n AND fac.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}'"); while ($db->ProximoRegistro()) { $tupla = $db->Tupla(); $resultado[] = $tupla; } $horas_total = 0; $minutos_total = 0; if ($resultado) { foreach ($resultado as $registro) { $data_atual = strtotime($registro['data_inicio']); $data_fim = strtotime($registro['data_fim']); do { $db2 = new clsBanco(); $dia_semana = $db2->CampoUnico("SELECT EXTRACT(DOW FROM (date '" . date('Y-m-d', $data_atual) . "') + 1)"); $obj_servidor = new clsPmieducarServidor(); $horas = $obj_servidor->qtdhoras($int_ref_cod_servidor, $int_ref_cod_escola, $int_ref_cod_instituicao, $dia_semana); if ($horas) { $horas_total += $horas['hora']; $minutos_total += $horas['min']; } $data_atual += 86400; } while ($data_atual <= $data_fim); } } $res['hora'] = $horas_total; $res['min'] = $minutos_total; return $res; } return FALSE; }