}
            }
        }
    }
    $this->campoLista("ref_cod_curso", "Curso", $opcoes_curso, $this->ref_cod_curso, null, null, null, null, $curso_desabilitado, $curso_obrigatorio);
    if ($get_semestre) {
        $this->campoRotulo("semestres", "Semestre", "<div id='div_semestre'>Selecione um Curso</div>");
        $this->campoOculto("is_padrao", 1);
    }
}
if ($get_escola_curso_serie) {
    $opcoes_series_curso_escola = array("" => "Selecione");
    // EDITAR
    if ($this->ref_cod_escola && $this->ref_cod_curso) {
        $obj_escola_serie = new clsPmieducarEscolaSerie();
        $obj_escola_serie->setOrderby("nm_serie ASC");
        $lst_escola_serie = $obj_escola_serie->lista($this->ref_cod_escola, null, null, null, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, $this->ref_cod_curso);
        if (is_array($lst_escola_serie) && count($lst_escola_serie)) {
            foreach ($lst_escola_serie as $escola_curso_serie) {
                $opcoes_series_curso_escola["{$escola_curso_serie["ref_cod_serie"]}"] = $escola_curso_serie['nm_serie'];
            }
        }
    }
    $this->campoLista("ref_ref_cod_serie", "S&eacute;rie", $opcoes_series_curso_escola, $this->ref_ref_cod_serie, null, null, null, null, $escola_curso_serie_desabilitado, $escola_curso_serie_obrigatorio);
}
if ($get_serie) {
    $opcoes_serie = array("" => "Selecione");
    // EDITAR
    if ($this->ref_cod_curso) {
        $obj_serie = new clsPmieducarSerie();
        $obj_serie->setOrderby("nm_serie ASC");
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = 'Escola S&eacute;rie - 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('S&eacute;rie', 'Curso');
     $obj_permissao = new clsPermissoes();
     $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         $lista_busca[] = 'Escola';
         $lista_busca[] = 'Institui&ccedil;&atilde;o';
     } else {
         if ($nivel_usuario == 2) {
             $lista_busca[] = 'Escola';
         }
     }
     $this->addCabecalhos($lista_busca);
     $get_escola = true;
     //    $get_escola_curso = true;
     $get_curso = true;
     $get_escola_curso_serie = true;
     include 'include/pmieducar/educar_campo_lista.php';
     // Paginador
     $this->limite = 20;
     $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0;
     $obj_escola_serie = new clsPmieducarEscolaSerie();
     $obj_escola_serie->setOrderby('nm_serie ASC');
     $obj_escola_serie->setLimite($this->limite, $this->offset);
     $lista = $obj_escola_serie->lista($this->ref_cod_escola, $this->ref_ref_cod_serie, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao, $this->ref_cod_curso);
     $total = $obj_escola_serie->_total;
     // monta a lista
     if (is_array($lista) && count($lista)) {
         foreach ($lista as $registro) {
             $obj_ref_cod_serie = new clsPmieducarSerie($registro['ref_cod_serie']);
             $det_ref_cod_serie = $obj_ref_cod_serie->detalhe();
             $nm_serie = $det_ref_cod_serie['nm_serie'];
             $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']);
             $det_curso = $obj_curso->detalhe();
             $registro['ref_cod_curso'] = $det_curso['nm_curso'];
             $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_cod_escola']);
             $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
             $nm_escola = $det_ref_cod_escola['nome'];
             $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'];
             $lista_busca = array("<a href=\"educar_escola_serie_det.php?ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_serie={$registro["ref_cod_serie"]}\">{$nm_serie}</a>", "<a href=\"educar_escola_serie_det.php?ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_serie={$registro["ref_cod_serie"]}\">{$registro["ref_cod_curso"]}</a>");
             if ($nivel_usuario == 1) {
                 $lista_busca[] = "<a href=\"educar_escola_serie_det.php?ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_serie={$registro["ref_cod_serie"]}\">{$nm_escola}</a>";
                 $lista_busca[] = "<a href=\"educar_escola_serie_det.php?ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_serie={$registro["ref_cod_serie"]}\">{$registro["ref_cod_instituicao"]}</a>";
             } elseif ($nivel_usuario == 2) {
                 $lista_busca[] = "<a href=\"educar_escola_serie_det.php?ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_serie={$registro["ref_cod_serie"]}\">{$nm_escola}</a>";
             }
             $this->addLinhas($lista_busca);
         }
     }
     $this->addPaginador2("educar_escola_serie_lst.php", $total, $_GET, $this->nome, $this->limite);
     if ($obj_permissao->permissao_cadastra(585, $this->pessoa_logada, 7)) {
         $this->acao = "go(\"educar_escola_serie_cad.php\")";
         $this->nome_acao = "Novo";
     }
     $this->largura = "100%";
     $localizacao = new LocalizacaoSistema();
     $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "In&iacute;cio", "educar_index.php" => "i-Educar - Escola", "" => "Listagem de v&iacute;nculos entre escolas e s&eacute;ries"));
     $this->enviaLocalizacao($localizacao->montar());
 }