Example #1
0
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Funcao - Detalhe";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->cod_funcao = $_GET["cod_funcao"];
     $this->ref_cod_instituicao = $_GET["ref_cod_instituicao"];
     $tmp_obj = new clsPmieducarFuncao($this->cod_funcao, null, null, null, null, null, null, null, null, $this->ref_cod_instituicao);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: educar_funcao_lst.php");
         die;
     }
     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 geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarInstituicao\n-->";
     }
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         if ($registro["ref_cod_instituicao"]) {
             $this->addDetalhe(array("Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}"));
         }
     }
     if ($registro["cod_funcao"]) {
         $this->addDetalhe(array("Func&atilde;o", "{$registro["cod_funcao"]}"));
     }
     if ($registro["nm_funcao"]) {
         $this->addDetalhe(array("Nome Func&atilde;o", "{$registro["nm_funcao"]}"));
     }
     if ($registro["abreviatura"]) {
         $this->addDetalhe(array("Abreviatura", "{$registro["abreviatura"]}"));
     }
     $opcoes = array('1' => 'Sim', '0' => 'N&atilde;o');
     if (is_numeric($registro["professor"])) {
         $this->addDetalhe(array("Professor", "{$opcoes[$registro["professor"]]}"));
     }
     if ($obj_permissoes->permissao_cadastra(634, $this->pessoa_logada, 3)) {
         $this->url_novo = "educar_funcao_cad.php";
         $this->url_editar = "educar_funcao_cad.php?cod_funcao={$registro["cod_funcao"]}";
     }
     $this->url_cancelar = "educar_funcao_lst.php";
     $this->largura = "100%";
 }
    if ($this->ref_cod_biblioteca) {
        $obj_cli_tpo = new clsPmieducarClienteTipo();
        $obj_cli_tpo->setOrderby("nm_tipo ASC");
        $lst_cli_tpo = $obj_cli_tpo->lista(null, $this->ref_cod_biblioteca, null, null, null, null, null, null, null, null, 1);
        if (is_array($lst_cli_tpo) && count($lst_cli_tpo)) {
            foreach ($lst_cli_tpo as $cli_tpo) {
                $opcoes_cli_tpo["{$cli_tpo['cod_cliente_tipo']}"] = "{$cli_tpo['nm_tipo']}";
            }
        }
    }
    $this->campoLista("ref_cod_cliente_tipo", "Tipo do Cliente", $opcoes_cli_tpo, $this->ref_cod_cliente_tipo, null, null, null, null, $cliente_tipo_desabilitado, $cliente_tipo_obrigatorio);
}
if ($get_funcao) {
    $opcoes_funcao = array("" => "Selecione");
    if ($this->ref_cod_instituicao) {
        $obj_funcao = new clsPmieducarFuncao();
        $obj_funcao->setOrderby("nm_funcao ASC");
        $lst_funcao = $obj_funcao->lista(null, null, null, null, null, null, null, null, null, null, 1, $this->ref_cod_instituicao);
        if (is_array($lst_funcao) && count($lst_funcao)) {
            foreach ($lst_funcao as $funcao) {
                $opcoes_funcao["{$funcao['cod_funcao']}"] = "{$funcao['nm_funcao']}";
            }
        }
    }
    $this->campoLista("ref_cod_funcao", "Função", $opcoes_funcao, $this->ref_cod_funcao, null, null, null, null, $funcao_desabilitado, $funcao_obrigatorio);
}
if ($get_turma) {
    $opcoes_turma = array("" => "Selecione");
    // EDITAR
    if ($this->ref_ref_cod_serie && $this->ref_cod_escola || $this->ref_cod_curso) {
        $obj_turma = new clsPmieducarTurma();
 function Gerar()
 {
     // Foreign keys
     $obrigatorio = TRUE;
     $get_instituicao = 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();
         $this->campoRotulo('nm_servidor', 'Servidor', $detalhe['nome']);
         $this->campoOculto('cod_servidor', $this->cod_servidor);
         $this->campoOculto('ref_cod_instituicao_original', $this->ref_cod_instituicao_original);
     } else {
         $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(), TRUE);
     }
     $opcoes = array('' => 'Selecione');
     if (class_exists('clsCadastroDeficiencia')) {
         $objTemp = new clsCadastroDeficiencia();
         $lista = $objTemp->lista();
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes[$registro['cod_deficiencia']] = $registro['nm_deficiencia'];
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsCadastroDeficiencia nao encontrada\n-->";
         $opcoes = array('' => 'Erro na geracao');
     }
     $script = "javascript:showExpansivelIframe(350, 100, 'educar_deficiencia_cad_pop.php');";
     $script = "<img id='img_deficiencia' style='display: \\'\\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
     $this->campoLista('ref_cod_deficiencia', 'Deficiência', $opcoes, $this->ref_cod_deficiencia, '', FALSE, '', $script, FALSE, FALSE);
     $opcoes = array('' => 'Selecione');
     if (class_exists('clsCadastroEscolaridade')) {
         $objTemp = new clsCadastroEscolaridade();
         $lista = $objTemp->lista();
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes[$registro['idesco']] = $registro['descricao'];
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsCadastroEscolaridade nao encontrada\n-->";
         $opcoes = array('' => 'Erro na geracao');
     }
     $script = "javascript:showExpansivelIframe(350, 100, 'educar_escolaridade_cad_pop.php');";
     $script = "<img id='img_deficiencia' style='display: \\'\\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
     $this->campoLista('ref_idesco', 'Escolaridade', $opcoes, $this->ref_idesco, '', FALSE, '', $script, FALSE, FALSE);
     $opcoes = array('' => 'Selecione');
     if (class_exists('clsPmieducarFuncao')) {
         if (is_numeric($this->ref_cod_instituicao)) {
             $objTemp = new clsPmieducarFuncao();
             $objTemp->setOrderby("nm_funcao ASC");
             $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao);
             if (is_array($lista) && count($lista)) {
                 foreach ($lista as $registro) {
                     $opcoes[$registro['cod_funcao'] . '-' . $registro['professor']] = $registro['nm_funcao'];
                 }
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmieducarFuncao nao encontrada\n-->";
         $opcoes = array('' => 'Erro na geracao');
     }
     $this->campoTabelaInicio('funcao', 'Funções Servidor', array("Função", "Componentes Curriculares", "Cursos"), $this->ref_cod_funcao);
     $funcao = 'popless()';
     $this->campoLista('ref_cod_funcao', 'Função', $opcoes, $this->ref_cod_funcao, 'funcaoChange(this)', '', '', '');
     $this->campoRotulo('disciplina', 'Componentes Curriculares', "<img src='imagens/lupa_antiga.png' border='0' style='cursor:pointer;' alt='Buscar Componente Curricular' title='Buscar Componente Curricular' onclick=\"{$funcao}\">");
     $funcao = 'popCurso()';
     $this->campoRotulo('curso', 'Curso', "<img src='imagens/lupa_antiga.png' border='0' style='cursor:pointer;' alt='Buscar Cursos' title='Buscar Cursos' onclick=\"{$funcao}\">");
     $this->campoTabelaFim();
     if (strtoupper($this->tipoacao) == 'EDITAR') {
         $this->campoTextoInv('total_horas_alocadas_', 'Total de Horas Alocadadas', $this->total_horas_alocadas, 9, 20);
         $hora = explode(':', $this->total_horas_alocadas);
         $this->total_horas_alocadas = $hora[0] + $hora[1] / 60;
         $this->campoOculto('total_horas_alocadas', $this->total_horas_alocadas);
         $this->acao_enviar = 'acao2()';
     }
     if ($this->carga_horaria) {
         $horas = (int) $this->carga_horaria;
         $minutos = round(($this->carga_horaria - (int) $this->carga_horaria) * 60);
         $hora_formatada = sprintf('%02d:%02d', $horas, $minutos);
     }
     $this->campoHora('carga_horaria', 'Carga Horária', $hora_formatada, TRUE, 'Número de horas deve ser maior que horas alocadas');
     // Dados do docente no Inep/Educacenso.
     if ($this->docente) {
         $docenteMapper = new Educacenso_Model_DocenteDataMapper();
         $docenteInep = NULL;
         try {
             $docenteInep = $docenteMapper->find(array('docente' => $this->cod_servidor));
         } catch (Exception $e) {
         }
         if (isset($docenteInep)) {
             $this->campoRotulo('_inep_cod_docente', 'Código do docente no Educacenso/Inep', $docenteInep->docenteInep);
             if (isset($docenteInep->nomeInep)) {
                 $this->campoRotulo('_inep_nome_docente', 'Nome do docente no Educacenso/Inep', $docenteInep->nomeInep);
             }
         }
     }
 }
Example #4
0
 function Excluir()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     $obj_permissoes = new clsPermissoes();
     $obj_permissoes->permissao_excluir(634, $this->pessoa_logada, 3, "educar_funcao_lst.php");
     $obj = new clsPmieducarFuncao($this->cod_funcao, $this->pessoa_logada, null, null, null, null, null, null, 0, $this->ref_cod_instituicao);
     $excluiu = $obj->excluir();
     if ($excluiu) {
         $this->mensagem .= "Exclus&atilde;o efetuada com sucesso.<br>";
         header("Location: educar_funcao_lst.php");
         die;
         return true;
     }
     $this->mensagem = "Exclus&atilde;o n&atilde;o realizada.<br>";
     echo "<!--\nErro ao excluir clsPmieducarFuncao\nvalores obrigatorios\nif( is_numeric( {$this->cod_funcao} ) && is_numeric( {$this->pessoa_logada} ) )\n-->";
     return false;
 }
