function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = "Matrículas Turma - Listagem"; foreach ($_GET as $var => $val) { // passa todos os valores obtidos no GET para atributos do objeto $this->{$var} = $val === "" ? null : $val; } $lista_busca = array("Ano", "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); $get_escola = true; $get_curso = true; // $get_escola_curso = true; $get_escola_curso_serie = true; $get_turma = true; $sem_padrao = true; include "include/pmieducar/educar_campo_lista.php"; if ($this->ref_cod_escola) { $this->ref_ref_cod_escola = $this->ref_cod_escola; } // Paginador $this->limite = 20; $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0; $obj_turma = new clsPmieducarTurma(); $obj_turma->setOrderby("nm_turma ASC"); $obj_turma->setLimite($this->limite, $this->offset); $lista = $obj_turma->lista3($this->ref_cod_turma, null, null, $this->ref_ref_cod_serie, $this->ref_ref_cod_escola, null, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, $this->ref_cod_curso, $this->ref_cod_instituicao); $total = $obj_turma->_total; // monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { /*if( class_exists( "clsPmieducarTurma" ) ) { $obj_ref_ref_cod_turma = new clsPmieducarTurma( $registro["cod_turma"] ); $det_ref_ref_cod_turma = $obj_ref_ref_cod_turma->detalhe(); $nm_turma = $det_ref_ref_cod_turma["nm_turma"]; } else { $registro["ref_cod_turma"] = "Erro na geracao"; echo "<!--\nErro\nClasse nao existente: clsPmieducarTurma\n-->"; } if( class_exists( "clsPmieducarSerie" ) ) { $obj_ref_cod_serie = new clsPmieducarSerie( $registro["ref_ref_cod_serie"] ); $det_ref_cod_serie = $obj_ref_cod_serie->detalhe(); $registro["ref_ref_cod_serie"] = $det_ref_cod_serie["nm_serie"]; } else { $registro["ref_cod_serie"] = "Erro na geracao"; echo "<!--\nErro\nClasse nao existente: clsPmieducarSerie\n-->"; } if( class_exists( "clsPmieducarCurso" ) ) { $obj_ref_cod_curso = new clsPmieducarCurso( $registro["ref_cod_curso"] ); $det_ref_cod_curso = $obj_ref_cod_curso->detalhe(); $registro["ref_cod_curso"] = $det_ref_cod_curso["nm_curso"]; } else { $registro["ref_cod_curso"] = "Erro na geracao"; echo "<!--\nErro\nClasse nao existente: clsPmieducarCurso\n-->"; } if( class_exists( "clsPmieducarInstituicao" ) ) { $obj_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] ); $obj_cod_instituicao_det = $obj_cod_instituicao->detalhe(); $registro["ref_cod_instituicao"] = $obj_cod_instituicao_det["nm_instituicao"]; } else { $registro["ref_cod_instituicao"] = "Erro na geração"; echo "<!--\nErro\nClasse não existente: clsPmieducarInstituicao\n-->"; }*/ if (class_exists("clsPmieducarEscola")) { $obj_ref_cod_escola = new clsPmieducarEscola($registro["ref_ref_cod_escola"]); $det_ref_cod_escola = $obj_ref_cod_escola->detalhe(); $registro["nm_escola"] = $det_ref_cod_escola["nome"]; } else { $registro["ref_ref_cod_escola"] = "Erro na geração"; echo "<!--\nErro\nClasse não existente: clsPmieducarEscola\n-->"; } $lista_busca = array("<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["ano"]}</a>", "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["nm_turma"]}</a>"); if ($registro["ref_ref_cod_serie"]) { $lista_busca[] = "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["nm_serie"]}</a>"; } else { $lista_busca[] = "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">-</a>"; } $lista_busca[] = "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["nm_curso"]}</a>"; if ($nivel_usuario == 1) { if ($registro["ref_ref_cod_escola"]) { $lista_busca[] = "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["nm_escola"]}</a>"; } else { $lista_busca[] = "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">-</a>"; } $lista_busca[] = "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["nm_instituicao"]}</a>"; } else { if ($nivel_usuario == 2) { if ($registro["ref_ref_cod_escola"]) { $lista_busca[] = "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["nm_escola"]}</a>"; } else { $lista_busca[] = "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">-</a>"; } } } $this->addLinhas($lista_busca); } } $this->addPaginador2("educar_matriculas_turma_lst.php", $total, $_GET, $this->nome, $this->limite); $this->largura = "100%"; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "educar_index.php" => "i-Educar - Escola", "" => "Listagem de turmas para enturmações")); $this->enviaLocalizacao($localizacao->montar()); }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = 'Selecione uma turma para enturmar ou remover a enturmação'; $this->ref_cod_matricula = $_GET['ref_cod_matricula']; if (!$this->ref_cod_matricula) { header('Location: educar_matricula_lst.php'); die; } $obj_matricula = new clsPmieducarMatricula($this->ref_cod_matricula); $det_matricula = $obj_matricula->detalhe(); $this->ref_cod_curso = $det_matricula['ref_cod_curso']; $this->ref_cod_serie = $det_matricula['ref_ref_cod_serie']; $this->ref_cod_escola = $det_matricula['ref_ref_cod_escola']; $this->ref_cod_turma = $_GET['ref_cod_turma']; $this->addCabecalhos(array('Turma', 'Enturmado')); // Busca dados da matricula $obj_ref_cod_matricula = new clsPmieducarMatricula(); $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula)); $obj_aluno = new clsPmieducarAluno(); $det_aluno = array_shift($obj_aluno->lista($detalhe_aluno['ref_cod_aluno'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1)); $obj_escola = new clsPmieducarEscola($this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); $det_escola = $obj_escola->detalhe(); if ($det_escola['nome']) { $this->campoRotulo('nm_escola', 'Escola', $det_escola['nome']); } $this->campoRotulo('nm_pessoa', 'Nome do Aluno', $det_aluno['nome_aluno']); // Filtros de foreign keys $opcoes = array('' => 'Selecione'); // Opções de turma $objTemp = new clsPmieducarTurma(); $lista = $objTemp->lista3(NULL, NULL, NULL, $this->ref_cod_serie, $this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_curso); if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { $opcoes[$registro['cod_turma']] = $registro['nm_turma']; } $this->exibirBotaoSubmit = false; } #$this->campoLista('ref_cod_turma_', 'Turma', $opcoes, $this->ref_cod_turma); // outros filtros $this->campoOculto('ref_cod_matricula', $this->ref_cod_matricula); $this->campoOculto('ref_cod_serie', ''); $this->campoOculto('ref_cod_turma', ''); $this->campoOculto('ref_cod_escola', ''); // Paginador $this->limite = 20; $this->offset = $_GET['pagina_' . $this->nome] ? $_GET['pagina_' . $this->nome] * $this->limite - $this->limite : 0; $obj_matricula_turma = new clsPmieducarTurma(); $obj_matricula_turma->setOrderby('data_cadastro ASC'); $obj_matricula_turma->setLimite($this->limite, $this->offset); $lista = $obj_matricula_turma->lista3($this->ref_cod_turma, NULL, NULL, $this->ref_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, $this->ref_cod_curso, NULL, NULL, NULL, NULL, NULL, NULL, TRUE); if (is_numeric($this->ref_cod_serie) && is_numeric($this->ref_cod_curso) && is_numeric($this->ref_cod_escola)) { $sql = "\nSELECT\n t.cod_turma, t.ref_usuario_exc, t.ref_usuario_cad, t.ref_ref_cod_serie,\n t.ref_ref_cod_escola, t.ref_cod_infra_predio_comodo, t.nm_turma, t.sgl_turma,\n t.max_aluno, t.multiseriada, t.data_cadastro, t.data_exclusao, t.ativo,\n t.ref_cod_turma_tipo, t.hora_inicial, t.hora_final, t.hora_inicio_intervalo,\n t.hora_fim_intervalo, t.ref_cod_regente, t.ref_cod_instituicao_regente,\n t.ref_cod_instituicao, t.ref_cod_curso, t.ref_ref_cod_serie_mult,\n t.ref_ref_cod_escola_mult\nFROM\n pmieducar.turma t\nWHERE\n t.ref_ref_cod_serie_mult = {$this->ref_cod_serie}\n AND t.ref_ref_cod_escola={$this->ref_cod_escola}\n AND t.ativo = '1'\n AND t.ref_ref_cod_escola = '{$this->ref_cod_escola}'"; $db = new clsBanco(); $db->Consulta($sql); $lista_aux = array(); while ($db->ProximoRegistro()) { $lista_aux[] = $db->Tupla(); } if (is_array($lista_aux) && count($lista_aux)) { if (is_array($lista) && count($lista)) { $lista = array_merge($lista, $lista_aux); } else { $lista = $lista_aux; } } $total = count($lista); } else { $total = $obj_matricula_turma->_total; } $enturmacoesMatricula = new clsPmieducarMatriculaTurma(); $enturmacoesMatricula = $enturmacoesMatricula->lista3($this->ref_cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); $turmasThisSerie = $lista; // lista turmas disponiveis para enturmacao, somente lista as turmas sem enturmacao foreach ($turmasThisSerie as $turma) { $turmaHasEnturmacao = false; foreach ($enturmacoesMatricula as $enturmacao) { if (!$turmaHasEnturmacao && $turma['cod_turma'] == $enturmacao['ref_cod_turma']) { $turmaHasEnturmacao = true; } } if ($turmaHasEnturmacao) { $enturmado = "Sim"; } else { $enturmado = "Não"; } $script = sprintf('onclick="enturmar(\'%s\',\'%s\',\'%s\',\'%s\');"', $this->ref_cod_escola, $turma['ref_ref_cod_serie'], $this->ref_cod_matricula, $turma['cod_turma']); $this->addLinhas(array(sprintf('<a href="#" %s>%s</a>', $script, $turma['nm_turma']), $enturmado)); } $this->addPaginador2("educar_matricula_turma_lst.php", $total, $_GET, $this->nome, $this->limite); $obj_permissoes = new clsPermissoes(); $this->array_botao[] = 'Voltar'; $this->array_botao_url[] = "educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}"; $this->largura = '100%'; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "educar_index.php" => "i-Educar - Escola", "" => "Listagem de enturmações da matrícula")); $this->enviaLocalizacao($localizacao->montar()); }