From eb755d0a2b525bf6826a014ebd7ecb48e273ed72 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Mon, 8 Mar 2010 19:51:38 +0000 Subject: [PATCH] Atualizado CRUD de Dispensa de Disciplina --- ieducar/intranet/educar_dispensa_disciplina_cad.php | 75 +++++++++++++++++++++++++++------------------------------------------------ ieducar/intranet/educar_dispensa_disciplina_det.php | 53 +++++++++++++++++------------------------------------ ieducar/intranet/educar_dispensa_disciplina_lst.php | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------- ieducar/intranet/educar_matricula_det.php | 2 +- ieducar/intranet/include/pmieducar/clsPmieducarDispensaDisciplina.inc.php | 120 +++++++++++++++++++++++++----------------------------------------------------------------------------------------------- 5 files changed, 122 insertions(+), 232 deletions(-) diff --git a/ieducar/intranet/educar_dispensa_disciplina_cad.php b/ieducar/intranet/educar_dispensa_disciplina_cad.php index 834fc96..f953562 100644 --- a/ieducar/intranet/educar_dispensa_disciplina_cad.php +++ b/ieducar/intranet/educar_dispensa_disciplina_cad.php @@ -32,6 +32,7 @@ require_once 'include/clsBase.inc.php'; require_once 'include/clsCadastro.inc.php'; require_once 'include/clsBanco.inc.php'; require_once 'include/pmieducar/geral.inc.php'; +require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php'; /** * clsIndexBase class. @@ -47,7 +48,7 @@ class clsIndexBase extends clsBase { function Formular() { - $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Disciplina'); + $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Componente Curricular'); $this->processoAp = 578; } } @@ -154,16 +155,8 @@ class indice extends clsCadastro /** * Busca dados da matricula */ - if (class_exists('clsPmieducarMatricula')) { - $obj_ref_cod_matricula = new clsPmieducarMatricula(); - $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista( - $this->ref_cod_matricula) - ); - } - else { - $registro['ref_cod_matricula'] = 'Erro na geracao'; - echo ""; - } + $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'], @@ -173,9 +166,9 @@ class indice extends clsCadastro NULL, NULL, NULL, NULL, NULL, NULL, 1); $det_escola = $obj_escola->detalhe(); - $this->ref_cod_instituicao = $det_escola["ref_cod_instituicao"]; + $this->ref_cod_instituicao = $det_escola['ref_cod_instituicao']; - $this->campoRotulo("nm_aluno", "Nome do Aluno", $det_aluno['nome_aluno']); + $this->campoRotulo('nm_aluno', 'Nome do Aluno', $det_aluno['nome_aluno']); $obj_matricula_turma = new clsPmieducarMatriculaTurma(); $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, @@ -194,29 +187,21 @@ class indice extends clsCadastro $this->campoOculto('ref_cod_escola', $this->ref_cod_escola); $opcoes = array('' => 'Selecione'); - if (class_exists('clsPmieducarEscolaSerieDisciplina')) { - $objTemp = new clsPmieducarEscolaSerieDisciplina(); - $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1); - - if (is_array($lista) && count($lista)) { - foreach ($lista as $registro) { - $obj_disciplina = new clsPmieducarDisciplina( - $registro['ref_cod_disciplina'], NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, 1); - - $det_disciplina = $obj_disciplina->detalhe(); - $opcoes[$registro['ref_cod_disciplina']] = $det_disciplina['nm_disciplina']; - } + + $objTemp = new clsPmieducarEscolaSerieDisciplina(); + $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1); + + $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $componente = $componenteMapper->find($registro['ref_cod_disciplina']); + $opcoes[$componente->id] = $componente->nome; } } - else { - echo ""; - $opcoes = array('' => 'Erro na geracao'); - } if ($this->ref_cod_disciplina) { $this->campoRotulo('nm_disciplina', 'Disciplina', $opcoes[$this->ref_cod_disciplina]); - $this->campoOculto('ref_cod_disciplina', $this->ref_cod_disciplina ); + $this->campoOculto('ref_cod_disciplina', $this->ref_cod_disciplina); } else { $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes, @@ -225,26 +210,20 @@ class indice extends clsCadastro $opcoes = array('' => 'Selecione'); - if (class_exists('clsPmieducarTipoDispensa')) { - $objTemp = new clsPmieducarTipoDispensa(); + $objTemp = new clsPmieducarTipoDispensa(); - if ($this->ref_cod_instituicao) { - $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, 1, $this->ref_cod_instituicao); - } - else { - $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); - } - - if (is_array($lista) && count($lista)) { - foreach ($lista as $registro) { - $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo']; - } - } + if ($this->ref_cod_instituicao) { + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, 1, $this->ref_cod_instituicao); } else { - echo ""; - $opcoes = array('' => 'Erro na geracao'); + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); + } + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo']; + } } $this->campoLista('ref_cod_tipo_dispensa', 'Tipo Dispensa', $opcoes, diff --git a/ieducar/intranet/educar_dispensa_disciplina_det.php b/ieducar/intranet/educar_dispensa_disciplina_det.php index 2bc3160..e50e37e 100644 --- a/ieducar/intranet/educar_dispensa_disciplina_det.php +++ b/ieducar/intranet/educar_dispensa_disciplina_det.php @@ -32,6 +32,7 @@ require_once "include/clsBase.inc.php"; require_once "include/clsDetalhe.inc.php"; require_once "include/clsBanco.inc.php"; require_once "include/pmieducar/geral.inc.php"; +require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php'; /** * clsIndexBase class. @@ -47,7 +48,7 @@ class clsIndexBase extends clsBase { function Formular() { - $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Disciplina'); + $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Componente Curricular'); $this->processoAp = 578; } } @@ -86,7 +87,7 @@ class indice extends clsDetalhe $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); - $this->titulo = 'Dispensa Disciplina - Detalhe'; + $this->titulo = 'Dispensa Componente Curricular - Detalhe'; $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); @@ -116,17 +117,9 @@ class indice extends clsDetalhe echo ""; } - /** - * Busca dados da matrícula - */ - if (class_exists('clsPmieducarMatricula')) { - $obj_ref_cod_matricula = new clsPmieducarMatricula(); - $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula)); - } - else { - $registro['ref_cod_matricula'] = 'Erro na geracao'; - echo ""; - } + // Dados da 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($obj_aluno->lista($detalhe_aluno['ref_cod_aluno'], @@ -138,25 +131,15 @@ class indice extends clsDetalhe $nm_aluno = $det_aluno['nome_aluno']; - if (class_exists('clsPmieducarCurso')) { - $obj_ref_cod_curso = new clsPmieducarCurso( $detalhe_aluno['ref_cod_curso'] ); - $det_ref_cod_curso = $obj_ref_cod_curso->detalhe(); - $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso']; - } - else { - $registro['ref_cod_curso'] = 'Erro na geracao'; - echo ""; - } + // Dados do curso + $obj_ref_cod_curso = new clsPmieducarCurso($detalhe_aluno['ref_cod_curso']); + $det_ref_cod_curso = $obj_ref_cod_curso->detalhe(); + $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso']; - if (class_exists('clsPmieducarTipoDispensa')) { - $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']); - $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe(); - $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo']; - } - else { - $registro['ref_cod_tipo_dispensa'] = 'Erro na geracao'; - echo ""; - } + // Tipo de dispensa + $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']); + $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe(); + $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo']; if ($registro['ref_cod_matricula']) { $this->addDetalhe(array('Matricula', $registro['ref_cod_matricula'])); @@ -175,11 +158,9 @@ class indice extends clsDetalhe } if ($registro['ref_cod_disciplina']) { - $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'], - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); - - $det_disciplina = $obj_disciplina->detalhe(); - $this->addDetalhe(array('Disciplina', $det_disciplina['nm_disciplina'])); + $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); + $componente = $componenteMapper->find($registro['ref_cod_disciplina']); + $this->addDetalhe(array('Componente Curricular', $componente->nome)); } if ($registro['ref_cod_tipo_dispensa']) { diff --git a/ieducar/intranet/educar_dispensa_disciplina_lst.php b/ieducar/intranet/educar_dispensa_disciplina_lst.php index 2b59473..04083e4 100644 --- a/ieducar/intranet/educar_dispensa_disciplina_lst.php +++ b/ieducar/intranet/educar_dispensa_disciplina_lst.php @@ -32,6 +32,8 @@ require_once 'include/clsBase.inc.php'; require_once 'include/clsListagem.inc.php'; require_once 'include/clsBanco.inc.php'; require_once 'include/pmieducar/geral.inc.php'; +require_once 'CoreExt/View/Helper/UrlHelper.php'; +require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php'; /** * clsIndexBase class. @@ -47,7 +49,7 @@ class clsIndexBase extends clsBase { function Formular() { - $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Disciplina'); + $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Componente Curricular'); $this->processoAp = 578; } } @@ -91,7 +93,10 @@ class indice extends clsListagem $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); - $this->titulo = 'Dispensa Disciplina - Listagem'; + // Helper para url + $urlHelper = CoreExt_View_Helper_UrlHelper::getInstance(); + + $this->titulo = 'Dispensa Componente Curricular - Listagem'; // passa todos os valores obtidos no GET para atributos do objeto foreach ($_GET as $var => $val) { @@ -139,26 +144,20 @@ class indice extends clsListagem // Filtros de Foreign Keys $opcoes = array('' => 'Selecione'); - if (class_exists('clsPmieducarTipoDispensa')) { $objTemp = new clsPmieducarTipoDispensa(); - if ($this->ref_cod_instituicao) { - $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, 1, $this->ref_cod_instituicao); - } - else { - $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); - } - - if (is_array($lista) && count($lista)) { - foreach ($lista as $registro) { - $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo']; - } - } + if ($this->ref_cod_instituicao) { + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, 1, $this->ref_cod_instituicao); } else { - echo ""; - $opcoes = array('' => 'Erro na geração'); + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); + } + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo']; + } } $this->campoLista('ref_cod_tipo_dispensa', 'Motivo', $opcoes, @@ -168,25 +167,21 @@ class indice extends clsListagem // outros Filtros $opcoes = array('' => 'Selecione'); - if (class_exists('clsPmieducarEscolaSerieDisciplina')) { - $objTemp = new clsPmieducarEscolaSerieDisciplina(); - $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1); - - if (is_array($lista) && count($lista)) { - foreach ($lista as $registro) { - $obj_disciplina = new clsPmieducarDisciplina( - $registro['ref_cod_disciplina'], NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, 1); - - $det_disciplina = $obj_disciplina->detalhe(); - $opcoes[$registro['ref_cod_disciplina']] = $det_disciplina['nm_disciplina']; - } + + // Escola série disciplina + $objTemp = new clsPmieducarEscolaSerieDisciplina(); + $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $obj_disciplina = new clsPmieducarDisciplina( + $registro['ref_cod_disciplina'], NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, 1); + + $det_disciplina = $obj_disciplina->detalhe(); + $opcoes[$registro['ref_cod_disciplina']] = $det_disciplina['nm_disciplina']; } } - else { - echo ""; - $opcoes = array('' => 'Erro na geração'); - } $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes, $this->ref_cod_disciplina, '', FALSE, '', '', FALSE, FALSE); @@ -217,6 +212,9 @@ class indice extends clsListagem $total = $obj_dispensa_disciplina->_total; + // Mapper de componente curricular + $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); + // monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { @@ -224,25 +222,27 @@ class indice extends clsListagem $registro['data_cadastro_time'] = strtotime(substr($registro['data_cadastro'], 0, 16)); $registro['data_cadastro_br'] = date('d/m/Y', $registro['data_cadastro_time']); - if (class_exists('clsPmieducarTipoDispensa')) { - $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']); - $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe(); - $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo']; - } - else { - $registro['ref_cod_tipo_dispensa'] = 'Erro na geracao'; - echo ""; - } - - $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'], - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); - - $det_disciplina = $obj_disciplina->detalhe(); + // Tipo da dispensa + $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']); + $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe(); + $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo']; + + // Componente curricular + $componente = $componenteMapper->find($registro['ref_cod_disciplina']); + + // Dados para a url + $url = 'educar_dispensa_disciplina_det.php'; + $options = array('query' => array( + 'ref_cod_matricula' => $registro['ref_cod_matricula'], + 'ref_cod_serie' => $registro['ref_cod_serie'], + 'ref_cod_escola' => $registro['ref_cod_escola'], + 'ref_cod_disciplina' => $registro['ref_cod_disciplina'] + )); $this->addLinhas(array( - "{$det_disciplina["nm_disciplina"]}", - "{$registro["ref_cod_tipo_dispensa"]}", - "{$registro["data_cadastro_br"]}" + $urlHelper->l($componente->nome, $url, $options), + $urlHelper->l($registro['ref_cod_tipo_dispensa'], $url, $options), + $urlHelper->l($registro['data_cadastro_br'], $url, $options) )); } } diff --git a/ieducar/intranet/educar_matricula_det.php b/ieducar/intranet/educar_matricula_det.php index a52c94f..1ae5077 100644 --- a/ieducar/intranet/educar_matricula_det.php +++ b/ieducar/intranet/educar_matricula_det.php @@ -231,7 +231,7 @@ class indice extends clsDetalhe $this->array_botao_url_script[] = "go(\"educar_matricula_ocorrencia_disciplinar_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")"; if ($registro['ref_ref_cod_serie']) { - $this->array_botao[] = 'Dispensa de Disciplinas'; + $this->array_botao[] = 'Dispensa de Componentes Curriculares'; $this->array_botao_url_script[] = "go(\"educar_dispensa_disciplina_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")"; } diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarDispensaDisciplina.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarDispensaDisciplina.inc.php index 6ff7f1b..d771e84 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarDispensaDisciplina.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarDispensaDisciplina.inc.php @@ -115,119 +115,49 @@ class clsPmieducarDispensaDisciplina $cod_dispensa = NULL) { $db = new clsBanco(); - $this->_schema = "pmieducar."; - $this->_tabela = "{$this->_schema}dispensa_disciplina"; + $this->_schema = 'pmieducar.'; + $this->_tabela = $this->_schema . 'dispensa_disciplina'; - $this->_campos_lista = $this->_todos_campos = "ref_cod_matricula, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, ref_usuario_exc, ref_usuario_cad, ref_cod_tipo_dispensa, data_cadastro, data_exclusao, ativo, observacao"; + $this->_campos_lista = $this->_todos_campos = 'ref_cod_matricula, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, ref_usuario_exc, ref_usuario_cad, ref_cod_tipo_dispensa, data_cadastro, data_exclusao, ativo, observacao'; if (is_numeric($ref_usuario_exc)) { - if (class_exists("clsPmieducarUsuario")) { - $tmp_obj = new clsPmieducarUsuario($ref_usuario_exc); - if (method_exists($tmp_obj, "existe")) { - if ($tmp_obj->existe()) { - $this->ref_usuario_exc = $ref_usuario_exc; - } - } - elseif (method_exists($tmp_obj, "detalhe")) { - if ($tmp_obj->detalhe()) { - $this->ref_usuario_exc = $ref_usuario_exc; - } - } - } - else { - if ($db->CampoUnico("SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_exc}'")) { - $this->ref_usuario_exc = $ref_usuario_exc; - } + $usuario = new clsPmieducarUsuario($ref_usuario_exc); + if ($usuario->existe()) { + $this->ref_usuario_exc = $ref_usuario_exc; } } if (is_numeric($ref_usuario_cad)) { - if (class_exists("clsPmieducarUsuario")) { - $tmp_obj = new clsPmieducarUsuario($ref_usuario_cad); - if (method_exists($tmp_obj, "existe")) { - if ($tmp_obj->existe()) { - $this->ref_usuario_cad = $ref_usuario_cad; - } - } - elseif (method_exists($tmp_obj, "detalhe")) { - if ($tmp_obj->detalhe()) { - $this->ref_usuario_cad = $ref_usuario_cad; - } - } - } - else { - if ($db->CampoUnico("SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_cad}'")) { - $this->ref_usuario_cad = $ref_usuario_cad; - } + $usuario = new clsPmieducarUsuario($ref_usuario_cad); + if ($usuario->existe()) { + $this->ref_usuario_cad = $ref_usuario_cad; } } if (is_numeric($ref_cod_matricula)) { - if (class_exists("clsPmieducarMatricula")) { - $tmp_obj = new clsPmieducarMatricula($ref_cod_matricula); - if (method_exists($tmp_obj, "existe")) { - if ($tmp_obj->existe()) { - $this->ref_cod_matricula = $ref_cod_matricula; - } - } - elseif (method_exists($tmp_obj, "detalhe")) { - if ($tmp_obj->detalhe()) { - $this->ref_cod_matricula = $ref_cod_matricula; - } - } - } - else { - if ($db->CampoUnico("SELECT 1 FROM pmieducar.matricula WHERE ref_cod_matricula = '{$ref_cod_matricula}'")) { - $this->ref_cod_matricula = $ref_cod_matricula; - } + $matricula = new clsPmieducarMatricula($ref_cod_matricula); + if ($matricula->existe()) { + $this->ref_cod_matricula = $ref_cod_matricula; } } if (is_numeric($ref_cod_tipo_dispensa)) { - if (class_exists("clsPmieducarTipoDispensa")) { - $tmp_obj = new clsPmieducarTipoDispensa($ref_cod_tipo_dispensa); - if (method_exists($tmp_obj, "existe")) { - if ($tmp_obj->existe()) { - $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; - } - } - elseif (method_exists($tmp_obj, "detalhe")) { - if ($tmp_obj->detalhe()) { - $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; - } - } - } - else { - if ($db->CampoUnico("SELECT 1 FROM pmieducar.tipo_dispensa WHERE cod_tipo_dispensa = '{$ref_cod_tipo_dispensa}'")) { - $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; - } + $tipoDispensa = new clsPmieducarTipoDispensa($ref_cod_tipo_dispensa); + if ($tipoDispensa->existe()) { + $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; } } - if (is_numeric($ref_cod_disciplina) && is_numeric($ref_cod_escola) && is_numeric($ref_cod_serie)) { - if (class_exists("clsPmieducarEscolaSerieDisciplina")) { - $tmp_obj = new clsPmieducarEscolaSerieDisciplina($ref_cod_serie, $ref_cod_escola, $ref_cod_disciplina); - if (method_exists($tmp_obj, "existe")) { - if ($tmp_obj->existe()) { - $this->ref_cod_disciplina = $ref_cod_disciplina; - $this->ref_cod_escola = $ref_cod_escola; - $this->ref_cod_serie = $ref_cod_serie; - } - } - elseif (method_exists($tmp_obj, "detalhe")) { - if ($tmp_obj->detalhe()) { - $this->ref_cod_disciplina = $ref_cod_disciplina; - $this->ref_cod_escola = $ref_cod_escola; - $this->ref_cod_serie = $ref_cod_serie; - } - } - } - else { - if ($db->CampoUnico("SELECT 1 FROM pmieducar.escola_serie_disciplina WHERE ref_cod_disciplina = '{$ref_cod_disciplina}' AND ref_cod_escola = '{$ref_cod_escola}' AND ref_cod_serie = '{$ref_cod_serie}'")) { - $this->ref_cod_disciplina = $ref_cod_disciplina; - $this->ref_cod_escola = $ref_cod_escola; - $this->ref_cod_serie = $ref_cod_serie; - } + if (is_numeric($ref_cod_disciplina) && is_numeric($ref_cod_escola) && + is_numeric($ref_cod_serie) + ) { + $escolaSerieDisciplina = new clsPmieducarEscolaSerieDisciplina($ref_cod_serie, + $ref_cod_escola, $ref_cod_disciplina); + + if ($escolaSerieDisciplina->existe()) { + $this->ref_cod_disciplina = $ref_cod_disciplina; + $this->ref_cod_escola = $ref_cod_escola; + $this->ref_cod_serie = $ref_cod_serie; } } -- libgit2 0.21.2