Example #5
0
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Funcao - Listagem";
     foreach ($_GET as $var => $val) {
         // passa todos os valores obtidos no GET para atributos do objeto
         $this->{$var} = $val === "" ? null : $val;
     }
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $lista_busca = array("Nome Func&atilde;o", "Abreviatura", "Professor");
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         $lista_busca[] = "Institui&ccedil;&atilde;o";
     }
     $this->addCabecalhos($lista_busca);
     // Filtros de Foreign Keys
     include "include/pmieducar/educar_campo_lista.php";
     // outros Filtros
     $this->campoTexto("nm_funcao", "Nome Fun&ccedil;&atilde;o", $this->nm_funcao, 30, 255, false);
     $this->campoTexto("abreviatura", "Abreviatura", $this->abreviatura, 30, 255, false);
     $opcoes = array('' => 'Selecione', 'N' => 'N&atilde;o', 'S' => 'Sim');
     $this->campoLista("professor", "Professor", $opcoes, $this->professor, "", false, "", "", false, false);
     if ($this->professor == "N") {
         $this->professor = "0";
     } elseif ($this->professor == "S") {
         $this->professor = "1";
     }
     // Paginador
     $this->limite = 20;
     $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0;
     $obj_funcao = new clsPmieducarFuncao();
     $obj_funcao->setOrderby("nm_funcao ASC");
     $obj_funcao->setLimite($this->limite, $this->offset);
     $lista = $obj_funcao->lista($this->cod_funcao, null, null, $this->nm_funcao, $this->abreviatura, $this->professor, null, null, null, null, 1, $this->ref_cod_instituicao);
     $total = $obj_funcao->_total;
     // monta a lista
     if (is_array($lista) && count($lista)) {
         foreach ($lista as $registro) {
             $registro["professor"] = $registro["professor"] == 1 ? "Sim" : "N&atilde;o";
             if (class_exists("clsPmieducarInstituicao")) {
                 $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro["ref_cod_instituicao"]);
                 $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
                 $nm_instituicao = $det_ref_cod_instituicao["nm_instituicao"];
             } else {
                 $registro["ref_cod_instituicao"] = "Erro na geracao";
                 echo "<!--\nErro\nClasse nao existente: clsPmieducarInstituicao\n-->";
             }
             $lista_busca = array("<a href=\"educar_funcao_det.php?cod_funcao={$registro["cod_funcao"]}&ref_cod_instituicao={$registro["ref_cod_instituicao"]}\">{$registro["nm_funcao"]}</a>", "<a href=\"educar_funcao_det.php?cod_funcao={$registro["cod_funcao"]}&ref_cod_instituicao={$registro["ref_cod_instituicao"]}\">{$registro["abreviatura"]}</a>", "<a href=\"educar_funcao_det.php?cod_funcao={$registro["cod_funcao"]}&ref_cod_instituicao={$registro["ref_cod_instituicao"]}\">{$registro["professor"]}</a>");
             if ($nivel_usuario == 1) {
                 $lista_busca[] = "<a href=\"educar_funcao_det.php?cod_funcao={$registro["cod_funcao"]}&ref_cod_instituicao={$registro["ref_cod_instituicao"]}\">{$nm_instituicao}</a>";
             }
             $this->addLinhas($lista_busca);
         }
     }
     $this->addPaginador2("educar_funcao_lst.php", $total, $_GET, $this->nome, $this->limite);
     if ($obj_permissoes->permissao_cadastra(634, $this->pessoa_logada, 3)) {
         $this->acao = "go(\"educar_funcao_cad.php\")";
         $this->nome_acao = "Novo";
     }
     $this->largura = "100%";
 }
 /**
  * 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&iacute;cio", "educar_index.php" => "i-Educar - Escola", "" => "Detalhe do servidor"));
     $this->enviaLocalizacao($localizacao->montar());
 }