function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Faltas/Notas Aluno - Listagem";
     // Passa todos os valores obtidos no GET para atributos do objeto
     foreach ($_GET as $var => $val) {
         $this->{$var} = $val === '' ? NULL : $val;
     }
     $lista_busca = array('Aluno', 'Matrícula', 'Turma', 'Sé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ção';
     } else {
         if ($nivel_usuario == 2) {
             $lista_busca[] = 'Escola';
         }
     }
     $this->addCabecalhos($lista_busca);
     $this->campoTexto('nm_aluno', 'Aluno', $this->nm_aluno, 30, 255, FALSE, FALSE, FALSE, '', "<img border=\"0\" onclick=\"pesquisa_aluno();\" id=\"ref_cod_aluno_lupa\" name=\"ref_cod_aluno_lupa\" src=\"imagens/lupa.png\"\\/>", '', '', TRUE);
     $this->campoOculto('ref_cod_aluno', $this->ref_cod_aluno);
     $get_escola = TRUE;
     $get_curso = TRUE;
     $sem_padrao = TRUE;
     $get_escola_curso_serie = TRUE;
     $get_turma = TRUE;
     include 'include/pmieducar/educar_campo_lista.php';
     if ($this->ref_cod_escola) {
         $this->ref_ref_cod_escola = $this->ref_cod_escola;
     }
     $opcoes = array('' => 'Selecione', 1 => 'Aprovado', 2 => 'Reprovado', 3 => 'Em Andamento');
     $this->campoLista('aprovado', 'Situa&ccedil;&atilde;o', $opcoes, $this->aprovado, '', '', '', '', FALSE, FALSE);
     // Paginador
     $this->limite = 20;
     $this->offset = $_GET['pagina_' . $this->nome] ? $_GET['pagina_' . $this->nome] * $this->limite - $this->limite : 0;
     $obj_nota_aluno = new clsPmieducarMatriculaTurma();
     $obj_nota_aluno->setOrderby('ref_cod_matricula ASC');
     $obj_nota_aluno->setLimite($this->limite, $this->offset);
     $aparece = TRUE;
     $lista = $obj_nota_aluno->lista($this->ref_cod_matricula, $this->ref_cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_ref_cod_serie, $this->ref_cod_curso, $this->ref_ref_cod_escola, $this->ref_cod_instituicao, $this->ref_cod_aluno, NULL, $this->aprovado, NULL, NULL, NULL, TRUE, FALSE, NULL, 1, TRUE, TRUE, NULL, NULL, NULL, NULL, $aparece);
     $total = $obj_nota_aluno->_total;
     // monta a lista
     if (is_array($lista) && count($lista)) {
         $ref_cod_serie = '';
         $nm_serie = '';
         $ref_cod_escola = '';
         $nm_escola = '';
         foreach ($lista as $registro) {
             if ($registro['ref_ref_cod_serie'] != '' && $ref_cod_serie != $registro['ref_ref_cod_serie']) {
                 $obj_ref_cod_serie = new clsPmieducarSerie($registro['ref_ref_cod_serie']);
                 $det_ref_cod_serie = $obj_ref_cod_serie->detalhe();
                 $ref_cod_serie = $registro['ref_ref_cod_serie'];
                 $nm_serie = $det_ref_cod_serie['nm_serie'];
             } elseif ($registro['ref_ref_cod_serie'] == '') {
                 $ref_cod_serie = '';
                 $nm_serie = '';
             }
             if ($registro['ref_ref_cod_escola'] != '' && $ref_cod_escola != $registro['ref_ref_cod_escola']) {
                 $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']);
                 $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
                 $ref_cod_escola = $registro['ref_ref_cod_escola'];
                 $nm_escola = $det_ref_cod_escola['nome'];
             } elseif ($registro['ref_ref_cod_escola'] == '') {
                 $ref_cod_escola = '';
                 $nm_escola = '';
             }
             // Itens a mostrar na listagem de alunos
             $lista_busca = array();
             // Variáveis para a geração do link
             $path = '/module/Avaliacao/boletim';
             $params = array('query' => array('matricula' => $registro['ref_cod_matricula']));
             // Instância de UrlHelper
             $url = CoreExt_View_Helper_UrlHelper::getInstance();
             $lista_busca[] = $url->l($registro['nome'], $path, $params);
             $lista_busca[] = $url->l($registro['ref_cod_matricula'], $path, $params);
             $lista_busca[] = $url->l($registro['nm_turma'], $path, $params);
             $lista_busca[] = $url->l($registro['ref_ref_cod_serie'] ? $registro['ref_ref_cod_serie'] : '', $path, $params);
             $lista_busca[] = $url->l($registro['nm_curso'], $path, $params);
             if ($nivel_usuario == 1) {
                 $lista_busca[] = $url->l($registro['ref_ref_cod_escola'] ? $nm_escola : '-', $path, $params);
                 $lista_busca[] = $url->l($registro['nm_instituicao'], $path, $params);
             } elseif ($nivel_usuario == 2) {
                 $lista_busca[] = $url->l($registro['ref_ref_cod_escola'] ? $registro['ref_ref_cod_escola'] : '-', $path, $params);
             }
             $this->addLinhas($lista_busca);
         }
     }
     $this->addPaginador2('educar_falta_nota_aluno_lst.php', $total, $_GET, $this->nome, $this->limite);
     $this->largura = '100%';
 }