function Editar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $this->data_fechamento = Portabilis_Date_Utils::brToPgSQL($this->data_fechamento); if (is_numeric($this->ano_hidden)) { $this->ano = $this->ano_hidden; } $this->ref_cod_instituicao_regente = $this->ref_cod_instituicao; if (isset($this->multiseriada)) { $this->multiseriada = 1; } else { $this->multiseriada = 0; } if (isset($this->visivel)) { $this->visivel = TRUE; } else { $this->visivel = FALSE; } // Não segue o padrão do curso if ($this->padrao_ano_escolar == 0) { $this->turma_modulo = unserialize(urldecode($this->turma_modulo)); $this->turma_dia_semana = unserialize(urldecode($this->turma_dia_semana)); if ($this->turma_modulo) { $obj = new clsPmieducarTurma($this->cod_turma, $this->pessoa_logada, NULL, $this->ref_ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_infra_predio_comodo, $this->nm_turma, $this->sgl_turma, $this->max_aluno, $this->multiseriada, NULL, NULL, 1, $this->ref_cod_turma_tipo, $this->hora_inicial, $this->hora_final, $this->hora_inicio_intervalo, $this->hora_fim_intervalo, $this->ref_cod_regente, $this->ref_cod_instituicao_regente, $this->ref_cod_instituicao, $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, $this->visivel, $this->turma_turno_id, $this->tipo_boletim, $this->ano, $this->data_fechamento); $editou = $obj->edita(); if ($editou) { $obj = new clsPmieducarTurmaModulo(); $excluiu = $obj->excluirTodos($this->cod_turma); if ($excluiu) { foreach ($this->turma_modulo as $campo) { $campo['data_inicio_'] = dataToBanco($campo['data_inicio_']); $campo['data_fim_'] = dataToBanco($campo['data_fim_']); $obj = new clsPmieducarTurmaModulo($this->cod_turma, $campo['ref_cod_modulo_'], $campo['sequencial_'], $campo['data_inicio_'], $campo['data_fim_']); $cadastrou1 = $obj->cadastra(); if (!$cadastrou1) { $this->mensagem = Portabilis_String_utils::toLatin1('Edição não realizada.'); echo "<!--\nErro ao editar clsPmieducarTurmaModulo\nvalores obrigatorios\nis_numeric( {$this->cod_turma} ) && is_numeric( {$campo["ref_cod_modulo_"]} ) \n-->"; return FALSE; } } } // Edita o dia da semana $obj = new clsPmieducarTurmaDiaSemana(NULL, $this->cod_turma); $excluiu = $obj->excluirTodos(); if ($excluiu) { foreach ($this->turma_dia_semana as $campo) { $obj = new clsPmieducarTurmaDiaSemana($campo["dia_semana_"], $this->cod_turma, $campo["hora_inicial_"], $campo["hora_final_"]); $cadastrou2 = $obj->cadastra(); if (!$cadastrou2) { $this->mensagem = Portabilis_String_utils::toLatin1('Edição não realizada.'); echo "<!--\nErro ao editar clsPmieducarTurmaDiaSemana\nvalores obrigatórios\nis_numeric( {$this->cod_turma} ) && is_numeric( {$campo["dia_semana_"]} ) \n-->"; return FALSE; } } } } else { $this->mensagem = Portabilis_String_utils::toLatin1('Edição não realizada.'); echo "<!--\nErro ao editar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( {$this->pessoa_logada} ) && is_numeric( {$this->ref_ref_cod_serie} ) && is_numeric( {$this->ref_cod_escola} ) && is_numeric( {$this->ref_cod_infra_predio_comodo} ) && is_string( {$this->nm_turma} ) && is_numeric( {$this->max_aluno} ) && is_numeric( {$this->multiseriada} ) && is_numeric( {$this->ref_cod_turma_tipo} )\n-->"; return FALSE; } } else { echo '<script type="text/javascript">alert(stringUtils.toUtf8("É necessário adicionar pelo menos 1 módulo!"))</script>'; $this->mensagem = Portabilis_String_utils::toLatin1('Edição não realizada.'); return FALSE; } } elseif ($this->padrao_ano_escolar == 1) { $obj = new clsPmieducarTurma($this->cod_turma, $this->pessoa_logada, NULL, $this->ref_ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_infra_predio_comodo, $this->nm_turma, $this->sgl_turma, $this->max_aluno, $this->multiseriada, NULL, NULL, 1, $this->ref_cod_turma_tipo, $this->hora_inicial, $this->hora_final, $this->hora_inicio_intervalo, $this->hora_fim_intervalo, $this->ref_cod_regente, $this->ref_cod_instituicao_regente, $this->ref_cod_instituicao, $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, $this->visivel, $this->turma_turno_id, $this->tipo_boletim, $this->ano, $this->data_fechamento); $editou = $obj->edita(); } $this->atualizaComponentesCurriculares(trim($this->serie_param) == '' ? $this->ref_ref_cod_serie : $this->serie_param, trim($this->escola_param) == '' ? $this->ref_cod_escola : $this->escola_param, $this->cod_turma, $this->disciplinas, $this->carga_horaria, $this->usar_componente); if ($editou) { $this->mensagem .= 'Edição efetuada com sucesso.'; header('Location: educar_turma_lst.php'); die; } else { $this->mensagem = Portabilis_String_utils::toLatin1('Edição não realizada.'); echo "<!--\nErro ao editar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( {$this->pessoa_logada} ) && is_numeric( {$this->ref_ref_cod_serie} ) && is_numeric( {$this->ref_cod_escola} ) && is_numeric( {$this->ref_cod_infra_predio_comodo} ) && is_string( {$this->nm_turma} ) && is_numeric( {$this->max_aluno} ) && is_numeric( {$this->multiseriada} ) && is_numeric( {$this->ref_cod_turma_tipo} )\n-->"; return FALSE; } }
function renderHTML() { if ($_POST) { foreach ($_POST as $key => $value) { $this->{$key} = $value; } } if (!$_POST) { echo '<script> alert("Erro ao gerar relatório!\\nNão existem dados!"); window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); </script>'; return true; } if ($this->ref_cod_escola) { $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); $det_escola = $obj_escola->detalhe(); $this->nm_escola = $det_escola['nome']; $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']); $det_instituicao = $obj_instituicao->detalhe(); $this->nm_instituicao = $det_instituicao['nm_instituicao']; } if (is_numeric($this->mes) && is_numeric($this->ano) && is_numeric($this->ref_cod_instituicao) && is_numeric($this->ref_cod_escola)) { $sql = ""; if (is_numeric($this->ref_cod_curso)) { $sql .= " AND m.ref_cod_curso = {$this->ref_cod_curso} "; } if (is_numeric($this->ref_ref_cod_serie)) { $sql .= " AND m.ref_ref_cod_serie = {$this->ref_ref_cod_serie} "; } if (is_numeric($this->ref_cod_turma)) { $sql .= " AND mt.ref_cod_turma = {$this->ref_cod_turma} "; } $primeiroDiaDoMes = mktime(0, 0, 0, $this->mes, 1, $this->ano); $NumeroDiasMes = date('t', $primeiroDiaDoMes); $ultimoDiaMes = date('d/m/Y', mktime(0, 0, 0, $this->mes, $NumeroDiasMes, $this->ano)); $ultimoDiaMes = dataToBanco($ultimoDiaMes, false); $primeiroDiaDoMes = date('d/m/Y', $primeiroDiaDoMes); $primeiroDiaDoMes = dataToBanco($primeiroDiaDoMes, false); // echo $primeiroDiaDoMes." ".$ultimoDiaMes; $sql = "SELECT \tm.cod_matricula, m.ref_cod_curso,\n\t\t\t\t\t \tm.ref_ref_cod_serie, mt.ref_cod_turma,\n\t\t\t\t\t\t(SELECT nome FROM cadastro.pessoa p\n\t\t\t\t\t\t\tWHERE a.cod_aluno = m.ref_cod_aluno AND a.ref_idpes = p.idpes) as nome,\n\t\t\t\t\t\t(SELECT to_char(data_nasc,'DD/MM/YYYY') FROM cadastro.fisica f\n\t\t\t\t\t\t\tWHERE a.cod_aluno = m.ref_cod_aluno AND a.ref_idpes = f.idpes) as dt_nasc,\n\t\t\t\t\t\ta.cod_aluno, a.analfabeto, s.nm_serie,c.nm_curso,t.nm_turma\n\t\t\t\t\t\tFROM pmieducar.matricula m, pmieducar.curso c,\n\t\t\t\t\t\t\tpmieducar.matricula_turma mt, pmieducar.aluno a,\n\t\t\t\t\t\t\tpmieducar.serie s, pmieducar.turma t WHERE\n\t\t\t\t\t\t\tm.ano = {$this->ano}\n\t\t\t\t\t\t\tAND s.cod_serie = m.ref_ref_cod_serie\n\t\t\t\t\t\t\tAND a.cod_aluno = m.ref_cod_aluno\n\t\t\t\t\t\t\tAND m.ref_ref_cod_escola = {$this->ref_cod_escola}\n\t\t\t\t\t\t\tAND m.ativo = 1\n\t\t\t\t\t\t\tAND m.ref_cod_curso = c.cod_curso\n\t\t\t\t\t\t\tAND c.ref_cod_instituicao = 1\n\t\t\t\t\t\t\tAND mt.ref_cod_matricula = m.cod_matricula\n\t\t\t\t\t\t\tAND mt.ativo = 1\n\t\t\t\t\t\t\tAND mt.ref_cod_turma = t.cod_turma\n\t\t\t\t\t\t\tAND m.aprovado IN (1,2,3)\n\t\t\t\t\t\t\tAND (m.data_cadastro <= '{$ultimoDiaMes}' OR (\n\t\t\t\t\t\t\t\t\ta.data_exclusao >= '{$primeiroDiaDoMes}' AND\n\t\t\t\t\t\t\t\t\ta.data_exclusao <= '{$ultimoDiaMes}')\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t{$sql}\n\t\t\t\t\t\tORDER BY m.ref_cod_curso, m.ref_ref_cod_serie, mt.ref_cod_turma, nome"; // AND (m.data_cadastro <= '2008-02-29 23:59:59' OR ( //a.data_exclusao >= '2008-02-01 23:59:59' AND a.data_exclusao <= '2008-02-29 23:59:59') //) // echo $sql."<br>"; $fonte = 'arial'; $corTexto = '#000000'; $db = new clsBanco(); $db->Consulta($sql); $registros = array(); while ($db->ProximoRegistro()) { $registros[] = $db->Tupla(); } $altura_linha = 23; $inicio_escrita_y = 175; if (is_array($registros) && count($registros)) { $this->pdf = new clsPDF("Levantamento Alfabetizados e Não Albetizados - {$this->ano}", "Levantamento Alfabetizados e Não Albetizados - {$this->ano}", "A4", "", false, false); $this->pdf->OpenPage(); $this->addCabecalho(); $this->novoCabecalho(); $total_serie_analfabeto = 0; $total_serie_nao_analfabeto = 0; $total_curso_analfabeto = 0; $total_curso_nao_analfabeto = 0; $total_geral_analfabeto = 0; $total_geral_nao_analfabeto = 0; $total_turma_analfabeto = 0; $total_turma_nao_analfabeto = 0; $primeira_vez_loop = true; $ref_cod_serie = 0; $ref_cod_curso = 0; $ref_cod_turma = 0; $altura = 20; $fonte = 'arial'; $corTexto = '#000000'; $left = 33; $tam_letra = 8; foreach ($registros as $registro) { $left = 33; if ($ref_cod_turma != $registro["ref_cod_turma"] && !$primeira_vez_loop) { $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura); $total = $total_turma_analfabeto + $total_turma_nao_analfabeto; $this->pdf->escreve_relativo("Total Turma {$nm_turma}", 33, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->escreve_relativo("{$total}", $left + 460, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->linha_relativa($left + 455, $this->page_y, 0, $altura); //analfabeto $this->pdf->escreve_relativo($total_turma_analfabeto, $left + 29 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); //nao analfabeto $this->pdf->escreve_relativo($total_turma_nao_analfabeto, $left + 6 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); $left = 33 + 60 + 70 + 268; $this->pdf->linha_relativa($left + 85, $this->page_y, 0, $altura); $left += 93; $this->pdf->linha_relativa($left + 18, $this->page_y, 0, $altura); $left = 33; $this->page_y += $altura; $total_turma_analfabeto = $total_turma_nao_analfabeto = 0; if ($this->page_y > $this->pdf->altura - 50) { $this->pdf->ClosePage(); $this->pdf->OpenPage(); $this->addCabecalho(); $this->novoCabecalho(); } } if ($ref_cod_serie != $registro["ref_ref_cod_serie"] && !$primeira_vez_loop) { $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura); $total = $total_serie_analfabeto + $total_serie_nao_analfabeto; $this->pdf->escreve_relativo("Total Série {$nm_serie}", 33, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->escreve_relativo("{$total}", $left + 460, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->linha_relativa($left + 455, $this->page_y, 0, $altura); //analfabeto $this->pdf->escreve_relativo($total_serie_analfabeto, $left + 29 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); //nao analfabeto $this->pdf->escreve_relativo($total_serie_nao_analfabeto, $left + 6 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); $left = 33 + 60 + 70 + 268; $this->pdf->linha_relativa($left + 85, $this->page_y, 0, $altura); $left += 93; $this->pdf->linha_relativa($left + 18, $this->page_y, 0, $altura); $left = 33; $this->page_y += $altura; $total_serie_analfabeto = $total_serie_nao_analfabeto = 0; if ($this->page_y > $this->pdf->altura - 50) { $this->pdf->ClosePage(); $this->pdf->OpenPage(); $this->addCabecalho(); $this->novoCabecalho(); } } if ($ref_cod_curso != $registro["ref_cod_curso"] && !$primeira_vez_loop) { $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura); $total = $total_curso_analfabeto + $total_curso_nao_analfabeto; $this->pdf->escreve_relativo("Total Curso {$nm_curso}", 33, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->escreve_relativo("{$total}", $left + 460, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->linha_relativa($left + 455, $this->page_y, 0, $altura); //analfabeto $this->pdf->escreve_relativo($total_curso_analfabeto, $left + 29 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); //nao analfabeto $this->pdf->escreve_relativo($total_curso_nao_analfabeto, $left + 6 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); $left = 33 + 60 + 70 + 268; $this->pdf->linha_relativa($left + 85, $this->page_y, 0, $altura); $left += 93; $this->pdf->linha_relativa($left + 18, $this->page_y, 0, $altura); $left = 33; $this->page_y += $altura; $total_curso_analfabeto = $total_curso_nao_analfabeto = 0; if ($this->page_y > $this->pdf->altura - 50) { $this->pdf->ClosePage(); $this->pdf->OpenPage(); $this->addCabecalho(); $this->novoCabecalho(); } } $ref_cod_serie = $registro["ref_ref_cod_serie"]; $ref_cod_curso = $registro["ref_cod_curso"]; $ref_cod_turma = $registro["ref_cod_turma"]; $nm_turma = $registro["nm_turma"]; $nm_serie = $registro["nm_serie"]; $nm_curso = $registro["nm_curso"]; $primeira_vez_loop = false; $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura); $this->pdf->escreve_relativo($registro["nm_turma"], $left, $this->page_y + 3, 50, $this->page_y, $fonte, $tam_letra, $corTexto, 'center'); $this->pdf->linha_relativa($left + 55, $this->page_y, 0, $altura); $this->pdf->escreve_relativo($registro["cod_aluno"], $left += 60, $this->page_y + 3, 60, 80, $fonte, $tam_letra, $corTexto, 'center'); $this->pdf->linha_relativa($left + 65, $this->page_y, 0, $altura); $this->pdf->escreve_relativo($registro["nome"], $left += 70, $this->page_y + 3, 535, 80, $fonte, $tam_letra, $corTexto, 'left'); $this->pdf->linha_relativa($left + 262, $this->page_y, 0, $altura); $this->pdf->escreve_relativo($registro["dt_nasc"], $left += 268, $this->page_y + 3, 70, 80, $fonte, $tam_letra, $corTexto, 'center'); $this->pdf->linha_relativa($left + 85, $this->page_y, 0, $altura); $left += 90; if ($registro["analfabeto"] == 1) { $this->pdf->escreve_relativo("X", $left + 29, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 2, $corTexto); $total_turma_analfabeto++; $total_serie_analfabeto++; $total_curso_analfabeto++; $total_geral_analfabeto++; } else { $this->pdf->escreve_relativo("X", $left + 6, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 2, $corTexto); $total_turma_nao_analfabeto++; $total_serie_nao_analfabeto++; $total_curso_nao_analfabeto++; $total_geral_nao_analfabeto++; } $left += 3; $this->pdf->linha_relativa($left + 18, $this->page_y, 0, $altura); $this->page_y += $altura; if ($this->page_y > $this->pdf->altura - 50) { $this->pdf->ClosePage(); $this->pdf->OpenPage(); $this->addCabecalho(); $this->novoCabecalho(); } } $ref_cod_turma = $ref_cod_serie = $ref_cod_curso = -1; if ($ref_cod_turma != $registro["ref_cod_turma"] && !$primeira_vez_loop) { $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura); $total = $total_turma_analfabeto + $total_turma_nao_analfabeto; $this->pdf->escreve_relativo("Total Turma {$nm_turma}", 33, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->escreve_relativo("{$total}", $left + 460, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->linha_relativa($left + 455, $this->page_y, 0, $altura); //analfabeto $this->pdf->escreve_relativo($total_turma_analfabeto, $left + 29 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); //nao analfabeto $this->pdf->escreve_relativo($total_turma_nao_analfabeto, $left + 6 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); $left = 33 + 60 + 70 + 268; $this->pdf->linha_relativa($left + 85, $this->page_y, 0, $altura); $left += 93; $this->pdf->linha_relativa($left + 18, $this->page_y, 0, $altura); $left = 33; $this->page_y += $altura; $total_turma_analfabeto = $total_turma_nao_analfabeto = 0; if ($this->page_y > $this->pdf->altura - 50) { $this->pdf->ClosePage(); $this->pdf->OpenPage(); $this->addCabecalho(); $this->novoCabecalho(); } } if ($ref_cod_serie != $registro["ref_ref_cod_serie"] && !$primeira_vez_loop) { $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura); $total = $total_serie_analfabeto + $total_serie_nao_analfabeto; $this->pdf->escreve_relativo("Total Série {$nm_serie}", 33, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->escreve_relativo("{$total}", $left + 460, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->linha_relativa($left + 455, $this->page_y, 0, $altura); //analfabeto $this->pdf->escreve_relativo($total_serie_analfabeto, $left + 29 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); //nao analfabeto $this->pdf->escreve_relativo($total_serie_nao_analfabeto, $left + 6 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); $left = 33 + 60 + 70 + 268; $this->pdf->linha_relativa($left + 85, $this->page_y, 0, $altura); $left += 93; $this->pdf->linha_relativa($left + 18, $this->page_y, 0, $altura); $left = 33; $this->page_y += $altura; $total_serie_analfabeto = $total_serie_nao_analfabeto = 0; if ($this->page_y > $this->pdf->altura - 50) { $this->pdf->ClosePage(); $this->pdf->OpenPage(); $this->addCabecalho(); $this->novoCabecalho(); } } if ($ref_cod_curso != $registro["ref_cod_curso"] && !$primeira_vez_loop) { $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura); $total = $total_curso_analfabeto + $total_curso_nao_analfabeto; $this->pdf->escreve_relativo("Total Curso {$nm_curso}", 33, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->escreve_relativo("{$total}", $left + 460, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->linha_relativa($left + 455, $this->page_y, 0, $altura); //analfabeto $this->pdf->escreve_relativo($total_curso_analfabeto, $left + 29 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); //nao analfabeto $this->pdf->escreve_relativo($total_curso_nao_analfabeto, $left + 6 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); $left = 33 + 60 + 70 + 268; $this->pdf->linha_relativa($left + 85, $this->page_y, 0, $altura); $left += 93; $this->pdf->linha_relativa($left + 18, $this->page_y, 0, $altura); $left = 33; $this->page_y += $altura; $total_curso_analfabeto = $total_curso_nao_analfabeto = 0; if ($this->page_y > $this->pdf->altura - 50) { $this->pdf->ClosePage(); $this->pdf->OpenPage(); $this->addCabecalho(); $this->novoCabecalho(); } } $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura); $total = $total_geral_analfabeto + $total_geral_nao_analfabeto; $this->pdf->escreve_relativo("Total Geral", 33, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->escreve_relativo("{$total}", $left + 460, $this->page_y + 3, 500, $this->page_y, $fonte, $tam_letra + 1, $corTexto, 'left'); $this->pdf->linha_relativa($left + 455, $this->page_y, 0, $altura); //analfabeto $this->pdf->escreve_relativo($total_geral_analfabeto, $left + 29 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); //nao analfabeto $this->pdf->escreve_relativo($total_geral_nao_analfabeto, $left + 6 + 485, $this->page_y + 3, 50, 50, $fonte, $tam_letra + 1, $corTexto); $left = 33 + 60 + 70 + 268; $this->pdf->linha_relativa($left + 85, $this->page_y, 0, $altura); $left += 93; $this->pdf->linha_relativa($left + 18, $this->page_y, 0, $altura); $left = 33; $this->page_y += $altura; $this->pdf->ClosePage(); $this->pdf->CloseFile(); $this->get_link = $this->pdf->GetLink(); echo "<script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=" . $this->get_link . "'}</script>"; echo "<html><center>Se o download não iniciar automaticamente <br /><a target='blank' href='" . $this->get_link . "' style='font-size: 16px; color: #000000; text-decoration: underline;'>clique aqui!</a><br><br>\n\t\t\t\t\t<span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>\n\n\t\t\t\t\tClique na Imagem para Baixar o instalador<br><br>\n\t\t\t\t\t<a href=\"http://www.adobe.com.br/products/acrobat/readstep2.html\" target=\"new\"><br><img src=\"imagens/acrobat.gif\" width=\"88\" height=\"31\" border=\"0\"></a>\n\t\t\t\t\t</span>\n\t\t\t\t\t</center>"; } else { echo '<script> alert("Erro ao gerar relatório!\\nNão dados a serem apresentados!"); window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); </script>'; return true; } } else { echo '<script> alert("Erro ao gerar relatório!\\nFalta dados!"); window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); </script>'; return true; } }
function Editar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(629, $this->pessoa_logada, 11, "educar_biblioteca_dados_lst.php"); $this->valor_multa = str_replace(".", "", $this->valor_multa); $this->valor_multa = str_replace(",", ".", $this->valor_multa); $this->valor_maximo_multa = str_replace(".", "", $this->valor_maximo_multa); $this->valor_maximo_multa = str_replace(",", ".", $this->valor_maximo_multa); $this->requisita_senha = is_null($this->requisita_senha) ? 0 : 1; $obj = new clsPmieducarBiblioteca($this->cod_biblioteca, null, null, null, $this->valor_multa, $this->max_emprestimo, $this->valor_maximo_multa, null, null, $this->requisita_senha, 1, $this->dias_espera, $this->tombo_automatico); $editou = $obj->edita(); if ($editou) { //-----------------------EDITA DISCIPLINA------------------------// $obj = new clsPmieducarBibliotecaDia($this->cod_biblioteca); $excluiu = $obj->excluirTodos(); if ($excluiu) { $this->biblioteca_dia_semana = unserialize(urldecode($this->biblioteca_dia_semana)); if ($this->biblioteca_dia_semana) { foreach ($this->biblioteca_dia_semana as $campo) { for ($i = 0; $i < sizeof($campo); $i++) { $obj = new clsPmieducarBibliotecaDia($this->cod_biblioteca, $campo[$i]); $cadastrou1 = $obj->cadastra(); if (!$cadastrou1) { $this->mensagem = "Edição não realizada.<br>"; echo "<!--\nErro ao editar clsPmieducarBibliotecaDia\nvalores obrigatórios\nis_numeric( {$this->cod_biblioteca} ) && is_numeric( {$campo[$i]} ) \n-->"; return false; } } } } } //-----------------------FIM EDITA DISCIPLINA------------------------// //-----------------------EDITA FERIADO------------------------// $obj = new clsPmieducarBibliotecaFeriados(); $excluiu = $obj->excluirTodos($this->cod_biblioteca); if ($excluiu) { $this->biblioteca_feriado = unserialize(urldecode($this->biblioteca_feriado)); if ($this->biblioteca_feriado) { foreach ($this->biblioteca_feriado as $feriado) { $feriado["data_feriado_"] = dataToBanco($feriado["data_feriado_"]); $obj = new clsPmieducarBibliotecaFeriados(null, $this->cod_biblioteca, $feriado["nm_feriado_"], null, $feriado["data_feriado_"], null, null, 1); $cadastrou2 = $obj->cadastra(); if (!$cadastrou2) { $this->mensagem = "Cadastro não realizado.<br>"; echo "<!--\nErro ao cadastrar clsPmieducarBibliotecaFeriados\nvalores obrigatórios\nis_numeric( {$this->cod_biblioteca} ) && is_string( {$feriado["nm_feriado_"]} ) && is_string( {$feriado["data_feriado_"]} )\n-->"; return false; } } } } //-----------------------FIM EDITA FERIADO------------------------// $this->mensagem .= "Edição efetuada com sucesso.<br>"; header("Location: educar_biblioteca_dados_lst.php"); die; return true; } $this->mensagem = "Edição não realizada.<br>"; echo "<!--\nErro ao editar clsPmieducarBiblioteca\nvalores obrigatorios\nif( is_numeric( {$this->cod_biblioteca} ) )\n-->"; return false; }
protected function getDataHoraCadastro() { return $this->data_cadastro = dataToBanco($this->data_cadastro) . " " . $this->hora_cadastro; }
function Excluir() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_excluir(635, $this->pessoa_logada, 7, sprintf('educar_falta_atraso_det.php?ref_cod_servidor=%d&ref_cod_escola=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_escola, $this->ref_cod_instituicao)); // Transforma a data para o formato aceito pelo banco $this->data_inicio = dataToBanco($this->data_inicio); $this->data_fim = dataToBanco($this->data_fim); $obj = new clsPmieducarFaltaAtrasoCompensado($this->cod_compensado, $this->ref_cod_escola, $this->ref_cod_instituicao, $this->ref_cod_servidor, $this->pessoa_logada, $this->pessoa_logada, $this->data_inicio, $this->data_fim, $this->data_cadastro, $this->data_exclusao, 0); $excluiu = $obj->excluir(); if ($excluiu) { $this->mensagem .= 'Exclusão efetuada com sucesso.<br />'; header("Location: educar_falta_atraso_det.php?ref_cod_servidor={$this->ref_cod_servidor}&ref_cod_escola={$this->ref_cod_escola}&ref_cod_instituicao={$this->ref_cod_instituicao}"); die; } $this->mensagem = 'Exclusão não realizada.<br />'; return FALSE; }
<?php require "./includes/restrito.inc.php"; require_once "./includes/conexao.inc.php"; require_once "./includes/funcoes.inc.php"; // Executa a conexao com o banco de dados dbcon(); // Verifica se foi pressionado o botao gravar. if ($_SERVER['REQUEST_METHOD'] == "POST") { $dataObs = dataToBanco($_POST["txtDataOBS"]); $dataVis = dataToBanco($_POST["txtDataVIS"]); $SQL = "INSERT INTO agenda (idesc, idpes_para, idpes_de, data_obs, hora_obs, data_vis, hora_vis, obs) \r\n\t\t\tVALUES (\"" . $_POST["cbCliente"] . "\",\"" . $_POST["cbPara"] . "\",\"" . $_POST["cbDe"] . "\",\r\n\t\t\t\"" . $dataObs . "\",\"" . $_POST["txtHoraOBS"] . "\",\"" . $dataVis . "\",\r\n\t\t\t\"" . $_POST["txtHoraVIS"] . "\",\"" . $_POST["txtOBS"] . "\")"; $result = mysql_query($SQL); if ($result == 1) { $_SESSION["MSG"] = "Cadastro realizado com sucesso."; } else { $_SESSION["MSG"] = "Erro ao efutar cadastro."; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- .style8 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } .style10 { font-family: Verdana, Arial, Helvetica, sans-serif;
function Editar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(561, $this->pessoa_logada, 7, 'educar_escola_lst.php'); $this->ano_letivo_modulo = unserialize(urldecode($this->ano_letivo_modulo)); if ($this->ano_letivo_modulo) { $obj = new clsPmieducarAnoLetivoModulo($this->ref_ano, $this->ref_ref_cod_escola); $excluiu = $obj->excluirTodos(); if ($excluiu) { if (FALSE == $this->_verificaModuloDatas($this->ano_letivo_modulo)) { return FALSE; } foreach ($this->ano_letivo_modulo as $campo) { $campo['data_inicio_'] = dataToBanco($campo['data_inicio_']); $campo['data_fim_'] = dataToBanco($campo['data_fim_']); $obj = new clsPmieducarAnoLetivoModulo($this->ref_ano, $this->ref_ref_cod_escola, $campo['sequencial_'], $campo['ref_cod_modulo_'], $campo['data_inicio_'], $campo['data_fim_']); $cadastrou = $obj->cadastra(); if (!$cadastrou) { $this->mensagem = 'Edição não realizada.<br />'; return FALSE; } } $this->mensagem .= 'Edição efetuada com sucesso.<br />'; header('Location: educar_escola_lst.php'); die; } } echo "<script>alert('É necessário adicionar pelo menos um módulo!')</script>"; $this->mensagem = 'Edição não realizada.<br />'; return FALSE; }
function Novo() { session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); if (!$this->cpf && $this->cpf_2) { $cpf = idFederal2int($this->cpf_2); $obj_pessoa_fisica = new clsPessoaFisica(); $lst_pessoa_fisica = $obj_pessoa_fisica->lista(NULL, $cpf); if ($lst_pessoa_fisica) { $this->mensagem = 'CPF Já Cadastrado'; return FALSE; } else { die('CPF Não Existente'); } } $obj_pessoa = new clsPessoa_($this->ref_idpes); if ($obj_pessoa->detalhe()) { $obj_pessoa = new clsPessoa_($this->ref_idpes, $this->nome, NULL, $this->url, NULL, $this->pessoa_logada, NULL, $this->email); if (!$obj_pessoa->edita()) { return false; } } else { $obj_pessoa = new clsPessoa_($this->ref_idpes, $this->nome, NULL, $this->url, 'F', $this->pessoa_logada, NULL, $this->email); if (!($this->ref_idpes = $obj_pessoa->cadastra())) { return FALSE; } } if (!$this->cpf) { $this->ref_cod_sistema = 1; } else { $this->ref_cod_sistema = 'NULL'; } if (is_string($this->cpf_pai) && $this->cpf_pai != '') { $this->cpf_pai = idFederal2int($this->cpf_pai); $obj_cpf = new clsFisica(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, $this->cpf_pai); $detalhe_cpf = $obj_cpf->detalheCPF(); if ($detalhe_cpf) { $this->idpes_pai = $detalhe_cpf['idpes']; $obj_pessoa = new clsPessoa_($this->idpes_pai); $det_pessoa = $obj_pessoa->detalhe(); if ($det_pessoa) { if ($this->nm_pai) { $obj_pessoa = new clsPessoa_($this->idpes_pai, $this->nm_pai); $obj_pessoa->edita(); } else { $this->nm_pai = $det_pessoa['nome']; } } } else { // cria uma pessoa para o pai $obj_pessoa = new clsPessoa_(FALSE, $this->nm_pai, $this->pessoa_logada, FALSE, 'F'); $idpes = $obj_pessoa->cadastra(); if ($idpes) { $this->idpes_pai = $idpes; //cadastra como pesso Fisica $obj_fisica = new clsFisica($idpes, FALSE, 'M', FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, $this->pessoa_logada, NULL, NULL, $this->cpf_pai); $obj_fisica->cadastra(); } } } else { $this->idpes_pai = "NULL"; } if (is_string($this->cpf_mae) && $this->cpf_mae != "") { $this->cpf_mae = idFederal2int($this->cpf_mae); $obj_cpf = new clsFisica(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, $this->cpf_mae); $detalhe_cpf = $obj_cpf->detalheCPF(); if ($detalhe_cpf) { $this->idpes_mae = $detalhe_cpf['idpes']; $obj_pessoa = new clsPessoa_($this->idpes_mae); $det_pessoa = $obj_pessoa->detalhe(); if ($det_pessoa) { if ($this->nm_mae) { $obj_pessoa = new clsPessoa_($this->idpes_mae, $this->nm_mae); $obj_pessoa->edita(); } else { $this->nm_mae = $det_pessoa['nome']; } } } else { // cria uma pessoa para a mae $obj_pessoa = new clsPessoa_(FALSE, $this->nm_mae, $this->pessoa_logada, FALSE, 'F'); $idpes = $obj_pessoa->cadastra(); if ($idpes) { $this->idpes_mae = $idpes; //cadastra como pesso Fisica $obj_fisica = new clsFisica($idpes, FALSE, 'F', FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, $this->pessoa_logada, NULL, NULL, $this->cpf_mae); $obj_fisica->cadastra(); } } } else { $this->idpes_mae = "NULL"; } $obj_fisica = new clsFisica($this->ref_idpes, dataToBanco($this->data_nascimento), $this->sexo, $this->idpes_mae, $this->idpes_pai, $this->ref_idpes_responsavel, NULL, $this->ideciv, NULL, NULL, NULL, $this->nacionalidade, $this->pais_origem, NULL, $this->idmun_nascimento, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->pessoa_logada, $this->ref_cod_sistema, $this->cpf); if ($obj_fisica->detalhe()) { if (!$this->ref_idpes_responsavel) { $this->ref_idpes_responsavel = "NULL"; } $obj_fisica = new clsFisica($this->ref_idpes, dataToBanco($this->data_nascimento), $this->sexo, $this->idpes_mae, $this->idpes_pai, $this->ref_idpes_responsavel, NULL, $this->ideciv, NULL, NULL, NULL, $this->nacionalidade, $this->pais_origem, NULL, $this->idmun_nascimento, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->pessoa_logada, $this->ref_cod_sistema); if (!$obj_fisica->edita()) { return FALSE; } } else { $obj_fisica = new clsFisica($this->ref_idpes, dataToBanco($this->data_nascimento), $this->sexo, $this->idpes_mae, $this->idpes_pai, $this->ref_idpes_responsavel, NULL, $this->ideciv, NULL, NULL, NULL, $this->nacionalidade, $this->pais_origem, NULL, $this->idmun_nascimento, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->pessoa_logada, $this->ref_cod_sistema, $this->cpf); if (!$obj_fisica->cadastra()) { return FALSE; } } if (is_numeric($this->ref_cod_raca)) { $obj_fisica_raca = new clsCadastroFisicaRaca($this->ref_idpes); if ($obj_fisica_raca->existe()) { $obj_fisica_raca = new clsCadastroFisicaRaca($this->ref_idpes, $this->ref_cod_raca); $obj_fisica_raca->edita(); } else { $obj_fisica_raca = new clsCadastroFisicaRaca($this->ref_idpes, $this->ref_cod_raca); $obj_fisica_raca->cadastra(); } } else { $obj_fisica_raca = new clsCadastroFisicaRaca($this->ref_idpes, $this->ref_cod_raca); $obj_fisica_raca->excluir(); } $objTelefone = new clsPessoaTelefone($this->ref_idpes, 1, $this->fone_1, $this->ddd_fone_1); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objTelefone = new clsPessoaTelefone($this->ref_idpes, 2, $this->fone_2, $this->ddd_fone_2); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objTelefone = new clsPessoaTelefone($this->ref_idpes, 3, $this->fone_mov, $this->ddd_mov); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objTelefone = new clsPessoaTelefone($this->ref_idpes, 4, $this->fone_fax, $this->ddd_fax); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } if ($this->isEnderecoExterno) { $this->cep_ = str_replace('-', '', $this->cep_); $obj_endereco = new clsEnderecoExterno($this->ref_idpes, 1, $this->ref_idtlog, $this->nm_logradouro, $this->numero, $this->letra, $this->complemento, $this->nm_bairro, $this->cep_, $this->cidade, $this->ref_sigla_uf_, NULL, $this->bloco, $this->apartamento, $this->andar, NULL, $this->pessoa_logada, $this->zona_localizacao); if ($obj_endereco->existe()) { if (!$obj_endereco->edita()) { return FALSE; } } else { if (!$obj_endereco->cadastra()) { return FALSE; } } if ($this->endereco_original_is_externo != $this->isEnderecoExterno) { $obj_endereco = new clsPessoaEndereco($this->ref_idpes); $obj_endereco->exclui(); } } else { $obj_endereco = new clsPessoaEndereco($this->ref_idpes, $this->id_cep, $this->id_logradouro, $this->id_bairro, $this->numero, $this->complemento, NULL, $this->letra, $this->bloco, $this->apartamento, $this->andar, null, $this->pessoa_logada); if ($obj_endereco->existe()) { if (!$obj_endereco->edita()) { return FALSE; } } else { if (!$obj_endereco->cadastra()) { return FALSE; } } if ($this->endereco_original_is_externo != $this->isEnderecoExterno) { $obj_endereco = new clsEnderecoExterno($this->ref_idpes); $obj_endereco->exclui(); } } $this->deficiencia_exc = $_POST['oc_defic_exc']; if ($this->deficiencia_exc) { foreach ($this->deficiencia_exc as $key => $deficiencia) { $obj_deficiencia_pessoa = new clsCadastroFisicaDeficiencia($this->ref_idpes, $deficiencia); if ($obj_deficiencia_pessoa->detalhe()) { $obj_deficiencia_pessoa->excluir(); } } } $this->deficiencia = $_POST['oc_defic']; if ($this->deficiencia) { foreach ($this->deficiencia as $key => $deficiencia) { $obj_deficiencia_pessoa = new clsCadastroFisicaDeficiencia($this->ref_idpes, $key); if (!$obj_deficiencia_pessoa->detalhe()) { $obj_deficiencia_pessoa->cadastra(); } } } if ($this->data_emissao_cart_trabalho) { $this->data_emissao_cart_trabalho = explode('/', $this->data_emissao_cart_trabalho); $this->data_emissao_cart_trabalho = "{$this->data_emissao_cart_trabalho[2]}/{$this->data_emissao_cart_trabalho[1]}/{$this->data_emissao_cart_trabalho[0]}"; } if ($this->data_emissao_cert_civil) { $this->data_emissao_cert_civil = explode('/', $this->data_emissao_cert_civil); $this->data_emissao_cert_civil = "{$this->data_emissao_cert_civil[2]}/{$this->data_emissao_cert_civil[1]}/{$this->data_emissao_cert_civil[0]}"; } if ($this->data_exp_rg) { $this->data_exp_rg = explode('/', $this->data_exp_rg); $this->data_exp_rg = "{$this->data_exp_rg[2]}/{$this->data_exp_rg[1]}/{$this->data_exp_rg[0]}"; } $ObjDocumento = new clsDocumento($this->ref_idpes, $this->rg, $this->data_exp_rg, $this->sigla_uf_exp_rg, $this->tipo_cert_civil, $this->num_termo, $this->num_livro, $this->num_folha, $this->data_emissao_cert_civil, $this->sigla_uf_cert_civil, $this->cartorio_cert_civil, $this->num_cart_trabalho, $this->serie_cart_trabalho, $this->data_emissao_cart_trabalho, $this->sigla_uf_cart_trabalho, $this->num_tit_eleitor, $this->zona_tit_eleitor, $this->secao_tit_eleitor, $this->idorg_exp_rg); if ($ObjDocumento->detalhe()) { $ObjDocumento = new clsDocumento($this->ref_idpes, $this->rg, $this->data_exp_rg, $this->sigla_uf_exp_rg, $this->tipo_cert_civil, $this->num_termo, $this->num_livro, $this->num_folha, $this->data_emissao_cert_civil, $this->sigla_uf_cert_civil, $this->cartorio_cert_civil, $this->num_cart_trabalho, $this->serie_cart_trabalho, $this->data_emissao_cart_trabalho, $this->sigla_uf_cart_trabalho, $this->num_tit_eleitor, $this->zona_tit_eleitor, $this->secao_tit_eleitor, $this->idorg_exp_rg); if (!$ObjDocumento->edita()) { return FALSE; } } else { $ObjDocumento = new clsDocumento($this->ref_idpes, $this->rg, $this->data_exp_rg, $this->sigla_uf_exp_rg, $this->tipo_cert_civil, $this->num_termo, $this->num_livro, $this->num_folha, $this->data_emissao_cert_civil, $this->sigla_uf_cert_civil, $this->cartorio_cert_civil, $this->num_cart_trabalho, $this->serie_cart_trabalho, $this->data_emissao_cart_trabalho, $this->sigla_uf_cart_trabalho, $this->num_tit_eleitor, $this->zona_tit_eleitor, $this->secao_tit_eleitor, $this->idorg_exp_rg); if (!$ObjDocumento->cadastra()) { return FALSE; } } if ($this->foto && $this->foto['error'] == 0) { $this->foto = $this->geraFotos($this->foto['tmp_name']); $obj = new clsPmieducarAluno(NULL, $this->ref_cod_aluno_beneficio, $this->ref_cod_religiao, $this->pessoa_logada, $this->pessoa_logada, $this->ref_idpes, NULL, NULL, 1, $this->foto, $this->analfabeto, $this->nm_pai, $this->nm_mae); $obj_det = $obj->detalhe(); if ($obj_det) { if ($obj_det['caminho_foto']) { $this->caminho_foto = $obj_det['caminho_foto']; } $this->foto_excluida = 1; } } elseif ($this->foto_excluida == 1) { $this->foto = 'NULL'; } elseif (!$this->foto_excluida) { $this->foto = $this->foto_antiga; } if ($this->foto_excluida) { if (file_exists('arquivos/educar/aluno/big/' . $this->caminho_foto)) { unlink('arquivos/educar/aluno/big/' . $this->caminho_foto); } if (file_exists('arquivos/educar/aluno/small/' . $this->caminho_foto)) { unlink('arquivos/educar/aluno/small/' . $this->caminho_foto); } if (file_exists('arquivos/educar/aluno/original/' . $this->caminho_foto)) { unlink('arquivos/educar/aluno/original/' . $this->caminho_foto); } } if (is_numeric($this->idpes_mae) && $this->idpes_mae != 'NULL') { $this->nm_mae = 'NULL'; } if (is_numeric($this->idpes_pai) && $this->idpes_pai != 'NULL') { $this->nm_pai = 'NULL'; } if (!$this->cod_aluno) { $obj = new clsPmieducarAluno(NULL, $this->ref_cod_aluno_beneficio, $this->ref_cod_religiao, $this->pessoa_logada, $this->pessoa_logada, $this->ref_idpes, NULL, NULL, 1, $this->foto, $this->analfabeto, $this->nm_pai, $this->nm_mae, $this->tipo_responsavel); if ($this->ref_idpes) { if ($obj->existePessoa()) { $aluno = $obj->edita(); $this->cod_aluno = $aluno['cod_aluno']; } else { $this->cod_aluno = $obj->cadastra(); } } } else { $obj = new clsPmieducarAluno($this->cod_aluno, $this->ref_cod_aluno_beneficio, $this->ref_cod_religiao, $this->pessoa_logada, $this->pessoa_logada, $this->ref_idpes, NULL, NULL, 1, $this->foto, $this->analfabeto, $this->nm_pai, $this->nm_mae, $this->tipo_responsavel); if ($this->ref_idpes) { if ($obj->existePessoa()) { $obj->edita(); } else { $obj->cadastra(); } } } // Atualiza a informação de uso de transporte escolar. $this->_cadastraTransporte($this->cod_aluno, $this->transporte_aluno, $this->transporte_responsavel, $this->pessoa_logada); header('Location: educar_aluno_det.php?cod_aluno=' . $this->cod_aluno); die; }
} if (mysql_num_rows($result) < 1) { $_SESSION["MSG"] = "Registro excluido com sucesso."; } } // Verifica se selecionou um consultor ou informou alguma escola if ($_POST["cbConsultor"] == "Todos os consultores" && $_POST["dtINI"] == "" && $_POST["dtFIN"] == "") { $SQL = "SELECT a.idage, a.data_obs, a.hora_obs, a.data_vis, a.hora_vis, a.obs, e.nome_fantasia,\r\n\t\t\t\t\t(SELECT nome FROM pessoa WHERE a.idpes_de = idpes) AS agendaDE,\r\n\t\t\t\t\t(SELECT nome FROM pessoa WHERE a.idpes_para = idpes) AS agendaPARA, a.visita\r\n\t\t\t\t\tFROM agenda a, escola e, pessoa p\r\n\t\t\t\t\tWHERE a.idesc = e.idesc\r\n\t\t\t\t\tAND p.idpes = a.idpes_de"; } else { // Excuta a pesquisa com base em parametros $SQL = "SELECT a.idage, a.data_obs, a.hora_obs, a.data_vis, a.hora_vis, a.obs, e.nome_fantasia,\r\n\t\t\t\t\t(SELECT nome FROM pessoa WHERE a.idpes_de = idpes) AS agendaDE,\r\n\t\t\t\t\t(SELECT nome FROM pessoa WHERE a.idpes_para = idpes) AS agendaPARA, a.visita\r\n\t\t\t\t\tFROM agenda a, escola e, pessoa p\r\n\t\t\t\t\tWHERE a.idesc = e.idesc\r\n\t\t\t\t\tAND p.idpes = a.idpes_de"; if ($_POST["cbConsultor"] != "Todos os consultores") { $SQL .= " AND p.idpes = " . $_POST["cbConsultor"]; } if ($_POST["dtINI"] != "" && $_POST["dtFIN"] != "") { $SQL .= " AND a.data_obs BETWEEN '" . dataToBanco($_POST["dtINI"]) . "' AND '" . dataToBanco($_POST["dtFIN"]) . "'"; } } // Verifica se a opcao visita esta ticada if ($_POST["cbVisita"] != "") { $SQL .= " ORDER BY a.data_vis, a.hora_vis "; } else { $SQL .= " ORDER BY a.data_obs, a.hora_obs "; } // Executa a procura $PES = mysql_query($SQL); if (!$PES) { die("Erro ao select da tabela AGENDA. Técnico:" . mysql_error()); } if (mysql_num_rows($PES) < 1) { $_SESSION["MSG"] = "Não existem dados para ser pesquisado.";
function Editar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); /*$obj_funcionario = new clsFuncionario($this->pessoa_logada); $detalhe_func = $obj_funcionario->detalhe(); $setor_funcionario = $detalhe_func["ref_cod_setor_new"]; $obj_secretaria_responsavel = new clsPmiacoesSecretariaResponsavel($setor_funcionario); $obj_secretaria_responsavel_det = $obj_secretaria_responsavel->detalhe();*/ //if($obj_secretaria_responsavel_det == false) if (!$this->permiteEditar()) { $pendente = 0; } else { $pendente = 1; } //$this->destaque = $this->destaque == "on" ? 1 : 0; $obj_acao_governo = new clsPmiacoesAcaoGoverno($this->cod_acao_governo, null, $this->pessoa_logada, $this->nm_acao, $this->descricao, dataToBanco($this->data_inauguracao), str_replace(array(".", ","), array("", "."), $this->valor), null, $pendente, null, null, $this->categoria, $this->idbai); if (!$obj_acao_governo->edita()) { return false; } header("location: acoes_acao_det.php?cod_acao_governo={$this->cod_acao_governo}"); return false; }
function Excluir() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_excluir(606, $this->pessoa_logada, 11, "educar_exemplar_lst.php"); $this->data_aquisicao = dataToBanco($this->data_aquisicao); $obj = new clsPmieducarExemplar($this->cod_exemplar, $this->ref_cod_fonte, $this->ref_cod_motivo_baixa, $this->ref_cod_acervo, $this->ref_cod_situacao, $this->pessoa_logada, $this->pessoa_logada, $this->permite_emprestimo, $this->preco, $this->data_cadastro, $this->data_exclusao, 0, $this->data_aquisicao); $excluiu = $obj->excluir(); if ($excluiu) { $this->mensagem .= "Exclusão efetuada com sucesso.<br>"; header("Location: educar_exemplar_lst.php"); die; return true; } $this->mensagem = "Exclusão não realizada.<br>"; echo "<!--\nErro ao excluir clsPmieducarExemplar\nvalores obrigatorios\nif( is_numeric( {$this->cod_exemplar} ) && is_numeric( {$this->ref_usuario_exc} ) )\n-->"; return false; }
function Editar() { @session_start(); $pessoaFj = $_SESSION['id_pessoa']; $parametros = new clsParametrosPesquisas(); if ($this->cep_) { $this->cep = idFederal2int($this->cep_); } if ($_SESSION["campos"]) { $parametros->preencheAtributosComArray($_SESSION['campos']); } session_write_close(); if ($_POST["pessoa"] == "F") { if ($this->id_federal) { $this->id_federal = idFederal2int($this->id_federal); $objCPF = new clsFisica(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, $this->id_federal); $detCPF = $objCPF->detalhe(); if ($detCPF) { if ($detCPF["idpes"] != $this->cod_pessoa_fj) { $this->mensagem = "CPF já cadastrado."; $this->id_federal = false; return false; } } } $this->data_nasc = dataToBanco($this->data_nasc); $objPessoa = new clsPessoa_($this->cod_pessoa_fj, $this->nm_pessoa, false, $this->p_http, false, $pessoaFj, date("Y-m-d H:i:s", time()), $this->email); $objPessoa->edita(); if ($this->id_federal) { $this->id_federal = idFederal2Int($this->id_federal); $objFisica = new clsFisica($this->cod_pessoa_fj, $this->data_nasc, $this->sexo, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, "NULL", $this->id_federal); $objFisica->edita(); } else { $objFisica = new clsFisica($this->cod_pessoa_fj, $this->data_nasc, $this->sexo, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, $this->ref_cod_sistema, $this->id_federal); $objFisica->edita(); } $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 1, $this->telefone_1, $this->ddd_telefone_1); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 2, $this->telefone_2, $this->ddd_telefone_2); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 3, $this->telefone_mov, $this->ddd_telefone_mov); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 4, $this->telefone_fax, $this->ddd_telefone_fax); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objEndereco = new clsPessoaEndereco($this->cod_pessoa_fj); $detEndereco = $objEndereco->detalhe(); $objEndereco2 = new clsPessoaEndereco($this->cod_pessoa_fj, $this->cep, $this->idlog, $this->idbai, $this->numero, $this->complemento, false, $this->letra, $this->bloco, $this->apartamento, $this->andar); if ($detEndereco && $this->cep && $this->idlog && $this->idbai) { $objEndereco2->edita(); } elseif ($this->cep && $this->idlog && $this->idbai) { $objEndereco2->cadastra(); $objEnderecoExterno = new clsEnderecoExterno($this->cod_pessoa_fj); if ($objEnderecoExterno->detalhe()) { $objEnderecoExterno->exclui(); } } elseif ($detEndereco) { $objEndereco2->exclui(); $this->cep = $this->cep; $objEnderecoExterno = new clsEnderecoExterno($this->cod_pessoa_fj); $detEnderecoExterno = $objEnderecoExterno->detalhe(); $objEnderecoExterno2 = new clsEnderecoExterno($this->cod_pessoa_fj, "1", $this->idtlog, $this->logradouro, $this->numero, $this->letra, $this->complemento, $this->bairro, $this->cep, $this->cidade, $this->sigla_uf, false, $this->bloco, $this->apartamento, $this->andar); if ($detEnderecoExterno) { $objEnderecoExterno2->edita(); if ($detEndereco) { $objEndereco->exclui(); } } else { $objEnderecoExterno2->cadastra(); if ($detEndereco) { $objEndereco->exclui(); } } } else { $this->cep = idFederal2int($this->cep); $objEnderecoExterno = new clsEnderecoExterno($this->cod_pessoa_fj); $objEnderecoExterno2 = new clsEnderecoExterno($this->cod_pessoa_fj, "1", $this->idtlog, $this->logradouro, $this->numero, $this->letra, $this->complemento, $this->bairro, $this->cep, $this->cidade, $this->sigla_uf, false, $this->bloco, $this->apartamento, $this->andar); if ($objEnderecoExterno->detalhe()) { $objEnderecoExterno2->edita(); } else { $objEnderecoExterno2->cadastra(); if ($detEndereco) { $objEndereco->exclui(); } } } if (is_numeric($this->cod_pessoa_fj)) { $obj_pessoa = new clsPessoaFj($this->cod_pessoa_fj); $pessoa = $obj_pessoa->lista_rapida($this->cod_pessoa_fj); $pessoa = $pessoa[0]; $funcao = " set_campo_pesquisa("; $virgula = ""; $cont = 0; foreach ($parametros->getCampoNome() as $campo) { if ($parametros->getCampoTipo($cont) == "text") { $funcao .= "{$virgula} '{$campo}', '{$pessoa[$parametros->getCampoValor($cont)]}'"; $virgula = ","; } elseif ($parametros->getCampoTipo($cont) == "select") { $funcao .= "{$virgula} '{$campo}', '{$pessoa[$parametros->getCampoIndice($cont)]}', '{$pessoa[$parametros->getCampoValor($cont)]}'"; $virgula = ","; } $cont++; } if ($parametros->getSubmit()) { $funcao .= "{$virgula} 'submit' )"; } else { $funcao .= " )"; } $this->executa_script = $funcao; /** * alteracao para executar script * em tabela dinamica * procon */ if ($_GET['tab_dinamica'] == 'procon') { $script = "function passaPraTraz(nome, id)\n\t\t\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t\t\t// reclamada\n\t\t\t\t\t\t\t\t\twindow.parent.document.getElementById('reclamada[{$_GET['tab_dinamica_id']}]').value = nome;\n\t\t\t\t\t\t\t\t\twindow.parent.document.getElementById('reclamada_id[{$_GET['tab_dinamica_id']}]').value = id;\n\n\t\t\t\t\t\t\t\t\twindow.parent.fechaExpansivel('div_dinamico_'+(parent.DOM_divs.length*1-1));\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tpassaPraTraz('{$pessoa['nome']}',{$this->cod_pessoa_fj});"; $this->executa_script = $script; } return true; } } elseif ($_POST["pessoa"] == "J") { if ($this->id_federal) { $this->id_federal = idFederal2int($this->id_federal); $objCNPJ = new clsJuridica(false, $this->id_federal); $detCNPJ = $objCNPJ->detalhe(); if ($detCNPJ) { if ($detCNPJ["idpes"] != $this->cod_pessoa_fj) { $this->mensagem = "CNPJ já cadastrado."; $this->id_federal = false; return false; } } } $this->id_federal = idFederal2int($this->id_federal); $this->insc_est = idFederal2int($this->insc_est); $objPessoa = new clsPessoa_($this->cod_pessoa_fj, $this->razao_social, $this->idpes_cad, $this->url, "J", false, false, $this->email); $objPessoa->edita(); $objJuridica = new clsJuridica($this->cod_pessoa_fj, $this->id_federal, $this->fantasia, $this->insc_est, $this->capital_social); $objJuridica->edita(); $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 1, $this->telefone_1, $this->ddd_telefone_1); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 2, $this->telefone_2, $this->ddd_telefone_2); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 3, $this->telefone_mov, $this->ddd_telefone_mov); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 4, $this->telefone_fax, $this->ddd_telefone_fax); if ($objTelefone->detalhe()) { $objTelefone->edita(); } else { $objTelefone->cadastra(); } $objEndereco = new clsPessoaEndereco($this->cod_pessoa_fj); $detEndereco = $objEndereco->detalhe(); $this->cep = $this->cep; $objEndereco2 = new clsPessoaEndereco($this->cod_pessoa_fj, $this->cep, $this->idlog, $this->idbai, $this->numero, $this->complemento, false, $this->letra, $this->bloco, $this->apartamento, $this->andar); if ($detEndereco && $this->cep && $this->idlog && $this->idbai) { $objEndereco2->edita(); } elseif ($this->cep && $this->idlog && $this->idbai) { $objEndereco2->cadastra(); } elseif ($detEndereco) { $objEndereco2->exclui(); $this->cep = $this->cep; $objEnderecoExterno = new clsEnderecoExterno($this->cod_pessoa_fj); $detEnderecoExterno = $objEnderecoExterno->detalhe(); $objEnderecoExterno2 = new clsEnderecoExterno($this->cod_pessoa_fj, "1", $this->idtlog, $this->logradouro, $this->numero, $this->letra, $this->complemento, $this->bairro, $this->cep, $this->cidade, $this->sigla_uf, false, $this->bloco, $this->apartamento, $this->andar); if ($detEnderecoExterno) { $objEnderecoExterno2->edita(); if ($detEndereco) { $objEndereco->exclui(); } } else { $objEnderecoExterno2->cadastra(); if ($detEndereco) { $objEndereco->exclui(); } } } if (is_numeric($this->cod_pessoa_fj)) { $obj_pessoa = new clsPessoaFj($this->cod_pessoa_fj); $pessoa = $obj_pessoa->lista_rapida($this->cod_pessoa_fj); $pessoa = $pessoa[0]; $funcao = " set_campo_pesquisa("; $virgula = ""; $cont = 0; foreach ($parametros->getCampoNome() as $campo) { if ($parametros->getCampoTipo($cont) == "text") { $funcao .= "{$virgula} '{$campo}', '{$pessoa[$parametros->getCampoValor($cont)]}'"; $virgula = ","; } elseif ($parametros->getCampoTipo($cont) == "select") { $funcao .= "{$virgula} '{$campo}', '{$pessoa[$parametros->getCampoIndice($cont)]}', '{$pessoa[$parametros->getCampoValor($cont)]}'"; $virgula = ","; } $cont++; } if ($parametros->getSubmit()) { $funcao .= "{$virgula} 'submit' )"; } else { $funcao .= " )"; } $this->executa_script = $funcao; /** * alteracao para executar script * em tabela dinamica * procon */ if ($_GET['tab_dinamica'] == 'procon') { $script = "function passaPraTraz(nome, id)\n\t\t\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t\t\t// reclamada\n\t\t\t\t\t\t\t\t\twindow.parent.document.getElementById('reclamada[{$_GET['tab_dinamica_id']}]').value = nome;\n\t\t\t\t\t\t\t\t\twindow.parent.document.getElementById('reclamada_id[{$_GET['tab_dinamica_id']}]').value = id;\n\n\t\t\t\t\t\t\t\t\twindow.parent.fechaExpansivel('div_dinamico_'+(parent.DOM_divs.length*1-1));\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tpassaPraTraz('{$pessoa['nome']}',{$this->cod_pessoa_fj});"; $this->executa_script = $script; } return true; } } return false; }
function Novo() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, sprintf('educar_falta_atraso_lst.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao)); if ($this->tipo == 1) { $obj = new clsPmieducarFaltaAtraso(NULL, $this->ref_cod_escola, $this->ref_cod_instituicao, NULL, $this->pessoa_logada, $this->ref_cod_servidor, $this->tipo, $this->data_falta_atraso, $this->qtd_horas, $this->qtd_min, $this->justificada, NULL, NULL, 1); } elseif ($this->tipo == 2) { $db = new clsBanco(); $dia_semana = $db->CampoUnico(sprintf('SELECT EXTRACT (DOW FROM (date "%s") + 1 )', dataToBanco($this->data_falta_atraso))); $obj_ser = new clsPmieducarServidor(); $horas = $obj_ser->qtdhoras($this->ref_cod_servidor, $this->ref_cod_escola, $this->ref_cod_instituicao, $dia_semana); if ($horas) { $obj = new clsPmieducarFaltaAtraso(NULL, $this->ref_cod_escola, $this->ref_cod_instituicao, NULL, $this->pessoa_logada, $this->ref_cod_servidor, $this->tipo, $this->data_falta_atraso, $horas['hora'], $horas['min'], $this->justificada, NULL, NULL, 1); } } $cadastrou = $obj->cadastra(); if ($cadastrou) { $this->mensagem .= 'Cadastro efetuado com sucesso.<br />'; header('Location: ' . sprintf('educar_falta_atraso_lst.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao)); die; } $this->mensagem = 'Cadastro não realizado.<br />'; echo "<!--\nErro ao cadastrar clsPmieducarFaltaAtraso\nvalores obrigatórios\nis_numeric( {$this->ref_cod_escola} ) && is_numeric({$this->ref_ref_cod_instituicao}) && is_numeric({$this->ref_usuario_exc}) && is_numeric({$this->ref_usuario_cad}) && is_numeric({$this->ref_cod_servidor}) && is_numeric({$this->tipo}) && is_string({$this->data_falta_atraso}) && is_numeric({$this->justificada})\n-->"; return FALSE; }
/** * Retorna uma lista de registros filtrados de acordo com os parâmetros. * @return array */ function lista($int_cod_matricula = NULL, $int_ref_cod_reserva_vaga = NULL, $int_ref_ref_cod_escola = NULL, $int_ref_ref_cod_serie = NULL, $int_ref_usuario_exc = NULL, $int_ref_usuario_cad = NULL, $int_ref_cod_aluno = NULL, $int_aprovado = NULL, $date_data_cadastro_ini = NULL, $date_data_cadastro_fim = NULL, $date_data_exclusao_ini = NULL, $date_data_exclusao_fim = NULL, $int_ativo = NULL, $int_ano = NULL, $int_ref_cod_curso2 = NULL, $int_ref_cod_instituicao = NULL, $int_ultima_matricula = NULL, $int_modulo = NULL, $int_padrao_ano_escolar = NULL, $int_analfabeto = NULL, $int_formando = NULL, $str_descricao_reclassificacao = NULL, $int_matricula_reclassificacao = NULL, $boo_com_deficiencia = NULL, $int_ref_cod_curso = NULL, $bool_curso_sem_avaliacao = NULL, $arr_int_cod_matricula = NULL, $int_mes_defasado = NULL, $boo_data_nasc = NULL, $boo_matricula_transferencia = NULL, $int_semestre = NULL, $int_ref_cod_turma = NULL) { if ($boo_data_nasc) { $this->_campos_lista .= " ,(SELECT data_nasc\n FROM cadastro.fisica\n WHERE idpes = ref_idpes\n ) as data_nasc"; } $sql = "SELECT {$this->_campos_lista}, c.ref_cod_instituicao, p.nome, a.cod_aluno, a.ref_idpes, c.cod_curso FROM {$this->_tabela} m, {$this->_schema}curso c, {$this->_schema}aluno a, cadastro.pessoa p "; $whereAnd = " AND "; $filtros = " WHERE m.ref_cod_aluno = a.cod_aluno AND m.ref_cod_curso = c.cod_curso AND p.idpes = a.ref_idpes "; if (is_numeric($int_cod_matricula)) { $filtros .= "{$whereAnd} m.cod_matricula = '{$int_cod_matricula}'"; $whereAnd = " AND "; } if (is_numeric($int_ref_cod_reserva_vaga)) { $filtros .= "{$whereAnd} m.ref_cod_reserva_vaga = '{$int_ref_cod_reserva_vaga}'"; $whereAnd = " AND "; } if (is_numeric($int_ref_ref_cod_escola)) { $filtros .= "{$whereAnd} m.ref_ref_cod_escola = '{$int_ref_ref_cod_escola}'"; $whereAnd = " AND "; } if (is_numeric($int_ref_ref_cod_serie)) { $filtros .= "{$whereAnd} m.ref_ref_cod_serie = '{$int_ref_ref_cod_serie}'"; $whereAnd = " AND "; } if (is_numeric($int_ref_usuario_exc)) { $filtros .= "{$whereAnd} m.ref_usuario_exc = '{$int_ref_usuario_exc}'"; $whereAnd = " AND "; } if (is_numeric($int_ref_usuario_cad)) { $filtros .= "{$whereAnd} m.ref_usuario_cad = '{$int_ref_usuario_cad}'"; $whereAnd = " AND "; } if (is_numeric($int_ref_cod_aluno)) { $filtros .= "{$whereAnd} m.ref_cod_aluno = '{$int_ref_cod_aluno}'"; $whereAnd = " AND "; } if (is_numeric($int_aprovado)) { $filtros .= "{$whereAnd} m.aprovado = '{$int_aprovado}'"; $whereAnd = " AND "; } elseif (is_array($int_aprovado)) { $int_aprovado = implode(",", $int_aprovado); $filtros .= "{$whereAnd} m.aprovado in ({$int_aprovado})"; $whereAnd = " AND "; } if (is_string($date_data_cadastro_ini)) { $filtros .= "{$whereAnd} m.data_cadastro >= '{$date_data_cadastro_ini}'"; $whereAnd = " AND "; } if (is_string($date_data_cadastro_fim)) { $filtros .= "{$whereAnd} m.data_cadastro <= '{$date_data_cadastro_fim}'"; $whereAnd = " AND "; } if (is_string($date_data_exclusao_ini)) { $filtros .= "{$whereAnd} m.data_exclusao >= '{$date_data_exclusao_ini}'"; $whereAnd = " AND "; } if (is_string($date_data_exclusao_fim)) { $filtros .= "{$whereAnd} m.data_exclusao <= '{$date_data_exclusao_fim}'"; $whereAnd = " AND "; } if ($int_ativo) { $filtros .= "{$whereAnd} m.ativo = '1'"; $whereAnd = " AND "; } elseif (!is_null($int_ativo) && is_numeric($int_ativo)) { $filtros .= "{$whereAnd} m.ativo = '0'"; $whereAnd = " AND "; } if (is_numeric($int_ano)) { $filtros .= "{$whereAnd} m.ano = '{$int_ano}'"; $whereAnd = " AND "; } if (is_numeric($int_ref_cod_curso)) { $filtros .= "{$whereAnd} m.ref_cod_curso = '{$int_ref_cod_curso}'"; $whereAnd = " AND "; } if (is_numeric($int_padrao_ano_escolar)) { $filtros .= "{$whereAnd} c.padrao_ano_escolar = '{$int_padrao_ano_escolar}'"; $whereAnd = " AND "; } if (is_numeric($int_ref_cod_instituicao)) { $filtros .= "{$whereAnd} c.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; $whereAnd = " AND "; } if (is_numeric($int_ultima_matricula)) { $filtros .= "{$whereAnd} ultima_matricula = '{$int_ultima_matricula}'"; $whereAnd = " AND "; } if (is_numeric($int_modulo)) { $filtros .= "{$whereAnd} m.modulo = '{$int_modulo}'"; $whereAnd = " AND "; } if (is_numeric($int_analfabeto)) { $filtros .= "{$whereAnd} a.analfabeto = '{$int_analfabeto}'"; $whereAnd = " AND "; } if (is_numeric($int_formando)) { $filtros .= "{$whereAnd} a.formando = '{$int_formando}'"; $whereAnd = " AND "; } if (is_numeric($int_matricula_reclassificacao)) { $filtros .= "{$whereAnd} m.matricula_reclassificacao = '{$int_matricula_reclassificacao}'"; $whereAnd = " AND "; } if (dbBool($boo_matricula_transferencia)) { $boo_matricula_transferencia = dbBool($boo_matricula_transferencia) ? 't' : 'f'; $filtros .= "{$whereAnd} m.matricula_transferencia = '{$boo_matricula_transferencia}'"; $whereAnd = " AND "; } if (is_string($int_matricula_reclassificacao)) { $filtros .= "{$whereAnd} to_ascii(a.matricula_reclassificacao) like to_ascii('%{$int_matricula_reclassificacao}%')"; $whereAnd = " AND "; } if (is_bool($boo_com_deficiencia)) { $not = $boo_com_deficiencia === true ? "" : "NOT"; $filtros .= "{$whereAnd} {$not} EXISTS (SELECT 1 FROM cadastro.fisica_deficiencia fd, pmieducar.aluno a WHERE a.cod_aluno = m.ref_cod_aluno AND fd.ref_idpes = a.ref_idpes)"; $whereAnd = " AND "; } if (is_numeric($int_semestre)) { $filtros .= "{$whereAnd} m.semestre = '{$int_semestre}'"; $whereAnd = " AND "; } if (is_numeric($int_ref_cod_turma)) { $filtros .= "{$whereAnd} EXISTS (SELECT 1 FROM pmieducar.matricula_turma mt WHERE mt.ativo = 1 AND mt.ref_cod_turma = {$int_ref_cod_turma} AND mt.ref_cod_matricula = m.cod_matricula)"; $whereAnd = " AND "; } if (is_array($arr_int_cod_matricula) && count($arr_int_cod_matricula)) { $filtros .= "{$whereAnd} cod_matricula IN (" . implode(',', $arr_int_cod_matricula) . ")"; $whereAnd = " AND "; } if (is_numeric($int_mes_defasado)) { $primeiroDiaDoMes = mktime(0, 0, 0, $int_mes_defasado, 1, $int_ano); $NumeroDiasMes = date('t', $primeiroDiaDoMes); $ultimoDiaMes = date('d/m/Y', mktime(0, 0, 0, $int_mes_defasado, $NumeroDiasMes, $int_ano)); $ultimoDiaMes = dataToBanco($ultimoDiaMes, FALSE); $primeiroDiaDoMes = date('d/m/Y', $primeiroDiaDoMes); $primeiroDiaDoMes = dataToBanco($primeiroDiaDoMes, FALSE); $filtroAux = "{$whereAnd} ((aprovado IN (1,2,3) AND m.data_cadastro <= '{$ultimoDiaMes}')\n OR (aprovado IN (1,2,3,4) AND m.data_exclusao >= '{$primeiroDiaDoMes}' AND m.data_exclusao <= '{$ultimoDiaMes}')\n )"; $filtros .= $filtroAux; $whereAnd = ' AND '; } $db = new clsBanco(); $countCampos = count(explode(',', $this->_campos_lista)); $resultado = array(); $sql .= $filtros . $this->getOrderby() . $this->getLimite(); $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} m, {$this->_schema}curso c, {$this->_schema}aluno a, cadastro.pessoa p {$filtros}"); $db->Consulta($sql); if ($countCampos > 1) { while ($db->ProximoRegistro()) { $tupla = $db->Tupla(); $tupla["_total"] = $this->_total; $resultado[] = $tupla; } } else { while ($db->ProximoRegistro()) { $tupla = $db->Tupla(); $resultado[] = $tupla[$this->_campos_lista]; } } if (count($resultado)) { return $resultado; } return FALSE; }
function Editar() { @session_start(); $pessoaFj = $_SESSION['id_pessoa']; session_write_close(); if ($this->id_federal) { $ref_cod_sistema = 'null'; $this->id_federal = idFederal2int($this->id_federal); $objFisicaCpf = new clsFisica($this->cod_pessoa_fj); $detalhe_fisica = $objFisicaCpf->detalhe(); if (!$detalhe_fisica['cpf']) { $objCPF = new clsFisica(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, $this->id_federal); if ($objCPF->detalhe()) { $this->erros['id_federal'] = 'CPF já cadastrado.'; return FALSE; } } } $objPessoa = new clsPessoa_($this->cod_pessoa_fj, $this->nm_pessoa, FALSE, $this->p_http, FALSE, $pessoaFj, date('Y-m-d H:i:s', time()), $this->email); $objPessoa->edita(); $this->data_nasc = dataToBanco($this->data_nasc); if ($this->id_federal) { $this->id_federal = idFederal2Int($this->id_federal); $objFisica = new clsFisica($this->cod_pessoa_fj, $this->data_nasc, $this->sexo, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, $ref_cod_sistema, $this->id_federal); } else { $objFisica = new clsFisica($this->cod_pessoa_fj, $this->data_nasc, $this->sexo, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, $ref_cod_sistema); } $objFisica->edita(); if ($this->alterado) { $db = new clsBanco(); $db->Consulta("UPDATE cadastro.fisica SET alterado = 'TRUE' WHERE idpes = '{$this->cod_pessoa_fj}'"); } $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 1, $this->telefone_1, $this->ddd_telefone_1); $objTelefone->cadastra(); $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 2, $this->telefone_2, $this->ddd_telefone_2); $objTelefone->cadastra(); $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 3, $this->telefone_mov, $this->ddd_telefone_mov); $objTelefone->cadastra(); $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 4, $this->telefone_fax, $this->ddd_telefone_fax); $objTelefone->cadastra(); $objEndereco = new clsPessoaEndereco($this->cod_pessoa_fj); $this->cep = idFederal2Int($this->cep); $objEndereco2 = new clsPessoaEndereco($this->cod_pessoa_fj, $this->cep, $this->idlog, $this->idbai, $this->numero, $this->complemento, FALSE, $this->letra, $this->bloco, $this->apartamento, $this->andar); if ($objEndereco->detalhe() && $this->cep && $this->idlog && $this->idbai) { $objEndereco2->edita(); } elseif ($this->cep && $this->idlog && $this->idbai) { $objEndereco2->cadastra(); } elseif ($objEndereco->detalhe()) { $objEndereco2->exclui(); } else { $this->cep_ = idFederal2int($this->cep_); $objEnderecoExterno = new clsEnderecoExterno($this->cod_pessoa_fj); $objEnderecoExterno2 = new clsEnderecoExterno($this->cod_pessoa_fj, '1', $this->idtlog, $this->logradouro, $this->numero, $this->letra, $this->complemento, $this->bairro, $this->cep_, $this->cidade, $this->sigla_uf, FALSE, $this->bloco, $this->apartamento, $this->andar, FALSE, FALSE, $this->zona_localizacao); if ($objEnderecoExterno->detalhe()) { $objEnderecoExterno2->edita(); } else { $objEnderecoExterno2->cadastra(); } } // Atualizada raça. $this->_cadastraRaca($this->cod_pessoa_fj, $this->cor_raca); echo '<script>document.location="atendidos_lst.php";</script>'; return TRUE; }
function Editar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $backUrl = sprintf('educar_servidor_formacao_lst.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, $backUrl); $obj = new clsPmieducarServidorFormacao($this->cod_formacao, $this->pessoa_logada, NULL, $this->ref_cod_servidor, $this->nm_formacao, $this->tipo, $this->descricao, NULL, NULL, 1); $editou = $obj->edita(); if ($editou) { if ($this->tipo == 'C') { $obj_curso = new clsPmieducarServidorCurso($this->cod_servidor_curso, $this->cod_formacao, dataToBanco($this->data_conclusao), dataToBanco($this->data_registro), $this->diplomas_registros); $editou_cur = $obj_curso->edita(); if ($editou_cur) { $this->mensagem .= 'Edição efetuada com sucesso.<br>'; header('Location: ' . $backUrl); die; } } else { $obj_titulo = new clsPmieducarServidorTituloConcurso($this->cod_servidor_titulo, $this->cod_formacao, dataToBanco($this->data_vigencia_homolog), dataToBanco($this->data_publicacao)); $editou_tit = $obj_titulo->edita(); if ($editou_tit) { $this->mensagem .= 'Edição efetuada com sucesso.<br>'; header('Location: ' . $backUrl); die; } } } $this->mensagem = "Edição não realizada.<br>"; return FALSE; }