function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = "Turma Tipo - Detalhe"; $this->cod_turma_tipo = $_GET["cod_turma_tipo"]; $tmp_obj = new clsPmieducarTurmaTipo($this->cod_turma_tipo); $registro = $tmp_obj->detalhe(); if (!$registro) { header("location: educar_turma_tipo_lst.php"); die; } if (class_exists("clsPmieducarInstituicao")) { $obj_instituicao = new clsPmieducarInstituicao($registro["ref_cod_instituicao"]); $obj_instituicao_det = $obj_instituicao->detalhe(); $registro["ref_cod_instituicao"] = $obj_instituicao_det['nm_instituicao']; } else { $cod_instituicao = "Erro na geração"; echo "<!--\nErro\nClasse não existente: clsPmieducarInstituicao\n-->"; } $obj_permissao = new clsPermissoes(); $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada); if ($nivel_usuario == 1) { if ($registro["ref_cod_instituicao"]) { $this->addDetalhe(array("Instituição", "{$registro["ref_cod_instituicao"]}")); } } if ($registro["nm_tipo"]) { $this->addDetalhe(array("Turma Tipo", "{$registro["nm_tipo"]}")); } if ($registro["sgl_tipo"]) { $this->addDetalhe(array("Sigla", "{$registro["sgl_tipo"]}")); } $obj_permissao = new clsPermissoes(); if ($obj_permissao->permissao_cadastra(570, $this->pessoa_logada, 7)) { $this->url_novo = "educar_turma_tipo_cad.php"; $this->url_editar = "educar_turma_tipo_cad.php?cod_turma_tipo={$registro["cod_turma_tipo"]}"; } $this->url_cancelar = "educar_turma_tipo_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 tipo de turma")); $this->enviaLocalizacao($localizacao->montar()); }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = "Turma Tipo - Detalhe"; $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet"); $this->cod_turma_tipo = $_GET["cod_turma_tipo"]; $tmp_obj = new clsPmieducarTurmaTipo($this->cod_turma_tipo); $registro = $tmp_obj->detalhe(); if (!$registro) { header("location: educar_turma_tipo_lst.php"); die; } if (class_exists("clsPmieducarInstituicao")) { $obj_instituicao = new clsPmieducarInstituicao($registro["ref_cod_instituicao"]); $obj_instituicao_det = $obj_instituicao->detalhe(); $registro["ref_cod_instituicao"] = $obj_instituicao_det['nm_instituicao']; } else { $cod_instituicao = "Erro na geração"; echo "<!--\nErro\nClasse não existente: clsPmieducarInstituicao\n-->"; } $obj_permissao = new clsPermissoes(); $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada); if ($nivel_usuario == 1) { if ($registro["ref_cod_instituicao"]) { $this->addDetalhe(array("Instituição", "{$registro["ref_cod_instituicao"]}")); } } if ($registro["nm_tipo"]) { $this->addDetalhe(array("Turma Tipo", "{$registro["nm_tipo"]}")); } if ($registro["sgl_tipo"]) { $this->addDetalhe(array("Sigla", "{$registro["sgl_tipo"]}")); } $obj_permissao = new clsPermissoes(); if ($obj_permissao->permissao_cadastra(570, $this->pessoa_logada, 7)) { $this->url_novo = "educar_turma_tipo_cad.php"; $this->url_editar = "educar_turma_tipo_cad.php?cod_turma_tipo={$registro["cod_turma_tipo"]}"; } $this->url_cancelar = "educar_turma_tipo_lst.php"; $this->largura = "100%"; }
function Gerar() { if ($_POST) { foreach ($_POST as $campo => $val) { $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val; } } $this->campoOculto('cod_turma', $this->cod_turma); // foreign keys $obrigatorio = FALSE; $instituicao_obrigatorio = TRUE; $escola_curso_obrigatorio = TRUE; $curso_obrigatorio = TRUE; $get_escola = TRUE; $get_escola_curso_serie = FALSE; $sem_padrao = TRUE; $get_curso = TRUE; $bloqueia = false; $anoVisivel = false; if (isset($this->ano) || !is_numeric($this->cod_turma)) { $anoVisivel = true; } if (!isset($this->cod_turma)) { $bloqueia = false; } else { if (is_numeric($this->cod_turma)) { $obj_matriculas_turma = new clsPmieducarMatriculaTurma(); $obj_matriculas_turma->setOrderby('nome_aluno'); $lst_matriculas_turma = $obj_matriculas_turma->lista(NULL, $this->cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, array(1, 2, 3), NULL, NULL, NULL, NULL, TRUE, NULL, 1, TRUE); if (is_array($lst_matriculas_turma) && count($lst_matriculas_turma) > 0) { $bloqueia = true; } } } $desabilitado = $bloqueia; include 'include/pmieducar/educar_campo_lista.php'; if ($this->ref_cod_escola) { $this->ref_ref_cod_escola = $this->ref_cod_escola; } $opcoes_serie = array('' => 'Selecione'); // Editar if ($this->ref_cod_curso) { $obj_serie = new clsPmieducarSerie(); $obj_serie->setOrderby('nm_serie ASC'); $lst_serie = $obj_serie->lista(NULL, NULL, NULL, $this->ref_cod_curso, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if (is_array($lst_serie) && count($lst_serie)) { foreach ($lst_serie as $serie) { $opcoes_serie[$serie['cod_serie']] = $serie['nm_serie']; } } } if ($bloqueia) { $this->campoOculto('serie_param', $this->serie_param = $this->ref_ref_cod_serie); $this->campoOculto('escola_param', $this->escola_param = $this->ref_cod_escola); } $this->campoLista('ref_ref_cod_serie', 'Série', $opcoes_serie, $this->ref_ref_cod_serie, '', FALSE, '', NULL, $bloqueia); // o campo ano somente é exibido para turmas novas ou cadastradas após inclusão deste campo. if ($anoVisivel) { $this->inputsHelper()->dynamic('anoLetivo', array('disabled' => $bloqueia)); if ($bloqueia) { $this->inputsHelper()->hidden('ano_hidden', array('value' => $this->ano)); } } // Infra prédio cômodo $opcoes = array('' => 'Selecione'); // Editar if ($this->ref_ref_cod_escola) { $obj_infra_predio = new clsPmieducarInfraPredio(); $obj_infra_predio->setOrderby('nm_predio ASC'); $lst_infra_predio = $obj_infra_predio->lista(NULL, NULL, NULL, $this->ref_ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if (is_array($lst_infra_predio) && count($lst_infra_predio)) { foreach ($lst_infra_predio as $predio) { $obj_infra_predio_comodo = new clsPmieducarInfraPredioComodo(); $lst_infra_predio_comodo = $obj_infra_predio_comodo->lista(NULL, NULL, NULL, NULL, $predio['cod_infra_predio'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if (is_array($lst_infra_predio_comodo) && count($lst_infra_predio_comodo)) { foreach ($lst_infra_predio_comodo as $comodo) { $opcoes[$comodo['cod_infra_predio_comodo']] = $comodo['nm_comodo']; } } } } } $this->campoLista('ref_cod_infra_predio_comodo', 'Sala', $opcoes, $this->ref_cod_infra_predio_comodo, NULL, NULL, NULL, NULL, NULL, FALSE); $array_servidor = array('' => 'Selecione um servidor'); if ($this->ref_cod_regente) { $obj_pessoa = new clsPessoa_($this->ref_cod_regente); $det = $obj_pessoa->detalhe(); $array_servidor[$this->ref_cod_regente] = $det['nome']; } $this->campoListaPesq('ref_cod_regente', 'Professor/Regente', $array_servidor, $this->ref_cod_regente, '', '', FALSE, '', '', NULL, NULL, '', TRUE, FALSE, FALSE); // Turma tipo $opcoes = array('' => 'Selecione'); // Editar if ($this->ref_cod_instituicao) { $objTemp = new clsPmieducarTurmaTipo(); $objTemp->setOrderby('nm_tipo ASC'); $lista = $objTemp->lista(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_turma_tipo']] = $registro['nm_tipo']; } } } $this->campoLista('ref_cod_turma_tipo', 'Tipo de Turma', $opcoes, $this->ref_cod_turma_tipo, '', FALSE, '', NULL); $this->campoTexto('nm_turma', 'Turma', $this->nm_turma, 30, 255, TRUE); $this->campoTexto('sgl_turma', 'Sigla', $this->sgl_turma, 15, 15, FALSE); $this->campoNumero('max_aluno', 'Máximo de Alunos', $this->max_aluno, 3, 3, TRUE); $this->inputsHelper()->date('data_fechamento', array('required' => false, 'label' => 'Data de fechamento', 'value' => Portabilis_Date_Utils::pgSQLToBr($this->data_fechamento))); $ativo = isset($this->cod_turma) ? dbBool($this->visivel) : true; $this->campoCheck('visivel', 'Ativo', $ativo); $this->campoCheck('multiseriada', 'Multi-Seriada', $this->multiseriada, '', FALSE, FALSE); $this->campoLista('ref_ref_cod_serie_mult', 'Série', array('' => 'Selecione'), '', '', FALSE, '', '', '', FALSE); $this->campoOculto('ref_ref_cod_serie_mult_', $this->ref_ref_cod_serie_mult); $this->campoQuebra2(); // hora $this->campoHora('hora_inicial', 'Hora Inicial', $this->hora_inicial, FALSE); $this->campoHora('hora_final', 'Hora Final', $this->hora_final, FALSE); $this->campoHora('hora_inicio_intervalo', Portabilis_String_Utils::toLatin1('Hora Início Intervalo'), $this->hora_inicio_intervalo, FALSE); $this->campoHora('hora_fim_intervalo', 'Hora Fim Intervalo', $this->hora_fim_intervalo, FALSE); $this->inputsHelper()->turmaTurno(); // modelos boletim require_once 'Portabilis/Model/Report/TipoBoletim.php'; require_once 'Portabilis/Array/Utils.php'; $tiposBoletim = Portabilis_Model_Report_TipoBoletim::getInstance()->getEnums(); $tiposBoletim = Portabilis_Array_Utils::insertIn(null, "Selecione um modelo", $tiposBoletim); $this->campoLista('tipo_boletim', Portabilis_String_Utils::toLatin1('Modelo relatório boletim'), $tiposBoletim, $this->tipo_boletim); $this->campoQuebra2(); if ($this->ref_ref_cod_serie) { require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php'; require_once 'ComponenteCurricular/Model/AnoEscolarDataMapper.php'; require_once 'ComponenteCurricular/Model/TurmaDataMapper.php'; $disciplinas = ''; $conteudo = ''; // Instancia o mapper de componente curricular $mapper = new ComponenteCurricular_Model_ComponenteDataMapper(); // Instancia o mapper de ano escolar $anoEscolar = new ComponenteCurricular_Model_AnoEscolarDataMapper(); $lista = $anoEscolar->findComponentePorSerie($this->ref_ref_cod_serie); // Instancia o mapper de turma $componenteTurmaMapper = new ComponenteCurricular_Model_TurmaDataMapper(); $componentesTurma = array(); if (isset($this->cod_turma) && is_numeric($this->cod_turma)) { $componentesTurma = $componenteTurmaMapper->findAll(array(), array('turma' => $this->cod_turma)); } $componentes = array(); foreach ($componentesTurma as $componenteTurma) { $componentes[$componenteTurma->get('componenteCurricular')] = $componenteTurma; } unset($componentesTurma); $this->escola_serie_disciplina = array(); if (is_array($lista) && count($lista)) { $conteudo .= '<div style="margin-bottom: 10px;">'; $conteudo .= ' <span style="display: block; float: left; width: 250px;">Nome</span>'; $conteudo .= ' <span style="display: block; float: left; width: 100px;">' . Portabilis_String_Utils::toLatin1('Carga horária') . '</span>'; $conteudo .= ' <span style="display: block; float: left">' . Portabilis_String_Utils::toLatin1('Usar padrão do componente?') . '</span>'; $conteudo .= '</div>'; $conteudo .= '<br style="clear: left" />'; foreach ($lista as $registro) { $checked = ''; $usarComponente = FALSE; if (isset($componentes[$registro->id])) { $checked = 'checked="checked"'; } if (is_null($componentes[$registro->id]->cargaHoraria) || 0 == $componentes[$registro->id]->cargaHoraria) { $usarComponente = TRUE; } else { $cargaHoraria = $componentes[$registro->id]->cargaHoraria; } $cargaComponente = $registro->cargaHoraria; $conteudo .= '<div style="margin-bottom: 10px; float: left">'; $conteudo .= " <label style='display: block; float: left; width: 250px'><input type=\"checkbox\" {$checked} name=\"disciplinas[{$registro->id}]\" id=\"disciplinas[]\" value=\"{$registro->id}\">{$registro}</label>"; $conteudo .= " <label style='display: block; float: left; width: 100px;'><input type='text' name='carga_horaria[{$registro->id}]' value='{$cargaHoraria}' size='5' maxlength='7'></label>"; $conteudo .= " <label style='display: block; float: left'><input type='checkbox' name='usar_componente[{$registro->id}]' value='1' " . ($usarComponente == TRUE ? $checked : '') . ">({$cargaComponente} h)</label>"; $conteudo .= '</div>'; $conteudo .= '<br style="clear: left" />'; $cargaHoraria = ''; } $disciplinas = '<table cellspacing="0" cellpadding="0" border="0">'; $disciplinas .= sprintf('<tr align="left"><td>%s</td></tr>', $conteudo); $disciplinas .= '</table>'; } else { $disciplinas = Portabilis_String_Utils::toLatin1('A série/ano escolar não possui componentes curriculares cadastrados.'); } } $componentes = $help = array(); try { $componentes = App_Model_IedFinder::getEscolaSerieDisciplina($this->ref_ref_cod_serie, $this->ref_cod_escola); } catch (Exception $e) { } foreach ($componentes as $componente) { $help[] = sprintf('%s (%.0f h)', $componente->nome, $componente->cargaHoraria); } if (count($componentes)) { $help = '<ul><li>' . implode('</li><li>', $help) . '</li></ul>'; } else { $help = ''; } $label = 'Componentes curriculares:<br />' . '<strong>Observação:</strong> caso não defina os componentes<br />' . 'curriculares para a turma, esta usará a definição<br />' . 'da série/ano escolar da escola:' . '<span id="_escola_serie_componentes">%s</span>'; $label = sprintf($label, $help); $this->campoRotulo('disciplinas_', $label, "<div id='disciplinas'>{$disciplinas}</div>"); $this->campoQuebra2(); if ($_POST['turma_modulo']) { $this->turma_modulo = unserialize(urldecode($_POST['turma_modulo'])); } $qtd_modulo = count($this->turma_modulo) == 0 ? 1 : count($this->turma_modulo) + 1; if (is_numeric($this->cod_turma) && !$_POST) { $obj = new clsPmieducarTurmaModulo(); $registros = $obj->lista($this->cod_turma); if ($registros) { foreach ($registros as $campo) { $this->turma_modulo[$campo[$qtd_modulo]]['sequencial_'] = $campo['sequencial']; $this->turma_modulo[$campo[$qtd_modulo]]['ref_cod_modulo_'] = $campo['ref_cod_modulo']; $this->turma_modulo[$campo[$qtd_modulo]]['data_inicio_'] = dataFromPgToBr($campo['data_inicio']); $this->turma_modulo[$campo[$qtd_modulo]]['data_fim_'] = dataFromPgToBr($campo['data_fim']); $qtd_modulo++; } } } if ($_POST["ref_cod_modulo"] && $_POST["data_inicio"] && $_POST["data_fim"]) { $this->turma_modulo[$qtd_modulo]["sequencial_"] = $qtd_modulo; $this->turma_modulo[$qtd_modulo]["ref_cod_modulo_"] = $_POST["ref_cod_modulo"]; $this->turma_modulo[$qtd_modulo]["data_inicio_"] = $_POST["data_inicio"]; $this->turma_modulo[$qtd_modulo]["data_fim_"] = $_POST["data_fim"]; $qtd_modulo++; unset($this->ref_cod_modulo); unset($this->data_inicio); unset($this->data_fim); } $this->campoOculto("excluir_modulo", ""); $qtd_modulo = 1; unset($aux); if ($this->turma_modulo) { foreach ($this->turma_modulo as $campo) { if ($this->excluir_modulo == $campo['sequencial_']) { $this->turma_modulo[$campo['sequencial']] = NULL; $this->excluir_modulo = NULL; } else { $obj_modulo = new clsPmieducarModulo($campo['ref_cod_modulo_']); $det_modulo = $obj_modulo->detalhe(); $nm_tipo_modulo = $det_modulo['nm_tipo']; $this->campoTextoInv('ref_cod_modulo_' . $campo['sequencial_'], '', $nm_tipo_modulo, 30, 255, FALSE, FALSE, TRUE, '', '', '', '', 'ref_cod_modulo'); $this->campoTextoInv('data_inicio_' . $campo['sequencial_'], '', $campo['data_inicio_'], 10, 10, FALSE, FALSE, TRUE, '', '', '', '', ''); $this->campoTextoInv('data_fim_' . $campo['sequencial_'], '', $campo['data_fim_'], 10, 10, FALSE, FALSE, FALSE, '', "<a href='#' onclick=\"document.getElementById('excluir_modulo').value = '{$campo["sequencial_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", '', '', ''); $aux[$qtd_modulo]['sequencial_'] = $qtd_modulo; $aux[$qtd_modulo]['ref_cod_modulo_'] = $campo['ref_cod_modulo_']; $aux[$qtd_modulo]['data_inicio_'] = $campo['data_inicio_']; $aux[$qtd_modulo]['data_fim_'] = $campo['data_fim_']; $qtd_modulo++; } } unset($this->turma_modulo); $this->turma_modulo = $aux; } $this->campoOculto('turma_modulo', serialize($this->turma_modulo)); // Módulo // foreign keys $opcoes = array('' => 'Selecione'); // Editar if ($this->ref_cod_instituicao) { $objTemp = new clsPmieducarModulo(); $objTemp->setOrderby('nm_tipo ASC'); $lista = $objTemp->lista(NULL, 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_modulo']] = $registro['nm_tipo']; } } } $this->campoLista('ref_cod_modulo', Portabilis_String_utils::toLatin1('Módulo'), $opcoes, $this->ref_cod_modulo, NULL, NULL, NULL, NULL, NULL, FALSE); $this->campoData('data_inicio', Portabilis_String_utils::toLatin1('Data Início'), $this->data_inicio, FALSE); $this->campoData('data_fim', 'Data Fim', $this->data_fim, FALSE); $this->campoOculto('incluir_modulo', ''); $this->campoRotulo('bt_incluir_modulo', Portabilis_String_utils::toLatin1('Módulo'), "<a href='#' onclick=\"document.getElementById('incluir_modulo').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>"); $this->campoQuebra2(); if ($_POST['turma_dia_semana']) { $this->turma_dia_semana = unserialize(urldecode($_POST['turma_dia_semana'])); } if (is_numeric($this->cod_turma) && !$_POST) { $obj = new clsPmieducarTurmaDiaSemana(); $registros = $obj->lista(NULL, $this->cod_turma); if ($registros) { foreach ($registros as $campo) { $aux['dia_semana_'] = $campo['dia_semana']; $aux['hora_inicial_'] = $campo['hora_inicial']; $aux['hora_final_'] = $campo['hora_final']; $this->turma_dia_semana[] = $aux; } } } unset($aux); if ($_POST['dia_semana'] && $_POST['ds_hora_inicial'] && $_POST['ds_hora_final']) { $aux['dia_semana_'] = $_POST['dia_semana']; $aux['hora_inicial_'] = $_POST['ds_hora_inicial']; $aux['hora_final_'] = $_POST['ds_hora_final']; $this->turma_dia_semana[] = $aux; unset($this->dia_semana); unset($this->ds_hora_inicial); unset($this->ds_hora_final); } $this->campoOculto('excluir_dia_semana', ''); unset($aux); if ($this->turma_dia_semana) { foreach ($this->turma_dia_semana as $key => $dias_semana) { if ($this->excluir_dia_semana == $dias_semana['dia_semana_']) { unset($this->turma_dia_semana[$key]); unset($this->excluir_dia_semana); } else { $nm_dia_semana = $this->dias_da_semana[$dias_semana['dia_semana_']]; $this->campoTextoInv('dia_semana_' . $dias_semana['dia_semana_'], '', $nm_dia_semana, 8, 8, FALSE, FALSE, TRUE, '', '', '', '', 'dia_semana'); $this->campoTextoInv('hora_inicial_' . $dias_semana['dia_semana_'], '', $dias_semana['hora_inicial_'], 5, 5, FALSE, FALSE, TRUE, '', '', '', '', 'ds_hora_inicial_'); $this->campoTextoInv('hora_final_' . $dias_semana['dia_semana_'], '', $dias_semana['hora_final_'], 5, 5, FALSE, FALSE, FALSE, '', "<a href='#' onclick=\"document.getElementById('excluir_dia_semana').value = '{$dias_semana["dia_semana_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", '', '', 'ds_hora_final_'); $aux['dia_semana_'] = $dias_semana['dia_semana_']; $aux['hora_inicial_'] = $dias_semana['hora_inicial_']; $aux['hora_final_'] = $dias_semana['hora_final_']; } } } $this->campoOculto('turma_dia_semana', serialize($this->turma_dia_semana)); if (class_exists('clsPmieducarTurmaDiaSemana')) { $opcoes = $this->dias_da_semana; } else { echo '<!--\\nErro\\nClasse clsPmieducarTurmaDiaSemana não encontrada\\n-->'; $opcoes = array('' => Portabilis_String_utils::toLatin1('Erro na geração')); } $this->campoLista('dia_semana', 'Dia Semana', $opcoes, $this->dia_semana, NULL, false, '', '', false, false); $this->campoHora('ds_hora_inicial', 'Hora Inicial', $this->ds_hora_inicial, FALSE); $this->campoHora('ds_hora_final', 'Hora Final', $this->ds_hora_final, FALSE); $this->campoOculto('incluir_dia_semana', ''); $this->campoRotulo('bt_incluir_dia_semana', 'Dia Semana', "<a href='#' onclick=\"document.getElementById('incluir_dia_semana').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>"); $this->campoOculto('padrao_ano_escolar', $this->padrao_ano_escolar); $this->acao_enviar = 'valida()'; }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = 'Matricula Turma - Detalhe'; $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); foreach ($_POST as $key => $value) { $this->{$key} = $value; } if (!$this->ref_cod_matricula) { header('Location: educar_matricula_lst.php'); die; } $obj_mat_turma = new clsPmieducarMatriculaTurma(); $det_mat_turma = $obj_mat_turma->lista($this->ref_cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if ($det_mat_turma) { $det_mat_turma = array_shift($det_mat_turma); $obj_turma = new clsPmieducarTurma($det_mat_turma['ref_cod_turma']); $det_turma = $obj_turma->detalhe(); $this->nm_turma = $det_turma['nm_turma']; $this->ref_cod_turma_origem = $det_turma['cod_turma']; $this->sequencial = $det_mat_turma['sequencial']; } // #TODO adicionar ano da matricula atual #$tmp_obj = new clsPmieducarMatriculaTurma( ); #$lista = $tmp_obj->lista(NULL, $this->ref_cod_turma, NULL, NULL, NULL, NULL, # NULL, NULL, 1); #$total_alunos = 0; #if ($lista) { # $total_alunos = count($lista); #} $tmp_obj = new clsPmieducarTurma(); $lst_obj = $tmp_obj->lista($this->ref_cod_turma); $registro = array_shift($lst_obj); $db = new clsBanco(); $ano = $db->CampoUnico("select ano from pmieducar.matricula where cod_matricula = {$this->ref_cod_matricula}"); $sql = "select count(cod_matricula) as qtd_matriculas from pmieducar.matricula, pmieducar.matricula_turma, pmieducar.aluno where aluno.cod_aluno = matricula.ref_cod_aluno and ano = {$ano} and aluno.ativo = 1 and matricula.ativo = 1 and matricula_turma.ativo = matricula.ativo and cod_matricula = ref_cod_matricula and ref_cod_turma = {$this->ref_cod_turma}"; $total_alunos = $db->CampoUnico($sql); $this->ref_cod_curso = $registro['ref_cod_curso']; if (!$registro || !$_POST) { header('Location: educar_matricula_lst.php'); die; } // Tipo da turma $obj_ref_cod_turma_tipo = new clsPmieducarTurmaTipo($registro['ref_cod_turma_tipo']); $det_ref_cod_turma_tipo = $obj_ref_cod_turma_tipo->detalhe(); $registro['ref_cod_turma_tipo'] = $det_ref_cod_turma_tipo['nm_tipo']; // Código da instituição $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']; // Nome da escola $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']); $det_ref_cod_escola = $obj_ref_cod_escola->detalhe(); $registro['ref_ref_cod_escola'] = $det_ref_cod_escola['nome']; // Nome do curso $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']; $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar']; // Nome da série $obj_ser = new clsPmieducarSerie($registro['ref_ref_cod_serie']); $det_ser = $obj_ser->detalhe(); $registro['ref_ref_cod_serie'] = $det_ser['nm_serie']; // Matrícula $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($det_aluno = $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(); $this->addDetalhe(array('Nome do Aluno', $det_aluno['nome_aluno'])); $objTemp = new clsPmieducarTurma($this->ref_cod_turma); $det_turma = $objTemp->detalhe(); if ($registro['ref_ref_cod_escola']) { $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola'])); } if ($registro['ref_cod_curso']) { $this->addDetalhe(array('Curso', $registro['ref_cod_curso'])); } if ($registro['ref_ref_cod_serie']) { $this->addDetalhe(array('Série', $registro['ref_ref_cod_serie'])); } //(enturmações) turma atual $enturmacoes = new clsPmieducarMatriculaTurma(); $enturmacoes = $enturmacoes->lista($this->ref_cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); $this->possuiEnturmacao = !empty($enturmacoes); $this->possuiEnturmacaoTurmaDestino = false; $this->turmaOrigemMesmaDestino = false; $this->addDetalhe(array('<b>Turma selecionada</b>', '<b>' . $registro['nm_turma'] . '</b>')); $this->addDetalhe(array('Total de vagas', $registro['max_aluno'])); if (is_numeric($total_alunos)) { $this->addDetalhe(array('Alunos enturmados', $total_alunos)); $this->addDetalhe(array('Vagas disponíveis', $registro['max_aluno'] - $total_alunos)); } if ($this->possuiEnturmacao) { //se possui uma enturmacao mostra o nome, se mais de uma mostra select para selecionar if (count($enturmacoes) > 1) { $selectEnturmacoes = "<select id='ref_cod_turma_origem' class='obrigatorio'>"; $selectEnturmacoes .= "<option value=''>Selecione</option>"; foreach ($enturmacoes as $enturmacao) { if ($enturmacao['ref_cod_turma'] != $this->ref_cod_turma) { $selectEnturmacoes .= "<option value='{$enturmacao['ref_cod_turma']}'>{$enturmacao['nm_turma']}</option>"; } elseif (!$this->possuiEnturmacaoTurmaDestino) { $this->possuiEnturmacaoTurmaDestino = true; } } $selectEnturmacoes .= "</select>"; } else { if ($enturmacoes[0]['ref_cod_turma'] == $this->ref_cod_turma) { $this->possuiEnturmacaoTurmaDestino = true; $this->turmaOrigemMesmaDestino = true; } $selectEnturmacoes = "<input id='ref_cod_turma_origem' type='hidden' value = '{$enturmacoes[0]['ref_cod_turma']}'/>{$enturmacoes[0]['nm_turma']}"; } $this->addDetalhe(array('<b>Enturmação</b>', $selectEnturmacoes)); } if (!$this->possuiEnturmacaoTurmaDestino) { $this->addDetalhe(array('Data da enturmação', '<input onkeypress="formataData(this,event);" value="' . date('d/m/Y') . '" class="geral" type="text" name="data_enturmacao" id="data_enturmacao" size="9" maxlength="10"/>')); } $this->addDetalhe(array('-', sprintf(' <form name="formcadastro" method="post" action="educar_matricula_turma_cad.php"> <input type="hidden" name="ref_cod_matricula" value=""> <input type="hidden" name="ref_cod_serie" value=""> <input type="hidden" name="ref_cod_escola" value=""> <input type="hidden" name="ref_cod_turma_origem" value="%d"> <input type="hidden" name="ref_cod_turma_destino" value=""> <input type="hidden" name="data_enturmacao" value=""> <input type="hidden" name="sequencial" value="%d"> </form> ', $this->ref_cod_turma_origem, $this->sequencial))); if ($registro['max_aluno'] - $total_alunos <= 0) { $escolaSerie = $this->getEscolaSerie($det_ref_cod_escola['cod_escola'], $det_ser['cod_serie']); if ($escolaSerie['bloquear_enturmacao_sem_vagas'] != 1) { $msg = sprintf('Atenção! Turma sem vagas! Deseja continuar com a enturmação mesmo assim?'); $jsEnturmacao = sprintf('if (!confirm("%s")) return false;', $msg); } else { $msg = sprintf('Enturmação não pode ser realizada,\\n\\no limite de vagas da turma já foi atingido e para esta série e escola foi definido bloqueio de enturmação após atingir tal limite.'); $jsEnturmacao = sprintf('alert("%s"); return false;', $msg); } } else { $jsEnturmacao = 'if (!confirm("Confirma a enturmação?")) return false;'; } $script = sprintf(' <script type="text/javascript"> function enturmar(ref_cod_matricula, ref_cod_turma_destino, tipo){ document.formcadastro.ref_cod_turma_origem.value = ""; if(tipo == "transferir") { var turmaOrigemId = document.getElementById("ref_cod_turma_origem"); if (turmaOrigemId && turmaOrigemId.value) document.formcadastro.ref_cod_turma_origem.value = turmaOrigemId.value; else { alert("Por favor, selecione a enturmação a ser transferida."); return false; } } %s document.formcadastro.ref_cod_matricula.value = ref_cod_matricula; document.formcadastro.ref_cod_turma_destino.value = ref_cod_turma_destino; document.formcadastro.data_enturmacao.value = document.getElementById("data_enturmacao").value; document.formcadastro.submit(); } function removerEnturmacao(ref_cod_matricula, ref_cod_turma_destino) { if (! confirm("Confirma remoção da enturmação?")) return false; document.formcadastro.ref_cod_turma_origem.value = "remover-enturmacao-destino"; document.formcadastro.ref_cod_matricula.value = ref_cod_matricula; document.formcadastro.ref_cod_turma_destino.value = ref_cod_turma_destino; document.formcadastro.submit(); } </script>', $jsEnturmacao); print $script; $canCreate = new clsPermissoes(); $canCreate = $canCreate->permissao_cadastra(578, $this->pessoa_logada, 7); if ($this->possuiEnturmacaoTurmaDestino && $canCreate) { $this->array_botao = array('Remover (enturmação) da turma selecionada'); $this->array_botao_url_script = array("removerEnturmacao({$this->ref_cod_matricula}, {$this->ref_cod_turma})"); } if (!$this->turmaOrigemMesmaDestino && $canCreate) { //mover enturmação if ($this->possuiEnturmacao) { $this->array_botao[] = 'Transferir para turma selecionada'; $this->array_botao_url_script[] = "enturmar({$this->ref_cod_matricula}, {$this->ref_cod_turma}, \"transferir\")"; } //nova enturmação if (!$this->possuiEnturmacaoTurmaDestino && $canCreate) { $this->array_botao[] = 'Enturmar na turma selecionada'; $this->array_botao_url_script[] = "enturmar({$this->ref_cod_matricula}, {$this->ref_cod_turma}, \"nova\")"; } } $this->array_botao[] = 'Voltar'; $this->array_botao_url_script[] = "go(\"educar_matricula_turma_lst.php?ref_cod_matricula={$this->ref_cod_matricula}\");"; $this->largura = '100%'; }
function Excluir() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj = new clsPmieducarTurmaTipo($this->cod_turma_tipo, $this->pessoa_logada, null, null, null, null, null, 0); $excluiu = $obj->excluir(); if ($excluiu) { $this->mensagem .= "Exclusão efetuada com sucesso.<br>"; header("Location: educar_turma_tipo_lst.php"); die; return true; } $this->mensagem = "Exclusão não realizada.<br>"; echo "<!--\nErro ao excluir clsPmieducarTurmaTipo\nvalores obrigatórios\nif( is_numeric( {$this->cod_turma_tipo} ) && is_numeric( {$this->pessoa_logada} ) )\n-->"; return false; }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = 'Turma - Detalhe'; $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); $this->cod_turma = $_GET['cod_turma']; $tmp_obj = new clsPmieducarTurma(); $lst_obj = $tmp_obj->lista($this->cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, array('true', 'false')); $registro = array_shift($lst_obj); foreach ($registro as $key => $value) { $this->{$key} = $value; } if (!$registro) { header('Location: educar_turma_lst.php'); die; } if (class_exists('clsPmieducarTurmaTipo')) { $obj_ref_cod_turma_tipo = new clsPmieducarTurmaTipo($registro['ref_cod_turma_tipo']); $det_ref_cod_turma_tipo = $obj_ref_cod_turma_tipo->detalhe(); $registro['ref_cod_turma_tipo'] = $det_ref_cod_turma_tipo['nm_tipo']; } else { $registro['ref_cod_turma_tipo'] = 'Erro na geração'; } if (class_exists('clsPmieducarInfraPredioComodo')) { $obj_ref_cod_infra_predio_comodo = new clsPmieducarInfraPredioComodo($registro['ref_cod_infra_predio_comodo']); $det_ref_cod_infra_predio_comodo = $obj_ref_cod_infra_predio_comodo->detalhe(); $registro['ref_cod_infra_predio_comodo'] = $det_ref_cod_infra_predio_comodo['nm_comodo']; } else { $registro['ref_cod_infra_predio_comodo'] = 'Erro na geração'; } 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'; } if (class_exists('clsPmieducarEscola')) { $this->ref_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(); $registro['ref_ref_cod_escola'] = $det_ref_cod_escola['nome']; } else { $registro['ref_cod_escola'] = 'Erro na geração'; } 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']; $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar']; } else { $registro['ref_cod_curso'] = 'Erro na geração'; } if (class_exists('clsPmieducarSerie')) { $this->ref_ref_cod_serie = $registro['ref_ref_cod_serie']; $obj_ser = new clsPmieducarSerie($registro['ref_ref_cod_serie']); $det_ser = $obj_ser->detalhe(); $registro['ref_ref_cod_serie'] = $det_ser['nm_serie']; } else { $registro['ref_ref_cod_serie'] = 'Erro na geração'; } $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ção', $registro['ref_cod_instituicao'])); } } if ($nivel_usuario == 1 || $nivel_usuario == 2) { if ($registro['ref_ref_cod_escola']) { $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola'])); } } if ($registro['ref_cod_curso']) { $this->addDetalhe(array('Curso', $registro['ref_cod_curso'])); } if ($registro['ref_ref_cod_serie']) { $this->addDetalhe(array('Série', $registro['ref_ref_cod_serie'])); } if ($registro['ref_cod_regente']) { $obj_pessoa = new clsPessoa_($registro['ref_cod_regente']); $det = $obj_pessoa->detalhe(); $this->addDetalhe(array('Professor/Regente', $det['nome'])); } if ($registro['ref_cod_infra_predio_comodo']) { $this->addDetalhe(array('Sala', $registro['ref_cod_infra_predio_comodo'])); } if ($registro['ref_cod_turma_tipo']) { $this->addDetalhe(array('Tipo de Turma', $registro['ref_cod_turma_tipo'])); } if ($registro['nm_turma']) { $this->addDetalhe(array('Turma', $registro['nm_turma'])); } if ($registro['sgl_turma']) { $this->addDetalhe(array('Sigla', $registro['sgl_turma'])); } if ($registro['max_aluno']) { $this->addDetalhe(array('Máximo de Alunos', $registro['max_aluno'])); } $this->addDetalhe(array('Situação', dbBool($registro['visivel']) ? 'Ativo' : 'Desativo')); if ($registro['multiseriada'] == 1) { if ($registro['multiseriada'] == 1) { $registro['multiseriada'] = 'sim'; } else { $registro['multiseriada'] = 'não'; } $this->addDetalhe(array('Multi-Seriada', $registro['multiseriada'])); $obj_serie_mult = new clsPmieducarSerie($registro['ref_ref_cod_serie_mult']); $det_serie_mult = $obj_serie_mult->detalhe(); $this->addDetalhe(array('Série Multi-Seriada', $det_serie_mult['nm_serie'])); } if ($padrao_ano_escolar == 1) { if ($registro['hora_inicial']) { $registro['hora_inicial'] = date('H:i', strtotime($registro['hora_inicial'])); $this->addDetalhe(array('Hora Inicial', $registro['hora_inicial'])); } if ($registro['hora_final']) { $registro['hora_final'] = date('H:i', strtotime($registro['hora_final'])); $this->addDetalhe(array('Hora Final', $registro['hora_final'])); } if ($registro['hora_inicio_intervalo']) { $registro['hora_inicio_intervalo'] = date('H:i', strtotime($registro['hora_inicio_intervalo'])); $this->addDetalhe(array('Hora Início Intervalo', $registro['hora_inicio_intervalo'])); } if ($registro['hora_fim_intervalo']) { $registro['hora_fim_intervalo'] = date('H:i', strtotime($registro['hora_fim_intervalo'])); $this->addDetalhe(array('Hora Fim Intervalo', $registro['hora_fim_intervalo'])); } } elseif ($padrao_ano_escolar == 0) { $obj = new clsPmieducarTurmaModulo(); $obj->setOrderby('data_inicio ASC'); $lst = $obj->lista($this->cod_turma); if ($lst) { $tabela = ' <table> <tr align="center"> <td bgcolor="#A1B3BD"><b>Nome</b></td> <td bgcolor="#A1B3BD"><b>Data Início</b></td> <td bgcolor="#A1B3BD"><b>Data Fim</b></td> </tr>'; $cont = 0; foreach ($lst as $valor) { if ($cont % 2 == 0) { $color = ' bgcolor="#E4E9ED" '; } else { $color = ' bgcolor="#FFFFFF" '; } $obj_modulo = new clsPmieducarModulo($valor['ref_cod_modulo']); $det_modulo = $obj_modulo->detalhe(); $nm_modulo = $det_modulo['nm_tipo']; $valor['data_inicio'] = dataFromPgToBr($valor['data_inicio']); $valor['data_fim'] = dataFromPgToBr($valor['data_fim']); $tabela .= sprintf(' <tr> <td %s align=left>%s</td> <td %s align=left>%s</td> <td %s align=left>%s</td> </tr>', $color, $nm_modulo, $color, $valor['data_inicio'], $color, $valor['data_fim']); $cont++; } $tabela .= '</table>'; } if ($tabela) { $this->addDetalhe(array('Módulo', $tabela)); } $dias_da_semana = array('' => 'Selecione', 1 => 'Domingo', 2 => 'Segunda', 3 => 'Terça', 4 => 'Quarta', 5 => 'Quinta', 6 => 'Sexta', 7 => 'Sábado'); $obj = new clsPmieducarTurmaDiaSemana(); $lst = $obj->lista(NULL, $this->cod_turma); if ($lst) { $tabela1 = ' <table> <tr align="center"> <td bgcolor="#A1B3BD"><b>Nome</b></td> <td bgcolor="#A1B3BD"><b>Hora Inicial</b></td> <td bgcolor="#A1B3BD"><b>Hora Final</b></td> </tr>'; $cont = 0; foreach ($lst as $valor) { if ($cont % 2 == 0) { $color = ' bgcolor="#E4E9ED" '; } else { $color = ' bgcolor="#FFFFFF" '; } $valor['hora_inicial'] = date('H:i', strtotime($valor['hora_inicial'])); $valor['hora_final'] = date('H:i', strtotime($valor['hora_final'])); $tabela1 .= sprintf("\n <tr>\n <td %s align=left>%s</td>\n <td %s align=left>%s</td>\n <td %s align=left>%s</td>\n </tr>", $color, $dias_da_semana[$valor['dia_semana']], $color, $valor['hora_inicial'], $color, $valor['hora_final']); $cont++; } $tabela1 .= '</table>'; } if ($tabela1) { $this->addDetalhe(array('Dia da Semana', $tabela1)); } } // Recupera os componentes curriculares da turma $componentes = array(); try { $componentes = App_Model_IedFinder::getComponentesTurma($this->ref_ref_cod_serie, $this->ref_ref_cod_escola, $this->cod_turma); } catch (Exception $e) { } $tabela3 = ' <table> <tr align="center"> <td bgcolor="#A1B3BD"><b>Nome</b></td> <td bgcolor="#A1B3BD"><b>Carga horária</b></td> </tr>'; $cont = 0; foreach ($componentes as $componente) { $color = $cont++ % 2 == 0 ? ' bgcolor="#E4E9ED" ' : ' bgcolor="#FFFFFF" '; $tabela3 .= sprintf(' <tr> <td %s align="left">%s</td> <td %s align="center">%.0f h</td> </tr>', $color, $componente, $color, $componente->cargaHoraria); } $tabela3 .= '</table>'; $this->addDetalhe(array('Componentes curriculares', $tabela3)); if ($obj_permissoes->permissao_cadastra(586, $this->pessoa_logada, 7)) { $this->url_novo = 'educar_turma_cad.php'; $this->url_editar = 'educar_turma_cad.php?cod_turma=' . $registro['cod_turma']; } $this->url_cancelar = 'educar_turma_lst.php'; $this->largura = '100%'; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "educar_index.php" => "i-Educar - Escola", "" => "Detalhe da turma")); $this->enviaLocalizacao($localizacao->montar()); $this->array_botao[] = 'Reclassificar alunos alfabeticamente'; $this->array_botao_url_script[] = "if(confirm(\"Deseja realmente reclassificar os alunos alfabeticamente?\\nAo utilizar esta opção para esta turma, a ordenação dos alunos no diário e em relatórios que é controlada por ordem de chegada após a data de fechamento da turma (campo Data de fechamento), passará a ter o controle novamente alfabético, desconsiderando a data de fechamento.\"))reclassifica_matriculas({$registro['cod_turma']})"; Portabilis_View_Helper_Application::loadJQueryLib($this); $scripts = array('/modules/Portabilis/Assets/Javascripts/Utils.js', '/modules/Portabilis/Assets/Javascripts/ClientApi.js', '/modules/Cadastro/Assets/Javascripts/TurmaDet.js'); Portabilis_View_Helper_Application::loadJavascript($this, $scripts); }
function Novo() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj = new clsPmieducarTurmaTipo(null, null, $this->pessoa_logada, $this->nm_tipo, $this->sgl_tipo, null, null, 1, $this->ref_cod_instituicao); $cadastrou = $obj->cadastra(); if ($cadastrou) { // $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; // header( "Location: educar_turma_tipo_lst.php" ); echo "<script>\n\t\t\t\t\t\tif (parent.document.getElementById('ref_cod_turma_tipo').disabled)\n\t\t\t\t\t\t\tparent.document.getElementById('ref_cod_turma_tipo').options[0] = new Option('Selectione um tipo de turma', '', false, false);\n\t\t\t\t\t\tparent.document.getElementById('ref_cod_turma_tipo').options[parent.document.getElementById('ref_cod_turma_tipo').options.length] = new Option('{$this->nm_tipo}', '{$cadastrou}', false, false);\n\t\t\t\t\t\tparent.document.getElementById('ref_cod_turma_tipo').value = '{$cadastrou}';\n\t\t\t\t\t\tparent.document.getElementById('ref_cod_turma_tipo').disabled = false;\n\t\t\t\t\t\twindow.parent.fechaExpansivel('div_dinamico_'+(parent.DOM_divs.length-1));\n\t\t\t \t</script>"; die; return true; } $this->mensagem = "Cadastro não realizado.<br>"; echo "<!--\nErro ao cadastrar clsPmieducarTurmaTipo\nvalores obrigatórios\nis_numeric( {$this->ref_cod_instituicao} ) && is_numeric( {$this->pessoa_logada} ) && is_string( {$this->nm_tipo} ) && is_string( {$this->sgl_tipo} )\n-->"; return false; }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = 'Turma - Detalhe'; $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); $this->cod_turma = $_GET['cod_turma']; $tmp_obj = new clsPmieducarTurma(); $lst_obj = $tmp_obj->lista($this->cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, array('true', 'false')); $registro = array_shift($lst_obj); foreach ($registro as $key => $value) { $this->{$key} = $value; } if (!$registro) { header('Location: educar_turma_lst.php'); die; } if (class_exists('clsPmieducarTurmaTipo')) { $obj_ref_cod_turma_tipo = new clsPmieducarTurmaTipo($registro['ref_cod_turma_tipo']); $det_ref_cod_turma_tipo = $obj_ref_cod_turma_tipo->detalhe(); $registro['ref_cod_turma_tipo'] = $det_ref_cod_turma_tipo['nm_tipo']; } else { $registro['ref_cod_turma_tipo'] = 'Erro na geração'; } if (class_exists('clsPmieducarInfraPredioComodo')) { $obj_ref_cod_infra_predio_comodo = new clsPmieducarInfraPredioComodo($registro['ref_cod_infra_predio_comodo']); $det_ref_cod_infra_predio_comodo = $obj_ref_cod_infra_predio_comodo->detalhe(); $registro['ref_cod_infra_predio_comodo'] = $det_ref_cod_infra_predio_comodo['nm_comodo']; } else { $registro['ref_cod_infra_predio_comodo'] = 'Erro na geração'; } 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'; } if (class_exists('clsPmieducarEscola')) { $this->ref_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(); $registro['ref_ref_cod_escola'] = $det_ref_cod_escola['nome']; } else { $registro['ref_cod_escola'] = 'Erro na geração'; } 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']; $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar']; } else { $registro['ref_cod_curso'] = 'Erro na geração'; } if (class_exists('clsPmieducarSerie')) { $this->ref_ref_cod_serie = $registro['ref_ref_cod_serie']; $obj_ser = new clsPmieducarSerie($registro['ref_ref_cod_serie']); $det_ser = $obj_ser->detalhe(); $registro['ref_ref_cod_serie'] = $det_ser['nm_serie']; } else { $registro['ref_ref_cod_serie'] = 'Erro na geração'; } $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ção', $registro['ref_cod_instituicao'])); } } if ($nivel_usuario == 1 || $nivel_usuario == 2) { if ($registro['ref_ref_cod_escola']) { $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola'])); } } if ($registro['ref_cod_curso']) { $this->addDetalhe(array('Curso', $registro['ref_cod_curso'])); } if ($registro['ref_ref_cod_serie']) { $this->addDetalhe(array('Série', $registro['ref_ref_cod_serie'])); } if ($registro['ref_cod_regente']) { $obj_pessoa = new clsPessoa_($registro['ref_cod_regente']); $det = $obj_pessoa->detalhe(); $this->addDetalhe(array('Professor/Regente', $det['nome'])); } if ($registro['ref_cod_infra_predio_comodo']) { $this->addDetalhe(array('Sala', $registro['ref_cod_infra_predio_comodo'])); } if ($registro['ref_cod_turma_tipo']) { $this->addDetalhe(array('Tipo de Turma', $registro['ref_cod_turma_tipo'])); } if ($registro['nm_turma']) { $this->addDetalhe(array('Turma', $registro['nm_turma'])); } if ($registro['sgl_turma']) { $this->addDetalhe(array('Sigla', $registro['sgl_turma'])); } if ($registro['max_aluno']) { $this->addDetalhe(array('Máximo de Alunos', $registro['max_aluno'])); } $this->addDetalhe(array('Situação', dbBool($registro['visivel']) ? 'Ativo' : 'Desativo')); if ($registro['multiseriada'] == 1) { if ($registro['multiseriada'] == 1) { $registro['multiseriada'] = 'sim'; } else { $registro['multiseriada'] = 'não'; } $this->addDetalhe(array('Multi-Seriada', $registro['multiseriada'])); $obj_serie_mult = new clsPmieducarSerie($registro['ref_ref_cod_serie_mult']); $det_serie_mult = $obj_serie_mult->detalhe(); $this->addDetalhe(array('Série Multi-Seriada', $det_serie_mult['nm_serie'])); } if ($padrao_ano_escolar == 1) { if ($registro['hora_inicial']) { $registro['hora_inicial'] = date('H:i', strtotime($registro['hora_inicial'])); $this->addDetalhe(array('Hora Inicial', $registro['hora_inicial'])); } if ($registro['hora_final']) { $registro['hora_final'] = date('H:i', strtotime($registro['hora_final'])); $this->addDetalhe(array('Hora Final', $registro['hora_final'])); } if ($registro['hora_inicio_intervalo']) { $registro['hora_inicio_intervalo'] = date('H:i', strtotime($registro['hora_inicio_intervalo'])); $this->addDetalhe(array('Hora Início Intervalo', $registro['hora_inicio_intervalo'])); } if ($registro['hora_fim_intervalo']) { $registro['hora_fim_intervalo'] = date('H:i', strtotime($registro['hora_fim_intervalo'])); $this->addDetalhe(array('Hora Fim Intervalo', $registro['hora_fim_intervalo'])); } } elseif ($padrao_ano_escolar == 0) { $obj = new clsPmieducarTurmaModulo(); $obj->setOrderby('data_inicio ASC'); $lst = $obj->lista($this->cod_turma); if ($lst) { $tabela = ' <table> <tr align="center"> <td bgcolor="#A1B3BD"><b>Nome</b></td> <td bgcolor="#A1B3BD"><b>Data Início</b></td> <td bgcolor="#A1B3BD"><b>Data Fim</b></td> </tr>'; $cont = 0; foreach ($lst as $valor) { if ($cont % 2 == 0) { $color = ' bgcolor="#E4E9ED" '; } else { $color = ' bgcolor="#FFFFFF" '; } $obj_modulo = new clsPmieducarModulo($valor['ref_cod_modulo']); $det_modulo = $obj_modulo->detalhe(); $nm_modulo = $det_modulo['nm_tipo']; $valor['data_inicio'] = dataFromPgToBr($valor['data_inicio']); $valor['data_fim'] = dataFromPgToBr($valor['data_fim']); $tabela .= sprintf(' <tr> <td %s align=left>%s</td> <td %s align=left>%s</td> <td %s align=left>%s</td> </tr>', $color, $nm_modulo, $color, $valor['data_inicio'], $color, $valor['data_fim']); $cont++; } $tabela .= '</table>'; } if ($tabela) { $this->addDetalhe(array('Módulo', $tabela)); } $dias_da_semana = array('' => 'Selecione', 1 => 'Domingo', 2 => 'Segunda', 3 => 'Terça', 4 => 'Quarta', 5 => 'Quinta', 6 => 'Sexta', 7 => 'Sábado'); $obj = new clsPmieducarTurmaDiaSemana(); $lst = $obj->lista(NULL, $this->cod_turma); if ($lst) { $tabela1 = ' <table> <tr align="center"> <td bgcolor="#A1B3BD"><b>Nome</b></td> <td bgcolor="#A1B3BD"><b>Hora Inicial</b></td> <td bgcolor="#A1B3BD"><b>Hora Final</b></td> </tr>'; $cont = 0; foreach ($lst as $valor) { if ($cont % 2 == 0) { $color = ' bgcolor="#E4E9ED" '; } else { $color = ' bgcolor="#FFFFFF" '; } $valor['hora_inicial'] = date('H:i', strtotime($valor['hora_inicial'])); $valor['hora_final'] = date('H:i', strtotime($valor['hora_final'])); $tabela1 .= sprintf("\n <tr>\n <td %s align=left>%s</td>\n <td %s align=left>%s</td>\n <td %s align=left>%s</td>\n </tr>", $color, $dias_da_semana[$valor['dia_semana']], $color, $valor['hora_inicial'], $color, $valor['hora_final']); $cont++; } $tabela1 .= '</table>'; } if ($tabela1) { $this->addDetalhe(array('Dia da Semana', $tabela1)); } } // Recupera os componentes curriculares da turma $componentes = array(); try { $componentes = App_Model_IedFinder::getComponentesTurma($this->ref_ref_cod_serie, $this->ref_ref_cod_escola, $this->cod_turma); } catch (Exception $e) { } $tabela3 = ' <table> <tr align="center"> <td bgcolor="#A1B3BD"><b>Nome</b></td> <td bgcolor="#A1B3BD"><b>Carga horária</b></td> </tr>'; $cont = 0; foreach ($componentes as $componente) { $color = $cont++ % 2 == 0 ? ' bgcolor="#E4E9ED" ' : ' bgcolor="#FFFFFF" '; $tabela3 .= sprintf(' <tr> <td %s align="left">%s</td> <td %s align="center">%.0f h</td> </tr>', $color, $componente, $color, $componente->cargaHoraria); } $tabela3 .= '</table>'; $this->addDetalhe(array('Componentes curriculares', $tabela3)); if ($obj_permissoes->permissao_cadastra(586, $this->pessoa_logada, 7)) { $this->url_novo = 'educar_turma_cad.php'; $this->url_editar = 'educar_turma_cad.php?cod_turma=' . $registro['cod_turma']; } $this->url_cancelar = 'educar_turma_lst.php'; $this->largura = '100%'; }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = "Turma Tipo - 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("Turma Tipo"); $obj_permissao = new clsPermissoes(); $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada); if ($nivel_usuario == 1) { $lista_busca[] = "Instituição"; } $this->addCabecalhos($lista_busca); include "include/pmieducar/educar_campo_lista.php"; // outros Filtros $this->campoTexto("nm_tipo", "Turma Tipo", $this->nm_tipo, 30, 255, false); // Paginador $this->limite = 20; $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0; $obj_turma_tipo = new clsPmieducarTurmaTipo(); $obj_turma_tipo->setOrderby("nm_tipo ASC"); $obj_turma_tipo->setLimite($this->limite, $this->offset); $lista = $obj_turma_tipo->lista(null, null, null, $this->nm_tipo, null, null, null, null, null, 1, $this->ref_cod_instituicao); $total = $obj_turma_tipo->_total; // monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { /*if( class_exists( "clsPmieducarEscola" ) ) { $obj_ref_cod_escola = new clsPmieducarEscola( $registro["ref_cod_escola"] ); $det_ref_cod_escola = $obj_ref_cod_escola->detalhe(); $registro["ref_cod_escola"] = $det_ref_cod_escola["nome"]; $registro["ref_cod_instituicao"] = $det_ref_cod_escola["ref_cod_instituicao"]; } else { $registro["ref_cod_escola"] = "Erro na geração"; echo "<!--\nErro\nClasse não existente: clsPmieducarEscola\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-->"; } $lista_busca = array("<a href=\"educar_turma_tipo_det.php?cod_turma_tipo={$registro["cod_turma_tipo"]}\">{$registro["nm_tipo"]}</a>"); if ($nivel_usuario == 1) { $lista_busca[] = "<a href=\"educar_turma_tipo_det.php?cod_turma_tipo={$registro["cod_turma_tipo"]}\">{$registro["ref_cod_instituicao"]}</a>"; } $this->addLinhas($lista_busca); } } $this->addPaginador2("educar_turma_tipo_lst.php", $total, $_GET, $this->nome, $this->limite); if ($obj_permissao->permissao_cadastra(570, $this->pessoa_logada, 7)) { $this->acao = "go(\"educar_turma_tipo_cad.php\")"; $this->nome_acao = "Novo"; } $this->largura = "100%"; }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = 'Matricula Turma - Detalhe'; $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); foreach ($_POST as $key => $value) { $this->{$key} = $value; } $obj_mat_turma = new clsPmieducarMatriculaTurma(); $det_mat_turma = $obj_mat_turma->lista($this->ref_cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if ($det_mat_turma) { $det_mat_turma = array_shift($det_mat_turma); $obj_turma = new clsPmieducarTurma($det_mat_turma['ref_cod_turma']); $det_turma = $obj_turma->detalhe(); $this->nm_turma = $det_turma['nm_turma']; $this->ref_cod_turma_origem = $det_turma['cod_turma']; $this->sequencial = $det_mat_turma['sequencial']; } $tmp_obj = new clsPmieducarMatriculaTurma(); $lista = $tmp_obj->lista(NULL, $this->ref_cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1); $total_alunos = 0; if ($lista) { $total_alunos = count($lista); } $tmp_obj = new clsPmieducarTurma(); $lst_obj = $tmp_obj->lista($this->ref_cod_turma); $registro = array_shift($lst_obj); $this->ref_cod_curso = $registro['ref_cod_curso']; if (!$registro || !$_POST) { header('Location: educar_matricula_lst.php'); die; } // Tipo da turma $obj_ref_cod_turma_tipo = new clsPmieducarTurmaTipo($registro['ref_cod_turma_tipo']); $det_ref_cod_turma_tipo = $obj_ref_cod_turma_tipo->detalhe(); $registro['ref_cod_turma_tipo'] = $det_ref_cod_turma_tipo['nm_tipo']; // Código da instituição $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']; // Nome da escola $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']); $det_ref_cod_escola = $obj_ref_cod_escola->detalhe(); $registro['ref_ref_cod_escola'] = $det_ref_cod_escola['nome']; // Nome do curso $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']; $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar']; // Nome da série $obj_ser = new clsPmieducarSerie($registro['ref_ref_cod_serie']); $det_ser = $obj_ser->detalhe(); $registro['ref_ref_cod_serie'] = $det_ser['nm_serie']; // Matrícula $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($det_aluno = $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(); $this->addDetalhe(array('Nome do Aluno', $det_aluno['nome_aluno'])); $objTemp = new clsPmieducarTurma($this->ref_cod_turma); $det_turma = $objTemp->detalhe(); if ($registro['ref_ref_cod_escola']) { $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola'])); } if ($registro['ref_cod_curso']) { $this->addDetalhe(array('Curso', $registro['ref_cod_curso'])); } if ($registro['ref_ref_cod_serie']) { $this->addDetalhe(array('Série', $registro['ref_ref_cod_serie'])); } $this->addDetalhe(array('Turma atual', $this->nm_turma)); if ($registro['nm_turma']) { $this->addDetalhe(array('Turma destino', $registro['nm_turma'])); } if ($registro['max_aluno']) { $this->addDetalhe(array('Total de vagas', $registro['max_aluno'])); } if (is_numeric($total_alunos)) { $this->addDetalhe(array('Alunos nesta turma', $total_alunos)); $this->addDetalhe(array('Vagas restantes', $registro['max_aluno'] - $total_alunos)); } $this->addDetalhe(array('-', sprintf(' <form name="formcadastro" method="post" action="educar_matricula_turma_cad.php"> <input type="hidden" name="ref_cod_matricula" value=""> <input type="hidden" name="ref_cod_serie" value=""> <input type="hidden" name="ref_cod_escola" value=""> <input type="hidden" name="ref_cod_turma_origem" value="%d"> <input type="hidden" name="ref_cod_turma_destino" value=""> <input type="hidden" name="sequencial" value="%d"> </form> ', $this->ref_cod_turma_origem, $this->sequencial))); if ($registro['max_aluno'] - $total_alunos <= 0) { $msg = sprintf('Atenção! Turma sem vagas! Deseja continuar com a enturmação mesmo assim?'); $valida = sprintf('if (!confirm("%s")) return false;', $msg); } else { $valida = 'if (!confirm("Confirmar a enturmação?")) return false;'; } $script = sprintf(' <script type="text/javascript"> function enturmar(ref_cod_matricula, ref_cod_turma_destino){ %s document.formcadastro.ref_cod_matricula.value = ref_cod_matricula; document.formcadastro.ref_cod_turma_destino.value = ref_cod_turma_destino; document.formcadastro.submit(); } </script>', $valida); print $script; $obj_permissoes = new clsPermissoes(); if ($obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7)) { $script = "enturmar({$this->ref_cod_matricula},{$this->ref_cod_turma})"; $this->array_botao = array('Transferir Aluno'); $this->array_botao_url_script = array($script); } $this->array_botao[] = 'Voltar'; $this->array_botao_url_script[] = "go(\"educar_matricula_turma_lst.php?ref_cod_matricula={$this->ref_cod_matricula}\");"; $this->largura = '100%'; }