function enturmacaoMatricula($matriculaId, $turmaDestinoId) { $enturmacaoExists = new clsPmieducarMatriculaTurma(); $enturmacaoExists = $enturmacaoExists->lista($matriculaId, $turmaDestinoId, NULL, NULL, NULL, NULL, NULL, NULL, 1); $enturmacaoExists = is_array($enturmacaoExists) && count($enturmacaoExists) > 0; if (!$enturmacaoExists) { $enturmacao = new clsPmieducarMatriculaTurma($matriculaId, $turmaDestinoId, $this->pessoa_logada, $this->pessoa_logada, NULL, NULL, 1); $enturmacao->data_enturmacao = $this->data_matricula; return $enturmacao->cadastra(); } return false; }
function Inicializar() { $retorno = "Novo"; @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); if (!$_POST) { header('Location: educar_matricula_lst.php'); die; } foreach ($_POST as $key => $value) { $this->{$key} = $value; } $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7, 'educar_matricula_lst.php'); if (is_numeric($this->ref_cod_matricula)) { if (is_numeric($this->ref_cod_turma_origem)) { $obj_matricula_turma = new clsPmieducarMatriculaTurma(); $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if ($lst_matricula_turma) { foreach ($lst_matricula_turma as $matricula) { $obj = new clsPmieducarMatriculaTurma($this->ref_cod_matricula, $matricula['ref_cod_turma'], $this->pessoa_logada, NULL, NULL, NULL, 0, NULL, $matricula['sequencial']); $registro = $obj->detalhe(); if ($registro) { if (!$obj->edita()) { echo "erro ao cadastrar"; die; } } } } $obj = new clsPmieducarMatriculaTurma($this->ref_cod_matricula, $this->ref_cod_turma_destino, $this->pessoa_logada, $this->pessoa_logada, NULL, NULL, 1); $cadastrou = $obj->cadastra(); if ($cadastrou) { $this->mensagem .= 'Cadastro efetuado com sucesso.<br>'; header('Location: educar_matricula_det.php?cod_matricula=' . $this->ref_cod_matricula); die; } } else { $obj = new clsPmieducarMatriculaTurma($this->ref_cod_matricula, $this->ref_cod_turma_destino, $this->pessoa_logada, $this->pessoa_logada, NULL, NULL, 1); $cadastrou = $obj->cadastra(); if ($cadastrou) { $this->mensagem .= 'Cadastro efetuado com sucesso.<br>'; header('Location: educar_matricula_det.php?cod_matricula=' . $this->ref_cod_matricula); die; } } } header('Location: educar_matricula_lst.php'); die; }
function Editar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); if ($this->matriculas_turma) { foreach ($this->ref_cod_matricula as $matricula => $campo) { $obj = new clsPmieducarMatriculaTurma($matricula, $this->ref_cod_turma, NULL, $this->pessoa_logada, NULL, NULL, 1, NULL, $campo['sequencial_']); $existe = $obj->existe(); if (!$existe) { $cadastrou = $obj->cadastra(); if (!$cadastrou) { $this->mensagem = 'Cadastro não realizado.<br>'; return FALSE; } } } $this->mensagem .= 'Cadastro efetuada com sucesso.<br>'; header('Location: educar_matriculas_turma_lst.php'); die; } header('Location: educar_matriculas_turma_lst.php'); die; }
function Editar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; $this->data_enturmacao = Portabilis_Date_Utils::brToPgSQL($this->data_enturmacao); @session_write_close(); // realiza desenturmações foreach ($this->check_desenturma as $matricula) { $this->removerEnturmacao($matricula, $this->ref_cod_turma); } if ($this->matriculas_turma) { foreach ($this->ref_cod_matricula as $matricula => $campo) { $obj = new clsPmieducarMatriculaTurma($matricula, $this->ref_cod_turma, NULL, $this->pessoa_logada, NULL, NULL, 1, NULL, $campo['sequencial_']); $existe = $obj->existe(); if (!$existe) { $obj->data_enturmacao = $this->data_enturmacao; $cadastrou = $obj->cadastra(); if (!$cadastrou) { $this->mensagem = 'Cadastro não realizado.<br>'; return FALSE; } } } $this->mensagem .= 'Cadastro efetuada com sucesso.<br>'; header('Location: educar_matriculas_turma_lst.php'); die; } header('Location: educar_matriculas_turma_lst.php'); die; }