From 9b56bed288b2cdf15f298e6baf716fb83f64c677 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Mon, 9 Jul 2018 15:33:38 -0300 Subject: [PATCH 01/73] =?UTF-8?q?Ajusta=20para=20n=C3=A3o=20inativar=20sol?= =?UTF-8?q?icita=C3=A7=C3=A3o=20transfer=C3=AAncia=20quando=20atendida;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ao realizar nova matrícula, é verificado se o aluno tem solitações de transferência, caso tenha, é atualizado campo matrícula entrada na solicitação de transferência e a mesma era colocada com status ativo = 0. Quando a nova matrícula atender a solicitação transferência não inativar a mesma, somente atualizar a matrícula de entrada. --- ieducar/intranet/educar_matricula_cad.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/intranet/educar_matricula_cad.php b/ieducar/intranet/educar_matricula_cad.php index 237da666c9..6be4e530c8 100644 --- a/ieducar/intranet/educar_matricula_cad.php +++ b/ieducar/intranet/educar_matricula_cad.php @@ -955,7 +955,7 @@ function copiaNotasFaltas($matriculaAntiga, $matriculaNova) { } function atendeSolicitacaoTransferencia($codTranferencia, $codMatriculaEntrada) { - $obj_transferencia = new clsPmieducarTransferenciaSolicitacao($codTranferencia, NULL, $this->pessoa_logada, NULL, $codMatriculaEntrada, NULL, NULL, NULL, NULL, 0); + $obj_transferencia = new clsPmieducarTransferenciaSolicitacao($codTranferencia, NULL, $this->pessoa_logada, NULL, $codMatriculaEntrada, NULL, NULL, NULL, NULL, 1); $obj_transferencia->edita(); } From 6f1a4c7b84aaf366b1a873a80700dd034f9626e4 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Tue, 10 Jul 2018 10:34:52 -0300 Subject: [PATCH 02/73] =?UTF-8?q?Melhoria=20de=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_matricula_cad.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/intranet/educar_matricula_cad.php b/ieducar/intranet/educar_matricula_cad.php index 6be4e530c8..2871940b11 100644 --- a/ieducar/intranet/educar_matricula_cad.php +++ b/ieducar/intranet/educar_matricula_cad.php @@ -955,7 +955,7 @@ function copiaNotasFaltas($matriculaAntiga, $matriculaNova) { } function atendeSolicitacaoTransferencia($codTranferencia, $codMatriculaEntrada) { - $obj_transferencia = new clsPmieducarTransferenciaSolicitacao($codTranferencia, NULL, $this->pessoa_logada, NULL, $codMatriculaEntrada, NULL, NULL, NULL, NULL, 1); + $obj_transferencia = new clsPmieducarTransferenciaSolicitacao($codTranferencia, NULL, $this->pessoa_logada, NULL, $codMatriculaEntrada, NULL, NULL, NULL, NULL, NULL); $obj_transferencia->edita(); } From e7674917189bb8121c3682fa9a037f9ee7482a0b Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Tue, 10 Jul 2018 11:46:30 -0300 Subject: [PATCH 03/73] =?UTF-8?q?Melhoria=20de=20c=C3=B3digo.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_matricula_cad.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/intranet/educar_matricula_cad.php b/ieducar/intranet/educar_matricula_cad.php index 2871940b11..a5c3c9502e 100644 --- a/ieducar/intranet/educar_matricula_cad.php +++ b/ieducar/intranet/educar_matricula_cad.php @@ -955,7 +955,7 @@ function copiaNotasFaltas($matriculaAntiga, $matriculaNova) { } function atendeSolicitacaoTransferencia($codTranferencia, $codMatriculaEntrada) { - $obj_transferencia = new clsPmieducarTransferenciaSolicitacao($codTranferencia, NULL, $this->pessoa_logada, NULL, $codMatriculaEntrada, NULL, NULL, NULL, NULL, NULL); + $obj_transferencia = new clsPmieducarTransferenciaSolicitacao($codTranferencia, NULL, $this->pessoa_logada, NULL, $codMatriculaEntrada); $obj_transferencia->edita(); } From bf4e12a1d965583f95d07f2a35a93b940e67e4eb Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Mon, 16 Jul 2018 14:39:57 -0300 Subject: [PATCH 04/73] Ajusta Save EducacensoEscola; Refs #3928 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ao editar inep escola ocorria erro pois não encontrava chaves (cod_escola, inep), ajustado para sempre apagar registro e cria quando houver inep. --- ieducar/modules/Api/Views/EscolaController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ieducar/modules/Api/Views/EscolaController.php b/ieducar/modules/Api/Views/EscolaController.php index dd8c25c3a0..72170fbbd6 100644 --- a/ieducar/modules/Api/Views/EscolaController.php +++ b/ieducar/modules/Api/Views/EscolaController.php @@ -67,9 +67,8 @@ protected function loadEscolaInepId($escolaId) { protected function createUpdateOrDestroyEducacensoEscola($escolaId) { $dataMapper = $this->getDataMapperFor('educacenso', 'escola'); - if (empty($this->getRequest()->escola_inep_id)) - $result = $this->deleteEntityOf($dataMapper, $escolaId); - else { + $result = $this->deleteEntityOf($dataMapper, $escolaId); + if (!empty($this->getRequest()->escola_inep_id)){ $data = array( 'escola' => $escolaId, 'escolaInep' => $this->getRequest()->escola_inep_id, From 0f20a54108b51869d9cf6cf84e3992ef903e6420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ber=20Freitas=20Dias?= Date: Tue, 17 Jul 2018 16:57:29 -0300 Subject: [PATCH 05/73] =?UTF-8?q?Adicionando=20verifica=C3=A7=C3=A3o=20ext?= =?UTF-8?q?ra=20para=20remo=C3=A7=C3=A3o=20de=20turmas;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs portabilis/i-educar-portabilis#3936 Já existia uma trava na remoção de turmas com alunos vinculados mas apenas no JavaScript. Foi feito um ajuste para impedir a remoção diretamente no PHP também. --- ieducar/intranet/educar_turma_cad.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ieducar/intranet/educar_turma_cad.php b/ieducar/intranet/educar_turma_cad.php index 7b4488b56e..b062b8cc9a 100644 --- a/ieducar/intranet/educar_turma_cad.php +++ b/ieducar/intranet/educar_turma_cad.php @@ -1154,6 +1154,12 @@ function Excluir() $obj = new clsPmieducarTurma($this->cod_turma, $this->pessoa_logada, null, null, null, null, null, null, null, null, null, null, 0); + if ($obj->possuiAlunosVinculados()) { + $this->mensagem = 'Exclusão não realizada.'; + + return false; + } + $turma = $obj->detalhe(); $excluiu = $obj->excluir(); From cad5784e0216f8a87372c9551ac7d268132d8e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ber=20Freitas=20Dias?= Date: Wed, 18 Jul 2018 11:34:50 -0300 Subject: [PATCH 06/73] =?UTF-8?q?Formata=C3=A7=C3=A3o=20PSR-2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmieducar/clsPmieducarSerie.inc.php | 1776 +++++++++-------- 1 file changed, 890 insertions(+), 886 deletions(-) diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php index 26f7adbfc7..254460da19 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php @@ -1,935 +1,935 @@ - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Prefeitura Municipal de Itajaí - * @category i-Educar - * @license @@license@@ - * @package iEd_Pmieducar - * @since Arquivo disponível desde a versão 1.0.0 - * @version $Id$ - */ - require_once 'include/pmieducar/geral.inc.php'; require_once 'RegraAvaliacao/Model/RegraDataMapper.php'; -/** - * clsPmieducarSerie class. - * - * @author Prefeitura Municipal de Itajaí - * @category i-Educar - * @license @@license@@ - * @package iEd_Pmieducar - * @since Classe disponível desde a versão 1.0.0 - * @todo A verificação de regra de avaliação no construtor é falha pois - * ignora os casos que a foreign key de curso não é informada. Atribuir - * um foreign key de instituição a tabelam pmieducar.serie resolveria este - * problema. - * @version @@package_version@@ - */ class clsPmieducarSerie { - var $cod_serie; - var $ref_usuario_exc; - var $ref_usuario_cad; - var $ref_cod_curso; - var $nm_serie; - var $etapa_curso; - var $concluinte; - var $carga_horaria; - var $data_cadastro; - var $data_exclusao; - var $ativo; - var $regra_avaliacao_id; - var $regra_avaliacao_diferenciada_id; - - var $idade_inicial; - var $idade_final; - var $idade_ideal; - - var $alerta_faixa_etaria; - var $bloquear_matricula_faixa_etaria; - var $exigir_inep; - - /** - * Armazena o total de resultados obtidos na última chamada ao método lista(). - * @var int - */ - var $_total; - - /** - * Nome do schema. - * @var string - */ - var $_schema; - - /** - * Nome da tabela. - * @var string - */ - var $_tabela; - - /** - * Lista separada por vírgula, com os campos que devem ser selecionados na - * próxima chamado ao método lista(). - * @var string - */ - var $_campos_lista; - - /** - * Lista com todos os campos da tabela separados por vírgula, padrão para - * seleção no método lista. - * @var string - */ - var $_todos_campos; - - /** - * Valor que define a quantidade de registros a ser retornada pelo método lista(). - * @var int - */ - var $_limite_quantidade; - - /** - * Define o valor de offset no retorno dos registros no método lista(). - * @var int - */ - var $_limite_offset; - - /** - * Define o campo para ser usado como padrão de ordenação no método lista(). - * @var string - */ - var $_campo_order_by; - - /** - * Construtor. - */ - function __construct($cod_serie = NULL, $ref_usuario_exc = NULL, - $ref_usuario_cad = NULL, $ref_cod_curso = NULL, $nm_serie = NULL, - $etapa_curso = NULL, $concluinte = NULL, $carga_horaria = NULL, - $data_cadastro = NULL, $data_exclusao = NULL, $ativo = NULL, - $idade_inicial = NULL, $idade_final = NULL, $regra_avaliacao_id = NULL, $observacao_historico = null, - $dias_letivos = null, $regra_avaliacao_diferenciada_id = null, $alerta_faixa_etaria = false, $bloquear_matricula_faixa_etaria = false,$idade_ideal = null, $exigir_inep = false) - { - $db = new clsBanco(); - $this->_schema = "pmieducar."; - $this->_tabela = "{$this->_schema}serie"; - $this->_campos_lista = $this->_todos_campos = "s.cod_serie, s.ref_usuario_exc, s.ref_usuario_cad, s.ref_cod_curso, s.nm_serie, s.etapa_curso, s.concluinte, s.carga_horaria, s.data_cadastro, s.data_exclusao, s.ativo, s.idade_inicial, s.idade_final, s.regra_avaliacao_id, s.observacao_historico, s.dias_letivos, s.regra_avaliacao_diferenciada_id, s.alerta_faixa_etaria, s.bloquear_matricula_faixa_etaria, s.idade_ideal, s.exigir_inep"; - - if (is_numeric($ref_cod_curso)) { - if (class_exists("clsPmieducarCurso")) { - $tmp_obj = new clsPmieducarCurso($ref_cod_curso); - $curso = $tmp_obj->detalhe(); - if (FALSE != $curso) { - $this->ref_cod_curso = $ref_cod_curso; - } - } - else { - if ($db->CampoUnico("SELECT 1 FROM pmieducar.curso WHERE cod_curso = '{$ref_cod_curso}'")) { - $this->ref_cod_curso = $ref_cod_curso; - } - } - } - 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; - } - } - else if( 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; - } - } - } - - 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; - } - } - else if(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; - } - } - } - - // Atribuibui a identificação de regra de avaliação - if (!is_null($regra_avaliacao_id) && is_numeric($regra_avaliacao_id)) { - $mapper = new RegraAvaliacao_Model_RegraDataMapper(); + public $cod_serie; + public $ref_usuario_exc; + public $ref_usuario_cad; + public $ref_cod_curso; + public $nm_serie; + public $etapa_curso; + public $concluinte; + public $carga_horaria; + public $data_cadastro; + public $data_exclusao; + public $ativo; + public $regra_avaliacao_id; + public $regra_avaliacao_diferenciada_id; + + public $idade_inicial; + public $idade_final; + public $idade_ideal; + + public $alerta_faixa_etaria; + public $bloquear_matricula_faixa_etaria; + public $exigir_inep; + + /** + * Armazena o total de resultados obtidos na última chamada ao método lista(). + * + * @var int + */ + public $_total; + + /** + * Nome do schema. + * + * @var string + */ + public $_schema; + + /** + * Nome da tabela. + * + * @var string + */ + public $_tabela; + + /** + * Lista separada por vírgula, com os campos que devem ser selecionados na + * próxima chamado ao método lista(). + * + * @var string + */ + public $_campos_lista; + + /** + * Lista com todos os campos da tabela separados por vírgula, padrão para + * seleção no método lista. + * + * @var string + */ + public $_todos_campos; + + /** + * Valor que define a quantidade de registros a ser retornada pelo método lista(). + * + * @var int + */ + public $_limite_quantidade; + + /** + * Define o valor de offset no retorno dos registros no método lista(). + * + * @var int + */ + public $_limite_offset; + + /** + * Define o campo para ser usado como padrão de ordenação no método lista(). + * + * @var string + */ + public $_campo_order_by; + + /** + * Construtor. + */ + public function __construct( + $cod_serie = null, + $ref_usuario_exc = null, + $ref_usuario_cad = null, + $ref_cod_curso = null, + $nm_serie = null, + $etapa_curso = null, + $concluinte = null, + $carga_horaria = null, + $data_cadastro = null, + $data_exclusao = null, + $ativo = null, + $idade_inicial = null, + $idade_final = null, + $regra_avaliacao_id = null, + $observacao_historico = null, + $dias_letivos = null, + $regra_avaliacao_diferenciada_id = null, + $alerta_faixa_etaria = false, + $bloquear_matricula_faixa_etaria = false, + $idade_ideal = null, + $exigir_inep = false + ) { + $db = new clsBanco(); + $this->_schema = 'pmieducar.'; + $this->_tabela = "{$this->_schema}serie"; + $this->_campos_lista = $this->_todos_campos = 's.cod_serie, s.ref_usuario_exc, s.ref_usuario_cad, s.ref_cod_curso, s.nm_serie, s.etapa_curso, s.concluinte, s.carga_horaria, s.data_cadastro, s.data_exclusao, s.ativo, s.idade_inicial, s.idade_final, s.regra_avaliacao_id, s.observacao_historico, s.dias_letivos, s.regra_avaliacao_diferenciada_id, s.alerta_faixa_etaria, s.bloquear_matricula_faixa_etaria, s.idade_ideal, s.exigir_inep'; + + if (is_numeric($ref_cod_curso)) { + if (class_exists('clsPmieducarCurso')) { + $tmp_obj = new clsPmieducarCurso($ref_cod_curso); + $curso = $tmp_obj->detalhe(); + if (false != $curso) { + $this->ref_cod_curso = $ref_cod_curso; + } + } else { + if ($db->CampoUnico("SELECT 1 FROM pmieducar.curso WHERE cod_curso = '{$ref_cod_curso}'")) { + $this->ref_cod_curso = $ref_cod_curso; + } + } + } - if (isset($curso)) { - $regras = $mapper->findAll(array(), - array('id' => $regra_avaliacao_id, 'instituicao' => $curso['ref_cod_instituicao']) - ); + 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; + } + } + } - if (1 == count($regras)) { - $regra = $regras[0]; + 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; + } + } } - } - else { - $regra = $mapper->find($regra_avaliacao_id); - } - // Verificação fraca pois deixa ser uma regra de outra instituição - if (isset($regra)) { - $this->regra_avaliacao_id = $regra->id; - } - } + // Atribuibui a identificação de regra de avaliação + if (!is_null($regra_avaliacao_id) && is_numeric($regra_avaliacao_id)) { + $mapper = new RegraAvaliacao_Model_RegraDataMapper(); + + if (isset($curso)) { + $regras = $mapper->findAll( + [], + ['id' => $regra_avaliacao_id, 'instituicao' => $curso['ref_cod_instituicao']] + ); + + if (1 == count($regras)) { + $regra = $regras[0]; + } + } else { + $regra = $mapper->find($regra_avaliacao_id); + } + + // Verificação fraca pois deixa ser uma regra de outra instituição + if (isset($regra)) { + $this->regra_avaliacao_id = $regra->id; + } + } - if (!is_null($regra_avaliacao_diferenciada_id) && is_numeric($regra_avaliacao_diferenciada_id)) { - $mapper = new RegraAvaliacao_Model_RegraDataMapper(); + if (!is_null($regra_avaliacao_diferenciada_id) && is_numeric($regra_avaliacao_diferenciada_id)) { + $mapper = new RegraAvaliacao_Model_RegraDataMapper(); + + if (isset($curso)) { + $regras = $mapper->findAll( + [], + ['id' => $regra_avaliacao_diferenciada_id, 'instituicao' => $curso['ref_cod_instituicao']] + ); + + if (1 == count($regras)) { + $regra = $regras[0]; + } + } else { + $regra = $mapper->find($regra_avaliacao_diferenciada_id); + } + + // Verificação fraca pois deixa ser uma regra de outra instituição + if (isset($regra)) { + $this->regra_avaliacao_diferenciada_id = $regra->id; + } + } - if (isset($curso)) { - $regras = $mapper->findAll(array(), - array('id' => $regra_avaliacao_diferenciada_id, 'instituicao' => $curso['ref_cod_instituicao']) - ); + if (is_numeric($cod_serie)) { + $this->cod_serie = $cod_serie; + } - if (1 == count($regras)) { - $regra = $regras[0]; + if (is_string($nm_serie)) { + $this->nm_serie = $nm_serie; } - } - else { - $regra = $mapper->find($regra_avaliacao_diferenciada_id); - } - // Verificação fraca pois deixa ser uma regra de outra instituição - if (isset($regra)) { - $this->regra_avaliacao_diferenciada_id = $regra->id; - } - } + if (is_numeric($etapa_curso)) { + $this->etapa_curso = $etapa_curso; + } - if (is_numeric($cod_serie)) { - $this->cod_serie = $cod_serie; - } + if (is_numeric($concluinte)) { + $this->concluinte = $concluinte; + } - if (is_string($nm_serie)) { - $this->nm_serie = $nm_serie; - } + if (is_numeric($carga_horaria)) { + $this->carga_horaria = $carga_horaria; + } - if (is_numeric($etapa_curso)) { - $this->etapa_curso = $etapa_curso; - } + if (is_string($data_cadastro)) { + $this->data_cadastro = $data_cadastro; + } - if (is_numeric($concluinte)) { - $this->concluinte = $concluinte; - } + if (is_string($data_exclusao)) { + $this->data_exclusao = $data_exclusao; + } - if (is_numeric($carga_horaria)) { - $this->carga_horaria = $carga_horaria; - } + if (is_numeric($ativo)) { + $this->ativo = $ativo; + } - if (is_string($data_cadastro)) { - $this->data_cadastro = $data_cadastro; - } + if (is_numeric($idade_inicial)) { + $this->idade_inicial = $idade_inicial; + } - if (is_string($data_exclusao)) { - $this->data_exclusao = $data_exclusao; - } + if (is_numeric($idade_final)) { + $this->idade_final = $idade_final; + } - if (is_numeric($ativo)) { - $this->ativo = $ativo; - } + if (dbBool($alerta_faixa_etaria)) { + $this->alerta_faixa_etaria = $alerta_faixa_etaria; + } - if (is_numeric($idade_inicial)) { - $this->idade_inicial = $idade_inicial; - } + if (dbBool($bloquear_matricula_faixa_etaria)) { + $this->bloquear_matricula_faixa_etaria = $bloquear_matricula_faixa_etaria; + } - if (is_numeric($idade_final)) { - $this->idade_final = $idade_final; - } + if (is_numeric($idade_ideal)) { + $this->idade_ideal = $idade_ideal; + } - if (dbBool($alerta_faixa_etaria)) { - $this->alerta_faixa_etaria = $alerta_faixa_etaria; - } + if (dbBool($exigir_inep)) { + $this->exigir_inep = $exigir_inep; + } - if (dbBool($bloquear_matricula_faixa_etaria)) { - $this->bloquear_matricula_faixa_etaria = $bloquear_matricula_faixa_etaria; + $this->observacao_historico = $observacao_historico; + $this->dias_letivos = $dias_letivos; } - if (is_numeric($idade_ideal)) { - $this->idade_ideal = $idade_ideal; - } + /** + * Cria um novo registro. + * + * @return bool + */ + public function cadastra() + { + if ( + is_numeric($this->ref_usuario_cad) && is_numeric($this->ref_cod_curso) && + is_string($this->nm_serie) && is_numeric($this->etapa_curso) && + is_numeric($this->concluinte) && is_numeric($this->carga_horaria) && + is_numeric($this->dias_letivos) + ) { + $db = new clsBanco(); + + $campos = ''; + $valores = ''; + $gruda = ''; + + if (is_numeric($this->ref_usuario_cad)) { + $campos .= "{$gruda}ref_usuario_cad"; + $valores .= "{$gruda}'{$this->ref_usuario_cad}'"; + $gruda = ', '; + } + + if (is_numeric($this->ref_cod_curso)) { + $campos .= "{$gruda}ref_cod_curso"; + $valores .= "{$gruda}'{$this->ref_cod_curso}'"; + $gruda = ', '; + } + + if (is_string($this->nm_serie)) { + $campos .= "{$gruda}nm_serie"; + $valores .= "{$gruda}'{$this->nm_serie}'"; + $gruda = ', '; + } + + if (is_numeric($this->etapa_curso)) { + $campos .= "{$gruda}etapa_curso"; + $valores .= "{$gruda}'{$this->etapa_curso}'"; + $gruda = ', '; + } + + if (is_numeric($this->concluinte)) { + $campos .= "{$gruda}concluinte"; + $valores .= "{$gruda}'{$this->concluinte}'"; + $gruda = ', '; + } + + if (is_numeric($this->carga_horaria)) { + $campos .= "{$gruda}carga_horaria"; + $valores .= "{$gruda}'{$this->carga_horaria}'"; + $gruda = ', '; + } + + if (is_numeric($this->idade_inicial)) { + $campos .= "{$gruda}idade_inicial"; + $valores .= "{$gruda}'{$this->idade_inicial}'"; + $gruda = ', '; + } + + if (is_numeric($this->idade_final)) { + $campos .= "{$gruda}idade_final"; + $valores .= "{$gruda}'{$this->idade_final}'"; + $gruda = ', '; + } + + if (is_numeric($this->regra_avaliacao_id)) { + $campos .= "{$gruda}regra_avaliacao_id"; + $valores .= "{$gruda}'{$this->regra_avaliacao_id}'"; + $gruda = ', '; + } + + if (is_numeric($this->regra_avaliacao_diferenciada_id)) { + $campos .= "{$gruda}regra_avaliacao_diferenciada_id"; + $valores .= "{$gruda}'{$this->regra_avaliacao_diferenciada_id}'"; + $gruda = ', '; + } + + $campos .= "{$gruda}data_cadastro"; + $valores .= "{$gruda}NOW()"; + $gruda = ', '; + + $campos .= "{$gruda}ativo"; + $valores .= "{$gruda}'1'"; + $gruda = ', '; + + if (is_string($this->observacao_historico)) { + $campos .= "{$gruda}observacao_historico"; + $valores .= "{$gruda}'{$this->observacao_historico}'"; + $gruda = ', '; + } + + if (is_numeric($this->dias_letivos)) { + $campos .= "{$gruda}dias_letivos"; + $valores .= "{$gruda}'{$this->dias_letivos}'"; + $gruda = ', '; + } + + if (is_numeric($this->idade_ideal)) { + $campos .= "{$gruda}idade_ideal"; + $valores .= "{$gruda}'{$this->idade_ideal}'"; + $gruda = ', '; + } + + if (dbBool($this->alerta_faixa_etaria)) { + $campos .= "{$gruda}alerta_faixa_etaria"; + $valores .= "{$gruda} true "; + $gruda = ', '; + } else { + $campos .= "{$gruda}alerta_faixa_etaria"; + $valores .= "{$gruda} false "; + $gruda = ', '; + } + + if (dbBool($this->bloquear_matricula_faixa_etaria)) { + $campos .= "{$gruda}bloquear_matricula_faixa_etaria"; + $valores .= "{$gruda} true "; + $gruda = ', '; + } else { + $campos .= "{$gruda}bloquear_matricula_faixa_etaria"; + $valores .= "{$gruda} false "; + $gruda = ', '; + } + + if (dbBool($this->exigir_inep)) { + $campos .= "{$gruda}exigir_inep"; + $valores .= "{$gruda} true "; + $gruda = ', '; + } else { + $campos .= "{$gruda}exigir_inep"; + $valores .= "{$gruda} false "; + $gruda = ', '; + } + + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); + + return $db->InsertId("{$this->_tabela}_cod_serie_seq"); + } - if (dbBool($exigir_inep)) { - $this->exigir_inep = $exigir_inep; + return false; } - $this->observacao_historico = $observacao_historico; - $this->dias_letivos = $dias_letivos; - } - - /** - * Cria um novo registro. - * @return bool - */ - function cadastra() - { - if (is_numeric($this->ref_usuario_cad) && is_numeric($this->ref_cod_curso) && - is_string($this->nm_serie) && is_numeric($this->etapa_curso) && - is_numeric($this->concluinte) && is_numeric($this->carga_horaria) && - is_numeric($this->dias_letivos) ) + /** + * Edita os dados de um registro. + * + * @return bool + */ + public function edita() { - $db = new clsBanco(); - - $campos = ''; - $valores = ''; - $gruda = ''; - - if (is_numeric($this->ref_usuario_cad)) { - $campos .= "{$gruda}ref_usuario_cad"; - $valores .= "{$gruda}'{$this->ref_usuario_cad}'"; - $gruda = ", "; - } - - if (is_numeric($this->ref_cod_curso)) { - $campos .= "{$gruda}ref_cod_curso"; - $valores .= "{$gruda}'{$this->ref_cod_curso}'"; - $gruda = ", "; - } - - if (is_string($this->nm_serie)) { - $campos .= "{$gruda}nm_serie"; - $valores .= "{$gruda}'{$this->nm_serie}'"; - $gruda = ", "; - } - - if (is_numeric($this->etapa_curso)) { - $campos .= "{$gruda}etapa_curso"; - $valores .= "{$gruda}'{$this->etapa_curso}'"; - $gruda = ", "; - } - - if (is_numeric($this->concluinte)) { - $campos .= "{$gruda}concluinte"; - $valores .= "{$gruda}'{$this->concluinte}'"; - $gruda = ", "; - } - - if (is_numeric($this->carga_horaria)) { - $campos .= "{$gruda}carga_horaria"; - $valores .= "{$gruda}'{$this->carga_horaria}'"; - $gruda = ", "; - } - - if (is_numeric($this->idade_inicial)) { - $campos .= "{$gruda}idade_inicial"; - $valores .= "{$gruda}'{$this->idade_inicial}'"; - $gruda = ", "; - } - - if (is_numeric($this->idade_final)) { - $campos .= "{$gruda}idade_final"; - $valores .= "{$gruda}'{$this->idade_final}'"; - $gruda = ", "; - } - - if (is_numeric($this->regra_avaliacao_id)) { - $campos .= "{$gruda}regra_avaliacao_id"; - $valores .= "{$gruda}'{$this->regra_avaliacao_id}'"; - $gruda = ", "; - } - - if (is_numeric($this->regra_avaliacao_diferenciada_id)) { - $campos .= "{$gruda}regra_avaliacao_diferenciada_id"; - $valores .= "{$gruda}'{$this->regra_avaliacao_diferenciada_id}'"; - $gruda = ", "; - } - - $campos .= "{$gruda}data_cadastro"; - $valores .= "{$gruda}NOW()"; - $gruda = ", "; - - $campos .= "{$gruda}ativo"; - $valores .= "{$gruda}'1'"; - $gruda = ", "; - - if(is_string($this->observacao_historico)){ - $campos .= "{$gruda}observacao_historico"; - $valores .= "{$gruda}'{$this->observacao_historico}'"; - $gruda = ", "; - } - - if (is_numeric($this->dias_letivos)) { - $campos .= "{$gruda}dias_letivos"; - $valores .= "{$gruda}'{$this->dias_letivos}'"; - $gruda = ", "; - } - - if (is_numeric($this->idade_ideal)) { - $campos .= "{$gruda}idade_ideal"; - $valores .= "{$gruda}'{$this->idade_ideal}'"; - $gruda = ", "; - } - - if (dbBool($this->alerta_faixa_etaria)) { - $campos .= "{$gruda}alerta_faixa_etaria"; - $valores .= "{$gruda} true "; - $gruda = ", "; - }else{ - $campos .= "{$gruda}alerta_faixa_etaria"; - $valores .= "{$gruda} false "; - $gruda = ", "; - } - - if (dbBool($this->bloquear_matricula_faixa_etaria)) { - $campos .= "{$gruda}bloquear_matricula_faixa_etaria"; - $valores .= "{$gruda} true "; - $gruda = ", "; - }else{ - $campos .= "{$gruda}bloquear_matricula_faixa_etaria"; - $valores .= "{$gruda} false "; - $gruda = ", "; - } - - if (dbBool($this->exigir_inep)) { - $campos .= "{$gruda}exigir_inep"; - $valores .= "{$gruda} true "; - $gruda = ", "; - }else{ - $campos .= "{$gruda}exigir_inep"; - $valores .= "{$gruda} false "; - $gruda = ", "; - } - - $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); - return $db->InsertId("{$this->_tabela}_cod_serie_seq"); - } - - return FALSE; - } - - /** - * Edita os dados de um registro. - * @return bool - */ - function edita() - { - if (is_numeric($this->cod_serie) && is_numeric($this->ref_usuario_exc)) { - $db = new clsBanco(); - $set = ""; - - if (is_numeric($this->ref_usuario_exc)) { - $set .= "{$gruda}ref_usuario_exc = '{$this->ref_usuario_exc}'"; - $gruda = ", "; - } - - if (is_numeric($this->ref_usuario_cad)) { - $set .= "{$gruda}ref_usuario_cad = '{$this->ref_usuario_cad}'"; - $gruda = ", "; - } - - if (is_numeric($this->ref_cod_curso)) { - $set .= "{$gruda}ref_cod_curso = '{$this->ref_cod_curso}'"; - $gruda = ", "; - } - - if (is_string($this->nm_serie)) { - $set .= "{$gruda}nm_serie = '{$this->nm_serie}'"; - $gruda = ", "; - } - - if (is_numeric($this->etapa_curso)) { - $set .= "{$gruda}etapa_curso = '{$this->etapa_curso}'"; - $gruda = ", "; - } - - if (is_numeric($this->concluinte)) { - $set .= "{$gruda}concluinte = '{$this->concluinte}'"; - $gruda = ", "; - } - - if (is_numeric($this->carga_horaria)) { - $set .= "{$gruda}carga_horaria = '{$this->carga_horaria}'"; - $gruda = ", "; - } - - if (is_string($this->data_cadastro)) { - $set .= "{$gruda}data_cadastro = '{$this->data_cadastro}'"; - $gruda = ", "; - } - - $set .= "{$gruda}data_exclusao = NOW()"; - $gruda = ", "; - - if (is_numeric($this->ativo)) { - $set .= "{$gruda}ativo = '{$this->ativo}'"; - $gruda = ", "; - } - - if (is_numeric($this->idade_inicial)) { - $set .= "{$gruda}idade_inicial = '{$this->idade_inicial}'"; - $gruda = ", "; - } - else { - $set .= "{$gruda}idade_inicial = NULL"; - $gruda = ", "; - } - - if (is_numeric($this->idade_final)) { - $set .= "{$gruda}idade_final = '{$this->idade_final}'"; - $gruda = ", "; - } - else { - $set .= "{$gruda}idade_final = NULL"; - $gruda = ", "; - } - - if (is_numeric($this->regra_avaliacao_id)) { - $set .= "{$gruda}regra_avaliacao_id = '{$this->regra_avaliacao_id}'"; - $gruda = ", "; - } - - if (is_numeric($this->regra_avaliacao_diferenciada_id)) - $set .= "{$gruda}regra_avaliacao_diferenciada_id = '{$this->regra_avaliacao_diferenciada_id}' "; - else - $set .= "{$gruda}regra_avaliacao_diferenciada_id = NULL "; - - $gruda = ", "; - - if(is_string($this->observacao_historico)){ - $set .= "{$gruda}observacao_historico = '{$this->observacao_historico}'"; - $gruda = ", "; - } - - if (is_numeric($this->dias_letivos)) { - $set .= "{$gruda}dias_letivos = '{$this->dias_letivos}'"; - $gruda = ", "; - } - - if (is_numeric($this->idade_ideal)) { - $set .= "{$gruda}idade_ideal = '{$this->idade_ideal}'"; - $gruda = ", "; - } - else { - $set .= "{$gruda}idade_ideal = NULL"; - $gruda = ", "; - } - - if (dbBool($this->alerta_faixa_etaria)) { - $set .= "{$gruda}alerta_faixa_etaria = true "; - $gruda = ", "; - }else{ - $set .= "{$gruda}alerta_faixa_etaria = false "; - $gruda = ", "; - } - - if (dbBool($this->bloquear_matricula_faixa_etaria)) { - $set .= "{$gruda}bloquear_matricula_faixa_etaria = true "; - $gruda = ", "; - }else{ - $set .= "{$gruda}bloquear_matricula_faixa_etaria = false "; - $gruda = ", "; - } - - if (dbBool($this->exigir_inep)) { - $set .= "{$gruda}exigir_inep = true "; - $gruda = ", "; - }else{ - $set .= "{$gruda}exigir_inep = false "; - $gruda = ", "; - } - - if ($set) { - $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_serie = '{$this->cod_serie}'"); - return TRUE; - } - } + if (is_numeric($this->cod_serie) && is_numeric($this->ref_usuario_exc)) { + $db = new clsBanco(); + $set = ''; + + if (is_numeric($this->ref_usuario_exc)) { + $set .= "{$gruda}ref_usuario_exc = '{$this->ref_usuario_exc}'"; + $gruda = ', '; + } + + if (is_numeric($this->ref_usuario_cad)) { + $set .= "{$gruda}ref_usuario_cad = '{$this->ref_usuario_cad}'"; + $gruda = ', '; + } + + if (is_numeric($this->ref_cod_curso)) { + $set .= "{$gruda}ref_cod_curso = '{$this->ref_cod_curso}'"; + $gruda = ', '; + } + + if (is_string($this->nm_serie)) { + $set .= "{$gruda}nm_serie = '{$this->nm_serie}'"; + $gruda = ', '; + } + + if (is_numeric($this->etapa_curso)) { + $set .= "{$gruda}etapa_curso = '{$this->etapa_curso}'"; + $gruda = ', '; + } + + if (is_numeric($this->concluinte)) { + $set .= "{$gruda}concluinte = '{$this->concluinte}'"; + $gruda = ', '; + } + + if (is_numeric($this->carga_horaria)) { + $set .= "{$gruda}carga_horaria = '{$this->carga_horaria}'"; + $gruda = ', '; + } + + if (is_string($this->data_cadastro)) { + $set .= "{$gruda}data_cadastro = '{$this->data_cadastro}'"; + $gruda = ', '; + } + + $set .= "{$gruda}data_exclusao = NOW()"; + $gruda = ', '; + + if (is_numeric($this->ativo)) { + $set .= "{$gruda}ativo = '{$this->ativo}'"; + $gruda = ', '; + } + + if (is_numeric($this->idade_inicial)) { + $set .= "{$gruda}idade_inicial = '{$this->idade_inicial}'"; + $gruda = ', '; + } else { + $set .= "{$gruda}idade_inicial = NULL"; + $gruda = ', '; + } + + if (is_numeric($this->idade_final)) { + $set .= "{$gruda}idade_final = '{$this->idade_final}'"; + $gruda = ', '; + } else { + $set .= "{$gruda}idade_final = NULL"; + $gruda = ', '; + } + + if (is_numeric($this->regra_avaliacao_id)) { + $set .= "{$gruda}regra_avaliacao_id = '{$this->regra_avaliacao_id}'"; + $gruda = ', '; + } + + if (is_numeric($this->regra_avaliacao_diferenciada_id)) { + $set .= "{$gruda}regra_avaliacao_diferenciada_id = '{$this->regra_avaliacao_diferenciada_id}' "; + } else { + $set .= "{$gruda}regra_avaliacao_diferenciada_id = NULL "; + } + + $gruda = ', '; + + if (is_string($this->observacao_historico)) { + $set .= "{$gruda}observacao_historico = '{$this->observacao_historico}'"; + $gruda = ', '; + } + + if (is_numeric($this->dias_letivos)) { + $set .= "{$gruda}dias_letivos = '{$this->dias_letivos}'"; + $gruda = ', '; + } + + if (is_numeric($this->idade_ideal)) { + $set .= "{$gruda}idade_ideal = '{$this->idade_ideal}'"; + $gruda = ', '; + } else { + $set .= "{$gruda}idade_ideal = NULL"; + $gruda = ', '; + } + + if (dbBool($this->alerta_faixa_etaria)) { + $set .= "{$gruda}alerta_faixa_etaria = true "; + $gruda = ', '; + } else { + $set .= "{$gruda}alerta_faixa_etaria = false "; + $gruda = ', '; + } + + if (dbBool($this->bloquear_matricula_faixa_etaria)) { + $set .= "{$gruda}bloquear_matricula_faixa_etaria = true "; + $gruda = ', '; + } else { + $set .= "{$gruda}bloquear_matricula_faixa_etaria = false "; + $gruda = ', '; + } + + if (dbBool($this->exigir_inep)) { + $set .= "{$gruda}exigir_inep = true "; + $gruda = ', '; + } else { + $set .= "{$gruda}exigir_inep = false "; + $gruda = ', '; + } + + if ($set) { + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_serie = '{$this->cod_serie}'"); + + return true; + } + } - return FALSE; - } - - /** - * Retorna uma lista de registros filtrados de acordo com os parâmetros. - * @return array - */ - function lista($int_cod_serie = NULL, $int_ref_usuario_exc = NULL, - $int_ref_usuario_cad = NULL, $int_ref_cod_curso = NULL, $str_nm_serie = NULL, - $int_etapa_curso = NULL, $int_concluinte = NULL, $int_carga_horaria = 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_ref_cod_instituicao = NULL, - $int_idade_inicial = NULL, $int_idade_final = NULL, $int_ref_cod_escola = NULL, - $regra_avaliacao_id = NULL, $int_idade_ideal = NULL) - { - $sql = "SELECT {$this->_campos_lista}, c.ref_cod_instituicao FROM {$this->_tabela} s, {$this->_schema}curso c"; - - $whereAnd = " AND "; - $filtros = " WHERE s.ref_cod_curso = c.cod_curso"; - - if (is_numeric($int_cod_serie)) { - $filtros .= "{$whereAnd} s.cod_serie = '{$int_cod_serie}'"; - $whereAnd = " AND "; - } + return false; + } + + /** + * Retorna uma lista de registros filtrados de acordo com os parâmetros. + * + * @return array + */ + public function lista( + $int_cod_serie = null, + $int_ref_usuario_exc = null, + $int_ref_usuario_cad = null, + $int_ref_cod_curso = null, + $str_nm_serie = null, + $int_etapa_curso = null, + $int_concluinte = null, + $int_carga_horaria = 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_ref_cod_instituicao = null, + $int_idade_inicial = null, + $int_idade_final = null, + $int_ref_cod_escola = null, + $regra_avaliacao_id = null, + $int_idade_ideal = null + ) { + $sql = "SELECT {$this->_campos_lista}, c.ref_cod_instituicao FROM {$this->_tabela} s, {$this->_schema}curso c"; + + $whereAnd = ' AND '; + $filtros = ' WHERE s.ref_cod_curso = c.cod_curso'; + + if (is_numeric($int_cod_serie)) { + $filtros .= "{$whereAnd} s.cod_serie = '{$int_cod_serie}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_ref_usuario_exc)) { - $filtros .= "{$whereAnd} s.ref_usuario_exc = '{$int_ref_usuario_exc}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_ref_usuario_exc)) { + $filtros .= "{$whereAnd} s.ref_usuario_exc = '{$int_ref_usuario_exc}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_ref_usuario_cad)) { - $filtros .= "{$whereAnd} s.ref_usuario_cad = '{$int_ref_usuario_cad}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_ref_usuario_cad)) { + $filtros .= "{$whereAnd} s.ref_usuario_cad = '{$int_ref_usuario_cad}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_ref_cod_curso)) { - $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_ref_cod_curso)) { + $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; + $whereAnd = ' AND '; + } - if (is_string($str_nm_serie)) { - $filtros .= "{$whereAnd} translate(upper(s.nm_serie),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_serie}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; - $whereAnd = " AND "; - } + if (is_string($str_nm_serie)) { + $filtros .= "{$whereAnd} translate(upper(s.nm_serie),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_serie}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; + $whereAnd = ' AND '; + } - if (is_numeric($int_etapa_curso)) { - $filtros .= "{$whereAnd} s.etapa_curso = '{$int_etapa_curso}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_etapa_curso)) { + $filtros .= "{$whereAnd} s.etapa_curso = '{$int_etapa_curso}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_concluinte)) { - $filtros .= "{$whereAnd} s.concluinte = '{$int_concluinte}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_concluinte)) { + $filtros .= "{$whereAnd} s.concluinte = '{$int_concluinte}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_carga_horaria)) { - $filtros .= "{$whereAnd} s.carga_horaria = '{$int_carga_horaria}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_carga_horaria)) { + $filtros .= "{$whereAnd} s.carga_horaria = '{$int_carga_horaria}'"; + $whereAnd = ' AND '; + } - if (is_string($date_data_cadastro_ini)) { - $filtros .= "{$whereAnd} s.data_cadastro >= '{$date_data_cadastro_ini}'"; - $whereAnd = " AND "; - } + if (is_string($date_data_cadastro_ini)) { + $filtros .= "{$whereAnd} s.data_cadastro >= '{$date_data_cadastro_ini}'"; + $whereAnd = ' AND '; + } - if (is_string($date_data_cadastro_fim)) { - $filtros .= "{$whereAnd} s.data_cadastro <= '{$date_data_cadastro_fim}'"; - $whereAnd = " AND "; - } + if (is_string($date_data_cadastro_fim)) { + $filtros .= "{$whereAnd} s.data_cadastro <= '{$date_data_cadastro_fim}'"; + $whereAnd = ' AND '; + } - if (is_string($date_data_exclusao_ini)) { - $filtros .= "{$whereAnd} s.data_exclusao >= '{$date_data_exclusao_ini}'"; - $whereAnd = " AND "; - } + if (is_string($date_data_exclusao_ini)) { + $filtros .= "{$whereAnd} s.data_exclusao >= '{$date_data_exclusao_ini}'"; + $whereAnd = ' AND '; + } - if (is_string($date_data_exclusao_fim)) { - $filtros .= "{$whereAnd} s.data_exclusao <= '{$date_data_exclusao_fim}'"; - $whereAnd = " AND "; - } + if (is_string($date_data_exclusao_fim)) { + $filtros .= "{$whereAnd} s.data_exclusao <= '{$date_data_exclusao_fim}'"; + $whereAnd = ' AND '; + } - if (is_numeric($regra_avaliacao_id)) { - $filtros .= "{$whereAnd} s.regra_avaliacao_id = '{$regra_avaliacao_id}'"; - $whereAnd = " AND "; - } + if (is_numeric($regra_avaliacao_id)) { + $filtros .= "{$whereAnd} s.regra_avaliacao_id = '{$regra_avaliacao_id}'"; + $whereAnd = ' AND '; + } - if (is_null($int_ativo) || $int_ativo) { - $filtros .= "{$whereAnd} s.ativo = '1'"; - $whereAnd = " AND "; - } - else { - $filtros .= "{$whereAnd} s.ativo = '0'"; - $whereAnd = " AND "; - } + if (is_null($int_ativo) || $int_ativo) { + $filtros .= "{$whereAnd} s.ativo = '1'"; + $whereAnd = ' AND '; + } else { + $filtros .= "{$whereAnd} s.ativo = '0'"; + $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_ref_cod_instituicao)) { + $filtros .= "{$whereAnd} c.ref_cod_instituicao = '$int_ref_cod_instituicao'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_idade_inicial)) { - $filtros .= "{$whereAnd} idade_inicial = '{$int_idade_inicial}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_idade_inicial)) { + $filtros .= "{$whereAnd} idade_inicial = '{$int_idade_inicial}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_idade_ideal)) { - $filtros .= "{$whereAnd} idade_ideal = '{$int_idade_ideal}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_idade_ideal)) { + $filtros .= "{$whereAnd} idade_ideal = '{$int_idade_ideal}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_idade_final)) { - $filtros .= "{$whereAnd} idade_final= '{$int_idade_final}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_idade_final)) { + $filtros .= "{$whereAnd} idade_final= '{$int_idade_final}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_ref_cod_escola)) { - $filtros .= "{$whereAnd} EXISTS (SELECT 1 + if (is_numeric($int_ref_cod_escola)) { + $filtros .= "{$whereAnd} EXISTS (SELECT 1 FROM pmieducar.escola_serie es WHERE s.cod_serie = es.ref_cod_serie AND es.ativo = 1 AND es.ref_cod_escola = '{$int_ref_cod_escola}') "; - $whereAnd = " AND "; - } + $whereAnd = ' AND '; + } - $db = new clsBanco(); - $countCampos = count(explode(',', $this->_campos_lista)); - $resultado = array(); + $db = new clsBanco(); + $countCampos = count(explode(',', $this->_campos_lista)); + $resultado = []; - $sql .= $filtros . $this->getOrderby() . $this->getLimite(); + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); - $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} s, " - . "{$this->_schema}curso c {$filtros}"); + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} s, " + . "{$this->_schema}curso c {$filtros}"); - $db->Consulta($sql); + $db->Consulta($sql); - if ($countCampos > 1) { - while ($db->ProximoRegistro()) { - $tupla = $db->Tupla(); + 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; + $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; } - return FALSE; - } + public function listaSeriesComComponentesVinculados( + $int_cod_serie = null, + $int_ref_cod_curso = null, + $int_ref_cod_instituicao = null, + $int_ativo = null + ) { + $sql = "SELECT {$this->_campos_lista}, + c.ref_cod_instituicao FROM {$this->_tabela} s, + {$this->_schema}curso c"; - function listaSeriesComComponentesVinculados($int_cod_serie = NULL, - $int_ref_cod_curso = NULL, - $int_ref_cod_instituicao = NULL, - $int_ativo = NULL) - { - $sql = "SELECT {$this->_campos_lista}, - c.ref_cod_instituicao FROM {$this->_tabela} s, - {$this->_schema}curso c"; + $whereAnd = ' AND '; + $filtros = ' WHERE s.ref_cod_curso = c.cod_curso'; - $whereAnd = " AND "; - $filtros = " WHERE s.ref_cod_curso = c.cod_curso"; + if (is_numeric($int_cod_serie)) { + $filtros .= "{$whereAnd} s.cod_serie = '{$int_cod_serie}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_cod_serie)) { - $filtros .= "{$whereAnd} s.cod_serie = '{$int_cod_serie}'"; - $whereAnd = " AND "; - } + if (is_numeric($int_ref_cod_curso)) { + $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; + $whereAnd = ' AND '; + } - if (is_numeric($int_ref_cod_curso)) { - $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; - $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_ref_cod_instituicao)) { - $filtros .= "{$whereAnd} c.ref_cod_instituicao = '$int_ref_cod_instituicao'"; - $whereAnd = " AND "; - } + if (is_null($int_ativo) || $int_ativo) { + $filtros .= "{$whereAnd} s.ativo = '1'"; + $whereAnd = ' AND '; + } - if (is_null($int_ativo) || $int_ativo) { - $filtros .= "{$whereAnd} s.ativo = '1'"; - $whereAnd = " AND "; - } + $filtros .= "{$whereAnd} s.cod_serie IN (SELECT DISTINCT ano_escolar_id + FROM modules.componente_curricular_ano_escolar)"; - $filtros .= "{$whereAnd} s.cod_serie IN (SELECT DISTINCT ano_escolar_id - FROM modules.componente_curricular_ano_escolar)"; - $whereAnd = " AND "; + $whereAnd = ' AND '; - $db = new clsBanco(); - $countCampos = count(explode(',', $this->_campos_lista)); - $resultado = array(); + $db = new clsBanco(); + $countCampos = count(explode(',', $this->_campos_lista)); + $resultado = []; - $sql .= $filtros . $this->getOrderby() . $this->getLimite(); + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); - $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} s, " - . "{$this->_schema}curso c {$filtros}"); + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} s, " + . "{$this->_schema}curso c {$filtros}"); - $db->Consulta($sql); + $db->Consulta($sql); - if ($countCampos > 1) { - while ($db->ProximoRegistro()) { - $tupla = $db->Tupla(); + if ($countCampos > 1) { + while ($db->ProximoRegistro()) { + $tupla = $db->Tupla(); - $tupla["_total"] = $this->_total; - $resultado[] = $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; } - else { - while ($db->ProximoRegistro()) { - $tupla = $db->Tupla(); - $resultado[] = $tupla[$this->_campos_lista]; - } + + /** + * Retorna um array com os dados de um registro. + * + * @return array + */ + public function detalhe() + { + if (is_numeric($this->cod_serie) && is_numeric($this->ref_cod_curso)) { + $db = new clsBanco(); + $db->Consulta("SELECT {$this->_todos_campos} FROM {$this->_tabela} s WHERE s.cod_serie = '{$this->cod_serie}' AND s.ref_cod_curso = '{$this->ref_cod_curso}'"); + $db->ProximoRegistro(); + + return $db->Tupla(); + } elseif (is_numeric($this->cod_serie)) { + $db = new clsBanco(); + $db->Consulta("SELECT {$this->_todos_campos} FROM {$this->_tabela} s WHERE s.cod_serie = '{$this->cod_serie}'"); + $db->ProximoRegistro(); + + return $db->Tupla(); + } + + return false; } - if (count($resultado)) { - return $resultado; + + /** + * Retorna um array com os dados de um registro ou FALSE caso não exista. + * + * @return array|bool + */ + public function existe() + { + if (is_numeric($this->cod_serie)) { + $db = new clsBanco(); + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_serie = '{$this->cod_serie}'"); + $db->ProximoRegistro(); + + return $db->Tupla(); + } + + return false; } - return FALSE; - } - - /** - * Retorna um array com os dados de um registro. - * @return array - */ - function detalhe() - { - if (is_numeric($this->cod_serie) && is_numeric($this->ref_cod_curso)) { - $db = new clsBanco(); - $db->Consulta("SELECT {$this->_todos_campos} FROM {$this->_tabela} s WHERE s.cod_serie = '{$this->cod_serie}' AND s.ref_cod_curso = '{$this->ref_cod_curso}'"); - $db->ProximoRegistro(); - return $db->Tupla(); + /** + * Exclui um registro. + * + * @return bool + */ + public function excluir() + { + if (is_numeric($this->cod_serie) && is_numeric($this->ref_usuario_exc)) { + $this->ativo = 0; + + return $this->edita(); + } + + return false; } - elseif (is_numeric($this->cod_serie)) { - $db = new clsBanco(); - $db->Consulta( "SELECT {$this->_todos_campos} FROM {$this->_tabela} s WHERE s.cod_serie = '{$this->cod_serie}'" ); - $db->ProximoRegistro(); - return $db->Tupla(); + + /** + * Define quais campos da tabela serão selecionados no método Lista(). + */ + public function setCamposLista($str_campos) + { + $this->_campos_lista = $str_campos; } - return FALSE; - } - - /** - * Retorna um array com os dados de um registro ou FALSE caso não exista. - * @return array|bool - */ - function existe() - { - if (is_numeric($this->cod_serie)) { - $db = new clsBanco(); - $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_serie = '{$this->cod_serie}'"); - $db->ProximoRegistro(); - return $db->Tupla(); + /** + * Define que o método Lista() deverpa retornar todos os campos da tabela. + */ + public function resetCamposLista() + { + $this->_campos_lista = $this->_todos_campos; } - return FALSE; - } - - /** - * Exclui um registro. - * @return bool - */ - function excluir() - { - if (is_numeric($this->cod_serie) && is_numeric($this->ref_usuario_exc)) { - $this->ativo = 0; - return $this->edita(); + /** + * Define limites de retorno para o método Lista(). + */ + public function setLimite($intLimiteQtd, $intLimiteOffset = null) + { + $this->_limite_quantidade = $intLimiteQtd; + $this->_limite_offset = $intLimiteOffset; } - return FALSE; - } - - /** - * Define quais campos da tabela serão selecionados no método Lista(). - */ - function setCamposLista($str_campos) - { - $this->_campos_lista = $str_campos; - } - - /** - * Define que o método Lista() deverpa retornar todos os campos da tabela. - */ - function resetCamposLista() - { - $this->_campos_lista = $this->_todos_campos; - } - - /** - * Define limites de retorno para o método Lista(). - */ - function setLimite($intLimiteQtd, $intLimiteOffset = NULL) - { - $this->_limite_quantidade = $intLimiteQtd; - $this->_limite_offset = $intLimiteOffset; - } - - /** - * Retorna a string com o trecho da query responsável pelo limite de - * registros retornados/afetados. - * - * @return string - */ - function getLimite() - { - if (is_numeric($this->_limite_quantidade)) { - $retorno = " LIMIT {$this->_limite_quantidade}"; - if (is_numeric($this->_limite_offset)) { - $retorno .= " OFFSET {$this->_limite_offset} "; - } - return $retorno; + /** + * Retorna a string com o trecho da query responsável pelo limite de + * registros retornados/afetados. + * + * @return string + */ + public function getLimite() + { + if (is_numeric($this->_limite_quantidade)) { + $retorno = " LIMIT {$this->_limite_quantidade}"; + if (is_numeric($this->_limite_offset)) { + $retorno .= " OFFSET {$this->_limite_offset} "; + } + + return $retorno; + } + + return ''; } - return ''; - } - - /** - * Define o campo para ser utilizado como ordenação no método Lista(). - */ - function setOrderby($strNomeCampo) - { - if (is_string($strNomeCampo) && $strNomeCampo) { - $this->_campo_order_by = $strNomeCampo; + + /** + * Define o campo para ser utilizado como ordenação no método Lista(). + */ + public function setOrderby($strNomeCampo) + { + if (is_string($strNomeCampo) && $strNomeCampo) { + $this->_campo_order_by = $strNomeCampo; + } } - } - - /** - * Retorna a string com o trecho da query responsável pela Ordenação dos - * registros. - * - * @return string - */ - function getOrderby() - { - if (is_string($this->_campo_order_by)) { - return " ORDER BY {$this->_campo_order_by} "; + + /** + * Retorna a string com o trecho da query responsável pela Ordenação dos + * registros. + * + * @return string + */ + public function getOrderby() + { + if (is_string($this->_campo_order_by)) { + return " ORDER BY {$this->_campo_order_by} "; + } + + return ''; } - return ''; - } - - /** - * Seleciona as série que não estejam cadastradas na escola. - * - * @param int $ref_cod_curso - * @param int $ref_cod_escola - * @return array - */ - function getNotEscolaSerie($ref_cod_curso, $ref_cod_escola) - { - $db = new clsBanco(); - $sql = "SELECT * + + /** + * Seleciona as série que não estejam cadastradas na escola. + * + * @param int $ref_cod_curso + * @param int $ref_cod_escola + * + * @return array + */ + public function getNotEscolaSerie($ref_cod_curso, $ref_cod_escola) + { + $db = new clsBanco(); + $sql = "SELECT * FROM pmieducar.serie s WHERE s.ref_cod_curso = '{$ref_cod_curso}' @@ -940,65 +940,69 @@ function getNotEscolaSerie($ref_cod_curso, $ref_cod_escola) WHERE es.ref_cod_escola = '{$ref_cod_escola}' )"; - $db->Consulta($sql); - - while ($db->ProximoRegistro()) { - $tupla = $db->Tupla(); - $resultado[] = $tupla; - } + $db->Consulta($sql); - return $resultado; - } + while ($db->ProximoRegistro()) { + $tupla = $db->Tupla(); + $resultado[] = $tupla; + } - /** - * Verifica se a data de nascimento enviada por parâmetro está dentro do período de corte etário pré-definido. - * - * @param int $dataNascimento - * @return boolean - */ - function verificaPeriodoCorteEtarioDataNascimento($dataNascimento, $ano){ + return $resultado; + } - $detSerie = $this->detalhe(); - $idadeInicial = $detSerie["idade_inicial"]; - $idadeFinal = $detSerie["idade_final"]; + /** + * Verifica se a data de nascimento enviada por parâmetro está dentro do período de corte etário pré-definido. + * + * @param int $dataNascimento + * + * @return boolean + */ + public function verificaPeriodoCorteEtarioDataNascimento($dataNascimento, $ano) + { + $detSerie = $this->detalhe(); + $idadeInicial = $detSerie['idade_inicial']; + $idadeFinal = $detSerie['idade_final']; + + $instituicaoId = $this->getInstituicaoByCurso($detSerie['ref_cod_curso']); + $objInstituicao = new clsPmieducarInstituicao($instituicaoId); + $detInstituicao = $objInstituicao->detalhe(); + $dataBaseMatricula = $detInstituicao['data_base_matricula']; + + //Caso não tenha data base na matricula, não verifica se está dentro do periodo + if (!is_string($dataBaseMatricula)) { + return true; + } - $instituicaoId = $this->getInstituicaoByCurso($detSerie["ref_cod_curso"]); - $objInstituicao = new clsPmieducarInstituicao($instituicaoId); - $detInstituicao = $objInstituicao->detalhe(); - $dataBaseMatricula = $detInstituicao["data_base_matricula"]; + $anoLimite = $ano; + $mesLimite = $dataBaseMatricula[1]; + $diaLimite = $dataBaseMatricula[2]; - //Caso não tenha data base na matricula, não verifica se está dentro do periodo - if (!is_string($dataBaseMatricula)) return true; + $dataLimite = $anoLimite . '-' . $mesLimite . '-' . $diaLimite; - $anoLimite = $ano; - $mesLimite = $dataBaseMatricula[1]; - $diaLimite = $dataBaseMatricula[2]; + $dataNascimento = new DateTime($dataNascimento); + $dataLimite = new DateTime($dataLimite); - $dataLimite = $anoLimite . '-' . $mesLimite . '-' . $diaLimite; + $diferencaDatas = $dataNascimento->diff($dataLimite); - $dataNascimento = new DateTime($dataNascimento); - $dataLimite = new DateTime($dataLimite); + $idadeNaData = $diferencaDatas->y; + $idadesPermitidas = range($idadeInicial, $idadeFinal); - $diferencaDatas = $dataNascimento->diff($dataLimite); + $idadeCompativel = false; - $idadeNaData = $diferencaDatas->y; - $idadesPermitidas = range($idadeInicial, $idadeFinal); + foreach ($idadesPermitidas as $idade) { + if ($idade == $idadeNaData) { + $idadeCompativel = true; + } + } - $idadeCompativel = false; - foreach($idadesPermitidas as $idade){ - if($idade == $idadeNaData){ - $idadeCompativel = true; - } + return $idadeCompativel; } - return $idadeCompativel; - } - - function getInstituicaoByCurso($codCurso){ - $objCurso = new clsPmieducarCurso($codCurso); - $detCurso = $objCurso->detalhe(); - - return $detCurso["ref_cod_instituicao"]; - } + public function getInstituicaoByCurso($codCurso) + { + $objCurso = new clsPmieducarCurso($codCurso); + $detCurso = $objCurso->detalhe(); + return $detCurso['ref_cod_instituicao']; + } } From eba8d0db331411f6c41e904e293799d142884307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ber=20Freitas=20Dias?= Date: Wed, 18 Jul 2018 12:00:01 -0300 Subject: [PATCH 07/73] =?UTF-8?q?Implementa=20travas=20de=20remo=C3=A7?= =?UTF-8?q?=C3=A3o=20nas=20s=C3=A9ries;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs portabilis/i-educar-portabilis#3936 --- ieducar/intranet/educar_serie_cad.php | 16 ++++++++++++++++ .../pmieducar/clsPmieducarSerie.inc.php | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/ieducar/intranet/educar_serie_cad.php b/ieducar/intranet/educar_serie_cad.php index 789dcacc15..861ccd9924 100644 --- a/ieducar/intranet/educar_serie_cad.php +++ b/ieducar/intranet/educar_serie_cad.php @@ -125,6 +125,11 @@ function Inicializar() $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']); $obj_curso_det = $obj_curso->detalhe(); $this->ref_cod_instituicao = $obj_curso_det['ref_cod_instituicao']; + + if ($obj->possuiTurmasVinculadas()) { + $this->script_excluir = "excluir_serie_com_turmas();"; + } + $this->fexcluir = $obj_permissoes->permissao_excluir(583, $this->pessoa_logada,3); @@ -306,6 +311,12 @@ function Excluir() $obj = new clsPmieducarSerie($this->cod_serie, $this->pessoa_logada, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); + if ($obj->possuiTurmasVinculadas()) { + $this->mensagem = 'Exclusão não realizada.'; + + return false; + } + $serie = $obj->detalhe(); $excluiu = $obj->excluir(); @@ -405,6 +416,11 @@ function RegrasInstituicao(xml_qtd_regras) } } +function excluir_serie_com_turmas() { + document.formcadastro.reset(); + alert(stringUtils.toUtf8('Não foi possível excluir a série, pois a mesma possui turmas vinculadas.')); +} + document.getElementById('ref_cod_curso').onchange = function() { var campoCurso = document.getElementById('ref_cod_curso').value; diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php index 254460da19..2f53814ba7 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php @@ -2,6 +2,7 @@ require_once 'include/pmieducar/geral.inc.php'; require_once 'RegraAvaliacao/Model/RegraDataMapper.php'; +require_once 'Portabilis/Utils/Database.php'; class clsPmieducarSerie { @@ -1005,4 +1006,22 @@ public function getInstituicaoByCurso($codCurso) return $detCurso['ref_cod_instituicao']; } + + public function possuiTurmasVinculadas() + { + $sql = 'SELECT + 1 + FROM + pmieducar.turma + WHERE TRUE + AND turma.ref_ref_cod_serie = $1 + AND turma.ativo = 1'; + + $params = [ + 'params' => $this->cod_serie, + 'return_only' => 'first-field' + ]; + + return Portabilis_Utils_Database::fetchPreparedQuery($sql, $params); + } } From b5d00953a736923611bba4755636744d3ed00e9c Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 18 Jul 2018 14:42:28 -0300 Subject: [PATCH 08/73] Implementa regra para o preenchimento do capo 24 do registro 60 O campo 24 do registro 60 deve ser preenchido com 1 quando os campos 17 e 22, ou 17 e 23, ou 18 e 22, ou 18 e 23, ou 19 e 22, ou 19 e 23, ou 20 e 22, ou 20 e 23, ou 21 e 22, ou 21 e 23, ou 17 e 20, ou 18 e 19, ou 18 e 20, ou 22 e 23 tiverem valores informados igual a 1 --- .../Api/Views/EducacensoExportController.php | 148 +++++++++++++----- 1 file changed, 111 insertions(+), 37 deletions(-) diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index d17b2ccf49..6d66f00289 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -1559,19 +1559,7 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, && is_null($r60s35) && is_null($r60s36) && is_null($r60s37) && is_null($r60s38); // Define 'tipodeficiencia' => 'seqleiaute' - $deficienciaToSeq = array( 1 => '17', - 2 => '18', - 3 => '19', - 4 => '20', - 5 => '21', - 6 => '22', - 7 => '23', - 8 => '24', - 9 => '25', - 10 => '26', - 11 => '27', - 12 => '28', - 13 => '29'); + $deficienciaToSeq = $this->getArrayMapeamentoDeficiencias(); if (count($deficiencias) == 0) { $r60s30 = $r60s31 = $r60s32 = $r60s33 = $r60s34 = $r60s35 = $r60s36 = $r60s37 = $r60s38 = NULL; @@ -1594,16 +1582,24 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, if ($r60s16) $r60s39 = NULL; else - $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = $r60s24 = + $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = $r60s25 = $r60s26 = $r60s27 = $r60s28 = $r60s29 = NULL; - if(!$this->transtornoGlobalDesenvolvimento($deficiencias)) { - for($i=30; $i <= 39; $i++){ - ${'r60s'.$i} = NULL; + if (!$this->precisaDeAuxilioEmProvaPorDeficiencia($deficiencias)) { + $r60s30 = null; + $r60s31 = null; + $r60s32 = null; + $r60s33 = null; + $r60s34 = null; + $r60s35 = null; + $r60s36 = null; + $r60s37 = null; + $r60s38 = null; + } else { + $r60s39 = 1; } - }else{ - $r60s39 = 1; - } + + $r60s24 = (int) $this->possuiDeficienciaMultipla($deficiencias); //O campo 39 recebe 0 quando algum campo de 30 à 38 for igual a 1 for($i=30; $i <= 38; $i++){ @@ -1630,31 +1626,21 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, return $return; } - protected function transtornoGlobalDesenvolvimento($deficiencias) { - $deficienciasLayout = array(1 => '17', - 2 => '18', - 3 => '19', - 4 => '20', - 5 => '21', - 6 => '22', - 7 => '23', - 8 => '24', - 9 => '25', - 10 => '26', - 11 => '27', - 12 => '28'); - - $existeDeficienciaTranstornoGlobal = FALSE; + protected function precisaDeAuxilioEmProvaPorDeficiencia($deficiencias) { + $deficienciasLayout = $this->getArrayMapeamentoDeficiencias(); + + unset($deficienciasLayout[13]); if (count($deficiencias)>0){ foreach ($deficiencias as $deficiencia) { $deficiencia = $deficiencia['id']; if (array_key_exists($deficiencia, $deficienciasLayout)){ - $existeDeficienciaTranstornoGlobal = TRUE; + return true; } } } - return $existeDeficienciaTranstornoGlobal; + + return false; } protected function exportaDadosRegistro70($escolaId, $ano, $data_ini, $data_fim, $alunoId){ @@ -2319,4 +2305,92 @@ private function isCursoSuperiorBachareladoOuTecnologoCompleto($grauAcademico, $ self::TECNOLOGO ]); } + + private function possuiDeficienciaMultipla($deficiencias) + { + $deficienciasAluno = []; + foreach ($deficiencias as $deficiencia) { + $deficienciasAluno[$this->getArrayMapeamentoDeficiencias()[$deficiencia['id']]] = true; + } + + if ($deficienciasAluno['17'] && $deficienciasAluno['22']) { + return true; + } + + if ($deficienciasAluno['17'] && $deficienciasAluno['23']) { + return true; + } + + if ($deficienciasAluno['18'] && $deficienciasAluno['22']) { + return true; + } + + if ($deficienciasAluno['18'] && $deficienciasAluno['23']) { + return true; + } + + if ($deficienciasAluno['19'] && $deficienciasAluno['22']) { + return true; + } + + if ($deficienciasAluno['19'] && $deficienciasAluno['23']) { + return true; + } + + if ($deficienciasAluno['20'] && $deficienciasAluno['22']) { + return true; + } + + if ($deficienciasAluno['20'] && $deficienciasAluno['23']) { + return true; + } + + if ($deficienciasAluno['21'] && $deficienciasAluno['22']) { + return true; + } + + if ($deficienciasAluno['21'] && $deficienciasAluno['23']) { + return true; + } + + if ($deficienciasAluno['17'] && $deficienciasAluno['20']) { + return true; + } + + if ($deficienciasAluno['18'] && $deficienciasAluno['19']) { + return true; + } + + if ($deficienciasAluno['18'] && $deficienciasAluno['20']) { + return true; + } + + if ($deficienciasAluno['22'] && $deficienciasAluno['23']) { + return true; + } + + return false; + } + + /** + * @return array + */ + private function getArrayMapeamentoDeficiencias() + { + return [ + 1 => '17', + 2 => '18', + 3 => '19', + 4 => '20', + 5 => '21', + 6 => '22', + 7 => '23', + 8 => '24', + 9 => '25', + 10 => '26', + 11 => '27', + 12 => '28', + 13 => '29' + ]; + } } From d1776c7c867fdb1f82952c2cdd7b1f900b7e954b Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 18 Jul 2018 15:35:12 -0300 Subject: [PATCH 09/73] =?UTF-8?q?Refatora=20valida=C3=A7ao=20de=20defici?= =?UTF-8?q?=C3=AAncia=20multipla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- .../CombinacaoDeficienciaMultipla.php | 10 ++ .../Educacenso/DeficienciaMultiplaAluno.php | 28 ++++++ .../Educacenso/MapeamentoDeficiencias.php | 29 ++++++ .../Educacenso/ValidaDeficienciaMultipla.php | 48 +++++++++ .../Api/Views/EducacensoExportController.php | 99 ++----------------- 6 files changed, 124 insertions(+), 92 deletions(-) create mode 100644 ieducar/lib/App/Model/Educacenso/CombinacaoDeficienciaMultipla.php create mode 100644 ieducar/lib/App/Model/Educacenso/DeficienciaMultiplaAluno.php create mode 100644 ieducar/lib/App/Model/Educacenso/MapeamentoDeficiencias.php create mode 100644 ieducar/lib/App/Model/Educacenso/ValidaDeficienciaMultipla.php diff --git a/composer.json b/composer.json index bfe8d47f32..91dedb7aad 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "autoload": { "psr-4": { - "iEducar\\": "src" + "iEducar\\": "ieducar/lib" } }, "autoload-dev": { diff --git a/ieducar/lib/App/Model/Educacenso/CombinacaoDeficienciaMultipla.php b/ieducar/lib/App/Model/Educacenso/CombinacaoDeficienciaMultipla.php new file mode 100644 index 0000000000..aab34ed376 --- /dev/null +++ b/ieducar/lib/App/Model/Educacenso/CombinacaoDeficienciaMultipla.php @@ -0,0 +1,10 @@ + '17', + 2 => '18', + 3 => '19', + 4 => '20', + 5 => '21', + 6 => '22', + 7 => '23', + 8 => '24', + 9 => '25', + 10 => '26', + 11 => '27', + 12 => '28', + 13 => '29' + ]; + } +} \ No newline at end of file diff --git a/ieducar/lib/App/Model/Educacenso/ValidaDeficienciaMultipla.php b/ieducar/lib/App/Model/Educacenso/ValidaDeficienciaMultipla.php new file mode 100644 index 0000000000..b35defcab6 --- /dev/null +++ b/ieducar/lib/App/Model/Educacenso/ValidaDeficienciaMultipla.php @@ -0,0 +1,48 @@ +mapeamentoDeficiencias = MapeamentoDeficiencias::getArrayMapeamentoDeficiencias(); + $this->combinacaoDeficiencias = $combinacao->getCombinacoes(); + } + + /** + * @param array $deficiencias + * @return bool + */ + public function possuiDeficienciaMultipla($deficiencias) + { + if (empty($deficiencias)) { + return false; + } + + $deficienciasAluno = []; + foreach ($deficiencias as $deficiencia) { + $deficienciasAluno[$this->mapeamentoDeficiencias[$deficiencia['id']]] = true; + } + + foreach ($this->combinacaoDeficiencias as $combinacao) { + if (isset($deficienciasAluno[$combinacao[0]]) && isset($deficienciasAluno[$combinacao[1]])) { + return true; + } + } + + return false; + } +} \ No newline at end of file diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index 6d66f00289..758d5ddc9b 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -32,6 +32,10 @@ * @version $Id$ */ +use iEducar\App\Model\Educacenso\DeficienciaMultiplaAluno; +use iEducar\App\Model\Educacenso\MapeamentoDeficiencias; +use iEducar\App\Model\Educacenso\ValidaDeficienciaMultipla; + require_once 'lib/Portabilis/Controller/ApiCoreController.php'; require_once 'include/clsBanco.inc.php'; require_once 'include/pmieducar/geral.inc.php'; @@ -1559,7 +1563,7 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, && is_null($r60s35) && is_null($r60s36) && is_null($r60s37) && is_null($r60s38); // Define 'tipodeficiencia' => 'seqleiaute' - $deficienciaToSeq = $this->getArrayMapeamentoDeficiencias(); + $deficienciaToSeq = MapeamentoDeficiencias::getArrayMapeamentoDeficiencias(); if (count($deficiencias) == 0) { $r60s30 = $r60s31 = $r60s32 = $r60s33 = $r60s34 = $r60s35 = $r60s36 = $r60s37 = $r60s38 = NULL; @@ -1599,7 +1603,8 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, $r60s39 = 1; } - $r60s24 = (int) $this->possuiDeficienciaMultipla($deficiencias); + $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new MapeamentoDeficiencias(), new DeficienciaMultiplaAluno()); + $r60s24 = (int) $validaDeficienciaMultipla->possuiDeficienciaMultipla($deficiencias); //O campo 39 recebe 0 quando algum campo de 30 à 38 for igual a 1 for($i=30; $i <= 38; $i++){ @@ -1627,7 +1632,7 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, } protected function precisaDeAuxilioEmProvaPorDeficiencia($deficiencias) { - $deficienciasLayout = $this->getArrayMapeamentoDeficiencias(); + $deficienciasLayout = MapeamentoDeficiencias::getArrayMapeamentoDeficiencias(); unset($deficienciasLayout[13]); @@ -2305,92 +2310,4 @@ private function isCursoSuperiorBachareladoOuTecnologoCompleto($grauAcademico, $ self::TECNOLOGO ]); } - - private function possuiDeficienciaMultipla($deficiencias) - { - $deficienciasAluno = []; - foreach ($deficiencias as $deficiencia) { - $deficienciasAluno[$this->getArrayMapeamentoDeficiencias()[$deficiencia['id']]] = true; - } - - if ($deficienciasAluno['17'] && $deficienciasAluno['22']) { - return true; - } - - if ($deficienciasAluno['17'] && $deficienciasAluno['23']) { - return true; - } - - if ($deficienciasAluno['18'] && $deficienciasAluno['22']) { - return true; - } - - if ($deficienciasAluno['18'] && $deficienciasAluno['23']) { - return true; - } - - if ($deficienciasAluno['19'] && $deficienciasAluno['22']) { - return true; - } - - if ($deficienciasAluno['19'] && $deficienciasAluno['23']) { - return true; - } - - if ($deficienciasAluno['20'] && $deficienciasAluno['22']) { - return true; - } - - if ($deficienciasAluno['20'] && $deficienciasAluno['23']) { - return true; - } - - if ($deficienciasAluno['21'] && $deficienciasAluno['22']) { - return true; - } - - if ($deficienciasAluno['21'] && $deficienciasAluno['23']) { - return true; - } - - if ($deficienciasAluno['17'] && $deficienciasAluno['20']) { - return true; - } - - if ($deficienciasAluno['18'] && $deficienciasAluno['19']) { - return true; - } - - if ($deficienciasAluno['18'] && $deficienciasAluno['20']) { - return true; - } - - if ($deficienciasAluno['22'] && $deficienciasAluno['23']) { - return true; - } - - return false; - } - - /** - * @return array - */ - private function getArrayMapeamentoDeficiencias() - { - return [ - 1 => '17', - 2 => '18', - 3 => '19', - 4 => '20', - 5 => '21', - 6 => '22', - 7 => '23', - 8 => '24', - 9 => '25', - 10 => '26', - 11 => '27', - 12 => '28', - 13 => '29' - ]; - } } From 57536f5ee9c29bce0232c9c8e7b4ea32dd2197a4 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 18 Jul 2018 15:35:34 -0300 Subject: [PATCH 10/73] =?UTF-8?q?Cria=20configura=C3=A7=C3=A3o=20de=20defi?= =?UTF-8?q?ci=C3=AAncia=20multipla=20do=20professor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeficienciaMultiplaProfessor.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ieducar/lib/App/Model/Educacenso/DeficienciaMultiplaProfessor.php diff --git a/ieducar/lib/App/Model/Educacenso/DeficienciaMultiplaProfessor.php b/ieducar/lib/App/Model/Educacenso/DeficienciaMultiplaProfessor.php new file mode 100644 index 0000000000..3bcfd1295e --- /dev/null +++ b/ieducar/lib/App/Model/Educacenso/DeficienciaMultiplaProfessor.php @@ -0,0 +1,28 @@ + Date: Wed, 18 Jul 2018 16:00:45 -0300 Subject: [PATCH 11/73] =?UTF-8?q?Implementa=20regra=20de=20defici=C3=AAnci?= =?UTF-8?q?a=20multipla=20para=20o=20professor=20e=20refatora=20algumas=20?= =?UTF-8?q?coisas=20na=20regra=20do=20aluno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CombinacaoDeficienciaMultipla.php | 2 +- .../DeficienciaMultiplaAluno.php | 2 +- .../DeficienciaMultiplaProfessor.php | 2 +- .../MapeamentoDeficienciasAluno.php} | 4 +- .../Deficiencia/ValidaDeficienciaMultipla.php | 37 ++++++++++++++ .../Educacenso/ValidaDeficienciaMultipla.php | 48 ------------------- .../Api/Views/EducacensoExportController.php | 29 ++++++----- 7 files changed, 60 insertions(+), 64 deletions(-) rename ieducar/lib/App/Model/Educacenso/{ => Deficiencia}/CombinacaoDeficienciaMultipla.php (63%) rename ieducar/lib/App/Model/Educacenso/{ => Deficiencia}/DeficienciaMultiplaAluno.php (90%) rename ieducar/lib/App/Model/Educacenso/{ => Deficiencia}/DeficienciaMultiplaProfessor.php (90%) rename ieducar/lib/App/Model/Educacenso/{MapeamentoDeficiencias.php => Deficiencia/MapeamentoDeficienciasAluno.php} (83%) create mode 100644 ieducar/lib/App/Model/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php delete mode 100644 ieducar/lib/App/Model/Educacenso/ValidaDeficienciaMultipla.php diff --git a/ieducar/lib/App/Model/Educacenso/CombinacaoDeficienciaMultipla.php b/ieducar/lib/App/Model/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php similarity index 63% rename from ieducar/lib/App/Model/Educacenso/CombinacaoDeficienciaMultipla.php rename to ieducar/lib/App/Model/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php index aab34ed376..e5019e5907 100644 --- a/ieducar/lib/App/Model/Educacenso/CombinacaoDeficienciaMultipla.php +++ b/ieducar/lib/App/Model/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php @@ -1,7 +1,7 @@ combinacaoDeficiencias = $combinacao->getCombinacoes(); + } + + /** + * @param array $deficiencias + * @return bool + */ + public function possuiDeficienciaMultipla($deficiencias) + { + if (empty($deficiencias)) { + return false; + } + + foreach ($this->combinacaoDeficiencias as $combinacao) { + if (in_array($combinacao[0], $deficiencias) && in_array($combinacao[1], $deficiencias)) { + return true; + } + } + + return false; + } +} \ No newline at end of file diff --git a/ieducar/lib/App/Model/Educacenso/ValidaDeficienciaMultipla.php b/ieducar/lib/App/Model/Educacenso/ValidaDeficienciaMultipla.php deleted file mode 100644 index b35defcab6..0000000000 --- a/ieducar/lib/App/Model/Educacenso/ValidaDeficienciaMultipla.php +++ /dev/null @@ -1,48 +0,0 @@ -mapeamentoDeficiencias = MapeamentoDeficiencias::getArrayMapeamentoDeficiencias(); - $this->combinacaoDeficiencias = $combinacao->getCombinacoes(); - } - - /** - * @param array $deficiencias - * @return bool - */ - public function possuiDeficienciaMultipla($deficiencias) - { - if (empty($deficiencias)) { - return false; - } - - $deficienciasAluno = []; - foreach ($deficiencias as $deficiencia) { - $deficienciasAluno[$this->mapeamentoDeficiencias[$deficiencia['id']]] = true; - } - - foreach ($this->combinacaoDeficiencias as $combinacao) { - if (isset($deficienciasAluno[$combinacao[0]]) && isset($deficienciasAluno[$combinacao[1]])) { - return true; - } - } - - return false; - } -} \ No newline at end of file diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index 758d5ddc9b..a2becf543c 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -32,9 +32,11 @@ * @version $Id$ */ -use iEducar\App\Model\Educacenso\DeficienciaMultiplaAluno; -use iEducar\App\Model\Educacenso\MapeamentoDeficiencias; -use iEducar\App\Model\Educacenso\ValidaDeficienciaMultipla; +use iEducar\App\Model\Educacenso\Deficiencia\DeficienciaMultiplaAluno; +use iEducar\App\Model\Educacenso\Deficiencia\DeficienciaMultiplaProfessor; +use iEducar\App\Model\Educacenso\Deficiencia\MapeamentoDeficienciasAluno; +use iEducar\App\Model\Educacenso\Deficiencia\ValidaDeficienciaMultipla; + require_once 'lib/Portabilis/Controller/ApiCoreController.php'; require_once 'include/clsBanco.inc.php'; @@ -932,7 +934,7 @@ protected function exportaDadosRegistro30($servidorId, $escolaId){ $deficiencias = Portabilis_Utils_Database::fetchPreparedQuery($sql, array( 'params' => array($r30s4))); - $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = $r30s26 = 0; + $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = 0; $deficienciaToSeq = array( 1 => '19', 2 => '20', @@ -943,17 +945,19 @@ protected function exportaDadosRegistro30($servidorId, $escolaId){ 7 => '25' ); $r30s18 = 0; - $qtde_deficiencia = 0; + $arrayDeficienciasProfessor = []; foreach ($deficiencias as $deficiencia_educacenso) { $deficiencia_educacenso = $deficiencia_educacenso['id']; if (array_key_exists($deficiencia_educacenso, $deficienciaToSeq)){ ${ 'r30s'. $deficienciaToSeq[$deficiencia_educacenso] } = 1; $r30s18 = 1; - $qtde_deficiencia++; } + + $arrayDeficienciasProfessor[] = $deficienciaToSeq[$deficiencia_educacenso]; } - if ($qtde_deficiencia > 1) $r30s26 = 1; + $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaProfessor()); + $r60s26 = (int) $validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasProfessor); if($r30s18 == 0) $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = $r30s26 = NULL; @@ -1563,12 +1567,13 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, && is_null($r60s35) && is_null($r60s36) && is_null($r60s37) && is_null($r60s38); // Define 'tipodeficiencia' => 'seqleiaute' - $deficienciaToSeq = MapeamentoDeficiencias::getArrayMapeamentoDeficiencias(); + $deficienciaToSeq = MapeamentoDeficienciasAluno::getArrayMapeamentoDeficiencias(); if (count($deficiencias) == 0) { $r60s30 = $r60s31 = $r60s32 = $r60s33 = $r60s34 = $r60s35 = $r60s36 = $r60s37 = $r60s38 = NULL; } + $arrayDeficienciasAluno = []; // Se tiver alguma deficiência, a seq 16 deve ser 1 if (count($deficiencias)>0) { $r60s16 = 1; @@ -1580,6 +1585,8 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, if (array_key_exists($deficiencia_educacenso, $deficienciaToSeq)){ ${ 'r60s'. $deficienciaToSeq[$deficiencia_educacenso] } = 1; } + + $arrayDeficienciasAluno[] = $deficienciaToSeq[$deficiencia_educacenso]; } } // Se o aluno não tiver deficiências não pode ser informado recursos para provas @@ -1603,8 +1610,8 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, $r60s39 = 1; } - $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new MapeamentoDeficiencias(), new DeficienciaMultiplaAluno()); - $r60s24 = (int) $validaDeficienciaMultipla->possuiDeficienciaMultipla($deficiencias); + $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaAluno()); + $r60s24 = (int) $validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasAluno); //O campo 39 recebe 0 quando algum campo de 30 à 38 for igual a 1 for($i=30; $i <= 38; $i++){ @@ -1632,7 +1639,7 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, } protected function precisaDeAuxilioEmProvaPorDeficiencia($deficiencias) { - $deficienciasLayout = MapeamentoDeficiencias::getArrayMapeamentoDeficiencias(); + $deficienciasLayout = MapeamentoDeficienciasAluno::getArrayMapeamentoDeficiencias(); unset($deficienciasLayout[13]); From 0b4581eaf283fc6b10e1b44634b5a7dbd635e44c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ber=20Freitas=20Dias?= Date: Wed, 18 Jul 2018 16:09:24 -0300 Subject: [PATCH 12/73] =?UTF-8?q?Refatorando=20c=C3=B3digo=20que=20usa=20v?= =?UTF-8?q?ari=C3=A1veis=20desnecess=C3=A1rias;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmieducar/clsPmieducarSerie.inc.php | 294 +++++++----------- 1 file changed, 113 insertions(+), 181 deletions(-) diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php index 2f53814ba7..dde37b3b17 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarSerie.inc.php @@ -290,126 +290,107 @@ public function cadastra() ) { $db = new clsBanco(); - $campos = ''; - $valores = ''; - $gruda = ''; + $campos = []; + $valores = []; if (is_numeric($this->ref_usuario_cad)) { - $campos .= "{$gruda}ref_usuario_cad"; - $valores .= "{$gruda}'{$this->ref_usuario_cad}'"; - $gruda = ', '; + $campos[] = "ref_usuario_cad"; + $valores[] = "'{$this->ref_usuario_cad}'"; } if (is_numeric($this->ref_cod_curso)) { - $campos .= "{$gruda}ref_cod_curso"; - $valores .= "{$gruda}'{$this->ref_cod_curso}'"; - $gruda = ', '; + $campos[] = "ref_cod_curso"; + $valores[] = "'{$this->ref_cod_curso}'"; } if (is_string($this->nm_serie)) { - $campos .= "{$gruda}nm_serie"; - $valores .= "{$gruda}'{$this->nm_serie}'"; - $gruda = ', '; + $campos[] = "nm_serie"; + $valores[] = "'{$this->nm_serie}'"; } if (is_numeric($this->etapa_curso)) { - $campos .= "{$gruda}etapa_curso"; - $valores .= "{$gruda}'{$this->etapa_curso}'"; - $gruda = ', '; + $campos[] = "etapa_curso"; + $valores[] = "'{$this->etapa_curso}'"; } if (is_numeric($this->concluinte)) { - $campos .= "{$gruda}concluinte"; - $valores .= "{$gruda}'{$this->concluinte}'"; - $gruda = ', '; + $campos[] = "concluinte"; + $valores[] = "'{$this->concluinte}'"; } if (is_numeric($this->carga_horaria)) { - $campos .= "{$gruda}carga_horaria"; - $valores .= "{$gruda}'{$this->carga_horaria}'"; - $gruda = ', '; + $campos[] = "carga_horaria"; + $valores[] = "'{$this->carga_horaria}'"; } if (is_numeric($this->idade_inicial)) { - $campos .= "{$gruda}idade_inicial"; - $valores .= "{$gruda}'{$this->idade_inicial}'"; - $gruda = ', '; + $campos[] = "idade_inicial"; + $valores[] = "'{$this->idade_inicial}'"; } if (is_numeric($this->idade_final)) { - $campos .= "{$gruda}idade_final"; - $valores .= "{$gruda}'{$this->idade_final}'"; - $gruda = ', '; + $campos[] = "idade_final"; + $valores[] = "'{$this->idade_final}'"; } if (is_numeric($this->regra_avaliacao_id)) { - $campos .= "{$gruda}regra_avaliacao_id"; - $valores .= "{$gruda}'{$this->regra_avaliacao_id}'"; - $gruda = ', '; + $campos[] = "regra_avaliacao_id"; + $valores[] = "'{$this->regra_avaliacao_id}'"; } if (is_numeric($this->regra_avaliacao_diferenciada_id)) { - $campos .= "{$gruda}regra_avaliacao_diferenciada_id"; - $valores .= "{$gruda}'{$this->regra_avaliacao_diferenciada_id}'"; - $gruda = ', '; + $campos[] = "regra_avaliacao_diferenciada_id"; + $valores[] = "'{$this->regra_avaliacao_diferenciada_id}'"; } - $campos .= "{$gruda}data_cadastro"; - $valores .= "{$gruda}NOW()"; - $gruda = ', '; + $campos[] = "data_cadastro"; + $valores[] = "NOW()"; - $campos .= "{$gruda}ativo"; - $valores .= "{$gruda}'1'"; - $gruda = ', '; + $campos[] = "ativo"; + $valores[] = "'1'"; if (is_string($this->observacao_historico)) { - $campos .= "{$gruda}observacao_historico"; - $valores .= "{$gruda}'{$this->observacao_historico}'"; - $gruda = ', '; + $campos[] = "observacao_historico"; + $valores[] = "'{$this->observacao_historico}'"; } if (is_numeric($this->dias_letivos)) { - $campos .= "{$gruda}dias_letivos"; - $valores .= "{$gruda}'{$this->dias_letivos}'"; - $gruda = ', '; + $campos[] = "dias_letivos"; + $valores[] = "'{$this->dias_letivos}'"; } if (is_numeric($this->idade_ideal)) { - $campos .= "{$gruda}idade_ideal"; - $valores .= "{$gruda}'{$this->idade_ideal}'"; - $gruda = ', '; + $campos[] = "idade_ideal"; + $valores[] = "'{$this->idade_ideal}'"; } if (dbBool($this->alerta_faixa_etaria)) { - $campos .= "{$gruda}alerta_faixa_etaria"; - $valores .= "{$gruda} true "; - $gruda = ', '; + $campos[] = "alerta_faixa_etaria"; + $valores[] = " true "; } else { - $campos .= "{$gruda}alerta_faixa_etaria"; - $valores .= "{$gruda} false "; - $gruda = ', '; + $campos[] = "alerta_faixa_etaria"; + $valores[] = " false "; } if (dbBool($this->bloquear_matricula_faixa_etaria)) { - $campos .= "{$gruda}bloquear_matricula_faixa_etaria"; - $valores .= "{$gruda} true "; - $gruda = ', '; + $campos[] = "bloquear_matricula_faixa_etaria"; + $valores[] = " true "; } else { - $campos .= "{$gruda}bloquear_matricula_faixa_etaria"; - $valores .= "{$gruda} false "; - $gruda = ', '; + $campos[] = "bloquear_matricula_faixa_etaria"; + $valores[] = " false "; } if (dbBool($this->exigir_inep)) { - $campos .= "{$gruda}exigir_inep"; - $valores .= "{$gruda} true "; - $gruda = ', '; + $campos[] = "exigir_inep"; + $valores[] = " true "; } else { - $campos .= "{$gruda}exigir_inep"; - $valores .= "{$gruda} false "; - $gruda = ', '; + $campos[] = "exigir_inep"; + $valores[] = " false "; } + $campos = join (', ', $campos); + $valores = join(', ', $valores); + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); return $db->InsertId("{$this->_tabela}_cod_serie_seq"); @@ -427,127 +408,102 @@ public function edita() { if (is_numeric($this->cod_serie) && is_numeric($this->ref_usuario_exc)) { $db = new clsBanco(); - $set = ''; + $set = []; if (is_numeric($this->ref_usuario_exc)) { - $set .= "{$gruda}ref_usuario_exc = '{$this->ref_usuario_exc}'"; - $gruda = ', '; + $set[] = "ref_usuario_exc = '{$this->ref_usuario_exc}'"; } if (is_numeric($this->ref_usuario_cad)) { - $set .= "{$gruda}ref_usuario_cad = '{$this->ref_usuario_cad}'"; - $gruda = ', '; + $set[] = "ref_usuario_cad = '{$this->ref_usuario_cad}'"; } if (is_numeric($this->ref_cod_curso)) { - $set .= "{$gruda}ref_cod_curso = '{$this->ref_cod_curso}'"; - $gruda = ', '; + $set[] = "ref_cod_curso = '{$this->ref_cod_curso}'"; } if (is_string($this->nm_serie)) { - $set .= "{$gruda}nm_serie = '{$this->nm_serie}'"; - $gruda = ', '; + $set[] = "nm_serie = '{$this->nm_serie}'"; } if (is_numeric($this->etapa_curso)) { - $set .= "{$gruda}etapa_curso = '{$this->etapa_curso}'"; - $gruda = ', '; + $set[] = "etapa_curso = '{$this->etapa_curso}'"; } if (is_numeric($this->concluinte)) { - $set .= "{$gruda}concluinte = '{$this->concluinte}'"; - $gruda = ', '; + $set[] = "concluinte = '{$this->concluinte}'"; } if (is_numeric($this->carga_horaria)) { - $set .= "{$gruda}carga_horaria = '{$this->carga_horaria}'"; - $gruda = ', '; + $set[] = "carga_horaria = '{$this->carga_horaria}'"; } if (is_string($this->data_cadastro)) { - $set .= "{$gruda}data_cadastro = '{$this->data_cadastro}'"; - $gruda = ', '; + $set[] = "data_cadastro = '{$this->data_cadastro}'"; } - $set .= "{$gruda}data_exclusao = NOW()"; - $gruda = ', '; + $set[] = "data_exclusao = NOW()"; if (is_numeric($this->ativo)) { - $set .= "{$gruda}ativo = '{$this->ativo}'"; - $gruda = ', '; + $set[] = "ativo = '{$this->ativo}'"; } if (is_numeric($this->idade_inicial)) { - $set .= "{$gruda}idade_inicial = '{$this->idade_inicial}'"; - $gruda = ', '; + $set[] = "idade_inicial = '{$this->idade_inicial}'"; } else { - $set .= "{$gruda}idade_inicial = NULL"; - $gruda = ', '; + $set[] = "idade_inicial = NULL"; } if (is_numeric($this->idade_final)) { - $set .= "{$gruda}idade_final = '{$this->idade_final}'"; - $gruda = ', '; + $set[] = "idade_final = '{$this->idade_final}'"; } else { - $set .= "{$gruda}idade_final = NULL"; - $gruda = ', '; + $set[] = "idade_final = NULL"; } if (is_numeric($this->regra_avaliacao_id)) { - $set .= "{$gruda}regra_avaliacao_id = '{$this->regra_avaliacao_id}'"; - $gruda = ', '; + $set[] = "regra_avaliacao_id = '{$this->regra_avaliacao_id}'"; } if (is_numeric($this->regra_avaliacao_diferenciada_id)) { - $set .= "{$gruda}regra_avaliacao_diferenciada_id = '{$this->regra_avaliacao_diferenciada_id}' "; + $set[] = "regra_avaliacao_diferenciada_id = '{$this->regra_avaliacao_diferenciada_id}' "; } else { - $set .= "{$gruda}regra_avaliacao_diferenciada_id = NULL "; + $set[] = "regra_avaliacao_diferenciada_id = NULL "; } - $gruda = ', '; - if (is_string($this->observacao_historico)) { - $set .= "{$gruda}observacao_historico = '{$this->observacao_historico}'"; - $gruda = ', '; + $set[] = "observacao_historico = '{$this->observacao_historico}'"; } if (is_numeric($this->dias_letivos)) { - $set .= "{$gruda}dias_letivos = '{$this->dias_letivos}'"; - $gruda = ', '; + $set[] = "dias_letivos = '{$this->dias_letivos}'"; } if (is_numeric($this->idade_ideal)) { - $set .= "{$gruda}idade_ideal = '{$this->idade_ideal}'"; - $gruda = ', '; + $set[] = "idade_ideal = '{$this->idade_ideal}'"; } else { - $set .= "{$gruda}idade_ideal = NULL"; - $gruda = ', '; + $set[] = "idade_ideal = NULL"; } if (dbBool($this->alerta_faixa_etaria)) { - $set .= "{$gruda}alerta_faixa_etaria = true "; - $gruda = ', '; + $set[] = "alerta_faixa_etaria = true "; } else { - $set .= "{$gruda}alerta_faixa_etaria = false "; - $gruda = ', '; + $set[] = "alerta_faixa_etaria = false "; } if (dbBool($this->bloquear_matricula_faixa_etaria)) { - $set .= "{$gruda}bloquear_matricula_faixa_etaria = true "; - $gruda = ', '; + $set[] = "bloquear_matricula_faixa_etaria = true "; } else { - $set .= "{$gruda}bloquear_matricula_faixa_etaria = false "; - $gruda = ', '; + $set[] = "bloquear_matricula_faixa_etaria = false "; } if (dbBool($this->exigir_inep)) { - $set .= "{$gruda}exigir_inep = true "; - $gruda = ', '; + $set[] = "exigir_inep = true "; } else { - $set .= "{$gruda}exigir_inep = false "; - $gruda = ', '; + $set[] = "exigir_inep = false "; } + $set = join(', ', $set); + if ($set) { $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_serie = '{$this->cod_serie}'"); @@ -586,114 +542,97 @@ public function lista( ) { $sql = "SELECT {$this->_campos_lista}, c.ref_cod_instituicao FROM {$this->_tabela} s, {$this->_schema}curso c"; - $whereAnd = ' AND '; - $filtros = ' WHERE s.ref_cod_curso = c.cod_curso'; + $filtros = [' WHERE s.ref_cod_curso = c.cod_curso']; if (is_numeric($int_cod_serie)) { - $filtros .= "{$whereAnd} s.cod_serie = '{$int_cod_serie}'"; - $whereAnd = ' AND '; + $filtros[] = "s.cod_serie = '{$int_cod_serie}'"; } if (is_numeric($int_ref_usuario_exc)) { - $filtros .= "{$whereAnd} s.ref_usuario_exc = '{$int_ref_usuario_exc}'"; - $whereAnd = ' AND '; + $filtros[] = "s.ref_usuario_exc = '{$int_ref_usuario_exc}'"; } if (is_numeric($int_ref_usuario_cad)) { - $filtros .= "{$whereAnd} s.ref_usuario_cad = '{$int_ref_usuario_cad}'"; - $whereAnd = ' AND '; + $filtros[] = "s.ref_usuario_cad = '{$int_ref_usuario_cad}'"; } if (is_numeric($int_ref_cod_curso)) { - $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; - $whereAnd = ' AND '; + $filtros[] = " s.ref_cod_curso = '{$int_ref_cod_curso}'"; } if (is_string($str_nm_serie)) { - $filtros .= "{$whereAnd} translate(upper(s.nm_serie),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_serie}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; - $whereAnd = ' AND '; + $filtros[] = "translate(upper(s.nm_serie),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_serie}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; } if (is_numeric($int_etapa_curso)) { - $filtros .= "{$whereAnd} s.etapa_curso = '{$int_etapa_curso}'"; - $whereAnd = ' AND '; + $filtros[] = "s.etapa_curso = '{$int_etapa_curso}'"; } if (is_numeric($int_concluinte)) { - $filtros .= "{$whereAnd} s.concluinte = '{$int_concluinte}'"; - $whereAnd = ' AND '; + $filtros[] = "s.concluinte = '{$int_concluinte}'"; } if (is_numeric($int_carga_horaria)) { - $filtros .= "{$whereAnd} s.carga_horaria = '{$int_carga_horaria}'"; - $whereAnd = ' AND '; + $filtros[] = "s.carga_horaria = '{$int_carga_horaria}'"; } if (is_string($date_data_cadastro_ini)) { - $filtros .= "{$whereAnd} s.data_cadastro >= '{$date_data_cadastro_ini}'"; - $whereAnd = ' AND '; + $filtros[] = "s.data_cadastro >= '{$date_data_cadastro_ini}'"; } if (is_string($date_data_cadastro_fim)) { - $filtros .= "{$whereAnd} s.data_cadastro <= '{$date_data_cadastro_fim}'"; - $whereAnd = ' AND '; + $filtros[] = "s.data_cadastro <= '{$date_data_cadastro_fim}'"; } if (is_string($date_data_exclusao_ini)) { - $filtros .= "{$whereAnd} s.data_exclusao >= '{$date_data_exclusao_ini}'"; - $whereAnd = ' AND '; + $filtros[] = "s.data_exclusao >= '{$date_data_exclusao_ini}'"; } if (is_string($date_data_exclusao_fim)) { - $filtros .= "{$whereAnd} s.data_exclusao <= '{$date_data_exclusao_fim}'"; - $whereAnd = ' AND '; + $filtros[] = "s.data_exclusao <= '{$date_data_exclusao_fim}'"; } if (is_numeric($regra_avaliacao_id)) { - $filtros .= "{$whereAnd} s.regra_avaliacao_id = '{$regra_avaliacao_id}'"; - $whereAnd = ' AND '; + $filtros[] = "s.regra_avaliacao_id = '{$regra_avaliacao_id}'"; } if (is_null($int_ativo) || $int_ativo) { - $filtros .= "{$whereAnd} s.ativo = '1'"; - $whereAnd = ' AND '; + $filtros[] = "s.ativo = '1'"; } else { - $filtros .= "{$whereAnd} s.ativo = '0'"; - $whereAnd = ' AND '; + $filtros[] = "s.ativo = '0'"; } if (is_numeric($int_ref_cod_instituicao)) { - $filtros .= "{$whereAnd} c.ref_cod_instituicao = '$int_ref_cod_instituicao'"; - $whereAnd = ' AND '; + $filtros[] = "c.ref_cod_instituicao = '$int_ref_cod_instituicao'"; } if (is_numeric($int_idade_inicial)) { - $filtros .= "{$whereAnd} idade_inicial = '{$int_idade_inicial}'"; - $whereAnd = ' AND '; + $filtros[] = "idade_inicial = '{$int_idade_inicial}'"; } if (is_numeric($int_idade_ideal)) { - $filtros .= "{$whereAnd} idade_ideal = '{$int_idade_ideal}'"; - $whereAnd = ' AND '; + $filtros[] = "idade_ideal = '{$int_idade_ideal}'"; } if (is_numeric($int_idade_final)) { - $filtros .= "{$whereAnd} idade_final= '{$int_idade_final}'"; - $whereAnd = ' AND '; + $filtros[] = "idade_final= '{$int_idade_final}'"; } if (is_numeric($int_ref_cod_escola)) { - $filtros .= "{$whereAnd} EXISTS (SELECT 1 - FROM pmieducar.escola_serie es - WHERE s.cod_serie = es.ref_cod_serie - AND es.ativo = 1 - AND es.ref_cod_escola = '{$int_ref_cod_escola}') "; - $whereAnd = ' AND '; + $filtros[] = "EXISTS (SELECT + 1 + FROM + pmieducar.escola_serie es + WHERE + s.cod_serie = es.ref_cod_serie + AND es.ativo = 1 + AND es.ref_cod_escola = '{$int_ref_cod_escola}') "; } $db = new clsBanco(); $countCampos = count(explode(',', $this->_campos_lista)); $resultado = []; + $filtros = join(' AND ', $filtros); $sql .= $filtros . $this->getOrderby() . $this->getLimite(); @@ -732,37 +671,30 @@ public function listaSeriesComComponentesVinculados( c.ref_cod_instituicao FROM {$this->_tabela} s, {$this->_schema}curso c"; - $whereAnd = ' AND '; - $filtros = ' WHERE s.ref_cod_curso = c.cod_curso'; + $filtros = [' WHERE s.ref_cod_curso = c.cod_curso']; if (is_numeric($int_cod_serie)) { - $filtros .= "{$whereAnd} s.cod_serie = '{$int_cod_serie}'"; - $whereAnd = ' AND '; + $filtros[] = "s.cod_serie = '{$int_cod_serie}'"; } if (is_numeric($int_ref_cod_curso)) { - $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; - $whereAnd = ' AND '; + $filtros[] = "s.ref_cod_curso = '{$int_ref_cod_curso}'"; } if (is_numeric($int_ref_cod_instituicao)) { - $filtros .= "{$whereAnd} c.ref_cod_instituicao = '$int_ref_cod_instituicao'"; - $whereAnd = ' AND '; + $filtros[] = "c.ref_cod_instituicao = '$int_ref_cod_instituicao'"; } if (is_null($int_ativo) || $int_ativo) { - $filtros .= "{$whereAnd} s.ativo = '1'"; - $whereAnd = ' AND '; + $filtros[] = "s.ativo = '1'"; } - $filtros .= "{$whereAnd} s.cod_serie IN (SELECT DISTINCT ano_escolar_id - FROM modules.componente_curricular_ano_escolar)"; - - $whereAnd = ' AND '; + $filtros[] = "s.cod_serie IN (SELECT DISTINCT ano_escolar_id FROM modules.componente_curricular_ano_escolar)"; $db = new clsBanco(); $countCampos = count(explode(',', $this->_campos_lista)); $resultado = []; + $filtros = join(' AND ', $filtros); $sql .= $filtros . $this->getOrderby() . $this->getLimite(); From bb498aec9dade7991a71f10f5cd7f55b52197e4c Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 18 Jul 2018 16:09:24 -0300 Subject: [PATCH 13/73] Move arquivos novos para estrutura src --- composer.json | 2 +- ieducar/modules/Api/Views/EducacensoExportController.php | 9 ++++----- .../Deficiencia/CombinacaoDeficienciaMultipla.php | 2 +- .../Educacenso/Deficiencia/DeficienciaMultiplaAluno.php | 2 +- .../Deficiencia/DeficienciaMultiplaProfessor.php | 2 +- .../Deficiencia/MapeamentoDeficienciasAluno.php | 2 +- .../Educacenso/Deficiencia/ValidaDeficienciaMultipla.php | 2 +- 7 files changed, 10 insertions(+), 11 deletions(-) rename ieducar/{lib/App/Model => src/Modules}/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php (63%) rename ieducar/{lib/App/Model => src/Modules}/Educacenso/Deficiencia/DeficienciaMultiplaAluno.php (90%) rename ieducar/{lib/App/Model => src/Modules}/Educacenso/Deficiencia/DeficienciaMultiplaProfessor.php (90%) rename ieducar/{lib/App/Model => src/Modules}/Educacenso/Deficiencia/MapeamentoDeficienciasAluno.php (90%) rename ieducar/{lib/App/Model => src/Modules}/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php (93%) diff --git a/composer.json b/composer.json index 91dedb7aad..50b2ec7ec9 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "autoload": { "psr-4": { - "iEducar\\": "ieducar/lib" + "iEducar\\": "ieducar/src" } }, "autoload-dev": { diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index a2becf543c..12312f86e8 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -32,11 +32,10 @@ * @version $Id$ */ -use iEducar\App\Model\Educacenso\Deficiencia\DeficienciaMultiplaAluno; -use iEducar\App\Model\Educacenso\Deficiencia\DeficienciaMultiplaProfessor; -use iEducar\App\Model\Educacenso\Deficiencia\MapeamentoDeficienciasAluno; -use iEducar\App\Model\Educacenso\Deficiencia\ValidaDeficienciaMultipla; - +use iEducar\Modules\Educacenso\Deficiencia\DeficienciaMultiplaAluno; +use iEducar\Modules\Educacenso\Deficiencia\DeficienciaMultiplaProfessor; +use iEducar\Modules\Educacenso\Deficiencia\MapeamentoDeficienciasAluno; +use iEducar\Modules\Educacenso\Deficiencia\ValidaDeficienciaMultipla; require_once 'lib/Portabilis/Controller/ApiCoreController.php'; require_once 'include/clsBanco.inc.php'; diff --git a/ieducar/lib/App/Model/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php b/ieducar/src/Modules/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php similarity index 63% rename from ieducar/lib/App/Model/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php rename to ieducar/src/Modules/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php index e5019e5907..cc8e6c244d 100644 --- a/ieducar/lib/App/Model/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php +++ b/ieducar/src/Modules/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php @@ -1,7 +1,7 @@ Date: Wed, 18 Jul 2018 16:10:22 -0300 Subject: [PATCH 14/73] =?UTF-8?q?Aplica=20PSR-2=20e=20ajustes=20em=20nome?= =?UTF-8?q?=20de=20fun=C3=A7=C3=A3o;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_serie_cad.php | 761 ++++++++++++++------------ 1 file changed, 404 insertions(+), 357 deletions(-) diff --git a/ieducar/intranet/educar_serie_cad.php b/ieducar/intranet/educar_serie_cad.php index 861ccd9924..66a6be5262 100644 --- a/ieducar/intranet/educar_serie_cad.php +++ b/ieducar/intranet/educar_serie_cad.php @@ -1,33 +1,5 @@ - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Prefeitura Municipal de Itajaí - * @category i-Educar - * @license @@license@@ - * @package iEd_Pmieducar - * @since Arquivo disponível desde a versão 1.0.0 - * @version $Id$ - */ - require_once 'include/clsBase.inc.php'; require_once 'include/clsCadastro.inc.php'; require_once 'include/clsBanco.inc.php'; @@ -35,304 +7,379 @@ require_once 'RegraAvaliacao/Model/RegraDataMapper.php'; require_once 'include/modules/clsModulesAuditoriaGeral.inc.php'; -/** - * clsIndexBase class. - * - * @author Prefeitura Municipal de Itajaí - * @category i-Educar - * @license @@license@@ - * @package iEd_Pmieducar - * @since Classe disponível desde a versão 1.0.0 - * @version @@package_version@@ - */ class clsIndexBase extends clsBase { - function Formular() - { - $this->SetTitulo($this->_instituicao . ' i-Educar - Série'); - $this->processoAp = '583'; - $this->addEstilo("localizacaoSistema"); - } + public function Formular() + { + $this->SetTitulo($this->_instituicao . ' i-Educar - Série'); + $this->processoAp = '583'; + $this->addEstilo('localizacaoSistema'); + } } -/** - * indice class. - * - * @author Prefeitura Municipal de Itajaí - * @category i-Educar - * @license @@license@@ - * @package iEd_Pmieducar - * @since Classe disponível desde a versão 1.0.0 - * @version @@package_version@@ - */ class indice extends clsCadastro { - var $pessoa_logada; - - var $cod_serie; - var $ref_usuario_exc; - var $ref_usuario_cad; - var $ref_cod_curso; - var $nm_serie; - var $etapa_curso; - var $concluinte; - var $carga_horaria; - var $data_cadastro; - var $data_exclusao; - var $ativo; - - var $ref_cod_instituicao; - - var $disciplina_serie; - var $ref_cod_disciplina; - var $incluir_disciplina; - var $excluir_disciplina; - - var $idade_inicial; - var $idade_ideal; - var $idade_final; - - var $regra_avaliacao_id; - var $regra_avaliacao_diferenciada_id; - - var $alerta_faixa_etaria; - var $bloquear_matricula_faixa_etaria; - var $exigir_inep; - - function Inicializar() - { - $retorno = 'Novo'; - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $this->cod_serie=$_GET['cod_serie']; - - $obj_permissoes = new clsPermissoes(); - $obj_permissoes->permissao_cadastra(583, $this->pessoa_logada, 3, - 'educar_serie_lst.php'); - - if (is_numeric($this->cod_serie)) { - $obj = new clsPmieducarSerie($this->cod_serie); - $registro = $obj->detalhe(); - - if ($registro) { - // passa todos os valores obtidos no registro para atributos do objeto - foreach ($registro as $campo => $val) { - $this->$campo = $val; - } - - $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']); - $obj_curso_det = $obj_curso->detalhe(); - $this->ref_cod_instituicao = $obj_curso_det['ref_cod_instituicao']; - - if ($obj->possuiTurmasVinculadas()) { - $this->script_excluir = "excluir_serie_com_turmas();"; + public $pessoa_logada; + + public $cod_serie; + public $ref_usuario_exc; + public $ref_usuario_cad; + public $ref_cod_curso; + public $nm_serie; + public $etapa_curso; + public $concluinte; + public $carga_horaria; + public $data_cadastro; + public $data_exclusao; + public $ativo; + + public $ref_cod_instituicao; + + public $disciplina_serie; + public $ref_cod_disciplina; + public $incluir_disciplina; + public $excluir_disciplina; + + public $idade_inicial; + public $idade_ideal; + public $idade_final; + + public $regra_avaliacao_id; + public $regra_avaliacao_diferenciada_id; + + public $alerta_faixa_etaria; + public $bloquear_matricula_faixa_etaria; + public $exigir_inep; + + public function Inicializar() + { + $retorno = 'Novo'; + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + $this->cod_serie=$_GET['cod_serie']; + + $obj_permissoes = new clsPermissoes(); + $obj_permissoes->permissao_cadastra( + 583, + $this->pessoa_logada, + 3, + 'educar_serie_lst.php' + ); + + if (is_numeric($this->cod_serie)) { + $obj = new clsPmieducarSerie($this->cod_serie); + $registro = $obj->detalhe(); + + if ($registro) { + // passa todos os valores obtidos no registro para atributos do objeto + foreach ($registro as $campo => $val) { + $this->$campo = $val; + } + + $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']); + $obj_curso_det = $obj_curso->detalhe(); + $this->ref_cod_instituicao = $obj_curso_det['ref_cod_instituicao']; + + if ($obj->possuiTurmasVinculadas()) { + $this->script_excluir = 'excluirSerieComTurmas();'; + } + + $this->fexcluir = $obj_permissoes->permissao_excluir( + 583, + $this->pessoa_logada, + 3 + ); + + $retorno = 'Editar'; + } } - $this->fexcluir = $obj_permissoes->permissao_excluir(583, - $this->pessoa_logada,3); + $this->url_cancelar = ($retorno == 'Editar') + ? "educar_serie_det.php?cod_serie={$registro['cod_serie']}" + : 'educar_serie_lst.php'; - $retorno = 'Editar'; - } - } - - $this->url_cancelar = ($retorno == "Editar") ? - "educar_serie_det.php?cod_serie={$registro["cod_serie"]}" : - "educar_serie_lst.php"; - - $nomeMenu = $retorno == "Editar" ? $retorno : "Cadastrar"; - $localizacao = new LocalizacaoSistema(); - $localizacao->entradaCaminhos( array( - $_SERVER['SERVER_NAME']."/intranet" => "Início", - "educar_index.php" => "Escola", - "" => "{$nomeMenu} série" - )); - $this->enviaLocalizacao($localizacao->montar()); - - $this->nome_url_cancelar = "Cancelar"; - - $this->alerta_faixa_etaria = dbBool($this->alerta_faixa_etaria); - $this->bloquear_matricula_faixa_etaria = dbBool($this->bloquear_matricula_faixa_etaria); - $this->exigir_inep = dbBool($this->exigir_inep); - - return $retorno; - } - - function Gerar() - { - if ($_POST) { - foreach($_POST as $campo => $val) { - $this->$campo = ($this->$campo) ? $this->$campo : $val; - } - } + $nomeMenu = $retorno == 'Editar' ? $retorno : 'Cadastrar'; + $localizacao = new LocalizacaoSistema(); - // primary keys - $this->campoOculto("cod_serie", $this->cod_serie); + $localizacao->entradaCaminhos([ + $_SERVER['SERVER_NAME'].'/intranet' => 'Início', + 'educar_index.php' => 'Escola', + '' => "{$nomeMenu} série" + ]); - $obrigatorio = TRUE; - $get_curso = TRUE; - include('include/pmieducar/educar_campo_lista.php'); + $this->enviaLocalizacao($localizacao->montar()); - $this->campoTexto("nm_serie", "Série", $this->nm_serie, 30, 255, TRUE); + $this->nome_url_cancelar = 'Cancelar'; - $opcoes = array("" => "Selecione"); + $this->alerta_faixa_etaria = dbBool($this->alerta_faixa_etaria); + $this->bloquear_matricula_faixa_etaria = dbBool($this->bloquear_matricula_faixa_etaria); + $this->exigir_inep = dbBool($this->exigir_inep); - if ($this->ref_cod_curso) { - $objTemp = new clsPmieducarCurso(); - $lista = $objTemp->lista($this->ref_cod_curso, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, 1); + return $retorno; + } - if (is_array($lista) && count($lista)) { - foreach ($lista as $registro) { - $opcoes_["{$registro['cod_curso']}"] = "{$registro['qtd_etapas']}"; + public function Gerar() + { + if ($_POST) { + foreach ($_POST as $campo => $val) { + $this->$campo = ($this->$campo) ? $this->$campo : $val; + } } - } - - for ($i=1; $i <= $opcoes_["{$registro['cod_curso']}"]; $i++) { - $opcoes[$i] = "Etapa {$i}"; - } - } - $this->campoLista('etapa_curso', 'Etapa Curso', $opcoes, $this->etapa_curso); + // primary keys + $this->campoOculto('cod_serie', $this->cod_serie); + + $obrigatorio = true; + $get_curso = true; + include('include/pmieducar/educar_campo_lista.php'); + + $this->campoTexto('nm_serie', 'Série', $this->nm_serie, 30, 255, true); + + $opcoes = ['' => 'Selecione']; + + if ($this->ref_cod_curso) { + $objTemp = new clsPmieducarCurso(); + $lista = $objTemp->lista( + $this->ref_cod_curso, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 1 + ); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes_["{$registro['cod_curso']}"] = "{$registro['qtd_etapas']}"; + } + } + + for ($i=1; $i <= $opcoes_["{$registro['cod_curso']}"]; $i++) { + $opcoes[$i] = "Etapa {$i}"; + } + } - // Regra de avaliação - $mapper = new RegraAvaliacao_Model_RegraDataMapper(); - $regras = array(); - if (!is_null($this->ref_cod_instituicao)) { - $regras = $mapper->findAll(array(), - array('instituicao' => $this->ref_cod_instituicao) - ); - $regras = CoreExt_Entity::entityFilterAttr($regras, 'id', 'nome'); - } + $this->campoLista('etapa_curso', 'Etapa Curso', $opcoes, $this->etapa_curso); - $regras = array('' => 'Selecione') + $regras; + // Regra de avaliação + $mapper = new RegraAvaliacao_Model_RegraDataMapper(); + $regras = []; - $this->campoLista('regra_avaliacao_id', 'Regra de avaliação', $regras, $this->regra_avaliacao_id); - $this->campoLista('regra_avaliacao_diferenciada_id', 'Regra de avaliação diferenciada', $regras, $this->regra_avaliacao_diferenciada_id, '', FALSE, 'Será utilizada quando campo Utilizar regra de avaliação diferenciada estiver marcado no cadastro da escola', '', FALSE, FALSE); + if (!is_null($this->ref_cod_instituicao)) { + $regras = $mapper->findAll( + [], + ['instituicao' => $this->ref_cod_instituicao] + ); - $opcoes = array('' => 'Selecione', 1 => 'não', 2 => 'sim'); + $regras = CoreExt_Entity::entityFilterAttr($regras, 'id', 'nome'); + } - $this->campoLista('concluinte', 'Concluinte', $opcoes, $this->concluinte); + $regras = ['' => 'Selecione'] + $regras; - $this->campoMonetario('carga_horaria', 'Carga Horária', $this->carga_horaria, 7, 7, TRUE); + $this->campoLista('regra_avaliacao_id', 'Regra de avaliação', $regras, $this->regra_avaliacao_id); + $this->campoLista('regra_avaliacao_diferenciada_id', 'Regra de avaliação diferenciada', $regras, $this->regra_avaliacao_diferenciada_id, '', false, 'Será utilizada quando campo Utilizar regra de avaliação diferenciada estiver marcado no cadastro da escola', '', false, false); - $this->campoNumero('dias_letivos', 'Dias letivos', $this->dias_letivos, 3, 3, TRUE); + $opcoes = ['' => 'Selecione', 1 => 'não', 2 => 'sim']; - $this->campoNumero('idade_ideal', 'Idade padrão', $this->idade_ideal, 2, 2, false); + $this->campoLista('concluinte', 'Concluinte', $opcoes, $this->concluinte); - $this->campoNumero('idade_inicial', 'Faixa etária', $this->idade_inicial, - 2, 2, FALSE, '', '', FALSE, FALSE, TRUE); + $this->campoMonetario('carga_horaria', 'Carga Horária', $this->carga_horaria, 7, 7, true); - $this->campoNumero('idade_final', ' até', $this->idade_final, 2, 2, FALSE); + $this->campoNumero('dias_letivos', 'Dias letivos', $this->dias_letivos, 3, 3, true); - $this->campoMemo( "observacao_historico", "Observação histórico", $this->observacao_historico, 60, 5, false ); + $this->campoNumero('idade_ideal', 'Idade padrão', $this->idade_ideal, 2, 2, false); - $this->campoCheck("alerta_faixa_etaria", "Exibir alerta ao tentar matricular alunos fora da faixa etária da série/ano", $this->alerta_faixa_etaria); - $this->campoCheck("bloquear_matricula_faixa_etaria", "Bloquear matrículas de alunos fora da faixa etária da série/ano", $this->bloquear_matricula_faixa_etaria); + $this->campoNumero( + 'idade_inicial', + 'Faixa etária', + $this->idade_inicial, + 2, + 2, + false, + '', + '', + false, + false, + true + ); - $this->campoCheck("exigir_inep", "Exigir INEP para a matrícula?", $this->exigir_inep); + $this->campoNumero('idade_final', ' até', $this->idade_final, 2, 2, false); - } + $this->campoMemo('observacao_historico', 'Observação histórico', $this->observacao_historico, 60, 5, false); - function Novo() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); + $this->campoCheck('alerta_faixa_etaria', 'Exibir alerta ao tentar matricular alunos fora da faixa etária da série/ano', $this->alerta_faixa_etaria); + $this->campoCheck('bloquear_matricula_faixa_etaria', 'Bloquear matrículas de alunos fora da faixa etária da série/ano', $this->bloquear_matricula_faixa_etaria); - $this->carga_horaria = str_replace(".", "", $this->carga_horaria); - $this->carga_horaria = str_replace(",", ".", $this->carga_horaria); + $this->campoCheck('exigir_inep', 'Exigir INEP para a matrícula?', $this->exigir_inep); + } - $obj = new clsPmieducarSerie(NULL, NULL, $this->pessoa_logada, $this->ref_cod_curso, - $this->nm_serie, $this->etapa_curso, $this->concluinte, $this->carga_horaria, - NULL, NULL, 1, $this->idade_inicial, $this->idade_final, - $this->regra_avaliacao_id, $this->observacao_historico, $this->dias_letivos, - $this->regra_avaliacao_diferenciada_id, !is_null($this->alerta_faixa_etaria), !is_null($this->bloquear_matricula_faixa_etaria), $this->idade_ideal, !is_null($this->exigir_inep)); + public function Novo() + { + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + $this->carga_horaria = str_replace('.', '', $this->carga_horaria); + $this->carga_horaria = str_replace(',', '.', $this->carga_horaria); + + $obj = new clsPmieducarSerie( + null, + null, + $this->pessoa_logada, + $this->ref_cod_curso, + $this->nm_serie, + $this->etapa_curso, + $this->concluinte, + $this->carga_horaria, + null, + null, + 1, + $this->idade_inicial, + $this->idade_final, + $this->regra_avaliacao_id, + $this->observacao_historico, + $this->dias_letivos, + $this->regra_avaliacao_diferenciada_id, + !is_null($this->alerta_faixa_etaria), + !is_null($this->bloquear_matricula_faixa_etaria), + $this->idade_ideal, + !is_null($this->exigir_inep) + ); + + $this->cod_serie = $cadastrou = $obj->cadastra(); + + if ($cadastrou) { + $serie = new clsPmieducarSerie($this->cod_serie); + $serie = $serie->detalhe(); + + $auditoria = new clsModulesAuditoriaGeral('serie', $this->pessoa_logada, $this->cod_serie); + $auditoria->inclusao($serie); + + $this->mensagem .= 'Cadastro efetuado com sucesso.
'; + header('Location: educar_serie_lst.php'); + die(); + } - $this->cod_serie = $cadastrou = $obj->cadastra(); + $this->mensagem = 'Cadastro não realizado.
'; + echo ""; - if ($cadastrou) { - $serie = new clsPmieducarSerie($this->cod_serie); - $serie = $serie->detalhe(); + return false; + } - $auditoria = new clsModulesAuditoriaGeral("serie", $this->pessoa_logada, $this->cod_serie); - $auditoria->inclusao($serie); + public function Editar() + { + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + $this->carga_horaria = str_replace('.', '', $this->carga_horaria); + $this->carga_horaria = str_replace(',', '.', $this->carga_horaria); + + $obj = new clsPmieducarSerie( + $this->cod_serie, + $this->pessoa_logada, + null, + $this->ref_cod_curso, + $this->nm_serie, + $this->etapa_curso, + $this->concluinte, + $this->carga_horaria, + null, + null, + 1, + $this->idade_inicial, + $this->idade_final, + $this->regra_avaliacao_id, + $this->observacao_historico, + $this->dias_letivos, + $this->regra_avaliacao_diferenciada_id, + !is_null($this->alerta_faixa_etaria), + !is_null($this->bloquear_matricula_faixa_etaria), + $this->idade_ideal, + !is_null($this->exigir_inep) + ); + + $detalheAntigo = $obj->detalhe(); + $editou = $obj->edita(); + + if ($editou) { + $detalheAtual = $obj->detalhe(); + $auditoria = new clsModulesAuditoriaGeral('serie', $this->pessoa_logada, $this->cod_serie); + $auditoria->alteracao($detalheAntigo, $detalheAtual); + + $this->mensagem .= 'Edição efetuada com sucesso.
'; + header('Location: educar_serie_lst.php'); + die(); + } - $this->mensagem .= "Cadastro efetuado com sucesso.
"; - header("Location: educar_serie_lst.php"); - die(); - } + $this->mensagem = 'Edição não realizada.
'; + echo ""; - $this->mensagem = "Cadastro não realizado.
"; - echo ""; - return FALSE; - } - - function Editar() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $this->carga_horaria = str_replace(".", "", $this->carga_horaria); - $this->carga_horaria = str_replace(",", ".", $this->carga_horaria); - - $obj = new clsPmieducarSerie($this->cod_serie, $this->pessoa_logada, NULL, - $this->ref_cod_curso, $this->nm_serie, $this->etapa_curso, $this->concluinte, - $this->carga_horaria, NULL, NULL, 1, $this->idade_inicial, - $this->idade_final, $this->regra_avaliacao_id, $this->observacao_historico, $this->dias_letivos, - $this->regra_avaliacao_diferenciada_id, !is_null($this->alerta_faixa_etaria), !is_null($this->bloquear_matricula_faixa_etaria),$this->idade_ideal, !is_null($this->exigir_inep)); - - $detalheAntigo = $obj->detalhe(); - $editou = $obj->edita(); - if ($editou) { - $detalheAtual = $obj->detalhe(); - $auditoria = new clsModulesAuditoriaGeral("serie", $this->pessoa_logada, $this->cod_serie); - $auditoria->alteracao($detalheAntigo, $detalheAtual); - - $this->mensagem .= "Edição efetuada com sucesso.
"; - header("Location: educar_serie_lst.php"); - die(); + return false; } - $this->mensagem = "Edição não realizada.
"; - echo ""; - return FALSE; - } + public function Excluir() + { + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + $obj = new clsPmieducarSerie( + $this->cod_serie, + $this->pessoa_logada, + null, + null, + null, + null, + null, + null, + null, + null, + 0 + ); - function Excluir() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); + if ($obj->possuiTurmasVinculadas()) { + $this->mensagem = 'Não foi possível excluir a série, pois a mesma possui turmas vinculadas.'; - $obj = new clsPmieducarSerie($this->cod_serie, $this->pessoa_logada, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); + return false; + } - if ($obj->possuiTurmasVinculadas()) { - $this->mensagem = 'Exclusão não realizada.'; + $serie = $obj->detalhe(); + $excluiu = $obj->excluir(); - return false; - } + if ($excluiu) { + $auditoria = new clsModulesAuditoriaGeral('serie', $this->pessoa_logada, $this->cod_serie); + $auditoria->exclusao($serie); - $serie = $obj->detalhe(); - $excluiu = $obj->excluir(); + $this->mensagem .= 'Exclusão efetuada com sucesso.
'; + header('Location: educar_serie_lst.php'); + die(); + } - if ($excluiu) { - $auditoria = new clsModulesAuditoriaGeral("serie", $this->pessoa_logada, $this->cod_serie); - $auditoria->exclusao($serie); + $this->mensagem = 'Exclusão não realizada.
'; + echo ""; - $this->mensagem .= "Exclusão efetuada com sucesso.
"; - header( "Location: educar_serie_lst.php" ); - die(); + return false; } - - $this->mensagem = "Exclusão não realizada.
"; - echo ""; - return FALSE; - } } // Instancia objeto de página @@ -348,101 +395,101 @@ function Excluir() $pagina->MakeAll(); ?> From 17b5dd822fe305b490168bfd795c68e2de684058 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 18 Jul 2018 16:18:47 -0300 Subject: [PATCH 15/73] Move pasta src pra raiz do projeto --- composer.json | 2 +- .../Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php | 0 .../Modules/Educacenso/Deficiencia/DeficienciaMultiplaAluno.php | 0 .../Educacenso/Deficiencia/DeficienciaMultiplaProfessor.php | 0 .../Educacenso/Deficiencia/MapeamentoDeficienciasAluno.php | 0 .../Educacenso/Deficiencia/ValidaDeficienciaMultipla.php | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename {ieducar/src => src}/Modules/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php (100%) rename {ieducar/src => src}/Modules/Educacenso/Deficiencia/DeficienciaMultiplaAluno.php (100%) rename {ieducar/src => src}/Modules/Educacenso/Deficiencia/DeficienciaMultiplaProfessor.php (100%) rename {ieducar/src => src}/Modules/Educacenso/Deficiencia/MapeamentoDeficienciasAluno.php (100%) rename {ieducar/src => src}/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php (100%) diff --git a/composer.json b/composer.json index 50b2ec7ec9..bfe8d47f32 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "autoload": { "psr-4": { - "iEducar\\": "ieducar/src" + "iEducar\\": "src" } }, "autoload-dev": { diff --git a/ieducar/src/Modules/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php b/src/Modules/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php similarity index 100% rename from ieducar/src/Modules/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php rename to src/Modules/Educacenso/Deficiencia/CombinacaoDeficienciaMultipla.php diff --git a/ieducar/src/Modules/Educacenso/Deficiencia/DeficienciaMultiplaAluno.php b/src/Modules/Educacenso/Deficiencia/DeficienciaMultiplaAluno.php similarity index 100% rename from ieducar/src/Modules/Educacenso/Deficiencia/DeficienciaMultiplaAluno.php rename to src/Modules/Educacenso/Deficiencia/DeficienciaMultiplaAluno.php diff --git a/ieducar/src/Modules/Educacenso/Deficiencia/DeficienciaMultiplaProfessor.php b/src/Modules/Educacenso/Deficiencia/DeficienciaMultiplaProfessor.php similarity index 100% rename from ieducar/src/Modules/Educacenso/Deficiencia/DeficienciaMultiplaProfessor.php rename to src/Modules/Educacenso/Deficiencia/DeficienciaMultiplaProfessor.php diff --git a/ieducar/src/Modules/Educacenso/Deficiencia/MapeamentoDeficienciasAluno.php b/src/Modules/Educacenso/Deficiencia/MapeamentoDeficienciasAluno.php similarity index 100% rename from ieducar/src/Modules/Educacenso/Deficiencia/MapeamentoDeficienciasAluno.php rename to src/Modules/Educacenso/Deficiencia/MapeamentoDeficienciasAluno.php diff --git a/ieducar/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php b/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php similarity index 100% rename from ieducar/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php rename to src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php From 11b809f407e8ea8ebe6e00a0bb8065ecbbfe8453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ber=20Freitas=20Dias?= Date: Wed, 18 Jul 2018 16:27:59 -0300 Subject: [PATCH 16/73] Removendo html entities --- ieducar/intranet/educar_serie_cad.php | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ieducar/intranet/educar_serie_cad.php b/ieducar/intranet/educar_serie_cad.php index 66a6be5262..c3c635873e 100644 --- a/ieducar/intranet/educar_serie_cad.php +++ b/ieducar/intranet/educar_serie_cad.php @@ -11,7 +11,7 @@ class clsIndexBase extends clsBase { public function Formular() { - $this->SetTitulo($this->_instituicao . ' i-Educar - Série'); + $this->SetTitulo($this->_instituicao . ' i-Educar - Série'); $this->processoAp = '583'; $this->addEstilo('localizacaoSistema'); } @@ -104,9 +104,9 @@ public function Inicializar() $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos([ - $_SERVER['SERVER_NAME'].'/intranet' => 'Início', + $_SERVER['SERVER_NAME'].'/intranet' => 'Início', 'educar_index.php' => 'Escola', - '' => "{$nomeMenu} série" + '' => "{$nomeMenu} série" ]); $this->enviaLocalizacao($localizacao->montar()); @@ -135,7 +135,7 @@ public function Gerar() $get_curso = true; include('include/pmieducar/educar_campo_lista.php'); - $this->campoTexto('nm_serie', 'Série', $this->nm_serie, 30, 255, true); + $this->campoTexto('nm_serie', 'Série', $this->nm_serie, 30, 255, true); $opcoes = ['' => 'Selecione']; @@ -198,11 +198,11 @@ public function Gerar() $this->campoLista('regra_avaliacao_id', 'Regra de avaliação', $regras, $this->regra_avaliacao_id); $this->campoLista('regra_avaliacao_diferenciada_id', 'Regra de avaliação diferenciada', $regras, $this->regra_avaliacao_diferenciada_id, '', false, 'Será utilizada quando campo Utilizar regra de avaliação diferenciada estiver marcado no cadastro da escola', '', false, false); - $opcoes = ['' => 'Selecione', 1 => 'não', 2 => 'sim']; + $opcoes = ['' => 'Selecione', 1 => 'não', 2 => 'sim']; $this->campoLista('concluinte', 'Concluinte', $opcoes, $this->concluinte); - $this->campoMonetario('carga_horaria', 'Carga Horária', $this->carga_horaria, 7, 7, true); + $this->campoMonetario('carga_horaria', 'Carga Horária', $this->carga_horaria, 7, 7, true); $this->campoNumero('dias_letivos', 'Dias letivos', $this->dias_letivos, 3, 3, true); @@ -210,7 +210,7 @@ public function Gerar() $this->campoNumero( 'idade_inicial', - 'Faixa etária', + 'Faixa etária', $this->idade_inicial, 2, 2, @@ -224,7 +224,7 @@ public function Gerar() $this->campoNumero('idade_final', ' até', $this->idade_final, 2, 2, false); - $this->campoMemo('observacao_historico', 'Observação histórico', $this->observacao_historico, 60, 5, false); + $this->campoMemo('observacao_historico', 'Observação histórico', $this->observacao_historico, 60, 5, false); $this->campoCheck('alerta_faixa_etaria', 'Exibir alerta ao tentar matricular alunos fora da faixa etária da série/ano', $this->alerta_faixa_etaria); $this->campoCheck('bloquear_matricula_faixa_etaria', 'Bloquear matrículas de alunos fora da faixa etária da série/ano', $this->bloquear_matricula_faixa_etaria); @@ -279,8 +279,8 @@ public function Novo() die(); } - $this->mensagem = 'Cadastro não realizado.
'; - echo ""; + $this->mensagem = 'Cadastro não realizado.
'; + echo ""; return false; } @@ -326,13 +326,13 @@ public function Editar() $auditoria = new clsModulesAuditoriaGeral('serie', $this->pessoa_logada, $this->cod_serie); $auditoria->alteracao($detalheAntigo, $detalheAtual); - $this->mensagem .= 'Edição efetuada com sucesso.
'; + $this->mensagem .= 'Edição efetuada com sucesso.
'; header('Location: educar_serie_lst.php'); die(); } - $this->mensagem = 'Edição não realizada.
'; - echo ""; + $this->mensagem = 'Edição não realizada.
'; + echo ""; return false; } @@ -370,13 +370,13 @@ public function Excluir() $auditoria = new clsModulesAuditoriaGeral('serie', $this->pessoa_logada, $this->cod_serie); $auditoria->exclusao($serie); - $this->mensagem .= 'Exclusão efetuada com sucesso.
'; + $this->mensagem .= 'Exclusão efetuada com sucesso.
'; header('Location: educar_serie_lst.php'); die(); } - $this->mensagem = 'Exclusão não realizada.
'; - echo ""; + $this->mensagem = 'Exclusão não realizada.
'; + echo ""; return false; } From d473949b041f0af9e93b74f48a88c19773eb9e68 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 18 Jul 2018 16:35:24 -0300 Subject: [PATCH 17/73] =?UTF-8?q?Melhora=20indenta=C3=A7=C3=A3o=20e=20remo?= =?UTF-8?q?ve=20coment=C3=A1rios=20antigos=20do=20arquivo=20EducacensoExpo?= =?UTF-8?q?rtController.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Api/Views/EducacensoExportController.php | 2744 +++++++++-------- 1 file changed, 1420 insertions(+), 1324 deletions(-) diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index 12312f86e8..ce44813a9a 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -1,37 +1,5 @@ - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Caroline Salib - * @category i-Educar - * @license @@license@@ - * @package Api - * @subpackage Modules - * @since Arquivo disponível desde a versão ? - * @version $Id$ - */ - use iEducar\Modules\Educacenso\Deficiencia\DeficienciaMultiplaAluno; use iEducar\Modules\Educacenso\Deficiencia\DeficienciaMultiplaProfessor; use iEducar\Modules\Educacenso\Deficiencia\MapeamentoDeficienciasAluno; @@ -55,151 +23,163 @@ class EducacensoExportController extends ApiCoreController { - var $pessoa_logada; - - var $ref_cod_escola; - var $ref_cod_escola_; - var $ref_cod_serie; - var $ref_cod_serie_; - var $ref_usuario_exc; - var $ref_usuario_cad; - var $hora_inicial; - var $hora_final; - var $data_cadastro; - var $data_exclusao; - var $ativo; - var $hora_inicio_intervalo; - var $hora_fim_intervalo; - var $hora_fim_intervalo_; - - var $ano; - var $ref_cod_instituicao; - var $msg = ""; - var $error = false; - - var $turma_presencial_ou_semi; - - const TECNOLOGO = 1; - const LICENCIATURA = 2; - const BACHARELADO = 3; - - - protected function educacensoExport() { - - $escola = $this->getRequest()->escola; - $ano = $this->getRequest()->ano; - $data_ini = $this->getRequest()->data_ini; - $data_fim = $this->getRequest()->data_fim; - - $conteudo = $this->exportaDadosCensoPorEscola($escola, - $ano, - Portabilis_Date_Utils::brToPgSQL($data_ini), - Portabilis_Date_Utils::brToPgSQL($data_fim)); - - if($this->error){ - return array("error" => true, - "mensagem" => $this->msg); - } + var $pessoa_logada; - return array('conteudo' => $conteudo); - } + var $ref_cod_escola; + var $ref_cod_escola_; + var $ref_cod_serie; + var $ref_cod_serie_; + var $ref_usuario_exc; + var $ref_usuario_cad; + var $hora_inicial; + var $hora_final; + var $data_cadastro; + var $data_exclusao; + var $ativo; + var $hora_inicio_intervalo; + var $hora_fim_intervalo; + var $hora_fim_intervalo_; - protected function educacensoExportFase2() { + var $ano; + var $ref_cod_instituicao; + var $msg = ""; + var $error = false; - $escola = $this->getRequest()->escola; - $ano = $this->getRequest()->ano; - $data_ini = $this->getRequest()->data_ini; - $data_fim = $this->getRequest()->data_fim; + var $turma_presencial_ou_semi; - $conteudo = $this->exportaDadosCensoPorEscolaFase2($escola, - $ano, - Portabilis_Date_Utils::brToPgSQL($data_ini), - Portabilis_Date_Utils::brToPgSQL($data_fim)); + const TECNOLOGO = 1; + const LICENCIATURA = 2; + const BACHARELADO = 3; - if($this->error){ - return array("error" => true, - "mensagem" => $this->msg); - } - return array('conteudo' => $conteudo); - } + protected function educacensoExport() + { - protected function exportaDadosCensoPorEscola($escolaId, $ano, $data_ini, $data_fim){ + $escola = $this->getRequest()->escola; + $ano = $this->getRequest()->ano; + $data_ini = $this->getRequest()->data_ini; + $data_fim = $this->getRequest()->data_fim; + + $conteudo = $this->exportaDadosCensoPorEscola($escola, + $ano, + Portabilis_Date_Utils::brToPgSQL($data_ini), + Portabilis_Date_Utils::brToPgSQL($data_fim)); + + if ($this->error) { + return array( + "error" => true, + "mensagem" => $this->msg + ); + } + + return array('conteudo' => $conteudo); + } - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); + protected function educacensoExportFase2() + { - $obj_permissoes = new clsPermissoes(); - $obj_permissoes->permissao_cadastra(846, $this->pessoa_logada, 7, - 'educar_index.php'); - $this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada); + $escola = $this->getRequest()->escola; + $ano = $this->getRequest()->ano; + $data_ini = $this->getRequest()->data_ini; + $data_fim = $this->getRequest()->data_fim; + + $conteudo = $this->exportaDadosCensoPorEscolaFase2($escola, + $ano, + Portabilis_Date_Utils::brToPgSQL($data_ini), + Portabilis_Date_Utils::brToPgSQL($data_fim)); + + if ($this->error) { + return array( + "error" => true, + "mensagem" => $this->msg + ); + } - $export = $this->exportaDadosRegistro00($escolaId, $ano); - $export .= $this->exportaDadosRegistro10($escolaId, $ano); - foreach ($this->getTurmas($escolaId, $ano) as $turmaId => $turmaNome) { - $export .= $this->exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_fim); - } - foreach ($this->getServidores($escolaId, $ano, $data_ini, $data_fim) as $servidor) { - - $registro30 = $this->exportaDadosRegistro30($servidor['id'], $escolaId); - $registro40 = $this->exportaDadosRegistro40($servidor['id'], $escolaId); - $registro50 = $this->exportaDadosRegistro50($servidor['id'], $escolaId); - $registro51 = $this->exportaDadosRegistro51($servidor['id'], $escolaId, $data_ini, $data_fim, $ano); - if(!empty($registro30) && !empty($registro40) && !empty($registro50)) - $export .= $registro30 . $registro40 . $registro50 . $registro51; + return array('conteudo' => $conteudo); } - foreach ($this->getAlunos($escolaId, $ano, $data_ini, $data_fim) as $alunoId) { - $registro60 = $this->exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, $alunoId['id']); - $registro70 = $this->exportaDadosRegistro70($escolaId, $ano, $data_ini, $data_fim, $alunoId['id']); - $registro80 = $this->exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, $alunoId['id']); - if(!empty($registro60) && !empty($registro70) && !empty($registro80)) - $export .= $registro60 . $registro70 . $registro80; + protected function exportaDadosCensoPorEscola($escolaId, $ano, $data_ini, $data_fim) + { + + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + $obj_permissoes = new clsPermissoes(); + $obj_permissoes->permissao_cadastra(846, $this->pessoa_logada, 7, + 'educar_index.php'); + $this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada); + + $export = $this->exportaDadosRegistro00($escolaId, $ano); + $export .= $this->exportaDadosRegistro10($escolaId, $ano); + foreach ($this->getTurmas($escolaId, $ano) as $turmaId => $turmaNome) { + $export .= $this->exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_fim); + } + foreach ($this->getServidores($escolaId, $ano, $data_ini, $data_fim) as $servidor) { + + $registro30 = $this->exportaDadosRegistro30($servidor['id'], $escolaId); + $registro40 = $this->exportaDadosRegistro40($servidor['id'], $escolaId); + $registro50 = $this->exportaDadosRegistro50($servidor['id'], $escolaId); + $registro51 = $this->exportaDadosRegistro51($servidor['id'], $escolaId, $data_ini, $data_fim, $ano); + if (!empty($registro30) && !empty($registro40) && !empty($registro50)) { + $export .= $registro30 . $registro40 . $registro50 . $registro51; + } + } + + foreach ($this->getAlunos($escolaId, $ano, $data_ini, $data_fim) as $alunoId) { + $registro60 = $this->exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, $alunoId['id']); + $registro70 = $this->exportaDadosRegistro70($escolaId, $ano, $data_ini, $data_fim, $alunoId['id']); + $registro80 = $this->exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, $alunoId['id']); + if (!empty($registro60) && !empty($registro70) && !empty($registro80)) { + $export .= $registro60 . $registro70 . $registro80; + } + } + $export .= $this->exportaDadosRegistro99(); + return $export; } - $export .= $this->exportaDadosRegistro99(); - return $export; - } - - protected function exportaDadosCensoPorEscolaFase2($escolaId, $ano, $data_ini, $data_fim) { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $obj_permissoes = new clsPermissoes(); - $obj_permissoes->permissao_cadastra(846, $this->pessoa_logada, 7, - 'educar_index.php'); - $this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada); - - $export = $this->exportaDadosRegistro89($escolaId); - - foreach ($this->getTurmas($escolaId, $ano) as $turmaId => $turmaNome) { - foreach ($this->getMatriculasTurma($escolaId, $ano, $data_ini, $data_fim, $turmaId) as $matricula) { - $export .= $this->exportaDadosRegistro90($escolaId, $turmaId, $matricula['id']); - } + + protected function exportaDadosCensoPorEscolaFase2($escolaId, $ano, $data_ini, $data_fim) + { + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + $obj_permissoes = new clsPermissoes(); + $obj_permissoes->permissao_cadastra(846, $this->pessoa_logada, 7, + 'educar_index.php'); + $this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada); + + $export = $this->exportaDadosRegistro89($escolaId); + + foreach ($this->getTurmas($escolaId, $ano) as $turmaId => $turmaNome) { + foreach ($this->getMatriculasTurma($escolaId, $ano, $data_ini, $data_fim, $turmaId) as $matricula) { + $export .= $this->exportaDadosRegistro90($escolaId, $turmaId, $matricula['id']); + } + } + foreach ($this->getTurmas($escolaId, $ano) as $turmaId => $turmaNome) { + foreach ($this->getMatriculasTurmaAposData($escolaId, $ano, $data_ini, $data_fim, $turmaId) as $matricula) { + $export .= $this->exportaDadosRegistro91($escolaId, $turmaId, $matricula['id']); + } + } + + return $export; } - foreach ($this->getTurmas($escolaId, $ano) as $turmaId => $turmaNome) { - foreach ($this->getMatriculasTurmaAposData($escolaId, $ano, $data_ini, $data_fim, $turmaId) as $matricula) { - $export .= $this->exportaDadosRegistro91($escolaId, $turmaId, $matricula['id']); - } + + protected function getTurmas($escolaId, $ano) + { + return App_Model_IedFinder::getTurmasEducacenso($escolaId, $ano); } - return $export; - } - - protected function getTurmas($escolaId, $ano){ - return App_Model_IedFinder::getTurmasEducacenso($escolaId, $ano); - } - - protected function getServidores($escolaId, $ano, $data_ini, $data_fim){ - $sql = 'SELECT distinct cod_servidor as id - from pmieducar.servidor - inner join modules.professor_turma on(servidor.cod_servidor = professor_turma.servidor_id) - inner join pmieducar.turma on(professor_turma.turma_id = turma.cod_turma) - where turma.ref_ref_cod_escola = $1 - and servidor.ativo = 1 - and professor_turma.ano = $2 - and turma.ativo = 1 + protected function getServidores($escolaId, $ano, $data_ini, $data_fim) + { + $sql = 'SELECT DISTINCT cod_servidor AS id + FROM pmieducar.servidor + INNER JOIN modules.professor_turma ON(servidor.cod_servidor = professor_turma.servidor_id) + INNER JOIN pmieducar.turma ON(professor_turma.turma_id = turma.cod_turma) + WHERE turma.ref_ref_cod_escola = $1 + AND servidor.ativo = 1 + AND professor_turma.ano = $2 + AND turma.ativo = 1 AND NOT EXISTS (SELECT 1 FROM pmieducar.servidor_alocacao WHERE servidor.cod_servidor = servidor_alocacao.ref_cod_servidor @@ -207,7 +187,7 @@ protected function getServidores($escolaId, $ano, $data_ini, $data_fim){ AND turma.ano = servidor_alocacao.ano AND servidor_alocacao.data_admissao > DATE($4) ) - and (SELECT 1 + AND (SELECT 1 FROM pmieducar.matricula_turma mt INNER JOIN pmieducar.matricula m ON(mt.ref_cod_matricula = m.cod_matricula) WHERE mt.ref_cod_turma = turma.cod_turma @@ -215,13 +195,15 @@ protected function getServidores($escolaId, $ano, $data_ini, $data_fim){ AND COALESCE(m.data_matricula,m.data_cadastro) BETWEEN DATE($3) AND DATE($4) LIMIT 1) IS NOT NULL'; - return Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($escolaId, $ano, $data_ini, $data_fim))); - } + return Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('params' => array($escolaId, $ano, $data_ini, $data_fim))); + } - protected function getAlunos($escolaId, $ano, $data_ini, $data_fim){ - $sql = - 'SELECT - distinct(a.cod_aluno) as id + protected function getAlunos($escolaId, $ano, $data_ini, $data_fim) + { + $sql = + 'SELECT + DISTINCT(a.cod_aluno) AS id FROM pmieducar.aluno a INNER JOIN cadastro.fisica fis ON (fis.idpes = a.ref_idpes) @@ -235,12 +217,14 @@ protected function getAlunos($escolaId, $ano, $data_ini, $data_fim){ AND (m.aprovado = 3 OR DATE(COALESCE(m.data_cancel,m.data_exclusao)) > DATE($4)) AND m.ano = $2 '; - return Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($escolaId, $ano, $data_ini, $data_fim))); - } + return Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('params' => array($escolaId, $ano, $data_ini, $data_fim))); + } - protected function getMatriculasTurma($escolaId, $ano, $data_ini, $data_fim, $turmaId){ - $sql = - 'SELECT DISTINCT m.cod_matricula as id + protected function getMatriculasTurma($escolaId, $ano, $data_ini, $data_fim, $turmaId) + { + $sql = + 'SELECT DISTINCT m.cod_matricula AS id FROM pmieducar.aluno a INNER JOIN cadastro.fisica fis ON (fis.idpes = a.ref_idpes) INNER JOIN cadastro.pessoa p ON (fis.idpes = p.idpes) @@ -256,13 +240,15 @@ protected function getMatriculasTurma($escolaId, $ano, $data_ini, $data_fim, $tu AND mt.ref_cod_turma = $5 AND m.ativo = 1 '; - return Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($escolaId, $ano, $data_ini, $data_fim, $turmaId))); - } + return Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('params' => array($escolaId, $ano, $data_ini, $data_fim, $turmaId))); + } - protected function getMatriculasTurmaAposData($escolaId, $ano, $data_ini, $data_fim, $turmaId){ - $sql = - 'SELECT - distinct(m.cod_matricula) as id + protected function getMatriculasTurmaAposData($escolaId, $ano, $data_ini, $data_fim, $turmaId) + { + $sql = + 'SELECT + DISTINCT(m.cod_matricula) AS id FROM pmieducar.aluno a INNER JOIN cadastro.fisica fis ON (fis.idpes = a.ref_idpes) @@ -280,41 +266,42 @@ protected function getMatriculasTurmaAposData($escolaId, $ano, $data_ini, $data_ AND i.data_educacenso IS NOT NULL AND m.ativo = 1 '; - return Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($escolaId, $ano, $turmaId))); - } + return Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($escolaId, $ano, $turmaId))); + } - protected function exportaDadosRegistro00($escolaId, $ano){ - $sql = - ' SELECT - \'00\' as r00s1, - ece.cod_escola_inep as r00s2, + protected function exportaDadosRegistro00($escolaId, $ano) + { + $sql = + ' SELECT + \'00\' AS r00s1, + ece.cod_escola_inep AS r00s2, - gestor_f.cpf as r00s3, - gestor_p.nome as r00s4, - e.cargo_gestor as r00s5, - e.email_gestor as r00s6, + gestor_f.cpf AS r00s3, + gestor_p.nome AS r00s4, + e.cargo_gestor AS r00s5, + e.email_gestor AS r00s6, - e.situacao_funcionamento as r00s7, + e.situacao_funcionamento AS r00s7, (SELECT min(ano_letivo_modulo.data_inicio) FROM pmieducar.ano_letivo_modulo - WHERE ano_letivo_modulo.ref_ano = $2 AND ano_letivo_modulo.ref_ref_cod_escola = e.cod_escola) as r00s8, + WHERE ano_letivo_modulo.ref_ano = $2 AND ano_letivo_modulo.ref_ref_cod_escola = e.cod_escola) AS r00s8, (SELECT max(ano_letivo_modulo.data_fim) FROM pmieducar.ano_letivo_modulo - WHERE ano_letivo_modulo.ref_ano = $2 AND ano_letivo_modulo.ref_ref_cod_escola = e.cod_escola) as r00s9, - - p.nome as r00s10, - e.latitude as r00s11, - e.longitude as r00s12, - COALESCE(ep.cep, ee.cep) as r00s13, - COALESCE(l.idtlog || l.nome, ee.idtlog || ee.logradouro) as r00s14, - COALESCE(ep.numero, ee.numero) as r00s15, - COALESCE(ep.complemento, ee.complemento) as r00s16, - COALESCE(bairro.nome, ee.bairro) as r00s17, - uf.cod_ibge as r00s18, - municipio.cod_ibge as r00s19, - distrito.cod_ibge as r00s20, + WHERE ano_letivo_modulo.ref_ano = $2 AND ano_letivo_modulo.ref_ref_cod_escola = e.cod_escola) AS r00s9, + + p.nome AS r00s10, + e.latitude AS r00s11, + e.longitude AS r00s12, + COALESCE(ep.cep, ee.cep) AS r00s13, + COALESCE(l.idtlog || l.nome, ee.idtlog || ee.logradouro) AS r00s14, + COALESCE(ep.numero, ee.numero) AS r00s15, + COALESCE(ep.complemento, ee.complemento) AS r00s16, + COALESCE(bairro.nome, ee.bairro) AS r00s17, + uf.cod_ibge AS r00s18, + municipio.cod_ibge AS r00s19, + distrito.cod_ibge AS r00s20, (SELECT COALESCE( (SELECT min(fone_pessoa.ddd) @@ -322,7 +309,7 @@ protected function exportaDadosRegistro00($escolaId, $ano){ WHERE j.idpes = fone_pessoa.idpes), (SELECT min(ddd_telefone) FROM pmieducar.escola_complemento - WHERE escola_complemento.ref_cod_escola = e.cod_escola))) as r00s21, + WHERE escola_complemento.ref_cod_escola = e.cod_escola))) AS r00s21, (SELECT COALESCE( (SELECT min(fone_pessoa.fone) @@ -330,7 +317,7 @@ protected function exportaDadosRegistro00($escolaId, $ano){ WHERE j.idpes = fone_pessoa.idpes), (SELECT min(telefone) FROM pmieducar.escola_complemento - WHERE escola_complemento.ref_cod_escola = e.cod_escola))) as r00s22, + WHERE escola_complemento.ref_cod_escola = e.cod_escola))) AS r00s22, (SELECT COALESCE( @@ -339,7 +326,7 @@ protected function exportaDadosRegistro00($escolaId, $ano){ WHERE j.idpes = fone_pessoa.idpes AND fone_pessoa.tipo = 3), (SELECT min(fax) FROM pmieducar.escola_complemento - WHERE escola_complemento.ref_cod_escola = e.cod_escola))) as r00s24, + WHERE escola_complemento.ref_cod_escola = e.cod_escola))) AS r00s24, (SELECT COALESCE( (SELECT min(fone_pessoa.fone) @@ -347,24 +334,24 @@ protected function exportaDadosRegistro00($escolaId, $ano){ WHERE j.idpes = fone_pessoa.idpes AND fone_pessoa.tipo = 4), (SELECT min(fax) FROM pmieducar.escola_complemento - WHERE escola_complemento.ref_cod_escola = e.cod_escola))) as r00s25, + WHERE escola_complemento.ref_cod_escola = e.cod_escola))) AS r00s25, - (SELECT COALESCE(p.email,(SELECT email FROM pmieducar.escola_complemento where ref_cod_escola = e.cod_escola))) as r00s26, + (SELECT COALESCE(p.email,(SELECT email FROM pmieducar.escola_complemento WHERE ref_cod_escola = e.cod_escola))) AS r00s26, - i.orgao_regional as r00s27, - e.dependencia_administrativa as r00s28, - e.zona_localizacao as r00s29, - e.categoria_escola_privada as r00s30, + i.orgao_regional AS r00s27, + e.dependencia_administrativa AS r00s28, + e.zona_localizacao AS r00s29, + e.categoria_escola_privada AS r00s30, e.conveniada_com_poder_publico r00s31, - (ARRAY[1] <@ e.mantenedora_escola_privada)::int as r00s32, - (ARRAY[2] <@ e.mantenedora_escola_privada)::int as r00s33, - (ARRAY[3] <@ e.mantenedora_escola_privada)::int as r00s34, - (ARRAY[4] <@ e.mantenedora_escola_privada)::int as r00s35, - (ARRAY[5] <@ e.mantenedora_escola_privada)::int as r00s36, - e.cnpj_mantenedora_principal as r00s37, + (ARRAY[1] <@ e.mantenedora_escola_privada)::INT AS r00s32, + (ARRAY[2] <@ e.mantenedora_escola_privada)::INT AS r00s33, + (ARRAY[3] <@ e.mantenedora_escola_privada)::INT AS r00s34, + (ARRAY[4] <@ e.mantenedora_escola_privada)::INT AS r00s35, + (ARRAY[5] <@ e.mantenedora_escola_privada)::INT AS r00s36, + e.cnpj_mantenedora_principal AS r00s37, j.cnpj AS r00s38, - e.regulamentacao as r00s39, - 0 as r00s40, + e.regulamentacao AS r00s39, + 0 AS r00s40, e.situacao_funcionamento FROM pmieducar.escola e @@ -391,133 +378,137 @@ protected function exportaDadosRegistro00($escolaId, $ano){ LEFT JOIN public.logradouro l ON (l.idlog = cl.idlog) WHERE e.cod_escola = $1 '; - // Transforma todos resultados em variáveis - extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array('return_only' => 'first-row', 'params' => array($escolaId, $ano)))); - if ($r00s1){ - $d = '|'; - $return = ''; - - $r00s2 = substr($r00s2, 0, 8); - $r00s3 = $this->cpfToCenso($r00s3); - $r00s4 = $this->convertStringToCenso($r00s4); - $r00s6 = strtoupper($r00s6); - - $r00s8 = Portabilis_Date_Utils::pgSQLToBr($r00s8); - $r00s9 = Portabilis_Date_Utils::pgSQLToBr($r00s9); - - $r00s10 = $this->convertStringToCenso($r00s10); - $r00s14 = $this->convertStringToCenso($r00s14); - $r00s15 = $this->convertStringToCenso($r00s15); - $r00s16 = $this->convertStringToCenso($r00s16); - $r00s17 = $this->convertStringToCenso($r00s17); - $r00s26 = strtoupper($r00s26); - $r00s27 = ($r00s27 ? str_pad($r00s27, 5, "0", STR_PAD_LEFT) : NULL); - - $r00s37 = $this->cnpjToCenso($r00s37); - $r00s38 = $this->cnpjToCenso($r00s38); - - if($r00s28 != 4) - $r00s30 = $r00s31 = $r00s32 = $r00s33 = $r00s34 = $r00s35 = $r00s36 = $r00s37 = $r00s38 = NULL; - - for ($i=1; $i <= 42 ; $i++) - $return .= ${'r00s'.$i}.$d; - - $return = substr_replace($return, "", -1); - - return $return."\n"; - }else{ - $this->msg .= "Dados para formular o registro 00 da escola {$escolaId} não encontrados. Verifique se a escola possuí endereço normalizado, código do INEP e dados do gestor cadastrados.
"; - $this->error = true; + // Transforma todos resultados em variáveis + extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('return_only' => 'first-row', 'params' => array($escolaId, $ano)))); + if ($r00s1) { + $d = '|'; + $return = ''; + + $r00s2 = substr($r00s2, 0, 8); + $r00s3 = $this->cpfToCenso($r00s3); + $r00s4 = $this->convertStringToCenso($r00s4); + $r00s6 = strtoupper($r00s6); + + $r00s8 = Portabilis_Date_Utils::pgSQLToBr($r00s8); + $r00s9 = Portabilis_Date_Utils::pgSQLToBr($r00s9); + + $r00s10 = $this->convertStringToCenso($r00s10); + $r00s14 = $this->convertStringToCenso($r00s14); + $r00s15 = $this->convertStringToCenso($r00s15); + $r00s16 = $this->convertStringToCenso($r00s16); + $r00s17 = $this->convertStringToCenso($r00s17); + $r00s26 = strtoupper($r00s26); + $r00s27 = ($r00s27 ? str_pad($r00s27, 5, "0", STR_PAD_LEFT) : null); + + $r00s37 = $this->cnpjToCenso($r00s37); + $r00s38 = $this->cnpjToCenso($r00s38); + + if ($r00s28 != 4) { + $r00s30 = $r00s31 = $r00s32 = $r00s33 = $r00s34 = $r00s35 = $r00s36 = $r00s37 = $r00s38 = null; + } + + for ($i = 1; $i <= 42; $i++) { + $return .= ${'r00s' . $i} . $d; + } + + $return = substr_replace($return, "", -1); + + return $return . "\n"; + } else { + $this->msg .= "Dados para formular o registro 00 da escola {$escolaId} não encontrados. Verifique se a escola possuí endereço normalizado, código do INEP e dados do gestor cadastrados.
"; + $this->error = true; + } } - } - protected function exportaDadosRegistro10($escolaId, $ano){ - $sql = - 'SELECT - \'10\' as r10s1, - ece.cod_escola_inep as r10s2, + protected function exportaDadosRegistro10($escolaId, $ano) + { + $sql = + 'SELECT + \'10\' AS r10s1, + ece.cod_escola_inep AS r10s2, e.local_funcionamento, - e.condicao as r10s12, - e.codigo_inep_escola_compartilhada as r10s14, - e.codigo_inep_escola_compartilhada2 as r10s15, - e.codigo_inep_escola_compartilhada3 as r10s16, - e.codigo_inep_escola_compartilhada4 as r10s17, - e.codigo_inep_escola_compartilhada5 as r10s18, - e.codigo_inep_escola_compartilhada6 as r10s19, - e.agua_consumida as r10s20, - (ARRAY[1] <@ e.abastecimento_agua)::int as r10s21, - (ARRAY[2] <@ e.abastecimento_agua)::int as r10s22, - (ARRAY[3] <@ e.abastecimento_agua)::int as r10s23, - (ARRAY[4] <@ e.abastecimento_agua)::int as r10s24, - (ARRAY[5] <@ e.abastecimento_agua)::int as r10s25, - (ARRAY[1] <@ e.abastecimento_energia)::int as r10s26, - (ARRAY[2] <@ e.abastecimento_energia)::int as r10s27, - (ARRAY[3] <@ e.abastecimento_energia)::int as r10s28, - (ARRAY[4] <@ e.abastecimento_energia)::int as r10s29, - (ARRAY[1] <@ e.esgoto_sanitario)::int as r10s30, - (ARRAY[2] <@ e.esgoto_sanitario)::int as r10s31, - (ARRAY[3] <@ e.esgoto_sanitario)::int as r10s32, - (ARRAY[1] <@ e.destinacao_lixo)::int as r10s33, - (ARRAY[2] <@ e.destinacao_lixo)::int as r10s34, - (ARRAY[3] <@ e.destinacao_lixo)::int as r10s35, - (ARRAY[4] <@ e.destinacao_lixo)::int as r10s36, - (ARRAY[5] <@ e.destinacao_lixo)::int as r10s37, - (ARRAY[6] <@ e.destinacao_lixo)::int as r10s38, - e.dependencia_sala_diretoria as r10s39, - e.dependencia_sala_professores as r10s40, - e.dependencia_sala_secretaria as r10s41, - e.dependencia_laboratorio_informatica as r10s42, - e.dependencia_laboratorio_ciencias as r10s43, - e.dependencia_sala_aee as r10s44, - e.dependencia_quadra_coberta as r10s45, - e.dependencia_quadra_descoberta as r10s46, - e.dependencia_cozinha as r10s47, - e.dependencia_biblioteca as r10s48, - e.dependencia_sala_leitura as r10s49, - e.dependencia_parque_infantil as r10s50, - e.dependencia_bercario as r10s51, - e.dependencia_banheiro_fora as r10s52, - e.dependencia_banheiro_dentro as r10s53, - e.dependencia_banheiro_infantil as r10s54, - e.dependencia_banheiro_deficiente as r10s55, - e.dependencia_vias_deficiente as r10s56, - e.dependencia_banheiro_chuveiro as r10s57, - e.dependencia_refeitorio as r10s58, - e.dependencia_dispensa as r10s59, - e.dependencia_aumoxarifado as r10s60, - e.dependencia_auditorio as r10s61, - e.dependencia_patio_coberto as r10s62, - e.dependencia_patio_descoberto as r10s63, - e.dependencia_alojamento_aluno as r10s64, - e.dependencia_alojamento_professor as r10s65, - e.dependencia_area_verde as r10s66, - e.dependencia_lavanderia as r10s67, - e.dependencia_nenhuma_relacionada as r10s68, - e.dependencia_numero_salas_existente as r10s69, - e.dependencia_numero_salas_utilizadas as r10s70, - - e.televisoes as r10s71, - e.videocassetes as r10s72, - e.dvds as r10s73, - e.antenas_parabolicas as r10s74, - e.copiadoras as r10s75, - e.retroprojetores as r10s76, - e.impressoras as r10s77, - e.aparelhos_de_som as r10s78, - e.projetores_digitais as r10s79, - e.faxs as r10s80, - e.maquinas_fotograficas as r10s81, - e.computadores as r10s82, - e.impressoras_multifuncionais as r10s83, - e.computadores_administrativo as r10s84, - e.computadores_alunos as r10s85, - e.acesso_internet as r10s86, - - total_funcionario as r10s88, - 1 as r10s89, - atendimento_aee as r10s90, - atividade_complementar as r10s91, + e.condicao AS r10s12, + e.codigo_inep_escola_compartilhada AS r10s14, + e.codigo_inep_escola_compartilhada2 AS r10s15, + e.codigo_inep_escola_compartilhada3 AS r10s16, + e.codigo_inep_escola_compartilhada4 AS r10s17, + e.codigo_inep_escola_compartilhada5 AS r10s18, + e.codigo_inep_escola_compartilhada6 AS r10s19, + e.agua_consumida AS r10s20, + (ARRAY[1] <@ e.abastecimento_agua)::INT AS r10s21, + (ARRAY[2] <@ e.abastecimento_agua)::INT AS r10s22, + (ARRAY[3] <@ e.abastecimento_agua)::INT AS r10s23, + (ARRAY[4] <@ e.abastecimento_agua)::INT AS r10s24, + (ARRAY[5] <@ e.abastecimento_agua)::INT AS r10s25, + (ARRAY[1] <@ e.abastecimento_energia)::INT AS r10s26, + (ARRAY[2] <@ e.abastecimento_energia)::INT AS r10s27, + (ARRAY[3] <@ e.abastecimento_energia)::INT AS r10s28, + (ARRAY[4] <@ e.abastecimento_energia)::INT AS r10s29, + (ARRAY[1] <@ e.esgoto_sanitario)::INT AS r10s30, + (ARRAY[2] <@ e.esgoto_sanitario)::INT AS r10s31, + (ARRAY[3] <@ e.esgoto_sanitario)::INT AS r10s32, + (ARRAY[1] <@ e.destinacao_lixo)::INT AS r10s33, + (ARRAY[2] <@ e.destinacao_lixo)::INT AS r10s34, + (ARRAY[3] <@ e.destinacao_lixo)::INT AS r10s35, + (ARRAY[4] <@ e.destinacao_lixo)::INT AS r10s36, + (ARRAY[5] <@ e.destinacao_lixo)::INT AS r10s37, + (ARRAY[6] <@ e.destinacao_lixo)::INT AS r10s38, + e.dependencia_sala_diretoria AS r10s39, + e.dependencia_sala_professores AS r10s40, + e.dependencia_sala_secretaria AS r10s41, + e.dependencia_laboratorio_informatica AS r10s42, + e.dependencia_laboratorio_ciencias AS r10s43, + e.dependencia_sala_aee AS r10s44, + e.dependencia_quadra_coberta AS r10s45, + e.dependencia_quadra_descoberta AS r10s46, + e.dependencia_cozinha AS r10s47, + e.dependencia_biblioteca AS r10s48, + e.dependencia_sala_leitura AS r10s49, + e.dependencia_parque_infantil AS r10s50, + e.dependencia_bercario AS r10s51, + e.dependencia_banheiro_fora AS r10s52, + e.dependencia_banheiro_dentro AS r10s53, + e.dependencia_banheiro_infantil AS r10s54, + e.dependencia_banheiro_deficiente AS r10s55, + e.dependencia_vias_deficiente AS r10s56, + e.dependencia_banheiro_chuveiro AS r10s57, + e.dependencia_refeitorio AS r10s58, + e.dependencia_dispensa AS r10s59, + e.dependencia_aumoxarifado AS r10s60, + e.dependencia_auditorio AS r10s61, + e.dependencia_patio_coberto AS r10s62, + e.dependencia_patio_descoberto AS r10s63, + e.dependencia_alojamento_aluno AS r10s64, + e.dependencia_alojamento_professor AS r10s65, + e.dependencia_area_verde AS r10s66, + e.dependencia_lavanderia AS r10s67, + e.dependencia_nenhuma_relacionada AS r10s68, + e.dependencia_numero_salas_existente AS r10s69, + e.dependencia_numero_salas_utilizadas AS r10s70, + + e.televisoes AS r10s71, + e.videocassetes AS r10s72, + e.dvds AS r10s73, + e.antenas_parabolicas AS r10s74, + e.copiadoras AS r10s75, + e.retroprojetores AS r10s76, + e.impressoras AS r10s77, + e.aparelhos_de_som AS r10s78, + e.projetores_digitais AS r10s79, + e.faxs AS r10s80, + e.maquinas_fotograficas AS r10s81, + e.computadores AS r10s82, + e.impressoras_multifuncionais AS r10s83, + e.computadores_administrativo AS r10s84, + e.computadores_alunos AS r10s85, + e.acesso_internet AS r10s86, + + total_funcionario AS r10s88, + 1 AS r10s89, + atendimento_aee AS r10s90, + atividade_complementar AS r10s91, (SELECT 1 FROM pmieducar.curso @@ -525,7 +516,7 @@ protected function exportaDadosRegistro10($escolaId, $ano){ WHERE escola_curso.ref_cod_escola = e.cod_escola AND curso.modalidade_curso = 1 LIMIT 1 - ) as r10s92, + ) AS r10s92, (SELECT 1 FROM pmieducar.curso @@ -533,7 +524,7 @@ protected function exportaDadosRegistro10($escolaId, $ano){ WHERE escola_curso.ref_cod_escola = e.cod_escola AND curso.modalidade_curso = 2 LIMIT 1 - ) as r10s93, + ) AS r10s93, (SELECT 1 FROM pmieducar.curso @@ -541,7 +532,7 @@ protected function exportaDadosRegistro10($escolaId, $ano){ WHERE escola_curso.ref_cod_escola = e.cod_escola AND curso.modalidade_curso = 3 LIMIT 1 - ) as r10s94, + ) AS r10s94, (SELECT 1 FROM pmieducar.curso @@ -549,26 +540,26 @@ protected function exportaDadosRegistro10($escolaId, $ano){ WHERE escola_curso.ref_cod_escola = e.cod_escola AND curso.modalidade_curso = 4 LIMIT 1 - ) as r10s95, + ) AS r10s95, - fundamental_ciclo as r10s96, - localizacao_diferenciada as r10s97, + fundamental_ciclo AS r10s96, + localizacao_diferenciada AS r10s97, CASE WHEN materiais_didaticos_especificos = 1 THEN 1 ELSE 0 - END as r10s98, + END AS r10s98, CASE WHEN materiais_didaticos_especificos = 2 THEN 1 ELSE 0 - END as r10s99, + END AS r10s99, CASE WHEN materiais_didaticos_especificos = 3 THEN 1 ELSE 0 - END as r10s100, - educacao_indigena as r10s101, + END AS r10s100, + educacao_indigena AS r10s101, CASE WHEN lingua_ministrada = 1 THEN 1 ELSE 0 END AS r10s102, CASE WHEN lingua_ministrada = 2 THEN 1 ELSE 0 END AS r10s103, - codigo_lingua_indigena as r10s104, - espaco_brasil_aprendizado as r10s105, - abre_final_semana as r10s106, - proposta_pedagogica as r10s107, + codigo_lingua_indigena AS r10s104, + espaco_brasil_aprendizado AS r10s105, + abre_final_semana AS r10s106, + proposta_pedagogica AS r10s107, (SELECT 1 FROM pmieducar.turma @@ -585,138 +576,145 @@ protected function exportaDadosRegistro10($escolaId, $ano){ WHERE e.cod_escola = $1 '; - $exclusivamente = 2; + $exclusivamente = 2; - extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array('return_only' => 'first-row', 'params' => array($escolaId, $ano)))); - if($r10s1){ - $d = '|'; - $return = ''; + extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('return_only' => 'first-row', 'params' => array($escolaId, $ano)))); + if ($r10s1) { + $d = '|'; + $return = ''; - for($i = 3; $i <=11; $i++){ - if ($local_funcionamento == $i) - ${'r10s'.$i} = 1; - else - ${'r10s'.$i} = 0; - } + for ($i = 3; $i <= 11; $i++) { + if ($local_funcionamento == $i) { + ${'r10s' . $i} = 1; + } else { + ${'r10s' . $i} = 0; + } + } - $existeEscolaCompartilhada = false; - for ($i=14; $i <= 19 ; $i++){ - if (${'r10s'.$i} != null && !$existeEscolaCompartilhada){ - $existeEscolaCompartilhada = true; - } - } + $existeEscolaCompartilhada = false; + for ($i = 14; $i <= 19; $i++) { + if (${'r10s' . $i} != null && !$existeEscolaCompartilhada) { + $existeEscolaCompartilhada = true; + } + } + + if ($existeEscolaCompartilhada) { + $r10s13 = 1; + } else { + $r10s13 = 0; + } + + if ($r10s3 == 0) { + $r10s13 = null; + } + + if ($r10s3 <> 1 && $r10s8 <> 1) { + $r10s12 = null; + } + + if ($r10s3 == 1) { + if (is_null($r10s12)) { + $this->msg .= "Dados para formular o registro 10 campo 12 da escola {$escolaId} com problemas. Obrigatório quando o campo 3 for igual a 1
"; + $this->error = true; + } + } + + if ($r10s25 == 1) { + $r10s21 = $r10s22 = $r10s23 = $r10s24 = 0; + } + + if ($r10s29 == 1) { + $r10s26 = $r10s27 = $r10s28 = 0; + } + + if ($r10s32 == 1) { + $r10s30 = $r10s31 = 0; + } + + if (!$r10s82) { + $r10s86 = null; + } + + $r10s87 = $r10s86 == 1 ? 1 : null; - if($existeEscolaCompartilhada){ - $r10s13 = 1; - }else - $r10s13 = 0; + $r10s96 = $etapa_ensino_fundamental ? $r10s96 : null; - if($r10s3 == 0) - $r10s13 = NULL; + if ($r10s90 == $exclusivamente || $r10s91 == $exclusivamente) { + $r10s92 = $r10s93 = $r10s94 = $r10s95 = ''; + } else { + $r10s92 = ($r10s92 ? $r10s92 : 0); + $r10s93 = ($r10s93 ? $r10s93 : 0); + $r10s94 = ($r10s94 ? $r10s94 : 0); + $r10s95 = ($r10s95 ? $r10s95 : 0); + } + + $r10s98 = 1; + $r10s99 = $r10s100 = 0; - if($r10s3 <> 1 && $r10s8 <> 1) - $r10s12 = NULL; + if (!$r10s101) { + $r10s102 = $r10s103 = $r10s104 = null; + } + + for ($i = 1; $i <= 107; $i++) { + if ($i >= 71 && $i <= 85) { + $return .= (${'r10s' . $i} == 0 ? '' : ${'r10s' . $i}) . $d; + } else { + $return .= ${'r10s' . $i} . $d; + } + } + $return = substr_replace($return, "", -1); - if($r10s3 == 1){ - if(is_null($r10s12)){ - $this->msg .= "Dados para formular o registro 10 campo 12 da escola {$escolaId} com problemas. Obrigatório quando o campo 3 for igual a 1
"; - $this->error = true; + return $return . "\n"; + } else { + $this->msg .= "Dados para formular o registro 10 da escola {$escolaId} não encontrados. Verifique se a escola possuí código do INEP cadastrado.
"; + $this->error = true; } - } - - if($r10s25 == 1){ - $r10s21 = $r10s22 = $r10s23 = $r10s24 = 0; - } - - if($r10s29 == 1){ - $r10s26 = $r10s27 = $r10s28 = 0; - } - - if($r10s32 == 1){ - $r10s30 = $r10s31 = 0; - } - - if (!$r10s82) { - $r10s86 = NULL; - } - - $r10s87 = $r10s86 == 1 ? 1 : null; - - $r10s96 = $etapa_ensino_fundamental ? $r10s96 : NULL; - - if ($r10s90 == $exclusivamente || $r10s91 == $exclusivamente) { - $r10s92 = $r10s93 = $r10s94 = $r10s95 = ''; - } else { - $r10s92 = ($r10s92 ? $r10s92 : 0); - $r10s93 = ($r10s93 ? $r10s93 : 0); - $r10s94 = ($r10s94 ? $r10s94 : 0); - $r10s95 = ($r10s95 ? $r10s95 : 0); - } - - $r10s98 = 1; - $r10s99 = $r10s100 = 0; - - if(!$r10s101){ - $r10s102 = $r10s103 = $r10s104 = NULL; - } - - for ($i=1; $i <= 107 ; $i++){ - if($i>=71 && $i<=85) - $return .= (${'r10s'.$i} == 0 ? '' : ${'r10s'.$i}).$d; - else - $return .= ${'r10s'.$i}.$d; - } - $return = substr_replace($return, "", -1); - - return $return."\n"; - }else{ - $this->msg .= "Dados para formular o registro 10 da escola {$escolaId} não encontrados. Verifique se a escola possuí código do INEP cadastrado.
"; - $this->error = true; } - } - - protected function exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_fim){ - $sql = - ' SELECT - \'20\' as r20s1, - ece.cod_escola_inep as r20s2, - t.cod_turma as r20s4, - t.nm_turma as r20s5, - 1 as r20s6, - substring(t.hora_inicial::varchar,1,2) as r20s7, - substring(t.hora_inicial::varchar,4,2) as r20s8, - substring(t.hora_final::varchar,1,2) as r20s9, - substring(t.hora_final::varchar,4,2) as r20s10, - (ARRAY[1] <@ t.dias_semana)::int as r20s11, - (ARRAY[2] <@ t.dias_semana)::int as r20s12, - (ARRAY[3] <@ t.dias_semana)::int as r20s13, - (ARRAY[4] <@ t.dias_semana)::int as r20s14, - (ARRAY[5] <@ t.dias_semana)::int as r20s15, - (ARRAY[6] <@ t.dias_semana)::int as r20s16, - (ARRAY[7] <@ t.dias_semana)::int as r20s17, - t.tipo_atendimento as r20s18, - t.turma_mais_educacao as r20s19, - t.atividades_complementares[1] as r20s20, - t.atividades_complementares[2] as r20s21, - t.atividades_complementares[3] as r20s22, - t.atividades_complementares[4] as r20s23, - t.atividades_complementares[5] as r20s24, - t.atividades_complementares[6] as r20s25, - (ARRAY[1] <@ t.atividades_aee)::int as r20s26, - (ARRAY[2] <@ t.atividades_aee)::int as r20s27, - (ARRAY[3] <@ t.atividades_aee)::int as r20s28, - (ARRAY[4] <@ t.atividades_aee)::int as r20s29, - (ARRAY[5] <@ t.atividades_aee)::int as r20s30, - (ARRAY[6] <@ t.atividades_aee)::int as r20s31, - (ARRAY[7] <@ t.atividades_aee)::int as r20s32, - (ARRAY[8] <@ t.atividades_aee)::int as r20s33, - (ARRAY[9] <@ t.atividades_aee)::int as r20s34, - (ARRAY[10] <@ t.atividades_aee)::int as r20s35, - (ARRAY[11] <@ t.atividades_aee)::int as r20s36, - c.modalidade_curso as r20s37, - t.etapa_educacenso as r20s38, - t.cod_curso_profissional as r20s39, - s.cod_serie as serieId, + + protected function exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_fim) + { + $sql = + ' SELECT + \'20\' AS r20s1, + ece.cod_escola_inep AS r20s2, + t.cod_turma AS r20s4, + t.nm_turma AS r20s5, + 1 AS r20s6, + substring(t.hora_inicial::VARCHAR,1,2) AS r20s7, + substring(t.hora_inicial::VARCHAR,4,2) AS r20s8, + substring(t.hora_final::VARCHAR,1,2) AS r20s9, + substring(t.hora_final::VARCHAR,4,2) AS r20s10, + (ARRAY[1] <@ t.dias_semana)::INT AS r20s11, + (ARRAY[2] <@ t.dias_semana)::INT AS r20s12, + (ARRAY[3] <@ t.dias_semana)::INT AS r20s13, + (ARRAY[4] <@ t.dias_semana)::INT AS r20s14, + (ARRAY[5] <@ t.dias_semana)::INT AS r20s15, + (ARRAY[6] <@ t.dias_semana)::INT AS r20s16, + (ARRAY[7] <@ t.dias_semana)::INT AS r20s17, + t.tipo_atendimento AS r20s18, + t.turma_mais_educacao AS r20s19, + t.atividades_complementares[1] AS r20s20, + t.atividades_complementares[2] AS r20s21, + t.atividades_complementares[3] AS r20s22, + t.atividades_complementares[4] AS r20s23, + t.atividades_complementares[5] AS r20s24, + t.atividades_complementares[6] AS r20s25, + (ARRAY[1] <@ t.atividades_aee)::INT AS r20s26, + (ARRAY[2] <@ t.atividades_aee)::INT AS r20s27, + (ARRAY[3] <@ t.atividades_aee)::INT AS r20s28, + (ARRAY[4] <@ t.atividades_aee)::INT AS r20s29, + (ARRAY[5] <@ t.atividades_aee)::INT AS r20s30, + (ARRAY[6] <@ t.atividades_aee)::INT AS r20s31, + (ARRAY[7] <@ t.atividades_aee)::INT AS r20s32, + (ARRAY[8] <@ t.atividades_aee)::INT AS r20s33, + (ARRAY[9] <@ t.atividades_aee)::INT AS r20s34, + (ARRAY[10] <@ t.atividades_aee)::INT AS r20s35, + (ARRAY[11] <@ t.atividades_aee)::INT AS r20s36, + c.modalidade_curso AS r20s37, + t.etapa_educacenso AS r20s38, + t.cod_curso_profissional AS r20s39, + s.cod_serie AS serieId, e.dependencia_administrativa FROM pmieducar.turma t @@ -736,68 +734,95 @@ protected function exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_ AND COALESCE(m.data_matricula,m.data_cadastro) BETWEEN DATE($2) AND DATE($3) LIMIT 1) IS NOT NULL'; - // Transforma todos resultados em variáveis - extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array('return_only' => 'first-row', 'params' => array($turmaId, $data_ini, $data_fim)))); - if ($r20s1){ - - $r20s5 = $this->convertStringToCenso($r20s5); - - //Dias da semana não podem ser nullos, 1 ou 0 - for($i = 11; $i <18; $i++) - ${'r20s'.$i} = (${'r20s'.$i} ? '1' : '0'); - - // Atribui 0 (Não lecionado) para todas as disciplinas por padrão. - $r20s40 = $r20s41 = $r20s42 = $r20s43 = $r20s44 = $r20s45 = $r20s46 = $r20s47 = $r20s48 = $r20s49 = - $r20s50 = $r20s51 = $r20s52 = $r20s53 = $r20s54 = $r20s55 = $r20s56 = $r20s57 = $r20s58 = $r20s59 = $r20s60 = - $r20s61 = $r20s62 = $r20s63 = $r20s64 = $r20s65 = 0; - - // Se a turma não presta atendimento educacional especializado AEE esses campos precisam ser nulos - if ($r20s18 != 5) - $r20s26 = $r20s27 = $r20s28 = $r20s29 = $r20s30 = $r20s31 = $r20s32 = $r20s33 = $r20s34 = $r20s35 = $r20s36 = NULL; - - if (!in_array($dependencia_administrativa, array(2,3))){ - $r20s19 = NULL; - } - - if (in_array($r20s18, array(1,5))){ - $r20s19 = NULL; - } - - if (($r20s37 == 3) || !(($r20s38 >= 4 && $r20s38 <= 38) || $r20s38 == 41)) { - $r20s19 = NULL; - } - - $coddigoEducacensoToSeq = - array( 1 => '40', 2 => '41', 3 => '42', 4 => '43', 5 => '44', 6 => '45', 7 => '46', - 8 => '47', 30 => '48', 9 => '49', 10 => '50', 11 => '51', 12 => '52', 13 => '53', - 14 => '54', 28 => '55', 29 => '56', 16 => '57', 17 => '58', 20 => '59', 21 => '60', - 23 => '61', 25 => '62', 26 => '63', 27 => '64', 99 => '65'); - try{ - $componentesTurma = App_Model_IedFinder::getComponentesTurma($serieid, $escolaId, $turmaId); - }catch(Exception $e){ - $componentesTurma = array(); - } - - foreach($componentesTurma as $componente){ - // Só serão consideradas disciplinas tipificadas com o código do Educacenso - if($componente->codigo_educacenso){ - // Pega o código educacenso - $codigoEducacenso = ComponenteCurricular_Model_CodigoEducacenso::getInstance(); - $codigoEducacenso = $codigoEducacenso->getKey($componente->codigo_educacenso); - - // Código da disciplina no i-Educar - $codigoSistema = $componente->id; - - // Verifica se é disciplina padrão ano letivo. Se for, será considerado que existe professor - // vinculado a disciplina na sala de aula - - $professorVinculado = (bool)Portabilis_Utils_Database::selectField - ('SELECT 1 - from modules.professor_turma - inner join modules.professor_turma_disciplina on(professor_turma_disciplina.professor_turma_id = professor_turma.id) - where professor_turma.turma_id = $1 - and professor_turma_disciplina.componente_curricular_id = $2 - and (SELECT 1 + // Transforma todos resultados em variáveis + extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('return_only' => 'first-row', 'params' => array($turmaId, $data_ini, $data_fim)))); + if ($r20s1) { + + $r20s5 = $this->convertStringToCenso($r20s5); + + //Dias da semana não podem ser nullos, 1 ou 0 + for ($i = 11; $i < 18; $i++) { + ${'r20s' . $i} = (${'r20s' . $i} ? '1' : '0'); + } + + // Atribui 0 (Não lecionado) para todas as disciplinas por padrão. + $r20s40 = $r20s41 = $r20s42 = $r20s43 = $r20s44 = $r20s45 = $r20s46 = $r20s47 = $r20s48 = $r20s49 = + $r20s50 = $r20s51 = $r20s52 = $r20s53 = $r20s54 = $r20s55 = $r20s56 = $r20s57 = $r20s58 = $r20s59 = $r20s60 = + $r20s61 = $r20s62 = $r20s63 = $r20s64 = $r20s65 = 0; + + // Se a turma não presta atendimento educacional especializado AEE esses campos precisam ser nulos + if ($r20s18 != 5) { + $r20s26 = $r20s27 = $r20s28 = $r20s29 = $r20s30 = $r20s31 = $r20s32 = $r20s33 = $r20s34 = $r20s35 = $r20s36 = null; + } + + if (!in_array($dependencia_administrativa, array(2, 3))) { + $r20s19 = null; + } + + if (in_array($r20s18, array(1, 5))) { + $r20s19 = null; + } + + if (($r20s37 == 3) || !(($r20s38 >= 4 && $r20s38 <= 38) || $r20s38 == 41)) { + $r20s19 = null; + } + + $coddigoEducacensoToSeq = + array( + 1 => '40', + 2 => '41', + 3 => '42', + 4 => '43', + 5 => '44', + 6 => '45', + 7 => '46', + 8 => '47', + 30 => '48', + 9 => '49', + 10 => '50', + 11 => '51', + 12 => '52', + 13 => '53', + 14 => '54', + 28 => '55', + 29 => '56', + 16 => '57', + 17 => '58', + 20 => '59', + 21 => '60', + 23 => '61', + 25 => '62', + 26 => '63', + 27 => '64', + 99 => '65' + ); + try { + $componentesTurma = App_Model_IedFinder::getComponentesTurma($serieid, $escolaId, $turmaId); + } catch (Exception $e) { + $componentesTurma = array(); + } + + foreach ($componentesTurma as $componente) { + // Só serão consideradas disciplinas tipificadas com o código do Educacenso + if ($componente->codigo_educacenso) { + // Pega o código educacenso + $codigoEducacenso = ComponenteCurricular_Model_CodigoEducacenso::getInstance(); + $codigoEducacenso = $codigoEducacenso->getKey($componente->codigo_educacenso); + + // Código da disciplina no i-Educar + $codigoSistema = $componente->id; + + // Verifica se é disciplina padrão ano letivo. Se for, será considerado que existe professor + // vinculado a disciplina na sala de aula + + $professorVinculado = (bool)Portabilis_Utils_Database::selectField + ('SELECT 1 + FROM modules.professor_turma + INNER JOIN modules.professor_turma_disciplina ON(professor_turma_disciplina.professor_turma_id = professor_turma.id) + WHERE professor_turma.turma_id = $1 + AND professor_turma_disciplina.componente_curricular_id = $2 + AND (SELECT 1 FROM pmieducar.matricula_turma mt INNER JOIN pmieducar.matricula m ON(mt.ref_cod_matricula = m.cod_matricula) WHERE mt.ref_cod_turma = professor_turma.turma_id @@ -805,78 +830,82 @@ protected function exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_ AND COALESCE(m.data_matricula,m.data_cadastro) BETWEEN DATE($3) AND DATE($4) LIMIT 1) IS NOT NULL ', - array('params' => array($turmaId, $codigoSistema, $data_ini, $data_fim))); + array('params' => array($turmaId, $codigoSistema, $data_ini, $data_fim))); + + if (array_key_exists($codigoEducacenso, $coddigoEducacensoToSeq)) { + if (${'r20s' . $coddigoEducacensoToSeq[$codigoEducacenso]} == 1) { + continue; + } elseif (${'r20s' . $coddigoEducacensoToSeq[$codigoEducacenso]} == 2) { + if (!$professorVinculado) { + continue; + } + } + ${'r20s' . $coddigoEducacensoToSeq[$codigoEducacenso]} = ($professorVinculado ? 1 : 2); + } + } - if (array_key_exists($codigoEducacenso, $coddigoEducacensoToSeq)){ - if(${ 'r20s'. $coddigoEducacensoToSeq[$codigoEducacenso]} == 1){ - continue; - }elseif(${ 'r20s'. $coddigoEducacensoToSeq[$codigoEducacenso]} == 2){ - if(!$professorVinculado){ - continue; - } - } - ${ 'r20s'. $coddigoEducacensoToSeq[$codigoEducacenso]} = ($professorVinculado ? 1 : 2); } - } - } - - $atividadeComplementar = 4; - $atendimentoEducEspecializado = 5; - - $educInfantilCreche = 1; - $educInfantilPreEscola = 2; - $educInfantilUnificada = 3; - $ejaEnsinoFundamental = 65; - - //Percorre todos os campos de disciplinas - for ($i=40; $i < 66; $i++) { - if ($r20s18 == $atividadeComplementar || $r20s18 == $atendimentoEducEspecializado){ - ${'r20s'. $i} = ''; - } else if ($r20s38 == $educInfantilCreche || - $r20s38 == $educInfantilPreEscola || - $r20s38 == $educInfantilUnificada || - $r20s38 == $ejaEnsinoFundamental){ - ${'r20s'. $i} = ''; - } - } + $atividadeComplementar = 4; + $atendimentoEducEspecializado = 5; + + $educInfantilCreche = 1; + $educInfantilPreEscola = 2; + $educInfantilUnificada = 3; + $ejaEnsinoFundamental = 65; + + //Percorre todos os campos de disciplinas + for ($i = 40; $i < 66; $i++) { + if ($r20s18 == $atividadeComplementar || $r20s18 == $atendimentoEducEspecializado) { + ${'r20s' . $i} = ''; + } else { + if ($r20s38 == $educInfantilCreche || + $r20s38 == $educInfantilPreEscola || + $r20s38 == $educInfantilUnificada || + $r20s38 == $ejaEnsinoFundamental) { + ${'r20s' . $i} = ''; + } + } + } - if ($r20s18 == $atividadeComplementar || $r20s18 == $atendimentoEducEspecializado){ - $r20s37 = $r20s38 = ''; - } + if ($r20s18 == $atividadeComplementar || $r20s18 == $atendimentoEducEspecializado) { + $r20s37 = $r20s38 = ''; + } - $this->turma_presencial_ou_semi = $r20s6; - $d = '|'; - $return = ''; + $this->turma_presencial_ou_semi = $r20s6; + $d = '|'; + $return = ''; - for ($i=1; $i <= 65 ; $i++) - $return .= ${'r20s'.$i}.$d; + for ($i = 1; $i <= 65; $i++) { + $return .= ${'r20s' . $i} . $d; + } - $return = substr_replace($return, "", -1); + $return = substr_replace($return, "", -1); - return $return."\n"; + return $return . "\n"; + } } - } - - protected function exportaDadosRegistro30($servidorId, $escolaId){ - $sql = - ' SELECT - \'30\' as r30s1, - ece.cod_escola_inep as r30s2, - ecd.cod_docente_inep as r30s3, - s.cod_servidor as r30s4, - p.nome as r30s5, - p.email as r30s6, - null as r30s7, - fis.data_nasc as r30s8, - fis.sexo as r30s9, - r.raca_educacenso as r30s10, - (SELECT nome FROM cadastro.pessoa WHERE pessoa.idpes = fis.idpes_mae) as r30s12, - (SELECT nome FROM cadastro.pessoa WHERE pessoa.idpes = fis.idpes_pai) as r30s13, - coalesce(fis.nacionalidade,1) as r30s14, - (SELECT cod_ibge FROM public.pais WHERE pais.idpais = fis.idpais_estrangeiro) as r30s15, - uf.cod_ibge as r30s16, - m.cod_ibge as r30s17 + + protected function exportaDadosRegistro30($servidorId, $escolaId) + { + $sql = + ' SELECT + \'30\' AS r30s1, + ece.cod_escola_inep AS r30s2, + ecd.cod_docente_inep AS r30s3, + s.cod_servidor AS r30s4, + p.nome AS r30s5, + p.email AS r30s6, + NULL AS r30s7, + fis.data_nasc AS r30s8, + fis.sexo AS r30s9, + r.raca_educacenso AS r30s10, + (SELECT nome FROM cadastro.pessoa WHERE pessoa.idpes = fis.idpes_mae) AS r30s12, + (SELECT nome FROM cadastro.pessoa WHERE pessoa.idpes = fis.idpes_pai) AS r30s13, + coalesce(fis.nacionalidade,1) AS r30s14, + (SELECT cod_ibge FROM public.pais WHERE pais.idpais = fis.idpais_estrangeiro) AS r30s15, + uf.cod_ibge AS r30s16, + m.cod_ibge AS r30s17 FROM pmieducar.servidor s @@ -899,100 +928,107 @@ protected function exportaDadosRegistro30($servidorId, $escolaId){ LIMIT 1 '; - // Transforma todos resultados em variáveis - extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array('return_only' => 'first-row', 'params' => array($servidorId, $escolaId)))); - if ($r30s1){ - $r30s5 = $this->convertStringToCenso($r30s5); - $r30s6 = strtoupper($r30s6); - $r30s8 = Portabilis_Date_Utils::pgSQLToBr($r30s8); - $r30s9 = $r30s9 == 'M' ? 1 : 2; - $r30s10 = is_numeric($r30s10) ? $r30s10 : 0; - - $r30s11 = ($r30s12 || $r30s13) ? 1 : 0; - - $r30s12 = $this->convertStringToAlpha($r30s12); - $r30s13 = $this->convertStringToAlpha($r30s13); + // Transforma todos resultados em variáveis + extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('return_only' => 'first-row', 'params' => array($servidorId, $escolaId)))); + if ($r30s1) { + $r30s5 = $this->convertStringToCenso($r30s5); + $r30s6 = strtoupper($r30s6); + $r30s8 = Portabilis_Date_Utils::pgSQLToBr($r30s8); + $r30s9 = $r30s9 == 'M' ? 1 : 2; + $r30s10 = is_numeric($r30s10) ? $r30s10 : 0; + + $r30s11 = ($r30s12 || $r30s13) ? 1 : 0; + + $r30s12 = $this->convertStringToAlpha($r30s12); + $r30s13 = $this->convertStringToAlpha($r30s13); + + if ($r30s14 != '1') { + $r30s16 = $r30s17 = null; + } - if($r30s14 != '1') { - $r30s16 = $r30s17 = NULL; - } + if ($r30s14 == '1' || $r30s14 == '2') { + $r30s15 = 76; + } - if($r30s14 == '1' || $r30s14 == '2') - $r30s15 = 76; + if ($r30s14 == "1") { + if (is_null($r30s16) || is_null($r30s17)) { + $this->msg .= "Dados para formular o registro 30 da escola {$escolaId} não encontrados. Verifique se os municípios e UFs dos servidores brasileiros possuem código INEP cadastrados.
"; + $this->error = true; + } + } - if($r30s14 == "1"){ - if(is_null($r30s16) || is_null($r30s17)){ - $this->msg .= "Dados para formular o registro 30 da escola {$escolaId} não encontrados. Verifique se os municípios e UFs dos servidores brasileiros possuem código INEP cadastrados.
"; - $this->error = true; - } - } - - $sql = 'select distinct(deficiencia_educacenso) as id from cadastro.fisica_deficiencia, - cadastro.deficiencia where cod_deficiencia = ref_cod_deficiencia and ref_idpes = $1 - and deficiencia_educacenso is not null'; - - $deficiencias = Portabilis_Utils_Database::fetchPreparedQuery($sql, array( 'params' => array($r30s4))); - - $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = 0; - - $deficienciaToSeq = array( 1 => '19', - 2 => '20', - 3 => '21', - 4 => '22', - 5 => '23', - 6 => '24', - 7 => '25' ); - $r30s18 = 0; - - $arrayDeficienciasProfessor = []; - foreach ($deficiencias as $deficiencia_educacenso) { - $deficiencia_educacenso = $deficiencia_educacenso['id']; - if (array_key_exists($deficiencia_educacenso, $deficienciaToSeq)){ - ${ 'r30s'. $deficienciaToSeq[$deficiencia_educacenso] } = 1; - $r30s18 = 1; - } + $sql = 'SELECT DISTINCT(deficiencia_educacenso) AS id FROM cadastro.fisica_deficiencia, + cadastro.deficiencia WHERE cod_deficiencia = ref_cod_deficiencia AND ref_idpes = $1 + AND deficiencia_educacenso IS NOT NULL'; + + $deficiencias = Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($r30s4))); + + $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = 0; + + $deficienciaToSeq = array( + 1 => '19', + 2 => '20', + 3 => '21', + 4 => '22', + 5 => '23', + 6 => '24', + 7 => '25' + ); + $r30s18 = 0; + + $arrayDeficienciasProfessor = []; + foreach ($deficiencias as $deficiencia_educacenso) { + $deficiencia_educacenso = $deficiencia_educacenso['id']; + if (array_key_exists($deficiencia_educacenso, $deficienciaToSeq)) { + ${'r30s' . $deficienciaToSeq[$deficiencia_educacenso]} = 1; + $r30s18 = 1; + } - $arrayDeficienciasProfessor[] = $deficienciaToSeq[$deficiencia_educacenso]; - } + $arrayDeficienciasProfessor[] = $deficienciaToSeq[$deficiencia_educacenso]; + } - $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaProfessor()); - $r60s26 = (int) $validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasProfessor); + $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaProfessor()); + $r60s26 = (int)$validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasProfessor); - if($r30s18 == 0) - $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = $r30s26 = NULL; + if ($r30s18 == 0) { + $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = $r30s26 = null; + } - $r30s7 = null; + $r30s7 = null; - $d = '|'; - $return = ''; - $numeroRegistros = 26; + $d = '|'; + $return = ''; + $numeroRegistros = 26; - for ($i=1; $i <= $numeroRegistros ; $i++) - $return .= ${'r30s'.$i}.$d; + for ($i = 1; $i <= $numeroRegistros; $i++) { + $return .= ${'r30s' . $i} . $d; + } - $return = substr_replace($return, "", -1); + $return = substr_replace($return, "", -1); - return $return."\n"; + return $return . "\n"; + } } - } - - protected function exportaDadosRegistro40($servidorId, $escolaId){ - $sql = - 'SELECT - - \'40\' as r40s1, - ece.cod_escola_inep as r40s2, - ecd.cod_docente_inep as r40s3, - s.cod_servidor as r40s4, - fis.cpf as r40s5, - b.zona_localizacao as r40s6, - ep.cep as r40s7, - l.idtlog || l.nome as r40s8, - ep.numero as r40s9, - ep.complemento as r40s10, - b.nome as r40s11, - uf.cod_ibge as r40s12, - m.cod_ibge as r40s13 + + protected function exportaDadosRegistro40($servidorId, $escolaId) + { + $sql = + 'SELECT + + \'40\' AS r40s1, + ece.cod_escola_inep AS r40s2, + ecd.cod_docente_inep AS r40s3, + s.cod_servidor AS r40s4, + fis.cpf AS r40s5, + b.zona_localizacao AS r40s6, + ep.cep AS r40s7, + l.idtlog || l.nome AS r40s8, + ep.numero AS r40s9, + ep.complemento AS r40s10, + b.nome AS r40s11, + uf.cod_ibge AS r40s12, + m.cod_ibge AS r40s13 FROM pmieducar.servidor s INNER JOIN cadastro.fisica fis ON (fis.idpes = s.cod_servidor) @@ -1019,28 +1055,30 @@ protected function exportaDadosRegistro40($servidorId, $escolaId){ LIMIT 1 '; - // Transforma todos resultados em variáveis - extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array('return_only' => 'first-row', 'params' => array($servidorId, $escolaId)))); - if ($r40s1){ - $r40s5 = $this->cpfToCenso($r40s5); + // Transforma todos resultados em variáveis + extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('return_only' => 'first-row', 'params' => array($servidorId, $escolaId)))); + if ($r40s1) { + $r40s5 = $this->cpfToCenso($r40s5); - $r40s8 = $this->convertStringToCenso($r40s8); - $r40s9 = $this->convertStringToCenso($r40s9); - $r40s10 = $this->convertStringToCenso($r40s10); - $r40s11 = $this->convertStringToCenso($r40s11); + $r40s8 = $this->convertStringToCenso($r40s8); + $r40s9 = $this->convertStringToCenso($r40s9); + $r40s10 = $this->convertStringToCenso($r40s10); + $r40s11 = $this->convertStringToCenso($r40s11); - $d = '|'; - $return = ''; - $numeroRegistros = 13; + $d = '|'; + $return = ''; + $numeroRegistros = 13; - for ($i=1; $i <= $numeroRegistros ; $i++) - $return .= ${'r40s'.$i}.$d; + for ($i = 1; $i <= $numeroRegistros; $i++) { + $return .= ${'r40s' . $i} . $d; + } - $return = substr_replace($return, "", -1); + $return = substr_replace($return, "", -1); - return $return."\n"; + return $return . "\n"; + } } - } protected function exportaDadosRegistro50($servidorId, $escolaId) { @@ -1130,7 +1168,8 @@ protected function exportaDadosRegistro50($servidorId, $escolaId) $return = ''; $numeroRegistros = 43; - if ($this->isCursoSuperiorBachareladoOuTecnologoCompleto($grau_academico_curso_superior_1, $situacao_curso_superior_1)) { + if ($this->isCursoSuperiorBachareladoOuTecnologoCompleto($grau_academico_curso_superior_1, + $situacao_curso_superior_1)) { if (is_null($r50s7)) { $this->msg .= "Dados para formular o registro 50 do servidor {$servidorId} com problemas. O registro 7 é obrigatório para cursos do tipo BACHARELADO ou TECNOLOGO.
"; $this->error = true; @@ -1139,7 +1178,8 @@ protected function exportaDadosRegistro50($servidorId, $escolaId) $r50s7 = null; } - if ($this->isCursoSuperiorBachareladoOuTecnologoCompleto($grau_academico_curso_superior_2, $situacao_curso_superior_2)) { + if ($this->isCursoSuperiorBachareladoOuTecnologoCompleto($grau_academico_curso_superior_2, + $situacao_curso_superior_2)) { if (is_null($r50s13)) { $this->msg .= "Dados para formular o registro 50 do servidor {$servidorId} com problemas. O registro 14 é obrigatório para cursos do tipo BACHARELADO ou TECNOLOGO.
"; $this->error = true; @@ -1148,7 +1188,8 @@ protected function exportaDadosRegistro50($servidorId, $escolaId) $r50s13 = null; } - if ($this->isCursoSuperiorBachareladoOuTecnologoCompleto($grau_academico_curso_superior_3, $situacao_curso_superior_3)) { + if ($this->isCursoSuperiorBachareladoOuTecnologoCompleto($grau_academico_curso_superior_3, + $situacao_curso_superior_3)) { if (is_null($r50s19)) { $this->msg .= "Dados para formular o registro 50 do servidor {$servidorId} com problemas. O registro 21 é obrigatório para cursos do tipo BACHARELADO ou TECNOLOGO.
"; $this->error = true; @@ -1213,21 +1254,22 @@ protected function exportaDadosRegistro50($servidorId, $escolaId) } } - protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $data_fim, $ano){ + protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $data_fim, $ano) + { - $sql = - 'SELECT + $sql = + 'SELECT - \'51\' as r51s1, - ece.cod_escola_inep as r51s2, - ecd.cod_docente_inep as r51s3, - s.cod_servidor as r51s4, - t.cod_turma as r51s6, - pt.funcao_exercida as r51s7, - pt.tipo_vinculo as r51s8, + \'51\' AS r51s1, + ece.cod_escola_inep AS r51s2, + ecd.cod_docente_inep AS r51s3, + s.cod_servidor AS r51s4, + t.cod_turma AS r51s6, + pt.funcao_exercida AS r51s7, + pt.tipo_vinculo AS r51s8, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1236,10 +1278,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 0 LIMIT 1 - ) as r51s9, + ) AS r51s9, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1249,10 +1291,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 1 LIMIT 1 - ) as r51s10, + ) AS r51s10, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1262,10 +1304,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 2 LIMIT 1 - ) as r51s11, + ) AS r51s11, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1275,10 +1317,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 3 LIMIT 1 - ) as r51s12, + ) AS r51s12, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1288,10 +1330,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 4 LIMIT 1 - ) as r51s13, + ) AS r51s13, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1301,10 +1343,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 5 LIMIT 1 - ) as r51s14, + ) AS r51s14, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1314,10 +1356,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 6 LIMIT 1 - ) as r51s15, + ) AS r51s15, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1327,10 +1369,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 7 LIMIT 1 - ) as r51s16, + ) AS r51s16, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1340,10 +1382,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 8 LIMIT 1 - ) as r51s17, + ) AS r51s17, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1353,10 +1395,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 9 LIMIT 1 - ) as r51s18, + ) AS r51s18, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1366,10 +1408,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 10 LIMIT 1 - ) as r51s19, + ) AS r51s19, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1379,10 +1421,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 11 LIMIT 1 - ) as r51s20, + ) AS r51s20, ( - SELECT distinct(cc.codigo_educacenso) + SELECT DISTINCT(cc.codigo_educacenso) FROM modules.componente_curricular cc INNER JOIN modules.professor_turma_disciplina ptd ON (cc.id = ptd.componente_curricular_id) @@ -1392,10 +1434,10 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da ORDER BY codigo_educacenso OFFSET 12 LIMIT 1 - ) as r51s21, + ) AS r51s21, t.tipo_atendimento AS tipo_atendimento, t.etapa_educacenso AS etapa_ensino, - e.dependencia_administrativa as dependencia_administrativa + e.dependencia_administrativa AS dependencia_administrativa FROM pmieducar.servidor s @@ -1413,7 +1455,7 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da AND t.ativo = 1 AND t.visivel = TRUE AND t.ano = $5 - and (SELECT 1 + AND (SELECT 1 FROM pmieducar.matricula_turma mt INNER JOIN pmieducar.matricula m ON(mt.ref_cod_matricula = m.cod_matricula) WHERE mt.ref_cod_turma = t.cod_turma @@ -1423,86 +1465,90 @@ protected function exportaDadosRegistro51($servidorId, $escolaId, $data_ini, $da '; - // Transforma todos resultados em variáveis + // Transforma todos resultados em variáveis $d = '|'; - $return = ''; - $numeroRegistros = 21; - - $docente = 1; - $docenteTitular = 5; - $docenteTutor = 6; + $return = ''; + $numeroRegistros = 21; - $atividadeComplementar = 4; - $atendimentoEducEspecializado = 5; + $docente = 1; + $docenteTitular = 5; + $docenteTutor = 6; - $educInfantilCreche = 1; - $educInfantilPreEscola = 2; - $educInfantilUnificada = 3; - $ejaEnsinoFundamental = 65; + $atividadeComplementar = 4; + $atendimentoEducEspecializado = 5; - foreach (Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($servidorId, $escolaId, $data_ini, $data_fim, $ano))) as $reg) { - extract($reg); - for ($i=1; $i <= $numeroRegistros ; $i++) { + $educInfantilCreche = 1; + $educInfantilPreEscola = 2; + $educInfantilUnificada = 3; + $ejaEnsinoFundamental = 65; - $escolaPrivada = $dependencia_administrativa == 4; + foreach (Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('params' => array($servidorId, $escolaId, $data_ini, $data_fim, $ano))) as $reg) { + extract($reg); + for ($i = 1; $i <= $numeroRegistros; $i++) { - $funcaoDocente = ($r51s7 == $docente || $r51s7 == $docenteTutor || $r51s7 == $docenteTitular); + $escolaPrivada = $dependencia_administrativa == 4; - if (!$funcaoDocente || $escolaPrivada) $r51s8 = ''; + $funcaoDocente = ($r51s7 == $docente || $r51s7 == $docenteTutor || $r51s7 == $docenteTitular); - //Validação das disciplinas - if ($i > 8) { - $atividadeDiferenciada = ($tipo_atendimento == $atividadeComplementar || - $tipo_atendimento == $atendimentoEducEspecializado); - $etapaEnsino = ($etapa_ensino == $educInfantilCreche || - $etapa_ensino == $educInfantilPreEscola || - $etapa_ensino == $educInfantilUnificada || - $etapa_ensino == $ejaEnsinoFundamental); + if (!$funcaoDocente || $escolaPrivada) { + $r51s8 = ''; + } - if (!$funcaoDocente || $atividadeDiferenciada || $etapaEnsino) { - ${'r51s'.$i} = ''; - } - } + //Validação das disciplinas + if ($i > 8) { + $atividadeDiferenciada = ($tipo_atendimento == $atividadeComplementar || + $tipo_atendimento == $atendimentoEducEspecializado); + $etapaEnsino = ($etapa_ensino == $educInfantilCreche || + $etapa_ensino == $educInfantilPreEscola || + $etapa_ensino == $educInfantilUnificada || + $etapa_ensino == $ejaEnsinoFundamental); + + if (!$funcaoDocente || $atividadeDiferenciada || $etapaEnsino) { + ${'r51s' . $i} = ''; + } + } - $return .= ${'r51s'.$i}.$d; - } + $return .= ${'r51s' . $i} . $d; + } - $return = substr_replace($return, "", -1); - $return .= "\n"; + $return = substr_replace($return, "", -1); + $return .= "\n"; + } + return $return; } - return $return; - } - protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, $alunoId){ + protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, $alunoId) + { - $sql = - 'SELECT + $sql = + 'SELECT - distinct(a.cod_aluno) as r60s4, + DISTINCT(a.cod_aluno) AS r60s4, p.idpes, - \'60\' as r60s1, - ece.cod_escola_inep as r60s2, - eca.cod_aluno_inep as r60s3, - p.nome as r60s5, - fis.data_nasc as r60s6, /*tratar formato*/ - fis.sexo as r60s7, /*tratar na aplicação formato*/ - r.raca_educacenso as r60s8, + \'60\' AS r60s1, + ece.cod_escola_inep AS r60s2, + eca.cod_aluno_inep AS r60s3, + p.nome AS r60s5, + fis.data_nasc AS r60s6, /*tratar formato*/ + fis.sexo AS r60s7, /*tratar na aplicação formato*/ + r.raca_educacenso AS r60s8, /*se não tiver r60s10 e 11 é 0 se tiver um dos dois é 1*/ - COALESCE((SELECT nome FROM cadastro.pessoa WHERE pessoa.idpes = fis.idpes_mae), a.nm_mae) as r60s10, - COALESCE((SELECT nome FROM cadastro.pessoa WHERE pessoa.idpes = fis.idpes_pai), a.nm_pai) as r60s11, - COALESCE(fis.nacionalidade,1) as r60s12, - (SELECT cod_ibge FROM public.pais WHERE pais.idpais = fis.idpais_estrangeiro) as r60s13, - uf.cod_ibge as r60s14, - mun.cod_ibge as r60s15, - (ARRAY[1] <@ recursos_prova_inep)::int as r60s30, - (ARRAY[2] <@ recursos_prova_inep)::int as r60s31, - (ARRAY[3] <@ recursos_prova_inep)::int as r60s32, - (ARRAY[4] <@ recursos_prova_inep)::int as r60s33, - (ARRAY[5] <@ recursos_prova_inep)::int as r60s34, - (ARRAY[6] <@ recursos_prova_inep)::int as r60s35, - (ARRAY[7] <@ recursos_prova_inep)::int as r60s36, - (ARRAY[8] <@ recursos_prova_inep)::int as r60s37, - (ARRAY[9] <@ recursos_prova_inep)::int as r60s38, + COALESCE((SELECT nome FROM cadastro.pessoa WHERE pessoa.idpes = fis.idpes_mae), a.nm_mae) AS r60s10, + COALESCE((SELECT nome FROM cadastro.pessoa WHERE pessoa.idpes = fis.idpes_pai), a.nm_pai) AS r60s11, + COALESCE(fis.nacionalidade,1) AS r60s12, + (SELECT cod_ibge FROM public.pais WHERE pais.idpais = fis.idpais_estrangeiro) AS r60s13, + uf.cod_ibge AS r60s14, + mun.cod_ibge AS r60s15, + (ARRAY[1] <@ recursos_prova_inep)::INT AS r60s30, + (ARRAY[2] <@ recursos_prova_inep)::INT AS r60s31, + (ARRAY[3] <@ recursos_prova_inep)::INT AS r60s32, + (ARRAY[4] <@ recursos_prova_inep)::INT AS r60s33, + (ARRAY[5] <@ recursos_prova_inep)::INT AS r60s34, + (ARRAY[6] <@ recursos_prova_inep)::INT AS r60s35, + (ARRAY[7] <@ recursos_prova_inep)::INT AS r60s36, + (ARRAY[8] <@ recursos_prova_inep)::INT AS r60s37, + (ARRAY[9] <@ recursos_prova_inep)::INT AS r60s38, fis.nacionalidade AS nacionalidade FROM pmieducar.aluno a @@ -1524,169 +1570,180 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, AND a.cod_aluno = $5 '; - // Transforma todos resultados em variáveis - $d = '|'; - $return = ''; - $numeroRegistros = 39; - $estrangeiro = 3; - $naturalizadoBrasileiro = 2; + // Transforma todos resultados em variáveis + $d = '|'; + $return = ''; + $numeroRegistros = 39; + $estrangeiro = 3; + $naturalizadoBrasileiro = 2; - $sqlDeficiencias = 'select distinct(deficiencia_educacenso) as id from cadastro.fisica_deficiencia, - cadastro.deficiencia where cod_deficiencia = ref_cod_deficiencia and ref_idpes = $1 - and deficiencia_educacenso is not null'; + $sqlDeficiencias = 'SELECT DISTINCT(deficiencia_educacenso) AS id FROM cadastro.fisica_deficiencia, + cadastro.deficiencia WHERE cod_deficiencia = ref_cod_deficiencia AND ref_idpes = $1 + AND deficiencia_educacenso IS NOT NULL'; - foreach (Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($escolaId, $ano, $data_ini, $data_fim, $alunoId))) as $reg) { - extract($reg); + foreach (Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('params' => array($escolaId, $ano, $data_ini, $data_fim, $alunoId))) as $reg) { + extract($reg); - $r60s5 = $this->convertStringToCenso($r60s5); + $r60s5 = $this->convertStringToCenso($r60s5); - $r60s6 = Portabilis_Date_Utils::pgSQLToBr($r60s6); - $r60s7 = $r60s7 == 'M' ? 1 : 2; - $r60s8 = is_numeric($r60s8) ? $r60s8 : 0; - $r60s9 = (int) !(is_null($r60s10) && is_null($r60s11)); + $r60s6 = Portabilis_Date_Utils::pgSQLToBr($r60s6); + $r60s7 = $r60s7 == 'M' ? 1 : 2; + $r60s8 = is_numeric($r60s8) ? $r60s8 : 0; + $r60s9 = (int)!(is_null($r60s10) && is_null($r60s11)); - $r60s10 = $this->convertStringToAlpha($r60s10); - $r60s11 = $this->convertStringToAlpha($r60s11); + $r60s10 = $this->convertStringToAlpha($r60s10); + $r60s11 = $this->convertStringToAlpha($r60s11); - if($r60s12 == '1' || $r60s12 == '2') - $r60s13 = 76; + if ($r60s12 == '1' || $r60s12 == '2') { + $r60s13 = 76; + } - if ($nacionalidade == $estrangeiro || $nacionalidade == $naturalizadoBrasileiro) - $r60s14 = $r60s15 = null; + if ($nacionalidade == $estrangeiro || $nacionalidade == $naturalizadoBrasileiro) { + $r60s14 = $r60s15 = null; + } - $deficiencias = Portabilis_Utils_Database::fetchPreparedQuery($sqlDeficiencias, array( 'params' => array($idpes))); + $deficiencias = Portabilis_Utils_Database::fetchPreparedQuery($sqlDeficiencias, + array('params' => array($idpes))); - // Reseta deficiências (DEFAULT NULL) - $r60s16 = 0; - $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = $r60s24 = - $r60s25 = $r60s26 = $r60s27 = $r60s28 = $r60s29 = NULL; + // Reseta deficiências (DEFAULT NULL) + $r60s16 = 0; + $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = $r60s24 = + $r60s25 = $r60s26 = $r60s27 = $r60s28 = $r60s29 = null; - // Caso não exista nenhum curso seta seq 40 como 1 - $r60s39 = (int) is_null($r60s30) && is_null($r60s31) && is_null($r60s32) && is_null($r60s33) && is_null($r60s34) + // Caso não exista nenhum curso seta seq 40 como 1 + $r60s39 = (int)is_null($r60s30) && is_null($r60s31) && is_null($r60s32) && is_null($r60s33) && is_null($r60s34) && is_null($r60s35) && is_null($r60s36) && is_null($r60s37) && is_null($r60s38); - // Define 'tipodeficiencia' => 'seqleiaute' - $deficienciaToSeq = MapeamentoDeficienciasAluno::getArrayMapeamentoDeficiencias(); + // Define 'tipodeficiencia' => 'seqleiaute' + $deficienciaToSeq = MapeamentoDeficienciasAluno::getArrayMapeamentoDeficiencias(); - if (count($deficiencias) == 0) { - $r60s30 = $r60s31 = $r60s32 = $r60s33 = $r60s34 = $r60s35 = $r60s36 = $r60s37 = $r60s38 = NULL; - } + if (count($deficiencias) == 0) { + $r60s30 = $r60s31 = $r60s32 = $r60s33 = $r60s34 = $r60s35 = $r60s36 = $r60s37 = $r60s38 = null; + } - $arrayDeficienciasAluno = []; - // Se tiver alguma deficiência, a seq 16 deve ser 1 - if (count($deficiencias)>0) { - $r60s16 = 1; - $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = $r60s24 = - $r60s25 = $r60s26 = $r60s27 = $r60s28 = $r60s29 = 0; + $arrayDeficienciasAluno = []; + // Se tiver alguma deficiência, a seq 16 deve ser 1 + if (count($deficiencias) > 0) { + $r60s16 = 1; + $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = $r60s24 = + $r60s25 = $r60s26 = $r60s27 = $r60s28 = $r60s29 = 0; - foreach ($deficiencias as $deficiencia_educacenso) { - $deficiencia_educacenso = $deficiencia_educacenso['id']; - if (array_key_exists($deficiencia_educacenso, $deficienciaToSeq)){ - ${ 'r60s'. $deficienciaToSeq[$deficiencia_educacenso] } = 1; - } + foreach ($deficiencias as $deficiencia_educacenso) { + $deficiencia_educacenso = $deficiencia_educacenso['id']; + if (array_key_exists($deficiencia_educacenso, $deficienciaToSeq)) { + ${'r60s' . $deficienciaToSeq[$deficiencia_educacenso]} = 1; + } - $arrayDeficienciasAluno[] = $deficienciaToSeq[$deficiencia_educacenso]; - } - } - // Se o aluno não tiver deficiências não pode ser informado recursos para provas - if ($r60s16) - $r60s39 = NULL; - else - $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = - $r60s25 = $r60s26 = $r60s27 = $r60s28 = $r60s29 = NULL; - - if (!$this->precisaDeAuxilioEmProvaPorDeficiencia($deficiencias)) { - $r60s30 = null; - $r60s31 = null; - $r60s32 = null; - $r60s33 = null; - $r60s34 = null; - $r60s35 = null; - $r60s36 = null; - $r60s37 = null; - $r60s38 = null; - } else { - $r60s39 = 1; - } + $arrayDeficienciasAluno[] = $deficienciaToSeq[$deficiencia_educacenso]; + } + } + // Se o aluno não tiver deficiências não pode ser informado recursos para provas + if ($r60s16) { + $r60s39 = null; + } else { + $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = + $r60s25 = $r60s26 = $r60s27 = $r60s28 = $r60s29 = null; + } - $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaAluno()); - $r60s24 = (int) $validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasAluno); + if (!$this->precisaDeAuxilioEmProvaPorDeficiencia($deficiencias)) { + $r60s30 = null; + $r60s31 = null; + $r60s32 = null; + $r60s33 = null; + $r60s34 = null; + $r60s35 = null; + $r60s36 = null; + $r60s37 = null; + $r60s38 = null; + } else { + $r60s39 = 1; + } - //O campo 39 recebe 0 quando algum campo de 30 à 38 for igual a 1 - for($i=30; $i <= 38; $i++){ - if(${'r60s'.$i} == 1) - $r60s39 = 0; - } + $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaAluno()); + $r60s24 = (int)$validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasAluno); - //O campo 39 deve ser diferente de com 1 quando o campo 17 ou 21 for igual a 1. - if ($r60s17 || $r60s21) $r60s39 = 0; + //O campo 39 recebe 0 quando algum campo de 30 à 38 for igual a 1 + for ($i = 30; $i <= 38; $i++) { + if (${'r60s' . $i} == 1) { + $r60s39 = 0; + } + } - if ($r60s39) { - for ($i = 30; $i <= 38; $i++) { - ${'r60s' . $i} = 0; - } - } + //O campo 39 deve ser diferente de com 1 quando o campo 17 ou 21 for igual a 1. + if ($r60s17 || $r60s21) { + $r60s39 = 0; + } - for ($i=1; $i <= $numeroRegistros ; $i++) - $return .= ${'r60s'.$i}.$d; + if ($r60s39) { + for ($i = 30; $i <= 38; $i++) { + ${'r60s' . $i} = 0; + } + } - $return = substr_replace($return, "", -1); - $return .= "\n"; - } + for ($i = 1; $i <= $numeroRegistros; $i++) { + $return .= ${'r60s' . $i} . $d; + } - return $return; - } + $return = substr_replace($return, "", -1); + $return .= "\n"; + } - protected function precisaDeAuxilioEmProvaPorDeficiencia($deficiencias) { - $deficienciasLayout = MapeamentoDeficienciasAluno::getArrayMapeamentoDeficiencias(); + return $return; + } - unset($deficienciasLayout[13]); + protected function precisaDeAuxilioEmProvaPorDeficiencia($deficiencias) + { + $deficienciasLayout = MapeamentoDeficienciasAluno::getArrayMapeamentoDeficiencias(); - if (count($deficiencias)>0){ - foreach ($deficiencias as $deficiencia) { - $deficiencia = $deficiencia['id']; - if (array_key_exists($deficiencia, $deficienciasLayout)){ - return true; - } - } - } + unset($deficienciasLayout[13]); - return false; - } + if (count($deficiencias) > 0) { + foreach ($deficiencias as $deficiencia) { + $deficiencia = $deficiencia['id']; + if (array_key_exists($deficiencia, $deficienciasLayout)) { + return true; + } + } + } -protected function exportaDadosRegistro70($escolaId, $ano, $data_ini, $data_fim, $alunoId){ + return false; + } - $sql = - ' SELECT + protected function exportaDadosRegistro70($escolaId, $ano, $data_ini, $data_fim, $alunoId) + { - distinct(a.cod_aluno) as r70s4, - \'70\' as r70s1, - ece.cod_escola_inep as r70s2, - eca.cod_aluno_inep as r70s3, - fd.rg as r70s5, - oer.codigo_educacenso as r70s6, - (SELECT cod_ibge FROM public.uf WHERE uf.sigla_uf = fd.sigla_uf_exp_rg) as r70s7, - fd.data_exp_rg as r70s8, + $sql = + ' SELECT + + DISTINCT(a.cod_aluno) AS r70s4, + \'70\' AS r70s1, + ece.cod_escola_inep AS r70s2, + eca.cod_aluno_inep AS r70s3, + fd.rg AS r70s5, + oer.codigo_educacenso AS r70s6, + (SELECT cod_ibge FROM public.uf WHERE uf.sigla_uf = fd.sigla_uf_exp_rg) AS r70s7, + fd.data_exp_rg AS r70s8, tipo_cert_civil, - num_termo as r70s11, - num_folha as r70s12, - num_livro as r70s13, - data_emissao_cert_civil as r70s14, - (SELECT cod_ibge FROM public.uf WHERE uf.sigla_uf = fd.sigla_uf_cert_civil) as r70s15, - cci.cod_municipio as r70s16, - id_cartorio as r70s17, - certidao_nascimento as r70s18, - fis.cpf as r70s19, - fd.passaporte as r70s20, - fis.nis_pis_pasep as r70s21, - fis.zona_localizacao_censo as r70s22, - ep.cep as r70s23, - l.idtlog || l.nome as r70s24, - ep.numero as r70s25, - ep.complemento as r70s26, - b.nome as r70s27, - uf.cod_ibge as r70s28, - mun.cod_ibge as r70s29, + num_termo AS r70s11, + num_folha AS r70s12, + num_livro AS r70s13, + data_emissao_cert_civil AS r70s14, + (SELECT cod_ibge FROM public.uf WHERE uf.sigla_uf = fd.sigla_uf_cert_civil) AS r70s15, + cci.cod_municipio AS r70s16, + id_cartorio AS r70s17, + certidao_nascimento AS r70s18, + fis.cpf AS r70s19, + fd.passaporte AS r70s20, + fis.nis_pis_pasep AS r70s21, + fis.zona_localizacao_censo AS r70s22, + ep.cep AS r70s23, + l.idtlog || l.nome AS r70s24, + ep.numero AS r70s25, + ep.complemento AS r70s26, + b.nome AS r70s27, + uf.cod_ibge AS r70s28, + mun.cod_ibge AS r70s29, fis.nacionalidade AS nacionalidade FROM pmieducar.aluno a @@ -1716,93 +1773,103 @@ protected function exportaDadosRegistro70($escolaId, $ano, $data_ini, $data_fim, AND a.cod_aluno = $5 '; - // Transforma todos resultados em variáveis - $d = '|'; - $return = ''; - $numeroRegistros = 29; - - $estrangeiro = 3; - - foreach (Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($escolaId, $ano, $data_ini, $data_fim, $alunoId))) as $reg) { - extract($reg); - - $r70s8 = Portabilis_Date_Utils::pgSQLToBr($r70s8); - $r70s14 = Portabilis_Date_Utils::pgSQLToBr($r70s14); - - $r70s18 = $this->convertStringToCertNovoFormato($r70s18); - - $r70s19 = $this->cpfToCenso($r70s19); - - $r70s24 = $this->convertStringToCenso($r70s24); - $r70s25 = $this->convertStringToCenso($r70s25); - $r70s26 = $this->convertStringToCenso(substr($r70s26, 0, 20)); - $r70s27 = $this->convertStringToCenso($r70s27); - - if($r70s21 == 0){ $r70s21 = null; } - if($r70s5 == 0){ $r70s5 = null; } - - if(!$r70s5){ - $r70s6 = null; - $r70s7 = null; - $r70s8 = null; - } - - // Validações referentes a certidões (Modelo antigo e novo, nascimento e casamento) - $r70s9 = $r70s10 = NULL; - if (is_null($tipo_cert_civil) && !empty($r70s18)){ - $r70s9 = 2; - $r70s10 = NULL; - $r70s11 = $r70s12 = $r70s13 = $r70s14 = $r70s15 = $r70s16 = $r70s17 = NULL; - $r70s18 = str_replace(' ', '',$r70s18); - }elseif($tipo_cert_civil == 91){ - if (!(is_null($r70s11) || is_null($r70s15) || is_null($r70s17))) - $r70s9 = $r70s10 = 1; - else - $r70s9 = $r70s10 = $r70s11 = $r70s12 = $r70s13 = $r70s14 = $r70s15 = $r70s16 = $r70s17 = $r70s18 = NULL; - - }elseif ($tipo_cert_civil == 92) { - if (!(is_null($r70s11) || is_null($r70s15) || is_null($r70s17))){ - $r70s9 = 1; - $r70s10 = 2; - }else - $r70s9 = $r70s10 = $r70s11 = $r70s12 = $r70s13 = $r70s14 = $r70s15 = $r70s16 = $r70s17 = $r70s18 = NULL; - }else - $r70s9 = $r70s10 = $r70s11 = $r70s12 = $r70s13 = $r70s14 = $r70s15 = $r70s16 = $r70s17 = $r70s18 = NULL; - // fim das validações de certidões // - - if ($nacionalidade == $estrangeiro) { - for ($i=5; $i < 19; $i++) { - ${'r70s'.$i} = NULL; - } - } else { - $r70s20 = NULL; - } + // Transforma todos resultados em variáveis + $d = '|'; + $return = ''; + $numeroRegistros = 29; - for ($i=1; $i <= $numeroRegistros ; $i++) - $return .= ${'r70s'.$i}.$d; + $estrangeiro = 3; - $return = $this->upperAndUnaccent(substr_replace($return, "", -1)); + foreach (Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('params' => array($escolaId, $ano, $data_ini, $data_fim, $alunoId))) as $reg) { + extract($reg); - $return .= "\n"; - } + $r70s8 = Portabilis_Date_Utils::pgSQLToBr($r70s8); + $r70s14 = Portabilis_Date_Utils::pgSQLToBr($r70s14); - return $return; - } + $r70s18 = $this->convertStringToCertNovoFormato($r70s18); + + $r70s19 = $this->cpfToCenso($r70s19); + + $r70s24 = $this->convertStringToCenso($r70s24); + $r70s25 = $this->convertStringToCenso($r70s25); + $r70s26 = $this->convertStringToCenso(substr($r70s26, 0, 20)); + $r70s27 = $this->convertStringToCenso($r70s27); + + if ($r70s21 == 0) { + $r70s21 = null; + } + if ($r70s5 == 0) { + $r70s5 = null; + } - protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, $alunoId){ + if (!$r70s5) { + $r70s6 = null; + $r70s7 = null; + $r70s8 = null; + } + + // Validações referentes a certidões (Modelo antigo e novo, nascimento e casamento) + $r70s9 = $r70s10 = null; + if (is_null($tipo_cert_civil) && !empty($r70s18)) { + $r70s9 = 2; + $r70s10 = null; + $r70s11 = $r70s12 = $r70s13 = $r70s14 = $r70s15 = $r70s16 = $r70s17 = null; + $r70s18 = str_replace(' ', '', $r70s18); + } elseif ($tipo_cert_civil == 91) { + if (!(is_null($r70s11) || is_null($r70s15) || is_null($r70s17))) { + $r70s9 = $r70s10 = 1; + } else { + $r70s9 = $r70s10 = $r70s11 = $r70s12 = $r70s13 = $r70s14 = $r70s15 = $r70s16 = $r70s17 = $r70s18 = null; + } + + } elseif ($tipo_cert_civil == 92) { + if (!(is_null($r70s11) || is_null($r70s15) || is_null($r70s17))) { + $r70s9 = 1; + $r70s10 = 2; + } else { + $r70s9 = $r70s10 = $r70s11 = $r70s12 = $r70s13 = $r70s14 = $r70s15 = $r70s16 = $r70s17 = $r70s18 = null; + } + } else { + $r70s9 = $r70s10 = $r70s11 = $r70s12 = $r70s13 = $r70s14 = $r70s15 = $r70s16 = $r70s17 = $r70s18 = null; + } + // fim das validações de certidões // + + if ($nacionalidade == $estrangeiro) { + for ($i = 5; $i < 19; $i++) { + ${'r70s' . $i} = null; + } + } else { + $r70s20 = null; + } + + for ($i = 1; $i <= $numeroRegistros; $i++) { + $return .= ${'r70s' . $i} . $d; + } + + $return = $this->upperAndUnaccent(substr_replace($return, "", -1)); + + $return .= "\n"; + } + + return $return; + } - $sql = - ' SELECT + protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, $alunoId) + { - \'80\' as r80s1, - ece.cod_escola_inep as r80s2, - eca.cod_aluno_inep as r80s3, - a.cod_aluno as r80s4, - t.cod_turma as r80s6, - t.turma_unificada as r80s8, - mt.etapa_educacenso as r80s9, - a.recebe_escolarizacao_em_outro_espaco as r80s10, - ta.responsavel as transporte_escolar, + $sql = + ' SELECT + + \'80\' AS r80s1, + ece.cod_escola_inep AS r80s2, + eca.cod_aluno_inep AS r80s3, + a.cod_aluno AS r80s4, + t.cod_turma AS r80s6, + t.turma_unificada AS r80s8, + mt.etapa_educacenso AS r80s9, + a.recebe_escolarizacao_em_outro_espaco AS r80s10, + ta.responsavel AS transporte_escolar, t.etapa_educacenso, ( SELECT COUNT(1) @@ -1812,7 +1879,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 1 - ) as r80s13, + ) AS r80s13, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1821,7 +1888,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 2 - ) as r80s14, + ) AS r80s14, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1830,7 +1897,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 3 - ) as r80s15, + ) AS r80s15, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1839,7 +1906,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 4 - ) as r80s16, + ) AS r80s16, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1848,7 +1915,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 5 - ) as r80s17, + ) AS r80s17, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1857,7 +1924,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 6 - ) as r80s18, + ) AS r80s18, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1866,7 +1933,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 7 - ) as r80s19, + ) AS r80s19, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1875,7 +1942,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 8 - ) as r80s20, + ) AS r80s20, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1884,7 +1951,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 9 - ) as r80s21, + ) AS r80s21, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1893,7 +1960,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 10 - ) as r80s22, + ) AS r80s22, ( SELECT COUNT(1) FROM modules.veiculo v @@ -1902,7 +1969,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, INNER JOIN modules.pessoa_transporte pt ON (pt.ref_cod_rota_transporte_escolar = rte.cod_rota_transporte_escolar) WHERE pt.ref_idpes = fis.idpes AND v.ref_cod_tipo_veiculo = 11 - ) as r80s23, + ) AS r80s23, a.veiculo_transporte_escolar, t.tipo_atendimento @@ -1935,86 +2002,91 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, END) '; - // Transforma todos resultados em variáveis - $d = '|'; - $return = ''; - $numeroRegistros = 24; - $atividadeComplementar = 4; - $atendimentoEducEspecializado = 5; - $educacaoInfantilUnificada = 3; + // Transforma todos resultados em variáveis + $d = '|'; + $return = ''; + $numeroRegistros = 24; + $atividadeComplementar = 4; + $atendimentoEducEspecializado = 5; + $educacaoInfantilUnificada = 3; + + foreach (Portabilis_Utils_Database::fetchPreparedQuery($sql, + array('params' => array($escolaId, $ano, $data_ini, $data_fim, $alunoId))) as $reg) { + extract($reg); + + if ($tipo_atendimento == $atividadeComplementar || $tipo_atendimento == $atendimentoEducEspecializado) { + $r80s10 = ''; + } - foreach (Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($escolaId, $ano, $data_ini, $data_fim, $alunoId))) as $reg) { - extract($reg); + if ($etapa_educacenso != $educacaoInfantilUnificada) { + $r80s8 = ''; + } - if ($tipo_atendimento == $atividadeComplementar || $tipo_atendimento == $atendimentoEducEspecializado) { - $r80s10 = ''; - } + $etapasEducacensoMulti = array(12, 13, 22, 23, 24, 56, 64, 72); - if ($etapa_educacenso != $educacaoInfantilUnificada) { - $r80s8 = ''; - } + if (!in_array($etapa_educacenso, $etapasEducacensoMulti)) { + $r80s9 = null; + } - $etapasEducacensoMulti = array(12, 13, 22, 23, 24, 56, 64, 72); + $r80s10 = ($r80s10 == 0 ? null : $r80s10); - if (!in_array($etapa_educacenso, $etapasEducacensoMulti)) { - $r80s9 = NULL; - } + for ($i = 13; $i <= 23; $i++) { + ${'r80s' . $i} = 0; + } - $r80s10 = ($r80s10 == 0 ? NULL : $r80s10); + if (is_null($transporte_escolar)) { + $r80s11 = null; + } else { + $r80s11 = (($transporte_escolar == 0) ? 0 : 1); + if ($r80s11) { + $r80s12 = $transporte_escolar; + } + } + ${'r80s' . ($veiculo_transporte_escolar + 12)} = 1; + $utiliza_algum_veiculo = false; + for ($i = 13; $i <= 23; $i++) { + $utiliza_algum_veiculo = (${'r80s' . $i} == 1) || $utiliza_algum_veiculo; + } - for ($i=13; $i <= 23 ; $i++) - ${'r80s'.$i} = 0; + if (!$transporte_escolar) { + for ($i = 12; $i <= 23; $i++) { + ${'r80s' . $i} = null; + } + } - if(is_null($transporte_escolar)){ - $r80s11 = NULL; - }else{ - $r80s11 = (($transporte_escolar == 0 ) ? 0 : 1); - if($r80s11){ - $r80s12 = $transporte_escolar; - } - } - ${'r80s'.($veiculo_transporte_escolar + 12)} = 1; - $utiliza_algum_veiculo = FALSE; - for($i=13; $i<=23;$i++){ - $utiliza_algum_veiculo = (${'r80s'.$i} == 1) || $utiliza_algum_veiculo; - } - - if(!$transporte_escolar){ - for($i=12; $i<=23;$i++){ - ${'r80s'.$i} = NULL; - } - } + if ($transporte_escolar && !$utiliza_algum_veiculo) { + $this->msg .= "Dados para formular o registro 80 campo 11 da escola {$escolaId} com problemas. Verifique se o campo tipo de veículo foi preenchido no aluno {$alunoId}.
"; + $this->error = true; + } - if($transporte_escolar && !$utiliza_algum_veiculo){ - $this->msg .= "Dados para formular o registro 80 campo 11 da escola {$escolaId} com problemas. Verifique se o campo tipo de veículo foi preenchido no aluno {$alunoId}.
"; - $this->error = true; - } + if ($this->turma_presencial_ou_semi == 1 || $this->turma_presencial_ou_semi == 2) { + if (is_null($r80s11)) { + $this->msg .= "Dados para formular o registro 80 campo 11 da escola {$escolaId} com problemas. Verifique se o campo transporte escolar foi preenchido para aluno {$alunoId}.
"; + $this->error = true; + } + } - if($this->turma_presencial_ou_semi == 1 || $this->turma_presencial_ou_semi == 2){ - if(is_null($r80s11)){ - $this->msg .= "Dados para formular o registro 80 campo 11 da escola {$escolaId} com problemas. Verifique se o campo transporte escolar foi preenchido para aluno {$alunoId}.
"; - $this->error = true; - } - } + // fim validações transporte escolar - // fim validações transporte escolar + for ($i = 1; $i <= $numeroRegistros; $i++) { + $return .= ${'r80s' . $i} . $d; + } - for ($i=1; $i <= $numeroRegistros ; $i++) - $return .= ${'r80s'.$i}.$d; + $return = substr_replace($return, "", -1); + $return .= "\n"; + } - $return = substr_replace($return, "", -1); - $return .= "\n"; + return $return; } - return $return; - } - - protected function exportaDadosRegistro99() { - return "99|\n"; - } + protected function exportaDadosRegistro99() + { + return "99|\n"; + } - protected function exportaDadosRegistro89($escolaId) { - $sql = "SELECT '89' AS r89s1, + protected function exportaDadosRegistro89($escolaId) + { + $sql = "SELECT '89' AS r89s1, educacenso_cod_escola.cod_escola_inep AS r89s2, gestor_f.cpf AS r89s3, gestor_p.nome AS r89s4, @@ -2026,28 +2098,32 @@ protected function exportaDadosRegistro89($escolaId) { LEFT JOIN cadastro.pessoa gestor_p ON (gestor_p.idpes = escola.ref_idpes_gestor) WHERE escola.cod_escola = $1"; - $numeroRegistros = 6; - $return = ''; + $numeroRegistros = 6; + $return = ''; - extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array('return_only' => 'first-row', - 'params' => array($escolaId)))); + extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array( + 'return_only' => 'first-row', + 'params' => array($escolaId) + ))); - $r89s3 = $this->cpfToCenso($r89s3); - $r89s4 = $this->convertStringToAlpha($r89s4); - $r89s6 = $this->convertEmailToCenso($r89s6); + $r89s3 = $this->cpfToCenso($r89s3); + $r89s4 = $this->convertStringToAlpha($r89s4); + $r89s6 = $this->convertEmailToCenso($r89s6); - for ($i=1; $i <= $numeroRegistros ; $i++) - $return .= ${'r89s'.$i}.'|'; + for ($i = 1; $i <= $numeroRegistros; $i++) { + $return .= ${'r89s' . $i} . '|'; + } - $return = substr_replace($return, "", -1); - $return .= "\n"; + $return = substr_replace($return, "", -1); + $return .= "\n"; - return $return; - } + return $return; + } - protected function exportaDadosRegistro90($escolaId, $turmaId, $matriculaId) { + protected function exportaDadosRegistro90($escolaId, $turmaId, $matriculaId) + { - $sql = "SELECT '90' AS r90s1, + $sql = "SELECT '90' AS r90s1, educacenso_cod_escola.cod_escola_inep AS r90s2, educacenso_cod_aluno.cod_aluno_inep AS r90s5, matricula.ref_cod_aluno AS r90s6, @@ -2059,61 +2135,65 @@ protected function exportaDadosRegistro90($escolaId, $turmaId, $matriculaId) { WHERE escola.cod_escola = $1 AND matricula.cod_matricula = $2"; - $numeroRegistros = 8; - $return = ''; - - extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array('return_only' => 'first-row', - 'params' => array($escolaId, $matriculaId)))); - - $turma = new clsPmieducarTurma($turmaId); - $inep = $turma->getInep(); - - $turma = $turma->detalhe(); - $serieId = $turma['ref_ref_cod_serie']; - - $serie = new clsPmieducarSerie($serieId); - $serie = $serie->detalhe(); - - $anoConcluinte = $serie['concluinte'] == 2; - - $r90s3 = $turmaId; - $r90s4 = ($inep ? $inep : null); - $r90s7 = null; - - // Atualiza situação para código do censo - switch ($r90s8) { - case 4: - $r90s8 = 1; - break; - case 6: - $r90s8 = 2; - break; - case 15: - $r90s8 = 3; - break; - case 2: - $r90s8 = 4; - break; - case 1: - $r90s8 = ($anoConcluinte ? 6 : 5); - break; - case 3: - $r90s8 = 7; - break; - } + $numeroRegistros = 8; + $return = ''; + + extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array( + 'return_only' => 'first-row', + 'params' => array($escolaId, $matriculaId) + ))); + + $turma = new clsPmieducarTurma($turmaId); + $inep = $turma->getInep(); + + $turma = $turma->detalhe(); + $serieId = $turma['ref_ref_cod_serie']; + + $serie = new clsPmieducarSerie($serieId); + $serie = $serie->detalhe(); + + $anoConcluinte = $serie['concluinte'] == 2; + + $r90s3 = $turmaId; + $r90s4 = ($inep ? $inep : null); + $r90s7 = null; + + // Atualiza situação para código do censo + switch ($r90s8) { + case 4: + $r90s8 = 1; + break; + case 6: + $r90s8 = 2; + break; + case 15: + $r90s8 = 3; + break; + case 2: + $r90s8 = 4; + break; + case 1: + $r90s8 = ($anoConcluinte ? 6 : 5); + break; + case 3: + $r90s8 = 7; + break; + } - for ($i=1; $i <= $numeroRegistros ; $i++) - $return .= ${'r90s'.$i}.'|'; + for ($i = 1; $i <= $numeroRegistros; $i++) { + $return .= ${'r90s' . $i} . '|'; + } - $return = substr_replace($return, "", -1); - $return .= "\n"; + $return = substr_replace($return, "", -1); + $return .= "\n"; - return $return; - } + return $return; + } - protected function exportaDadosRegistro91($escolaId, $turmaId, $matriculaId) { + protected function exportaDadosRegistro91($escolaId, $turmaId, $matriculaId) + { - $sql = "SELECT '91' AS r91s1, + $sql = "SELECT '91' AS r91s1, educacenso_cod_escola.cod_escola_inep AS r91s2, educacenso_cod_aluno.cod_aluno_inep AS r91s5, matricula.ref_cod_aluno AS r91s6, @@ -2127,176 +2207,192 @@ protected function exportaDadosRegistro91($escolaId, $turmaId, $matriculaId) { WHERE escola.cod_escola = $1 AND matricula.cod_matricula = $2"; - $numeroRegistros = 11; - $return = ''; - - extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array('return_only' => 'first-row', - 'params' => array($escolaId, $matriculaId)))); - - $turma = new clsPmieducarTurma($turmaId); - $inep = $turma->getInep(); - - $turma = $turma->detalhe(); - $serieId = $turma['ref_ref_cod_serie']; - - $serie = new clsPmieducarSerie($serieId); - $serie = $serie->detalhe(); - - $anoConcluinte = $serie['concluinte'] == 2; - $etapaEducacenso = $turma['etapa_educacenso']; - - $etapasValidasEducacenso = array(3, 12, 13, 22, 23, 24, 56, 64, 72); - - $tipoMediacaoDidaticoPedagogico = $turma['tipo_mediacao_didatico_pedagogico']; - - $r91s3 = $turmaId; - $r91s4 = ($inep ? $inep : null); - $r91s7 = null; - $r91s8 = ($inep ? null : $tipoMediacaoDidaticoPedagogico); - $r91s9 = ($inep ? null : $r91s9); - $r91s10 = (in_array($etapaEducacenso, $etapasValidasEducacenso) ? $etapaEducacenso : null); - - // Atualiza situação para código do censo - switch ($r91s11) { - case 4: - $r91s11 = 1; - break; - case 6: - $r91s11 = 2; - break; - case 15: - $r91s11 = 3; - break; - case 2: - $r91s11 = 4; - break; - case 1: - $r91s11 = ($anoConcluinte ? 6 : 5); - break; - case 3: - $r91s11 = 7; - break; + $numeroRegistros = 11; + $return = ''; + + extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, array( + 'return_only' => 'first-row', + 'params' => array($escolaId, $matriculaId) + ))); + + $turma = new clsPmieducarTurma($turmaId); + $inep = $turma->getInep(); + + $turma = $turma->detalhe(); + $serieId = $turma['ref_ref_cod_serie']; + + $serie = new clsPmieducarSerie($serieId); + $serie = $serie->detalhe(); + + $anoConcluinte = $serie['concluinte'] == 2; + $etapaEducacenso = $turma['etapa_educacenso']; + + $etapasValidasEducacenso = array(3, 12, 13, 22, 23, 24, 56, 64, 72); + + $tipoMediacaoDidaticoPedagogico = $turma['tipo_mediacao_didatico_pedagogico']; + + $r91s3 = $turmaId; + $r91s4 = ($inep ? $inep : null); + $r91s7 = null; + $r91s8 = ($inep ? null : $tipoMediacaoDidaticoPedagogico); + $r91s9 = ($inep ? null : $r91s9); + $r91s10 = (in_array($etapaEducacenso, $etapasValidasEducacenso) ? $etapaEducacenso : null); + + // Atualiza situação para código do censo + switch ($r91s11) { + case 4: + $r91s11 = 1; + break; + case 6: + $r91s11 = 2; + break; + case 15: + $r91s11 = 3; + break; + case 2: + $r91s11 = 4; + break; + case 1: + $r91s11 = ($anoConcluinte ? 6 : 5); + break; + case 3: + $r91s11 = 7; + break; + } + + for ($i = 1; $i <= $numeroRegistros; $i++) { + $return .= ${'r91s' . $i} . '|'; + } + + $return = substr_replace($return, "", -1); + $return .= "\n"; + + return $return; + } + + protected function cpfToCenso($cpf) + { + $cpf = str_replace(array('.', '-'), '', int2CPF($cpf)); + return $cpf == '00000000000' ? null : $cpf; + } + + protected function cnpjToCenso($cnpj) + { + $cnpj = str_replace(array('.', '-', '/'), '', int2CNPJ($cnpj)); + return $cnpj == '00000000000000' ? null : $cnpj; + } + + protected function upperAndUnaccent($string) + { + $string = Portabilis_String_Utils::toUtf8($string); + $string = preg_replace(array( + "/(á|à|ã|â|ä)/", + "/(Á|À|Ã|Â|Ä)/", + "/(é|è|ê|ë)/", + "/(É|È|Ê|Ë)/", + "/(í|ì|î|ï)/", + "/(Í|Ì|Î|Ï)/", + "/(ó|ò|õ|ô|ö)/", + "/(Ó|Ò|Õ|Ô|Ö)/", + "/(ú|ù|û|ü)/", + "/(Ú|Ù|Û|Ü)/", + "/(ñ)/", + "/(Ñ)/", + "/(ç)/", + "/(Ç)/" + ), + explode(" ", "a A e E i I o O u U n N c C"), $string); + + return strtoupper($string); } - for ($i=1; $i <= $numeroRegistros ; $i++) - $return .= ${'r91s'.$i}.'|'; + protected function convertStringToAlpha($string) + { + $string = $this->upperAndUnaccent($string); - $return = substr_replace($return, "", -1); - $return .= "\n"; + //Aceita apenas letras + $alphas = range('A', 'Z'); + $caracteresAceitos = array(" "); + $caracteresAceitos = array_merge($alphas, $caracteresAceitos); - return $return; - } - protected function cpfToCenso($cpf){ - $cpf = str_replace(array('.', '-'), '', int2CPF($cpf)); - return $cpf == '00000000000' ? NULL : $cpf; - } + //Aplica filtro na string eliminando caracteres indesejados + $regex = sprintf('/[^%s]/u', preg_quote(join($caracteresAceitos), '/')); + $string = preg_replace($regex, '', $string); -protected function cnpjToCenso($cnpj){ - $cnpj = str_replace(array('.', '-', '/'), '', int2CNPJ($cnpj)); - return $cnpj == '00000000000000' ? NULL : $cnpj; -} + //Elimina espaços indesejados + $string = trim($string); + $string = preg_replace('/( )+/', ' ', $string); + + return $string; + } + + protected function convertStringToCenso($string) + { + $string = $this->upperAndUnaccent($string); + + //Aceita apenas letras e numeros e alguns caracteres especiais + $alphas = range('A', 'Z'); + $numbers = range(0, 9); + $caracteresAceitos = array(" ", "ª", "º", "-"); + $caracteresAceitos = array_merge($numbers, $caracteresAceitos); + $caracteresAceitos = array_merge($alphas, $caracteresAceitos); + + //Aplica filtro na string eliminando caracteres indesejados + $regex = sprintf('/[^%s]/u', preg_quote(join($caracteresAceitos), '/')); + $string = preg_replace($regex, '', $string); - protected function upperAndUnaccent($string){ - $string = Portabilis_String_Utils::toUtf8($string); - $string = preg_replace(array("/(á|à|ã|â|ä)/", - "/(Á|À|Ã|Â|Ä)/", - "/(é|è|ê|ë)/", - "/(É|È|Ê|Ë)/", - "/(í|ì|î|ï)/", - "/(Í|Ì|Î|Ï)/", - "/(ó|ò|õ|ô|ö)/", - "/(Ó|Ò|Õ|Ô|Ö)/", - "/(ú|ù|û|ü)/", - "/(Ú|Ù|Û|Ü)/", - "/(ñ)/","/(Ñ)/", - "/(ç)/","/(Ç)/"), - explode(" ","a A e E i I o O u U n N c C"), $string); - - return strtoupper($string); - } - - protected function convertStringToAlpha($string){ - $string = $this->upperAndUnaccent($string); - - //Aceita apenas letras - $alphas = range('A','Z'); - $caracteresAceitos = array(" "); - $caracteresAceitos = array_merge($alphas, $caracteresAceitos); - - - //Aplica filtro na string eliminando caracteres indesejados - $regex = sprintf('/[^%s]/u', preg_quote(join($caracteresAceitos), '/')); - $string = preg_replace($regex, '', $string); - - //Elimina espaços indesejados - $string = trim($string); - $string = preg_replace('/( )+/', ' ', $string); - - return $string; - } - - protected function convertStringToCenso($string){ - $string = $this->upperAndUnaccent($string); - - //Aceita apenas letras e numeros e alguns caracteres especiais - $alphas = range('A','Z'); - $numbers = range(0,9); - $caracteresAceitos = array(" ", "ª", "º", "-"); - $caracteresAceitos = array_merge($numbers, $caracteresAceitos); - $caracteresAceitos = array_merge($alphas, $caracteresAceitos); - - //Aplica filtro na string eliminando caracteres indesejados - $regex = sprintf('/[^%s]/u', preg_quote(join($caracteresAceitos), '/')); - $string = preg_replace($regex, '', $string); - - //Elimina espaços indesejados - $string = trim($string); - $string = preg_replace('/( )+/', ' ', $string); - - return $string; - } - - protected function convertStringToCertNovoFormato($string){ - $string = $this->upperAndUnaccent($string); - - //Aceita apenas números e letra X - $numbers = range(0,9); - $caracteresAceitos = array(" ", "x", "X"); - $caracteresAceitos = array_merge($numbers, $caracteresAceitos); - - //Aplica filtro na string eliminando caracteres indesejados - $regex = sprintf('/[^%s]/u', preg_quote(join($caracteresAceitos), '/')); - $string = preg_replace($regex, '', $string); - - return $string; - } - - protected function convertEmailToCenso($string){ - $string = $this->upperAndUnaccent($string); - - //Aceita apenas letras e numeros e alguns caracteres especiais - $alphas = range('A','Z'); - $numbers = range(0,9); - $caracteresAceitos = array("_", "-", "@", "."); - $caracteresAceitos = array_merge($numbers, $caracteresAceitos); - $caracteresAceitos = array_merge($alphas, $caracteresAceitos); - - //Aplica filtro na string eliminando caracteres indesejados - $regex = sprintf('/[^%s]/u', preg_quote(join($caracteresAceitos), '/')); - $string = preg_replace($regex, '', $string); - - return $string; - } - - public function Gerar() { - if ($this->isRequestFor('get', 'educacenso-export')) - $this->appendResponse($this->educacensoExport()); - elseif ($this->isRequestFor('get', 'educacenso-export-fase2')) - $this->appendResponse($this->educacensoExportFase2()); - else - $this->notImplementedOperationError(); - } + //Elimina espaços indesejados + $string = trim($string); + $string = preg_replace('/( )+/', ' ', $string); + + return $string; + } + + protected function convertStringToCertNovoFormato($string) + { + $string = $this->upperAndUnaccent($string); + + //Aceita apenas números e letra X + $numbers = range(0, 9); + $caracteresAceitos = array(" ", "x", "X"); + $caracteresAceitos = array_merge($numbers, $caracteresAceitos); + + //Aplica filtro na string eliminando caracteres indesejados + $regex = sprintf('/[^%s]/u', preg_quote(join($caracteresAceitos), '/')); + $string = preg_replace($regex, '', $string); + + return $string; + } + + protected function convertEmailToCenso($string) + { + $string = $this->upperAndUnaccent($string); + + //Aceita apenas letras e numeros e alguns caracteres especiais + $alphas = range('A', 'Z'); + $numbers = range(0, 9); + $caracteresAceitos = array("_", "-", "@", "."); + $caracteresAceitos = array_merge($numbers, $caracteresAceitos); + $caracteresAceitos = array_merge($alphas, $caracteresAceitos); + + //Aplica filtro na string eliminando caracteres indesejados + $regex = sprintf('/[^%s]/u', preg_quote(join($caracteresAceitos), '/')); + $string = preg_replace($regex, '', $string); + + return $string; + } + + public function Gerar() + { + if ($this->isRequestFor('get', 'educacenso-export')) { + $this->appendResponse($this->educacensoExport()); + } elseif ($this->isRequestFor('get', 'educacenso-export-fase2')) { + $this->appendResponse($this->educacensoExportFase2()); + } else { + $this->notImplementedOperationError(); + } + } /** * Retorna true se o grau acadêmido informado for bacharelado ou tecnólogo e se a situação informada for concluído From 9d943bdfb851d196fe2fb5afac7e95b643aea112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ber=20Freitas=20Dias?= Date: Wed, 18 Jul 2018 17:04:48 -0300 Subject: [PATCH 18/73] =?UTF-8?q?Atualizando=20composer.lock=20para=20vers?= =?UTF-8?q?=C3=B5es=20reais?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.lock | 207 +++++++++++++++++++++++++------------------------- 1 file changed, 102 insertions(+), 105 deletions(-) diff --git a/composer.lock b/composer.lock index 1cab7f7d33..4d6b91ec41 100644 --- a/composer.lock +++ b/composer.lock @@ -425,16 +425,16 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v6.1.0", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "0ff595e1d9d7d1c929b2a5f7b774bbcfbbd81587" + "reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0ff595e1d9d7d1c929b2a5f7b774bbcfbbd81587", - "reference": "0ff595e1d9d7d1c929b2a5f7b774bbcfbbd81587", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7d760881d266d63c5e7a1155cbcf2ac656a31ca8", + "reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8", "shasum": "" }, "require": { @@ -480,7 +480,7 @@ "mail", "mailer" ], - "time": "2018-07-02T20:24:38+00:00" + "time": "2018-07-13T07:04:35+00:00" }, { "name": "symfony/config", @@ -617,32 +617,32 @@ }, { "name": "symfony/debug", - "version": "v4.1.1", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "dbe0fad88046a755dcf9379f2964c61a02f5ae3d" + "reference": "47e6788c5b151cf0cfdf3329116bf33800632d75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/dbe0fad88046a755dcf9379f2964c61a02f5ae3d", - "reference": "dbe0fad88046a755dcf9379f2964c61a02f5ae3d", + "url": "https://api.github.com/repos/symfony/debug/zipball/47e6788c5b151cf0cfdf3329116bf33800632d75", + "reference": "47e6788c5b151cf0cfdf3329116bf33800632d75", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0" }, "conflict": { - "symfony/http-kernel": "<3.4" + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/http-kernel": "~3.4|~4.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -669,30 +669,30 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-06-08T09:39:36+00:00" + "time": "2018-06-25T11:10:40+00:00" }, { "name": "symfony/filesystem", - "version": "v4.1.1", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "562bf7005b55fd80d26b582d28e3e10f2dd5ae9c" + "reference": "8a721a5f2553c6c3482b1c5b22ed60fe94dd63ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/562bf7005b55fd80d26b582d28e3e10f2dd5ae9c", - "reference": "562bf7005b55fd80d26b582d28e3e10f2dd5ae9c", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8a721a5f2553c6c3482b1c5b22ed60fe94dd63ed", + "reference": "8a721a5f2553c6c3482b1c5b22ed60fe94dd63ed", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -719,7 +719,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-05-30T07:26:09+00:00" + "time": "2018-06-21T11:10:19+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1004,30 +1004,30 @@ }, { "name": "doctrine/annotations", - "version": "v1.6.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", - "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": "^7.1" + "php": "^5.6 || ^7.0" }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^5.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -1068,36 +1068,36 @@ "docblock", "parser" ], - "time": "2017-12-06T07:11:42+00:00" + "time": "2017-02-24T16:22:25+00:00" }, { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=5.3,<8.0-DEV" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -1122,20 +1122,20 @@ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.12.1", + "version": "v2.12.2", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "beef6cbe6dec7205edcd143842a49f9a691859a6" + "reference": "dcc87d5414e9d0bd316fce81a5bedb9ce720b183" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/beef6cbe6dec7205edcd143842a49f9a691859a6", - "reference": "beef6cbe6dec7205edcd143842a49f9a691859a6", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/dcc87d5414e9d0bd316fce81a5bedb9ce720b183", + "reference": "dcc87d5414e9d0bd316fce81a5bedb9ce720b183", "shasum": "" }, "require": { @@ -1169,7 +1169,7 @@ "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1", "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", - "phpunitgoodpractices/traits": "^1.5", + "phpunitgoodpractices/traits": "^1.5.1", "symfony/phpunit-bridge": "^4.0" }, "suggest": { @@ -1213,32 +1213,29 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2018-06-10T08:26:56+00:00" + "time": "2018-07-06T10:37:40+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.8.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", "shasum": "" }, "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" + "php": "^5.6 || ^7.0" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^4.1" }, "type": "library", "autoload": { @@ -1261,20 +1258,20 @@ "object", "object graph" ], - "time": "2018-06-11T23:09:50+00:00" + "time": "2017-10-19T19:58:43+00:00" }, { "name": "paragonie/random_compat", - "version": "v2.0.15", + "version": "v2.0.17", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "10bcb46e8f3d365170f6de9d05245aa066b81f09" + "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/10bcb46e8f3d365170f6de9d05245aa066b81f09", - "reference": "10bcb46e8f3d365170f6de9d05245aa066b81f09", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d", + "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d", "shasum": "" }, "require": { @@ -1310,7 +1307,7 @@ "pseudorandom", "random" ], - "time": "2018-06-08T15:26:40+00:00" + "time": "2018-07-04T16:31:37+00:00" }, { "name": "phar-io/manifest", @@ -2067,16 +2064,16 @@ }, { "name": "phpunit/phpunit-mock-objects", - "version": "5.0.7", + "version": "5.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce" + "reference": "6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", - "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f", + "reference": "6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f", "shasum": "" }, "require": { @@ -2122,7 +2119,7 @@ "mock", "xunit" ], - "time": "2018-05-29T13:50:43+00:00" + "time": "2018-07-13T03:27:23+00:00" }, { "name": "phpunit/phpunit-selenium", @@ -2759,30 +2756,30 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.1.1", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "2391ed210a239868e7256eb6921b1bd83f3087b5" + "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2391ed210a239868e7256eb6921b1bd83f3087b5", - "reference": "2391ed210a239868e7256eb6921b1bd83f3087b5", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fdd5abcebd1061ec647089c6c41a07ed60af09f8", + "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^5.5.9|>=7.0.8" }, "conflict": { - "symfony/dependency-injection": "<3.4" + "symfony/dependency-injection": "<3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/stopwatch": "~3.4|~4.0" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/dependency-injection": "", @@ -2791,7 +2788,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2818,29 +2815,29 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-04-06T07:35:57+00:00" + "time": "2018-04-06T07:35:25+00:00" }, { "name": "symfony/finder", - "version": "v4.1.1", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "84714b8417d19e4ba02ea78a41a975b3efaafddb" + "reference": "3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/84714b8417d19e4ba02ea78a41a975b3efaafddb", - "reference": "84714b8417d19e4ba02ea78a41a975b3efaafddb", + "url": "https://api.github.com/repos/symfony/finder/zipball/3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394", + "reference": "3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2867,29 +2864,29 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-06-19T21:38:16+00:00" + "time": "2018-06-19T20:52:10+00:00" }, { "name": "symfony/options-resolver", - "version": "v4.1.1", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "45cdcc8a96ef92b43a50723e6d1f5f83096e8cef" + "reference": "cc5e98ed91688a22a7162a8800096356f9076b1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/45cdcc8a96ef92b43a50723e6d1f5f83096e8cef", - "reference": "45cdcc8a96ef92b43a50723e6d1f5f83096e8cef", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc5e98ed91688a22a7162a8800096356f9076b1d", + "reference": "cc5e98ed91688a22a7162a8800096356f9076b1d", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2921,7 +2918,7 @@ "configuration", "options" ], - "time": "2018-05-31T10:17:53+00:00" + "time": "2018-05-30T04:26:49+00:00" }, { "name": "symfony/polyfill-php70", @@ -3039,25 +3036,25 @@ }, { "name": "symfony/process", - "version": "v4.1.1", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "1d1677391ecf00d1c5b9482d6050c0c27aa3ac3a" + "reference": "acc5a37c706ace827962851b69705b24e71ca17c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/1d1677391ecf00d1c5b9482d6050c0c27aa3ac3a", - "reference": "1d1677391ecf00d1c5b9482d6050c0c27aa3ac3a", + "url": "https://api.github.com/repos/symfony/process/zipball/acc5a37c706ace827962851b69705b24e71ca17c", + "reference": "acc5a37c706ace827962851b69705b24e71ca17c", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -3084,29 +3081,29 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-05-31T10:17:53+00:00" + "time": "2018-05-30T04:24:30+00:00" }, { "name": "symfony/stopwatch", - "version": "v4.1.1", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "07463bbbbbfe119045a24c4a516f92ebd2752784" + "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/07463bbbbbfe119045a24c4a516f92ebd2752784", - "reference": "07463bbbbbfe119045a24c4a516f92ebd2752784", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/eb17cfa072cab26537ac37e9c4ece6c0361369af", + "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -3133,7 +3130,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2018-02-19T16:51:42+00:00" + "time": "2018-02-17T14:55:25+00:00" }, { "name": "theseer/tokenizer", @@ -3235,4 +3232,4 @@ "php": "~7.0" }, "platform-dev": [] -} +} \ No newline at end of file From 62f5fff44f923e2cbe070838a1951f681e9095f3 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Thu, 19 Jul 2018 11:25:18 -0300 Subject: [PATCH 19/73] =?UTF-8?q?Corrige=20vari=C3=A1vel=20que=20represent?= =?UTF-8?q?a=20o=20campo=2026=20do=20registro=2030?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/modules/Api/Views/EducacensoExportController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index ce44813a9a..f4bb0bddf8 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -989,7 +989,7 @@ protected function exportaDadosRegistro30($servidorId, $escolaId) } $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaProfessor()); - $r60s26 = (int)$validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasProfessor); + $r30s26 = (int)$validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasProfessor); if ($r30s18 == 0) { $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = $r30s26 = null; From 8bff7f1a4a9bce63f64502197e022687b9fd19e4 Mon Sep 17 00:00:00 2001 From: bonot Date: Thu, 19 Jul 2018 15:45:50 -0300 Subject: [PATCH 20/73] Aplica PSR 2 --- ieducar/intranet/educar_deficiencia_cad.php | 198 +++--- .../pessoa/clsCadastroDeficiencia.inc.php | 618 +++++++++--------- 2 files changed, 391 insertions(+), 425 deletions(-) diff --git a/ieducar/intranet/educar_deficiencia_cad.php b/ieducar/intranet/educar_deficiencia_cad.php index 1ce847cb4c..10fd527c3f 100644 --- a/ieducar/intranet/educar_deficiencia_cad.php +++ b/ieducar/intranet/educar_deficiencia_cad.php @@ -1,44 +1,19 @@ SetTitulo( "{$this->_instituicao} i-Educar - Deficiência" ); - $this->processoAp = "631"; - $this->addEstilo("localizacaoSistema"); + $this->SetTitulo("{$this->_instituicao} i-Educar - Deficiência"); + $this->processoAp = '631'; + $this->addEstilo('localizacaoSistema'); } } @@ -49,117 +24,122 @@ class indice extends clsCadastro * * @var int */ - var $pessoa_logada; + public $pessoa_logada; - var $cod_deficiencia; - var $nm_deficiencia; - var $deficiencia_educacenso; + public $cod_deficiencia; + public $nm_deficiencia; + public $deficiencia_educacenso; - function Inicializar() + public function Inicializar() { - $retorno = "Novo"; + $retorno = 'Novo'; @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); - $this->cod_deficiencia=$_GET["cod_deficiencia"]; + $this->cod_deficiencia=$_GET['cod_deficiencia']; $obj_permissoes = new clsPermissoes(); - $obj_permissoes->permissao_cadastra( 631, $this->pessoa_logada, 7, "educar_deficiencia_lst.php" ); + $obj_permissoes->permissao_cadastra(631, $this->pessoa_logada, 7, 'educar_deficiencia_lst.php'); - if( is_numeric( $this->cod_deficiencia ) ) - { - - $obj = new clsCadastroDeficiencia( $this->cod_deficiencia ); + if (is_numeric($this->cod_deficiencia)) { + $obj = new clsCadastroDeficiencia($this->cod_deficiencia); $registro = $obj->detalhe(); - if( $registro ) - { - foreach( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto + if ($registro) { + foreach ($registro as $campo => $val) { // passa todos os valores obtidos no registro para atributos do objeto $this->$campo = $val; + } - if( $obj_permissoes->permissao_excluir( 631, $this->pessoa_logada, 7 ) ) - { + if ($obj_permissoes->permissao_excluir(631, $this->pessoa_logada, 7)) { $this->fexcluir = true; } - $retorno = "Editar"; + $retorno = 'Editar'; } } - $this->url_cancelar = ($retorno == "Editar") ? "educar_deficiencia_det.php?cod_deficiencia={$registro["cod_deficiencia"]}" : "educar_deficiencia_lst.php"; + $this->url_cancelar = ($retorno == 'Editar') ? "educar_deficiencia_det.php?cod_deficiencia={$registro['cod_deficiencia']}" : 'educar_deficiencia_lst.php'; - $nomeMenu = $retorno == "Editar" ? $retorno : "Cadastrar"; + $nomeMenu = $retorno == 'Editar' ? $retorno : 'Cadastrar'; $localizacao = new LocalizacaoSistema(); - $localizacao->entradaCaminhos( array( - $_SERVER['SERVER_NAME']."/intranet" => "Início", - "educar_pessoas_index.php" => "Pessoas", - "" => "{$nomeMenu} deficiência" - )); + $localizacao->entradaCaminhos([ + $_SERVER['SERVER_NAME'].'/intranet' => 'Início', + 'educar_pessoas_index.php' => 'Pessoas', + '' => "{$nomeMenu} deficiência" + ]); $this->enviaLocalizacao($localizacao->montar()); - $this->nome_url_cancelar = "Cancelar"; + $this->nome_url_cancelar = 'Cancelar'; + return $retorno; } - function Gerar() + public function Gerar() { // primary keys - $this->campoOculto( "cod_deficiencia", $this->cod_deficiencia ); + $this->campoOculto('cod_deficiencia', $this->cod_deficiencia); // foreign keys // text - $this->campoTexto( "nm_deficiencia", "Deficiência", $this->nm_deficiencia, 30, 255, true ); - - $resources = array ( null => 'Selecione', - 1 => "Cegueira", - 2 => "Baixa visão", - 3 => "Surdez", - 4 => "Deficiência auditiva", - 5 => "Surdocegueira", - 6 => "Deficiência física", - 7 => "Deficiência intelectual", - 9 => "Autismo infantil", - 10 => "Síndrome de Asperger", - 11 => "Síndrome de Rett", - 12 => "Transtorno desintegrativo da infância", - 13 => "Altas habilidades/Superdotação",); - - $options = array('label' => Portabilis_String_Utils::toLatin1('Deficiência educacenso'), 'resources' => $resources, 'value' => $this->deficiencia_educacenso); + $this->campoTexto('nm_deficiencia', 'Deficiência', $this->nm_deficiencia, 30, 255, true); + + $resources = [ + null => 'Selecione', + 1 => 'Cegueira', + 2 => 'Baixa visão', + 3 => 'Surdez', + 4 => 'Deficiência auditiva', + 5 => 'Surdocegueira', + 6 => 'Deficiência física', + 7 => 'Deficiência intelectual', + 9 => 'Autismo infantil', + 10 => 'Síndrome de Asperger', + 11 => 'Síndrome de Rett', + 12 => 'Transtorno desintegrativo da infância', + 13 => 'Altas habilidades/Superdotação' + ]; + + $options = [ + 'label' => 'Deficiência educacenso', + 'resources' => $resources, + 'value' => $this->deficiencia_educacenso + ]; + $this->inputsHelper()->select('deficiencia_educacenso', $options); - } - function Novo() + public function Novo() { @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; + $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); - $obj = new clsCadastroDeficiencia( $this->cod_deficiencia, $this->nm_deficiencia, $this->deficiencia_educacenso ); + $obj = new clsCadastroDeficiencia($this->cod_deficiencia, $this->nm_deficiencia, $this->deficiencia_educacenso); $cadastrou = $obj->cadastra(); - if( $cadastrou ) - { + if ($cadastrou) { $deficiencia = new clsCadastroDeficiencia($cadastrou); $deficiencia = $deficiencia->detalhe(); - $auditoria = new clsModulesAuditoriaGeral("deficiencia", $this->pessoa_logada, $cadastrou); + $auditoria = new clsModulesAuditoriaGeral('deficiencia', $this->pessoa_logada, $cadastrou); $auditoria->inclusao($deficiencia); - $this->mensagem .= "Cadastro efetuado com sucesso.
"; - header( "Location: educar_deficiencia_lst.php" ); + $this->mensagem .= 'Cadastro efetuado com sucesso.
'; + header('Location: educar_deficiencia_lst.php'); die(); + return true; } - $this->mensagem = "Cadastro não realizado.
"; + $this->mensagem = 'Cadastro não realizado.
'; echo ""; + return false; } - function Editar() + public function Editar() { @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; + $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $deficienciaDetalhe = new clsCadastroDeficiencia($this->cod_deficiencia); @@ -167,46 +147,48 @@ function Editar() $obj = new clsCadastroDeficiencia($this->cod_deficiencia, $this->nm_deficiencia, $this->deficiencia_educacenso); $editou = $obj->edita(); - if( $editou ) - { + if ($editou) { $deficienciaDetalheDepois = $deficienciaDetalhe->detalhe(); - $auditoria = new clsModulesAuditoriaGeral("deficiencia", $this->pessoa_logada, $this->cod_deficiencia); + $auditoria = new clsModulesAuditoriaGeral('deficiencia', $this->pessoa_logada, $this->cod_deficiencia); $auditoria->alteracao($deficienciaDetalheAntes, $deficienciaDetalheDepois); - $this->mensagem .= "Edição efetuada com sucesso.
"; - header( "Location: educar_deficiencia_lst.php" ); + $this->mensagem .= 'Edição efetuada com sucesso.
'; + header('Location: educar_deficiencia_lst.php'); die(); + return true; } - $this->mensagem = "Edição não realizada.
"; + $this->mensagem = 'Edição não realizada.
'; echo ""; + return false; } - function Excluir() + public function Excluir() { @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; + $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj = new clsCadastroDeficiencia($this->cod_deficiencia, $this->nm_deficiencia); $detalhe = $obj->detalhe(); $excluiu = $obj->excluir(); - if( $excluiu ) - { - $auditoria = new clsModulesAuditoriaGeral("deficiencia", $this->pessoa_logada, $this->cod_deficiencia); + if ($excluiu) { + $auditoria = new clsModulesAuditoriaGeral('deficiencia', $this->pessoa_logada, $this->cod_deficiencia); $auditoria->exclusao($detalhe); - $this->mensagem .= "Exclusão efetuada com sucesso.
"; - header( "Location: educar_deficiencia_lst.php" ); + $this->mensagem .= 'Exclusão efetuada com sucesso.
'; + header('Location: educar_deficiencia_lst.php'); die(); + return true; } - $this->mensagem = "Exclusão não realizada.
"; + $this->mensagem = 'Exclusão não realizada.
'; echo ""; + return false; } } @@ -216,7 +198,7 @@ function Excluir() // cria o conteudo $miolo = new indice(); // adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); +$pagina->addForm($miolo); // gera o html $pagina->MakeAll(); ?> diff --git a/ieducar/intranet/include/pessoa/clsCadastroDeficiencia.inc.php b/ieducar/intranet/include/pessoa/clsCadastroDeficiencia.inc.php index f39d3e0b88..ae50fc6511 100644 --- a/ieducar/intranet/include/pessoa/clsCadastroDeficiencia.inc.php +++ b/ieducar/intranet/include/pessoa/clsCadastroDeficiencia.inc.php @@ -1,342 +1,326 @@ - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Prefeitura Municipal de Itajaí - * @category i-Educar - * @license @@license@@ - * @package iEd_Pessoa - * @since Arquivo disponível desde a versão 1.0.0 - * @version $Id$ - */ - -/** - * clsCadastroDeficiencia class. - * - * @author Prefeitura Municipal de Itajaí - * @category i-Educar - * @license @@license@@ - * @package iEd_Pessoa - * @since Classe disponível desde a versão 1.0.0 - * @version @@package_version@@ - */ class clsCadastroDeficiencia { - var $cod_deficiencia; - var $nm_deficiencia; - var $deficiencia_educacenso; - - /** - * Armazena o total de resultados obtidos na última chamada ao método lista(). - * @var int - */ - var $_total; - - /** - * Nome do schema. - * @var string - */ - var $_schema; - - /** - * Nome da tabela. - * @var string - */ - var $_tabela; - - /** - * Lista separada por vírgula, com os campos que devem ser selecionados na - * próxima chamado ao método lista(). - * @var string - */ - var $_campos_lista; - - /** - * Lista com todos os campos da tabela separados por vírgula, padrão para - * seleção no método lista. - * @var string - */ - var $_todos_campos; - - /** - * Valor que define a quantidade de registros a ser retornada pelo método lista(). - * @var int - */ - var $_limite_quantidade; - - /** - * Define o valor de offset no retorno dos registros no método lista(). - * @var int - */ - var $_limite_offset; - - /** - * Define o campo para ser usado como padrão de ordenação no método lista(). - * @var string - */ - var $_campo_order_by; - - /** - * Construtor. - */ - function __construct($cod_deficiencia = NULL, $nm_deficiencia = NULL, $deficiencia_educacenso = NULL) - { - $db = new clsBanco(); - $this->_schema = 'cadastro.'; - $this->_tabela = "{$this->_schema}deficiencia"; - - $this->_campos_lista = $this->_todos_campos = 'cod_deficiencia, nm_deficiencia, deficiencia_educacenso'; - - if (is_numeric($cod_deficiencia)) { - $this->cod_deficiencia = $cod_deficiencia; + public $cod_deficiencia; + public $nm_deficiencia; + public $deficiencia_educacenso; + + /** + * Armazena o total de resultados obtidos na última chamada ao método lista(). + * + * @var int + */ + public $_total; + + /** + * Nome do schema. + * + * @var string + */ + public $_schema; + + /** + * Nome da tabela. + * + * @var string + */ + public $_tabela; + + /** + * Lista separada por vírgula, com os campos que devem ser selecionados na + * próxima chamado ao método lista(). + * + * @var string + */ + public $_campos_lista; + + /** + * Lista com todos os campos da tabela separados por vírgula, padrão para + * seleção no método lista. + * + * @var string + */ + public $_todos_campos; + + /** + * Valor que define a quantidade de registros a ser retornada pelo método lista(). + * + * @var int + */ + public $_limite_quantidade; + + /** + * Define o valor de offset no retorno dos registros no método lista(). + * + * @var int + */ + public $_limite_offset; + + /** + * Define o campo para ser usado como padrão de ordenação no método lista(). + * + * @var string + */ + public $_campo_order_by; + + /** + * Construtor. + */ + public function __construct($cod_deficiencia = null, $nm_deficiencia = null, $deficiencia_educacenso = null) + { + $db = new clsBanco(); + $this->_schema = 'cadastro.'; + $this->_tabela = "{$this->_schema}deficiencia"; + + $this->_campos_lista = $this->_todos_campos = 'cod_deficiencia, nm_deficiencia, deficiencia_educacenso'; + + if (is_numeric($cod_deficiencia)) { + $this->cod_deficiencia = $cod_deficiencia; + } + + if (is_string($nm_deficiencia)) { + $this->nm_deficiencia = $nm_deficiencia; + } + + if (is_numeric($deficiencia_educacenso)) { + $this->deficiencia_educacenso = $deficiencia_educacenso; + } } - if (is_string($nm_deficiencia)) { - $this->nm_deficiencia = $nm_deficiencia; + /** + * Cria um novo registro. + * + * @return bool + */ + public function cadastra() + { + if (is_string($this->nm_deficiencia)) { + $db = new clsBanco(); + + $campos = ''; + $valores = ''; + $gruda = ''; + + if (is_numeric($this->cod_deficiencia)) { + $campos .= "{$gruda}cod_deficiencia"; + $valores .= "{$gruda}'{$this->cod_deficiencia}'"; + $gruda = ', '; + } + + if (is_string($this->nm_deficiencia)) { + $campos .= "{$gruda}nm_deficiencia"; + $valores .= "{$gruda}'{$this->nm_deficiencia}'"; + $gruda = ', '; + } + + if (is_numeric($this->deficiencia_educacenso)) { + $campos .= "{$gruda}deficiencia_educacenso"; + $valores .= "{$gruda}'{$this->deficiencia_educacenso}'"; + $gruda = ', '; + } + + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); + + return $db->InsertId("{$this->_tabela}_cod_deficiencia_seq"); + } + + return false; } - if (is_numeric($deficiencia_educacenso)) { - $this->deficiencia_educacenso = $deficiencia_educacenso; - } - } - - /** - * Cria um novo registro. - * @return bool - */ - function cadastra() - { - if (is_string($this->nm_deficiencia)) { - $db = new clsBanco(); - - $campos = ''; - $valores = ''; - $gruda = ''; - - if (is_numeric($this->cod_deficiencia)) { - $campos .= "{$gruda}cod_deficiencia"; - $valores .= "{$gruda}'{$this->cod_deficiencia}'"; - $gruda = ", "; - } - - if (is_string($this->nm_deficiencia)) { - $campos .= "{$gruda}nm_deficiencia"; - $valores .= "{$gruda}'{$this->nm_deficiencia}'"; - $gruda = ", "; - } - - if (is_numeric($this->deficiencia_educacenso)) { - $campos .= "{$gruda}deficiencia_educacenso"; - $valores .= "{$gruda}'{$this->deficiencia_educacenso}'"; - $gruda = ", "; - } - - $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" ); - return $db->InsertId( "{$this->_tabela}_cod_deficiencia_seq" ); - } - return FALSE; - } - - /** - * Edita os dados de um registro. - * @return bool - */ - function edita() - { - if (is_numeric($this->cod_deficiencia)) { - $db = new clsBanco(); - $set = ''; - - if (is_string($this->nm_deficiencia)) { - $set .= "{$gruda}nm_deficiencia = '{$this->nm_deficiencia}'"; - $gruda = ", "; - } - - if (is_numeric($this->deficiencia_educacenso)) { - $set .= "{$gruda}deficiencia_educacenso = '{$this->deficiencia_educacenso}'"; - $gruda = ", "; - } - - if ($set) { - $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_deficiencia = '{$this->cod_deficiencia}'"); - return TRUE; - } + /** + * Edita os dados de um registro. + * + * @return bool + */ + public function edita() + { + if (is_numeric($this->cod_deficiencia)) { + $db = new clsBanco(); + $set = ''; + + if (is_string($this->nm_deficiencia)) { + $set .= "{$gruda}nm_deficiencia = '{$this->nm_deficiencia}'"; + $gruda = ', '; + } + + if (is_numeric($this->deficiencia_educacenso)) { + $set .= "{$gruda}deficiencia_educacenso = '{$this->deficiencia_educacenso}'"; + $gruda = ', '; + } + + if ($set) { + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_deficiencia = '{$this->cod_deficiencia}'"); + + return true; + } + } + + return false; } - return FALSE; - } - - /** - * Retorna uma lista de registros filtrados de acordo com os parâmetros. - * @return array - */ - function lista($int_cod_deficiencia = NULL, $str_nm_deficiencia = NULL) - { - $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}"; - $filtros = ''; - - $whereAnd = ' WHERE '; - - if (is_numeric($int_cod_deficiencia)) { - $filtros .= "{$whereAnd} cod_deficiencia = '{$int_cod_deficiencia}'"; - $whereAnd = " AND "; + /** + * Retorna uma lista de registros filtrados de acordo com os parâmetros. + * + * @return array + */ + public function lista($int_cod_deficiencia = null, $str_nm_deficiencia = null) + { + $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}"; + $filtros = ''; + + $whereAnd = ' WHERE '; + + if (is_numeric($int_cod_deficiencia)) { + $filtros .= "{$whereAnd} cod_deficiencia = '{$int_cod_deficiencia}'"; + $whereAnd = ' AND '; + } + + if (is_string($str_nm_deficiencia)) { + $filtros .= "{$whereAnd} nm_deficiencia ILIKE '%{$str_nm_deficiencia}%'"; + $whereAnd = ' AND '; + } + + $db = new clsBanco(); + $countCampos = count(explode(',', $this->_campos_lista)); + $resultado = []; + + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); + + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$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; } - if (is_string($str_nm_deficiencia)) { - $filtros .= "{$whereAnd} nm_deficiencia ILIKE '%{$str_nm_deficiencia}%'"; - $whereAnd = " AND "; + /** + * Retorna um array com os dados de um registro. + * + * @return array + */ + public function detalhe() + { + if (is_numeric($this->cod_deficiencia)) { + $db = new clsBanco(); + $db->Consulta("SELECT {$this->_todos_campos} FROM {$this->_tabela} WHERE cod_deficiencia = '{$this->cod_deficiencia}'"); + $db->ProximoRegistro(); + + return $db->Tupla(); + } + + return false; } - $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} {$filtros}"); + /** + * Exclui um registro. + * + * @return bool + */ + public function excluir() + { + if (is_numeric($this->cod_deficiencia)) { + $this->excluiVinculosDeficiencia($this->cod_deficiencia); + $db = new clsBanco(); + $db->Consulta("DELETE FROM {$this->_tabela} WHERE cod_deficiencia = '{$this->cod_deficiencia}'"); + + return true; + } + + return false; + } - $db->Consulta($sql); + public function excluiVinculosDeficiencia($deficienciaId) + { + $db = new clsBanco(); + $db->Consulta(" DELETE FROM cadastro.fisica_deficiencia WHERE ref_cod_deficiencia = {$deficienciaId};"); - 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]; - } + return true; } - if (count($resultado)) { - return $resultado; + /** + * Define quais campos da tabela serão selecionados no método Lista(). + */ + public function setCamposLista($str_campos) + { + $this->_campos_lista = $str_campos; } - return FALSE; - } - - /** - * Retorna um array com os dados de um registro. - * @return array - */ - function detalhe() - { - if (is_numeric($this->cod_deficiencia)) { - $db = new clsBanco(); - $db->Consulta("SELECT {$this->_todos_campos} FROM {$this->_tabela} WHERE cod_deficiencia = '{$this->cod_deficiencia}'"); - $db->ProximoRegistro(); - return $db->Tupla(); + /** + * Define que o método Lista() deverpa retornar todos os campos da tabela. + */ + public function resetCamposLista() + { + $this->_campos_lista = $this->_todos_campos; } - return FALSE; - } - - /** - * Exclui um registro. - * @return bool - */ - function excluir() - { - if (is_numeric($this->cod_deficiencia)) { - $this->excluiVinculosDeficiencia($this->cod_deficiencia); - $db = new clsBanco(); - $db->Consulta("DELETE FROM {$this->_tabela} WHERE cod_deficiencia = '{$this->cod_deficiencia}'"); - return TRUE; + + /** + * Define limites de retorno para o método Lista(). + */ + public function setLimite($intLimiteQtd, $intLimiteOffset = null) + { + $this->_limite_quantidade = $intLimiteQtd; + $this->_limite_offset = $intLimiteOffset; } - return FALSE; - } - - function excluiVinculosDeficiencia($deficienciaId){ - $db = new clsBanco(); - $db->Consulta(" DELETE FROM cadastro.fisica_deficiencia WHERE ref_cod_deficiencia = {$deficienciaId};"); - return TRUE; - } - - /** - * Define quais campos da tabela serão selecionados no método Lista(). - */ - function setCamposLista($str_campos) - { - $this->_campos_lista = $str_campos; - } - - /** - * Define que o método Lista() deverpa retornar todos os campos da tabela. - */ - function resetCamposLista() - { - $this->_campos_lista = $this->_todos_campos; - } - - /** - * Define limites de retorno para o método Lista(). - */ - function setLimite($intLimiteQtd, $intLimiteOffset = NULL) - { - $this->_limite_quantidade = $intLimiteQtd; - $this->_limite_offset = $intLimiteOffset; - } - - /** - * Retorna a string com o trecho da query responsável pelo limite de - * registros retornados/afetados. - * - * @return string - */ - function getLimite() - { - if (is_numeric($this->_limite_quantidade)) { - $retorno = " LIMIT {$this->_limite_quantidade}"; - if (is_numeric($this->_limite_offset)) { - $retorno .= " OFFSET {$this->_limite_offset} "; - } - return $retorno; + /** + * Retorna a string com o trecho da query responsável pelo limite de + * registros retornados/afetados. + * + * @return string + */ + public function getLimite() + { + if (is_numeric($this->_limite_quantidade)) { + $retorno = " LIMIT {$this->_limite_quantidade}"; + if (is_numeric($this->_limite_offset)) { + $retorno .= " OFFSET {$this->_limite_offset} "; + } + + return $retorno; + } + + return ''; } - return ''; - } - - /** - * Define o campo para ser utilizado como ordenação no método Lista(). - */ - function setOrderby( $strNomeCampo ) - { - if (is_string($strNomeCampo) && $strNomeCampo) { - $this->_campo_order_by = $strNomeCampo; + + /** + * Define o campo para ser utilizado como ordenação no método Lista(). + */ + public function setOrderby($strNomeCampo) + { + if (is_string($strNomeCampo) && $strNomeCampo) { + $this->_campo_order_by = $strNomeCampo; + } } - } - - /** - * Retorna a string com o trecho da query responsável pela Ordenação dos - * registros. - * - * @return string - */ - function getOrderby() - { - if (is_string($this->_campo_order_by)) { - return " ORDER BY {$this->_campo_order_by} "; + + /** + * Retorna a string com o trecho da query responsável pela Ordenação dos + * registros. + * + * @return string + */ + public function getOrderby() + { + if (is_string($this->_campo_order_by)) { + return " ORDER BY {$this->_campo_order_by} "; + } + + return ''; } - return ''; - } -} \ No newline at end of file +} From b962ed3a13815c45287a6de97848f7c6ec312c4c Mon Sep 17 00:00:00 2001 From: bonot Date: Thu, 19 Jul 2018 17:00:35 -0300 Subject: [PATCH 21/73] Adiciona campo para desconsiderar deficiencia na regra diferenciada --- ieducar/intranet/educar_deficiencia_cad.php | 13 +++++++++-- .../pessoa/clsCadastroDeficiencia.inc.php | 22 +++++++++++++++++-- ...erar_deficiencia_na_regra_diferenciada.php | 16 ++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 ieducar/misc/database/migrations/20180719185458_cria_campo_para_desconsiderar_deficiencia_na_regra_diferenciada.php diff --git a/ieducar/intranet/educar_deficiencia_cad.php b/ieducar/intranet/educar_deficiencia_cad.php index 10fd527c3f..638f239902 100644 --- a/ieducar/intranet/educar_deficiencia_cad.php +++ b/ieducar/intranet/educar_deficiencia_cad.php @@ -106,6 +106,7 @@ public function Gerar() ]; $this->inputsHelper()->select('deficiencia_educacenso', $options); + $this->campoCheck('desconsidera_regra_diferenciada', 'Desconsiderar deficiência na regra de avaliação diferenciada', dbBool($this->desconsidera_regra_diferenciada)); } public function Novo() @@ -114,7 +115,11 @@ public function Novo() $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); - $obj = new clsCadastroDeficiencia($this->cod_deficiencia, $this->nm_deficiencia, $this->deficiencia_educacenso); + $obj = new clsCadastroDeficiencia($this->cod_deficiencia); + $obj->nm_deficiencia = $this->nm_deficiencia; + $obj->deficiencia_educacenso = $this->deficiencia_educacenso; + $obj->desconsidera_regra_diferenciada = is_null($this->desconsidera_regra_diferenciada) ? false : true; + $cadastrou = $obj->cadastra(); if ($cadastrou) { $deficiencia = new clsCadastroDeficiencia($cadastrou); @@ -145,7 +150,11 @@ public function Editar() $deficienciaDetalhe = new clsCadastroDeficiencia($this->cod_deficiencia); $deficienciaDetalheAntes = $deficienciaDetalhe->detalhe(); - $obj = new clsCadastroDeficiencia($this->cod_deficiencia, $this->nm_deficiencia, $this->deficiencia_educacenso); + $obj = new clsCadastroDeficiencia($this->cod_deficiencia); + $obj->nm_deficiencia = $this->nm_deficiencia; + $obj->deficiencia_educacenso = $this->deficiencia_educacenso; + $obj->desconsidera_regra_diferenciada = is_null($this->desconsidera_regra_diferenciada) ? false : true; + $editou = $obj->edita(); if ($editou) { $deficienciaDetalheDepois = $deficienciaDetalhe->detalhe(); diff --git a/ieducar/intranet/include/pessoa/clsCadastroDeficiencia.inc.php b/ieducar/intranet/include/pessoa/clsCadastroDeficiencia.inc.php index ae50fc6511..6b42cc7bcc 100644 --- a/ieducar/intranet/include/pessoa/clsCadastroDeficiencia.inc.php +++ b/ieducar/intranet/include/pessoa/clsCadastroDeficiencia.inc.php @@ -4,6 +4,7 @@ class clsCadastroDeficiencia public $cod_deficiencia; public $nm_deficiencia; public $deficiencia_educacenso; + public $desconsidera_regra_diferenciada; /** * Armazena o total de resultados obtidos na última chamada ao método lista(). @@ -66,13 +67,13 @@ class clsCadastroDeficiencia /** * Construtor. */ - public function __construct($cod_deficiencia = null, $nm_deficiencia = null, $deficiencia_educacenso = null) + public function __construct($cod_deficiencia = null, $nm_deficiencia = null, $deficiencia_educacenso = null, $desconsidera_regra_diferenciada = null) { $db = new clsBanco(); $this->_schema = 'cadastro.'; $this->_tabela = "{$this->_schema}deficiencia"; - $this->_campos_lista = $this->_todos_campos = 'cod_deficiencia, nm_deficiencia, deficiencia_educacenso'; + $this->_campos_lista = $this->_todos_campos = 'cod_deficiencia, nm_deficiencia, deficiencia_educacenso, desconsidera_regra_diferenciada '; if (is_numeric($cod_deficiencia)) { $this->cod_deficiencia = $cod_deficiencia; @@ -85,6 +86,10 @@ public function __construct($cod_deficiencia = null, $nm_deficiencia = null, $de if (is_numeric($deficiencia_educacenso)) { $this->deficiencia_educacenso = $deficiencia_educacenso; } + + if (is_bool($desconsidera_regra_diferenciada)) { + $this->desconsidera_regra_diferenciada = $desconsidera_regra_diferenciada; + } } /** @@ -119,6 +124,13 @@ public function cadastra() $gruda = ', '; } + if (is_bool($this->desconsidera_regra_diferenciada)) { + $desconsidera_regra_diferenciada = $this->desconsidera_regra_diferenciada ? 'true' : 'false'; + $campos .= "{$gruda}desconsidera_regra_diferenciada"; + $valores .= "{$gruda}'{$desconsidera_regra_diferenciada}'"; + $gruda = ', '; + } + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); return $db->InsertId("{$this->_tabela}_cod_deficiencia_seq"); @@ -148,6 +160,12 @@ public function edita() $gruda = ', '; } + if (is_bool($this->desconsidera_regra_diferenciada)) { + $desconsidera_regra_diferenciada = $this->desconsidera_regra_diferenciada ? 'true' : 'false'; + $set .= "{$gruda}desconsidera_regra_diferenciada = '{$desconsidera_regra_diferenciada}'"; + $gruda = ', '; + } + if ($set) { $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_deficiencia = '{$this->cod_deficiencia}'"); diff --git a/ieducar/misc/database/migrations/20180719185458_cria_campo_para_desconsiderar_deficiencia_na_regra_diferenciada.php b/ieducar/misc/database/migrations/20180719185458_cria_campo_para_desconsiderar_deficiencia_na_regra_diferenciada.php new file mode 100644 index 0000000000..740d700456 --- /dev/null +++ b/ieducar/misc/database/migrations/20180719185458_cria_campo_para_desconsiderar_deficiencia_na_regra_diferenciada.php @@ -0,0 +1,16 @@ +execute('ALTER TABLE cadastro.deficiencia ADD COLUMN desconsidera_regra_diferenciada BOOLEAN DEFAULT false;'); + } + + public function down() + { + $this->execute('ALTER TABLE cadastro.deficiencia DROP COLUMN desconsidera_regra_diferenciada;'); + } +} From 707bbb4b5dfcbaaaae88b6701b6aec522a4dcc03 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Thu, 19 Jul 2018 17:03:11 -0300 Subject: [PATCH 22/73] Corrige bug nos campos 24 e 39 --- .../modules/Api/Views/EducacensoExportController.php | 10 ++++------ .../Deficiencia/ValidaDeficienciaMultipla.php | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index f4bb0bddf8..ae873de304 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -989,7 +989,7 @@ protected function exportaDadosRegistro30($servidorId, $escolaId) } $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaProfessor()); - $r30s26 = (int)$validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasProfessor); + $r30s26 = $validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasProfessor); if ($r30s18 == 0) { $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = $r30s26 = null; @@ -1610,10 +1610,8 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, $r60s16 = 0; $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = $r60s24 = $r60s25 = $r60s26 = $r60s27 = $r60s28 = $r60s29 = null; - - // Caso não exista nenhum curso seta seq 40 como 1 - $r60s39 = (int)is_null($r60s30) && is_null($r60s31) && is_null($r60s32) && is_null($r60s33) && is_null($r60s34) - && is_null($r60s35) && is_null($r60s36) && is_null($r60s37) && is_null($r60s38); + + $r60s39 = null; // Define 'tipodeficiencia' => 'seqleiaute' $deficienciaToSeq = MapeamentoDeficienciasAluno::getArrayMapeamentoDeficiencias(); @@ -1661,7 +1659,7 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, } $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaAluno()); - $r60s24 = (int)$validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasAluno); + $r60s24 = $validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasAluno); //O campo 39 recebe 0 quando algum campo de 30 à 38 for igual a 1 for ($i = 30; $i <= 38; $i++) { diff --git a/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php b/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php index ca5ebb3974..5836e60c7a 100644 --- a/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php +++ b/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php @@ -23,15 +23,15 @@ public function __construct(CombinacaoDeficienciaMultipla $combinacao) public function possuiDeficienciaMultipla($deficiencias) { if (empty($deficiencias)) { - return false; + return null; } foreach ($this->combinacaoDeficiencias as $combinacao) { if (in_array($combinacao[0], $deficiencias) && in_array($combinacao[1], $deficiencias)) { - return true; + return 1; } } - return false; + return 0; } } \ No newline at end of file From 3a0631fca2fa49501b348b30462b0cc794c01646 Mon Sep 17 00:00:00 2001 From: bonot Date: Thu, 19 Jul 2018 17:46:54 -0300 Subject: [PATCH 23/73] =?UTF-8?q?Busca=20apenas=20defici=C3=AAncias=20n?= =?UTF-8?q?=C3=A3o=20desconsideradas;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A busca de alunos com deficiências funciona para aplicar mudanças específicas na regra de avaliação, porém algumas deficiências devem ser desconsideradas. --- ieducar/lib/App/Model/IedFinder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/ieducar/lib/App/Model/IedFinder.php b/ieducar/lib/App/Model/IedFinder.php index cc1beef5a7..1fa141d7e4 100644 --- a/ieducar/lib/App/Model/IedFinder.php +++ b/ieducar/lib/App/Model/IedFinder.php @@ -1168,6 +1168,7 @@ public static function verificaSePossuiDeficiencia($alunoId) { ON d.cod_deficiencia = fd.ref_cod_deficiencia WHERE a.cod_aluno = $1 AND d.nm_deficiencia NOT ILIKE \'nenhuma\' + AND d.desconsidera_regra_diferenciada = false LIMIT 1 '; return Portabilis_Utils_Database::selectField($sql,array('params' => array($alunoId))) == 1; From 5b87478f87869e00a4488d3a02643651c4f38a0b Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Thu, 19 Jul 2018 18:44:41 -0300 Subject: [PATCH 24/73] =?UTF-8?q?Ajusta=20exporta=C3=A7=C3=A3o=20censo=20r?= =?UTF-8?q?egistro=2070=20remover=20caracteres=20especiais=20do=20rg.=20Re?= =?UTF-8?q?fs=20#3946?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/modules/Api/Views/EducacensoExportController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index f4bb0bddf8..879cc3dc48 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -1720,7 +1720,7 @@ protected function exportaDadosRegistro70($escolaId, $ano, $data_ini, $data_fim, \'70\' AS r70s1, ece.cod_escola_inep AS r70s2, eca.cod_aluno_inep AS r70s3, - fd.rg AS r70s5, + REGEXP_REPLACE(fd.rg,\'[^a-zA-Z0-9ª°-]\',\'\',\'g\') AS r70s5, oer.codigo_educacenso AS r70s6, (SELECT cod_ibge FROM public.uf WHERE uf.sigla_uf = fd.sigla_uf_exp_rg) AS r70s7, fd.data_exp_rg AS r70s8, From 56b59fb3391b793990351f2b51966969d7ccdcca Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Fri, 20 Jul 2018 02:42:43 -0300 Subject: [PATCH 25/73] =?UTF-8?q?Ajusta=20para=20n=C3=A3o=20realizar=20val?= =?UTF-8?q?ida=C3=A7=C3=A3o=20em=20campos=20ocultos;=20Refs=20#3927?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/modules/Cadastro/Assets/Javascripts/Servidor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/modules/Cadastro/Assets/Javascripts/Servidor.js b/ieducar/modules/Cadastro/Assets/Javascripts/Servidor.js index 54ceb5b5db..b420ea72ba 100644 --- a/ieducar/modules/Cadastro/Assets/Javascripts/Servidor.js +++ b/ieducar/modules/Cadastro/Assets/Javascripts/Servidor.js @@ -1,6 +1,6 @@ $j('#btn_enviar').removeAttr('onclick'); $j('#btn_enviar').on('click', () => { - if (!validaServidor() || !validaPosGraduacao() || !validaCursoFormacaoContinuada() || !validationUtils.validatesFields(true)) { + if (!validaServidor() || !validaPosGraduacao() || !validaCursoFormacaoContinuada() || !validationUtils.validatesFields(false)) { return false; } From dc1a09c5de3eee9dbac59ff522af51fc5c0bb406 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 09:23:13 -0300 Subject: [PATCH 26/73] Refatora regra do campo 19 registro 20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Campo Turma participante do programa mais educação teve sua regra refatorada Também foram feitas algumas refatorações nas novas classes de validação do censo --- .../Api/Views/EducacensoExportController.php | 34 ++--- .../Deficiencia/ValidaDeficienciaMultipla.php | 37 ----- .../Deficiencia/ValueDeficienciaMultipla.php | 43 ++++++ .../Model/DependenciaAdministrativaEscola.php | 9 ++ .../Educacenso/Model/ModalidadeTurma.php | 8 ++ .../Educacenso/Model/TipoAtendimentoTurma.php | 10 ++ .../Model/TipoMediacaoDidaticoPedagogico.php | 10 ++ src/Modules/Educacenso/ValueInterface.php | 10 ++ .../Educacenso/ValueTurmaMaisEducacao.php | 129 ++++++++++++++++++ 9 files changed, 236 insertions(+), 54 deletions(-) delete mode 100644 src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php create mode 100644 src/Modules/Educacenso/Deficiencia/ValueDeficienciaMultipla.php create mode 100644 src/Modules/Educacenso/Model/DependenciaAdministrativaEscola.php create mode 100644 src/Modules/Educacenso/Model/ModalidadeTurma.php create mode 100644 src/Modules/Educacenso/Model/TipoAtendimentoTurma.php create mode 100644 src/Modules/Educacenso/Model/TipoMediacaoDidaticoPedagogico.php create mode 100644 src/Modules/Educacenso/ValueInterface.php create mode 100644 src/Modules/Educacenso/ValueTurmaMaisEducacao.php diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index f4bb0bddf8..f72698243d 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -3,7 +3,8 @@ use iEducar\Modules\Educacenso\Deficiencia\DeficienciaMultiplaAluno; use iEducar\Modules\Educacenso\Deficiencia\DeficienciaMultiplaProfessor; use iEducar\Modules\Educacenso\Deficiencia\MapeamentoDeficienciasAluno; -use iEducar\Modules\Educacenso\Deficiencia\ValidaDeficienciaMultipla; +use iEducar\Modules\Educacenso\Deficiencia\ValueDeficienciaMultipla; +use iEducar\Modules\Educacenso\ValueTurmaMaisEducacao; require_once 'lib/Portabilis/Controller/ApiCoreController.php'; require_once 'include/clsBanco.inc.php'; @@ -736,7 +737,7 @@ protected function exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_ // Transforma todos resultados em variáveis extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, - array('return_only' => 'first-row', 'params' => array($turmaId, $data_ini, $data_fim)))); + array('return_only' => 'first-row', 'params' => array(3588, $data_ini, $data_fim)))); if ($r20s1) { $r20s5 = $this->convertStringToCenso($r20s5); @@ -756,17 +757,16 @@ protected function exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_ $r20s26 = $r20s27 = $r20s28 = $r20s29 = $r20s30 = $r20s31 = $r20s32 = $r20s33 = $r20s34 = $r20s35 = $r20s36 = null; } - if (!in_array($dependencia_administrativa, array(2, 3))) { - $r20s19 = null; - } - - if (in_array($r20s18, array(1, 5))) { - $r20s19 = null; - } - - if (($r20s37 == 3) || !(($r20s38 >= 4 && $r20s38 <= 38) || $r20s38 == 41)) { - $r20s19 = null; - } + /** + * @var integer $dependencia_administrativa + * @var integer $r20s18 Tipo de atendimento + * @var integer $r20s37 Modalidade + * @var integer $r20s38 Etapa de ensino + * @var integer $r20s19 Turma mais educacao + * @var integer $r20s6 Tipo mediação + */ + $turmaMaisEducacao = new ValueTurmaMaisEducacao($dependencia_administrativa, $r20s18, $r20s37, $r20s38, $r20s19, $r20s6); + $r20s19 = $turmaMaisEducacao->getValue(); $coddigoEducacensoToSeq = array( @@ -988,8 +988,8 @@ protected function exportaDadosRegistro30($servidorId, $escolaId) $arrayDeficienciasProfessor[] = $deficienciaToSeq[$deficiencia_educacenso]; } - $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaProfessor()); - $r30s26 = (int)$validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasProfessor); + $validaDeficienciaMultipla = new ValueDeficienciaMultipla(new DeficienciaMultiplaProfessor(), $arrayDeficienciasProfessor); + $r30s26 = $validaDeficienciaMultipla->getValue(); if ($r30s18 == 0) { $r30s19 = $r30s20 = $r30s21 = $r30s22 = $r30s23 = $r30s24 = $r30s25 = $r30s26 = null; @@ -1660,8 +1660,8 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, $r60s39 = 1; } - $validaDeficienciaMultipla = new ValidaDeficienciaMultipla(new DeficienciaMultiplaAluno()); - $r60s24 = (int)$validaDeficienciaMultipla->possuiDeficienciaMultipla($arrayDeficienciasAluno); + $validaDeficienciaMultipla = new ValueDeficienciaMultipla(new DeficienciaMultiplaAluno(), $arrayDeficienciasAluno); + $r60s24 = $validaDeficienciaMultipla->getValue(); //O campo 39 recebe 0 quando algum campo de 30 à 38 for igual a 1 for ($i = 30; $i <= 38; $i++) { diff --git a/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php b/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php deleted file mode 100644 index ca5ebb3974..0000000000 --- a/src/Modules/Educacenso/Deficiencia/ValidaDeficienciaMultipla.php +++ /dev/null @@ -1,37 +0,0 @@ -combinacaoDeficiencias = $combinacao->getCombinacoes(); - } - - /** - * @param array $deficiencias - * @return bool - */ - public function possuiDeficienciaMultipla($deficiencias) - { - if (empty($deficiencias)) { - return false; - } - - foreach ($this->combinacaoDeficiencias as $combinacao) { - if (in_array($combinacao[0], $deficiencias) && in_array($combinacao[1], $deficiencias)) { - return true; - } - } - - return false; - } -} \ No newline at end of file diff --git a/src/Modules/Educacenso/Deficiencia/ValueDeficienciaMultipla.php b/src/Modules/Educacenso/Deficiencia/ValueDeficienciaMultipla.php new file mode 100644 index 0000000000..0ba033a525 --- /dev/null +++ b/src/Modules/Educacenso/Deficiencia/ValueDeficienciaMultipla.php @@ -0,0 +1,43 @@ +combinacaoDeficiencias = $combinacao->getCombinacoes(); + $this->deficiencias = $deficiencias; + } + + /** + * @return integer + */ + public function getValue() + { + if (empty($this->deficiencias)) { + return 0; + } + + foreach ($this->combinacaoDeficiencias as $combinacao) { + if (in_array($combinacao[0], $this->deficiencias) && in_array($combinacao[1], $this->deficiencias)) { + return 1; + } + } + + return 0; + } +} \ No newline at end of file diff --git a/src/Modules/Educacenso/Model/DependenciaAdministrativaEscola.php b/src/Modules/Educacenso/Model/DependenciaAdministrativaEscola.php new file mode 100644 index 0000000000..d3db4078be --- /dev/null +++ b/src/Modules/Educacenso/Model/DependenciaAdministrativaEscola.php @@ -0,0 +1,9 @@ +dependenciaAdministrativa = $dependenciaAdministrativa; + $this->tipoAtendimento = $tipoAtendimento; + $this->modalidade = $modalidade; + $this->etapaEnsino = $etapaEnsino; + $this->turmaMaisEducacao = $turmaMaisEducacao; + $this->tipoMediacao = $tipoMediacao; + } + + public function getValue() + { + if ($this->tipoMediacao != TipoMediacaoDidaticoPedagogico::PRESENCIAL) { + return null; + } + + if (!in_array($this->dependenciaAdministrativa, $this->getArrayDependencias())) { + return null; + } + + if (in_array($this->tipoAtendimento, $this->getArrayAtendimentos())) { + return null; + } + + if (!$this->atendeQuartaRegra()) { + return null; + } + + return $this->turmaMaisEducacao; + } + + private function getArrayDependencias() + { + return [ + DependenciaAdministrativaEscola::ESTADUAL, + DependenciaAdministrativaEscola::MUNICIPAL, + ]; + } + + private function getArrayAtendimentos() + { + return [ + TipoAtendimentoTurma::CLASSE_HOSPITALAR, + TipoAtendimentoTurma::AEE, + ]; + } + + private function getArrayEtapas() + { + return [ + '4', + '5', + '6', + '7', + '8', + '9', + '10', + '11', + '12', + '13', + '14', + '15', + '16', + '17', + '18', + '19', + '20', + '21', + '22', + '23', + '24', + '41', + '25', + '26', + '27', + '28', + '29', + '30', + '31', + '32', + '33', + '34', + '35', + '36', + '37', + '38', + ]; + } + + private function atendeQuartaRegra() + { + if ($this->tipoAtendimento != TipoAtendimentoTurma::ATIVIDADE_COMPLEMENTAR) { + if ($this->modalidade == ModalidadeTurma::EJA) { + return false; + } + + if (!in_array($this->etapaEnsino, $this->getArrayEtapas())) { + return false; + } + } + + return true; + } +} \ No newline at end of file From bec6ca6d459ac191a0b2b891d1dd7e094f438986 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 10:10:41 -0300 Subject: [PATCH 27/73] =?UTF-8?q?Refatora=20logica=20pra=20manter=20soment?= =?UTF-8?q?e=20um=20n=C3=ADvel=20de=20indenta=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Educacenso/ValueTurmaMaisEducacao.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Modules/Educacenso/ValueTurmaMaisEducacao.php b/src/Modules/Educacenso/ValueTurmaMaisEducacao.php index b65f612855..cdbe7d2b2b 100644 --- a/src/Modules/Educacenso/ValueTurmaMaisEducacao.php +++ b/src/Modules/Educacenso/ValueTurmaMaisEducacao.php @@ -114,14 +114,16 @@ private function getArrayEtapas() private function atendeQuartaRegra() { - if ($this->tipoAtendimento != TipoAtendimentoTurma::ATIVIDADE_COMPLEMENTAR) { - if ($this->modalidade == ModalidadeTurma::EJA) { - return false; - } - - if (!in_array($this->etapaEnsino, $this->getArrayEtapas())) { - return false; - } + if ($this->tipoAtendimento == TipoAtendimentoTurma::ATIVIDADE_COMPLEMENTAR) { + return true; + } + + if ($this->modalidade == ModalidadeTurma::EJA) { + return false; + } + + if (!in_array($this->etapaEnsino, $this->getArrayEtapas())) { + return false; } return true; From 6e5d70b03821aeec852ad91500793c0efb36593c Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 10:17:37 -0300 Subject: [PATCH 28/73] Corrige erro do id da turma fixo --- ieducar/modules/Api/Views/EducacensoExportController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index 2b04d5e7ff..515528d08f 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -737,7 +737,7 @@ protected function exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_ // Transforma todos resultados em variáveis extract(Portabilis_Utils_Database::fetchPreparedQuery($sql, - array('return_only' => 'first-row', 'params' => array(3588, $data_ini, $data_fim)))); + array('return_only' => 'first-row', 'params' => array($turmaId, $data_ini, $data_fim)))); if ($r20s1) { $r20s5 = $this->convertStringToCenso($r20s5); From cbe51ec7a2b5914c4d7a75ed9042c2619f76b92b Mon Sep 17 00:00:00 2001 From: bonot Date: Fri, 20 Jul 2018 10:45:14 -0300 Subject: [PATCH 29/73] =?UTF-8?q?Remove=20ternario=20desnecess=C3=A1rio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_deficiencia_cad.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ieducar/intranet/educar_deficiencia_cad.php b/ieducar/intranet/educar_deficiencia_cad.php index 638f239902..6323e85f59 100644 --- a/ieducar/intranet/educar_deficiencia_cad.php +++ b/ieducar/intranet/educar_deficiencia_cad.php @@ -118,8 +118,8 @@ public function Novo() $obj = new clsCadastroDeficiencia($this->cod_deficiencia); $obj->nm_deficiencia = $this->nm_deficiencia; $obj->deficiencia_educacenso = $this->deficiencia_educacenso; - $obj->desconsidera_regra_diferenciada = is_null($this->desconsidera_regra_diferenciada) ? false : true; - + $obj->desconsidera_regra_diferenciada = !is_null($this->desconsidera_regra_diferenciada); + $cadastrou = $obj->cadastra(); if ($cadastrou) { $deficiencia = new clsCadastroDeficiencia($cadastrou); @@ -153,7 +153,7 @@ public function Editar() $obj = new clsCadastroDeficiencia($this->cod_deficiencia); $obj->nm_deficiencia = $this->nm_deficiencia; $obj->deficiencia_educacenso = $this->deficiencia_educacenso; - $obj->desconsidera_regra_diferenciada = is_null($this->desconsidera_regra_diferenciada) ? false : true; + $obj->desconsidera_regra_diferenciada = !is_null($this->desconsidera_regra_diferenciada); $editou = $obj->edita(); if ($editou) { From 76302d42184585a391855ce36804f1a4df8dd392 Mon Sep 17 00:00:00 2001 From: bonot Date: Fri, 20 Jul 2018 11:01:51 -0300 Subject: [PATCH 30/73] =?UTF-8?q?Remove=20clausula=20que=20excetua=20defic?= =?UTF-8?q?i=C3=AAncia=20'Nenhuma'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Como foi criado um campo para desconsiderar a deficiencia da regra de avaliação diferenciada, o mesmo pode ser checado nos casos de cadastro de deficiência 'Nenhuma'. --- ieducar/lib/App/Model/IedFinder.php | 1 - 1 file changed, 1 deletion(-) diff --git a/ieducar/lib/App/Model/IedFinder.php b/ieducar/lib/App/Model/IedFinder.php index 1fa141d7e4..549d29b8a4 100644 --- a/ieducar/lib/App/Model/IedFinder.php +++ b/ieducar/lib/App/Model/IedFinder.php @@ -1167,7 +1167,6 @@ public static function verificaSePossuiDeficiencia($alunoId) { JOIN cadastro.deficiencia d ON d.cod_deficiencia = fd.ref_cod_deficiencia WHERE a.cod_aluno = $1 - AND d.nm_deficiencia NOT ILIKE \'nenhuma\' AND d.desconsidera_regra_diferenciada = false LIMIT 1 '; From b7b6856ebf3b100cb17c573d434ddbc22ad1086f Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 13:48:08 -0300 Subject: [PATCH 31/73] Refactor --- .../Api/Views/EducacensoExportController.php | 9 ++- .../Educacenso/ValueTurmaMaisEducacao.php | 64 ++++++++++++++----- 2 files changed, 56 insertions(+), 17 deletions(-) diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index 515528d08f..393f8015b4 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -765,7 +765,14 @@ protected function exportaDadosRegistro20($escolaId, $turmaId, $data_ini, $data_ * @var integer $r20s19 Turma mais educacao * @var integer $r20s6 Tipo mediação */ - $turmaMaisEducacao = new ValueTurmaMaisEducacao($dependencia_administrativa, $r20s18, $r20s37, $r20s38, $r20s19, $r20s6); + $turmaMaisEducacao = new ValueTurmaMaisEducacao(); + $turmaMaisEducacao->setDependenciaAdministrativa($dependencia_administrativa); + $turmaMaisEducacao->setTipoAtendimento($r20s18); + $turmaMaisEducacao->setModalidade($r20s37); + $turmaMaisEducacao->setEtapaEnsino($r20s38); + $turmaMaisEducacao->setTurmaMaisEducacao($r20s19); + $turmaMaisEducacao->setTipoMediacao($r20s6); + $r20s19 = $turmaMaisEducacao->getValue(); $coddigoEducacensoToSeq = diff --git a/src/Modules/Educacenso/ValueTurmaMaisEducacao.php b/src/Modules/Educacenso/ValueTurmaMaisEducacao.php index cdbe7d2b2b..d5858a1802 100644 --- a/src/Modules/Educacenso/ValueTurmaMaisEducacao.php +++ b/src/Modules/Educacenso/ValueTurmaMaisEducacao.php @@ -17,22 +17,6 @@ class ValueTurmaMaisEducacao implements ValueInterface private $turmaMaisEducacao; private $tipoMediacao; - public function __construct( - $dependenciaAdministrativa, - $tipoAtendimento, - $modalidade, - $etapaEnsino, - $turmaMaisEducacao, - $tipoMediacao - ) { - $this->dependenciaAdministrativa = $dependenciaAdministrativa; - $this->tipoAtendimento = $tipoAtendimento; - $this->modalidade = $modalidade; - $this->etapaEnsino = $etapaEnsino; - $this->turmaMaisEducacao = $turmaMaisEducacao; - $this->tipoMediacao = $tipoMediacao; - } - public function getValue() { if ($this->tipoMediacao != TipoMediacaoDidaticoPedagogico::PRESENCIAL) { @@ -128,4 +112,52 @@ private function atendeQuartaRegra() return true; } + + /** + * @param integer $dependenciaAdministrativa + */ + public function setDependenciaAdministrativa($dependenciaAdministrativa) + { + $this->dependenciaAdministrativa = $dependenciaAdministrativa; + } + + /** + * @param integer $tipoAtendimento + */ + public function setTipoAtendimento($tipoAtendimento) + { + $this->tipoAtendimento = $tipoAtendimento; + } + + /** + * @param integer $modalidade + */ + public function setModalidade($modalidade) + { + $this->modalidade = $modalidade; + } + + /** + * @param integer $etapaEnsino + */ + public function setEtapaEnsino($etapaEnsino) + { + $this->etapaEnsino = $etapaEnsino; + } + + /** + * @param integer $turmaMaisEducacao + */ + public function setTurmaMaisEducacao($turmaMaisEducacao) + { + $this->turmaMaisEducacao = $turmaMaisEducacao; + } + + /** + * @param integer $tipoMediacao + */ + public function setTipoMediacao($tipoMediacao) + { + $this->tipoMediacao = $tipoMediacao; + } } \ No newline at end of file From ff86a0f9b2ce7ebd33438d3a70df532a2eb9892e Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 13:48:55 -0300 Subject: [PATCH 32/73] =?UTF-8?q?Implementa=20testes=20para=20regra=20Turm?= =?UTF-8?q?a=20do=20Mais=20Educa=C3=A7=C3=A3o=20do=20censo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Educacenso/ValueTurmaMaisEducacaoTest.php | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php diff --git a/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php b/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php new file mode 100644 index 0000000000..fcdf7872a7 --- /dev/null +++ b/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php @@ -0,0 +1,75 @@ +getValueObject(); + $value->setTipoMediacao(2); + $this->assertEquals(null, $value->getValue()); + } + + public function testDependenciaAdministrativaInvalidoValueNull() + { + $value = $this->getValueObject(); + $value->setDependenciaAdministrativa(1); + $this->assertEquals(null, $value->getValue()); + } + + public function testTipoAtendimentoInvalidoValueNull() + { + $value = $this->getValueObject(); + $value->setTipoAtendimento(TipoAtendimentoTurma::CLASSE_HOSPITALAR); + $this->assertEquals(null, $value->getValue()); + } + + public function testTipoAtendimentoValidoModalidadeInvalidaValueNull() + { + $value = $this->getValueObject(); + $value->setTipoAtendimento(3); + $value->setModalidade(ModalidadeTurma::EJA); + $this->assertEquals(null, $value->getValue()); + } + + public function testTipoAtendimentoValidoModalidadeValidaEtapaEnsinoInvalidaValueNull() + { + $value = $this->getValueObject(); + $value->setTipoAtendimento(3); + $value->setEtapaEnsino(3); + $this->assertEquals(null, $value->getValue()); + } + + public function testValueNaoNulo() + { + $value = $this->getValueObject(); + $this->assertEquals(1, $value->getValue()); + + $value->setTurmaMaisEducacao(0); + $this->assertEquals(0, $value->getValue()); + } + + /** + * @return ValueTurmaMaisEducacao + */ + private function getValueObject() + { + $valueObject = new ValueTurmaMaisEducacao(); + $valueObject->setDependenciaAdministrativa(DependenciaAdministrativaEscola::MUNICIPAL); + $valueObject->setTipoAtendimento(TipoAtendimentoTurma::ATIVIDADE_COMPLEMENTAR); + $valueObject->setModalidade(1); + $valueObject->setEtapaEnsino(4); + $valueObject->setTipoMediacao(TipoMediacaoDidaticoPedagogico::PRESENCIAL); + $valueObject->setTurmaMaisEducacao(1); + + return $valueObject; + } +} \ No newline at end of file From fd11022e1013c9a178602c062e79f5633c9523e0 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 14:36:44 -0300 Subject: [PATCH 33/73] Melhorias sugeridas no review --- .../unit/Educacenso/ValueTurmaMaisEducacaoTest.php | 12 ++++++------ .../Deficiencia/ValueDeficienciaMultipla.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php b/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php index fcdf7872a7..5ad762ab59 100644 --- a/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php +++ b/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php @@ -1,6 +1,6 @@ getValueObject(); $value->setTipoMediacao(2); - $this->assertEquals(null, $value->getValue()); + $this->assertNull($value->getValue()); } public function testDependenciaAdministrativaInvalidoValueNull() { $value = $this->getValueObject(); $value->setDependenciaAdministrativa(1); - $this->assertEquals(null, $value->getValue()); + $this->assertNull($value->getValue()); } public function testTipoAtendimentoInvalidoValueNull() { $value = $this->getValueObject(); $value->setTipoAtendimento(TipoAtendimentoTurma::CLASSE_HOSPITALAR); - $this->assertEquals(null, $value->getValue()); + $this->assertNull($value->getValue()); } public function testTipoAtendimentoValidoModalidadeInvalidaValueNull() @@ -37,7 +37,7 @@ public function testTipoAtendimentoValidoModalidadeInvalidaValueNull() $value = $this->getValueObject(); $value->setTipoAtendimento(3); $value->setModalidade(ModalidadeTurma::EJA); - $this->assertEquals(null, $value->getValue()); + $this->assertNull($value->getValue()); } public function testTipoAtendimentoValidoModalidadeValidaEtapaEnsinoInvalidaValueNull() @@ -45,7 +45,7 @@ public function testTipoAtendimentoValidoModalidadeValidaEtapaEnsinoInvalidaValu $value = $this->getValueObject(); $value->setTipoAtendimento(3); $value->setEtapaEnsino(3); - $this->assertEquals(null, $value->getValue()); + $this->assertNull($value->getValue()); } public function testValueNaoNulo() diff --git a/src/Modules/Educacenso/Deficiencia/ValueDeficienciaMultipla.php b/src/Modules/Educacenso/Deficiencia/ValueDeficienciaMultipla.php index d24056d593..99564c8c17 100644 --- a/src/Modules/Educacenso/Deficiencia/ValueDeficienciaMultipla.php +++ b/src/Modules/Educacenso/Deficiencia/ValueDeficienciaMultipla.php @@ -24,7 +24,7 @@ public function __construct(CombinacaoDeficienciaMultipla $combinacao, $deficien } /** - * @return integer + * @return integer|null */ public function getValue() { From f92a43864c55448e77abc37eae5ee14f20825f11 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 14:50:14 -0300 Subject: [PATCH 34/73] Renomeia classe ModalidadeTurma para ModalidadeCurso --- ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php | 4 ++-- .../Model/{ModalidadeTurma.php => ModalidadeCurso.php} | 2 +- src/Modules/Educacenso/ValueTurmaMaisEducacao.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/Modules/Educacenso/Model/{ModalidadeTurma.php => ModalidadeCurso.php} (77%) diff --git a/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php b/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php index 5ad762ab59..440f8d1768 100644 --- a/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php +++ b/ieducar/tests/unit/Educacenso/ValueTurmaMaisEducacaoTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\Educacenso; use iEducar\Modules\Educacenso\Model\DependenciaAdministrativaEscola; -use iEducar\Modules\Educacenso\Model\ModalidadeTurma; +use iEducar\Modules\Educacenso\Model\ModalidadeCurso; use iEducar\Modules\Educacenso\Model\TipoAtendimentoTurma; use iEducar\Modules\Educacenso\Model\TipoMediacaoDidaticoPedagogico; use iEducar\Modules\Educacenso\ValueTurmaMaisEducacao; @@ -36,7 +36,7 @@ public function testTipoAtendimentoValidoModalidadeInvalidaValueNull() { $value = $this->getValueObject(); $value->setTipoAtendimento(3); - $value->setModalidade(ModalidadeTurma::EJA); + $value->setModalidade(ModalidadeCurso::EJA); $this->assertNull($value->getValue()); } diff --git a/src/Modules/Educacenso/Model/ModalidadeTurma.php b/src/Modules/Educacenso/Model/ModalidadeCurso.php similarity index 77% rename from src/Modules/Educacenso/Model/ModalidadeTurma.php rename to src/Modules/Educacenso/Model/ModalidadeCurso.php index c9e8262723..9ccd04a504 100644 --- a/src/Modules/Educacenso/Model/ModalidadeTurma.php +++ b/src/Modules/Educacenso/Model/ModalidadeCurso.php @@ -2,7 +2,7 @@ namespace iEducar\Modules\Educacenso\Model; -class ModalidadeTurma +class ModalidadeCurso { const EJA = 3; } \ No newline at end of file diff --git a/src/Modules/Educacenso/ValueTurmaMaisEducacao.php b/src/Modules/Educacenso/ValueTurmaMaisEducacao.php index d5858a1802..29f469cf24 100644 --- a/src/Modules/Educacenso/ValueTurmaMaisEducacao.php +++ b/src/Modules/Educacenso/ValueTurmaMaisEducacao.php @@ -3,7 +3,7 @@ namespace iEducar\Modules\Educacenso; use iEducar\Modules\Educacenso\Model\DependenciaAdministrativaEscola; -use iEducar\Modules\Educacenso\Model\ModalidadeTurma; +use iEducar\Modules\Educacenso\Model\ModalidadeCurso; use iEducar\Modules\Educacenso\Model\TipoAtendimentoTurma; use iEducar\Modules\Educacenso\Model\TipoMediacaoDidaticoPedagogico; @@ -102,7 +102,7 @@ private function atendeQuartaRegra() return true; } - if ($this->modalidade == ModalidadeTurma::EJA) { + if ($this->modalidade == ModalidadeCurso::EJA) { return false; } From af0412b9f0a951ba064c0ace01ae7bbd103dbbdc Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Fri, 20 Jul 2018 17:06:32 -0300 Subject: [PATCH 35/73] Corrige bloqueio dos campos horas cadastro turma; Refs #3924 Removido disabilitar na abertura da tela, e deixado somente no js. --- ieducar/intranet/educar_turma_cad.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ieducar/intranet/educar_turma_cad.php b/ieducar/intranet/educar_turma_cad.php index b062b8cc9a..8f293ced1b 100644 --- a/ieducar/intranet/educar_turma_cad.php +++ b/ieducar/intranet/educar_turma_cad.php @@ -410,14 +410,14 @@ function Gerar() $this->hora_fim_intervalo = ""; $this->dias_semana = array(); } - $this->campoHora('hora_inicial', 'Hora inicial', $this->hora_inicial, FALSE, NULL, NULL, NULL, !$this->obrigaCamposHorario()); + $this->campoHora('hora_inicial', 'Hora inicial', $this->hora_inicial, FALSE, NULL, NULL, NULL); - $this->campoHora('hora_final', 'Hora final', $this->hora_final, FALSE, NULL, NULL, NULL, !$this->obrigaCamposHorario()); + $this->campoHora('hora_final', 'Hora final', $this->hora_final, FALSE, NULL, NULL, NULL); $this->campoHora('hora_inicio_intervalo', 'Hora início intervalo', - $this->hora_inicio_intervalo, FALSE, NULL, NULL, NULL, !$this->obrigaCamposHorario()); + $this->hora_inicio_intervalo, FALSE, NULL, NULL, NULL); - $this->campoHora( 'hora_fim_intervalo', 'Hora fim intervalo', $this->hora_fim_intervalo, FALSE, NULL, NULL, NULL, !$this->obrigaCamposHorario()); + $this->campoHora( 'hora_fim_intervalo', 'Hora fim intervalo', $this->hora_fim_intervalo, FALSE, NULL, NULL, NULL); $helperOptions = array('objectName' => 'dias_semana'); $options = array('label' => 'Dias da semana', From 5705c7c074bb32650aea411339a1834349c9466b Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 17:34:18 -0300 Subject: [PATCH 36/73] Adiciona constantes faltando na classe DependenciaAdministrativaEscola --- .../Educacenso/Model/DependenciaAdministrativaEscola.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Modules/Educacenso/Model/DependenciaAdministrativaEscola.php b/src/Modules/Educacenso/Model/DependenciaAdministrativaEscola.php index d3db4078be..075601ea62 100644 --- a/src/Modules/Educacenso/Model/DependenciaAdministrativaEscola.php +++ b/src/Modules/Educacenso/Model/DependenciaAdministrativaEscola.php @@ -4,6 +4,8 @@ class DependenciaAdministrativaEscola { + const FEREDAL = 1; const ESTADUAL = 2; const MUNICIPAL = 3; + const PRIVADA = 4; } \ No newline at end of file From 50b0f4f5b9299164535c0564bb7d51153b12c791 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 18:29:20 -0300 Subject: [PATCH 37/73] =?UTF-8?q?Trata=20JSON=20do=20campo=20laudo=20m?= =?UTF-8?q?=C3=A9dico=20do=20aluno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A exibição do campo laudo médico do aluno não estava esperando um JSON. A funcionalidade foi alterada para que funcione da forma que os dados estão armazenados hoje --- ieducar/intranet/educar_aluno_det.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ieducar/intranet/educar_aluno_det.php b/ieducar/intranet/educar_aluno_det.php index ee9625e552..367015fbb0 100644 --- a/ieducar/intranet/educar_aluno_det.php +++ b/ieducar/intranet/educar_aluno_det.php @@ -627,11 +627,11 @@ function Gerar() $cor = '#D1DADF'; - $urlLaudoMedico = explode(",", $registro['url_laudo_medico']); - for ($i = 0; $i < count($urlLaudoMedico); $i++) { + $arrayLaudoMedico = json_decode($registro['url_laudo_medico']); + foreach ($arrayLaudoMedico as $key => $laudoMedico) { $cor = $cor == '#D1DADF' ? '#f5f9fd' : '#D1DADF'; - $tabela .= " Visualizar laudo " . (count($urlLaudoMedico) > 1 ? ($i + 1) : "") . " "; + $tabela .= " Visualizar laudo " . (count($arrayLaudoMedico) > 1 ? ($key + 1) : "") . " "; } $tabela .= ''; From 65ecd9f33986d269f4898bacd34571d78ffc3718 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 19:04:43 -0300 Subject: [PATCH 38/73] =?UTF-8?q?Corrige=20alguns=20erros=20gerados=20por?= =?UTF-8?q?=20vari=C3=A1veis=20e=20indices=20n=C3=A3o=20existentes=20na=20?= =?UTF-8?q?tela=20de=20aluno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_aluno_det.php | 24 +++++++++---------- .../include/pessoa/clsDocumento.inc.php | 2 +- .../include/pessoa/clsEnderecoPessoa.inc.php | 8 +------ .../include/pessoa/clsEstadoCivil.inc.php | 1 + .../include/pessoa/clsMunicipio.inc.php | 2 +- .../include/pessoa/clsPessoaFj.inc.php | 2 +- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/ieducar/intranet/educar_aluno_det.php b/ieducar/intranet/educar_aluno_det.php index 367015fbb0..072d55af70 100644 --- a/ieducar/intranet/educar_aluno_det.php +++ b/ieducar/intranet/educar_aluno_det.php @@ -228,11 +228,11 @@ function Gerar() $registro['ddd_fone_2'] = $det_pessoa_fj['ddd_2']; $registro['fone_2'] = $det_pessoa_fj['fone_2']; - $registro['ddd_fax'] = $det_pessoa_fj['ddd_fax']; - $registro['fone_fax'] = $det_pessoa_fj['fone_fax']; + $registro['ddd_fax'] = $det_pessoa_fj['ddd_fax'] ?? null; + $registro['fone_fax'] = $det_pessoa_fj['fone_fax'] ?? null; - $registro['ddd_mov'] = $det_pessoa_fj['ddd_mov']; - $registro['fone_mov'] = $det_pessoa_fj['fone_mov']; + $registro['ddd_mov'] = $det_pessoa_fj['ddd_mov'] ?? null; + $registro['fone_mov'] = $det_pessoa_fj['fone_mov'] ?? null; $obj_deficiencia_pessoa = new clsCadastroFisicaDeficiencia(); $obj_deficiencia_pessoa_lista = $obj_deficiencia_pessoa->lista($this->ref_idpes); @@ -285,10 +285,10 @@ function Gerar() } $registro['sigla_uf_cart_trabalho'] = $detalheDocumento['sigla_uf_cart_trabalho']; - $registro['num_tit_eleitor'] = $detalheDocumento['num_titulo_eleitor']; - $registro['zona_tit_eleitor'] = $detalheDocumento['zona_titulo_eleitor']; - $registro['secao_tit_eleitor'] = $detalheDocumento['secao_titulo_eleitor']; - $registro['idorg_exp_rg'] = $detalheDocumento['ref_idorg_rg']; + $registro['num_tit_eleitor'] = $detalheDocumento['num_titulo_eleitor'] ?? null; + $registro['zona_tit_eleitor'] = $detalheDocumento['zona_titulo_eleitor'] ?? null; + $registro['secao_tit_eleitor'] = $detalheDocumento['secao_titulo_eleitor'] ?? null; + $registro['idorg_exp_rg'] = $detalheDocumento['ref_idorg_rg'] ?? null; $obj_endereco = new clsPessoaEndereco($this->ref_idpes); @@ -302,7 +302,7 @@ function Gerar() $registro['andar'] = $obj_endereco_det['andar']; $registro['apartamento'] = $obj_endereco_det['apartamento']; $registro['bloco'] = $obj_endereco_det['bloco']; - $registro['nm_logradouro'] = $obj_endereco_det['logradouro']; + $registro['nm_logradouro'] = $obj_endereco_det['logradouro'] ?? null; $registro['cep_'] = int2CEP($registro['id_cep']); $obj_bairro = new clsBairro($registro['id_bairro']); @@ -352,7 +352,7 @@ function Gerar() $registro['idtlog'] = $registro['idtlog']['descricao']; $det_uf = $obj_endereco_det['sigla_uf']->detalhe(); - $registro['ref_sigla_uf'] = $det_uf['nome']; + $registro['ref_sigla_uf'] = $det_uf['nome'] ?? null; $registro['cep_'] = int2CEP($registro['id_cep']); } @@ -425,8 +425,8 @@ function Gerar() $this->addDetalhe(array('CEP', $registro['cep_'])); } - if ($registro['ref_sigla_uf']) { - $this->addDetalhe(array('UF', $registro['ref_sigla_uf'])); + if (isset($registro['ref_sigla_uf']) && !empty($registro['ref_sigla_uf'])) { + $this->addDetalhe(array('UF', $registro['ref_sigla_uf'] ?? null)); } if ($registro['cidade']) { diff --git a/ieducar/intranet/include/pessoa/clsDocumento.inc.php b/ieducar/intranet/include/pessoa/clsDocumento.inc.php index 137dba1712..1d85345184 100644 --- a/ieducar/intranet/include/pessoa/clsDocumento.inc.php +++ b/ieducar/intranet/include/pessoa/clsDocumento.inc.php @@ -822,7 +822,7 @@ function detalhe() $this->certidao_casamento = $tupla["certidao_casamento"]; $this->passaporte = $tupla["passaporte"]; - $tupla["idpes"] = $tupla["idpes"]; + $tupla["idpes"] = $tupla["idpes"] ?? null; $tupla["idorg_exp_rg"] = $tupla["idorg_exp_rg"]; $tupla["sigla_uf_cart_trabalho"] = $tupla["sigla_uf_cart_trabalho"]; $tupla["sigla_uf_cert_civil"] = $tupla["sigla_uf_cert_civil"]; diff --git a/ieducar/intranet/include/pessoa/clsEnderecoPessoa.inc.php b/ieducar/intranet/include/pessoa/clsEnderecoPessoa.inc.php index 7faa1fbe34..5ee8a81ecc 100644 --- a/ieducar/intranet/include/pessoa/clsEnderecoPessoa.inc.php +++ b/ieducar/intranet/include/pessoa/clsEnderecoPessoa.inc.php @@ -348,13 +348,7 @@ function detalhe() $cep = $tupla['cep']; $tupla['cep'] = new clsCepLogradouro($cep, $tupla['idlog']); - #$tupla['idlog'] = new clsCepLogradouro($cep, $tupla['idlog']); - - #$tupla['idbai'] = new clsPublicBairro(NULL, NULL, $tupla['idbai']); - - #$bairro = $tupla['idbai']->detalhe(); - - $tupla['zona_localizacao'] = $bairro['zona_localizacao']; + $tupla['zona_localizacao'] = null; return $tupla; } diff --git a/ieducar/intranet/include/pessoa/clsEstadoCivil.inc.php b/ieducar/intranet/include/pessoa/clsEstadoCivil.inc.php index d892ff8f11..1ee6c9d66e 100644 --- a/ieducar/intranet/include/pessoa/clsEstadoCivil.inc.php +++ b/ieducar/intranet/include/pessoa/clsEstadoCivil.inc.php @@ -107,6 +107,7 @@ function exclui( ) function lista( $int_ideciv=false, $str_descricao=false, $str_ordenacao="descricao", $int_limite_ini=0, $int_limite_qtd=20 ) { // verificacoes de filtros a serem usados + $where = ''; $whereAnd = "WHERE "; if(is_numeric($int_ideciv)) { diff --git a/ieducar/intranet/include/pessoa/clsMunicipio.inc.php b/ieducar/intranet/include/pessoa/clsMunicipio.inc.php index 8c4f18b41e..83805d0814 100644 --- a/ieducar/intranet/include/pessoa/clsMunicipio.inc.php +++ b/ieducar/intranet/include/pessoa/clsMunicipio.inc.php @@ -390,7 +390,7 @@ function detalhe() $tupla["sigla_uf"] = new clsUf( $tupla["sigla_uf"] ); $tupla["idasmun"] = new clsUf( $tupla["idasmun"] ); - $tupla["idmun_pai"] = new clsUf( $tupla["idamun_pai"] ); + $tupla["idmun_pai"] = new clsUf( $tupla["idamun_pai"] ?? null ); return $tupla; } diff --git a/ieducar/intranet/include/pessoa/clsPessoaFj.inc.php b/ieducar/intranet/include/pessoa/clsPessoaFj.inc.php index afcdaa0d3e..47f53f04c1 100644 --- a/ieducar/intranet/include/pessoa/clsPessoaFj.inc.php +++ b/ieducar/intranet/include/pessoa/clsPessoaFj.inc.php @@ -281,7 +281,7 @@ function detalhe() $this->logradouro = $detalheEndereco['logradouro']; $this->sigla_uf = $detalheEndereco['sigla_uf']; $this->cidade = $detalheEndereco['cidade']; - $this->reside_desde = $detalheEndereco['reside_desde']; + $this->reside_desde = $detalheEndereco['reside_desde'] ?? null; $this->idtlog = $detalheEndereco['idtlog']; $this->complemento = $detalheEndereco['complemento']; $this->numero = $detalheEndereco['numero']; From 025d162206fac4aff725cbdd649c6eba2b63ab72 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Fri, 20 Jul 2018 19:06:04 -0300 Subject: [PATCH 39/73] =?UTF-8?q?Melhora=20indenta=C3=A7=C3=A3o=20e=20remo?= =?UTF-8?q?ve=20coment=C3=A1rios=20antigos=20do=20arquivo=20educar=5Faluno?= =?UTF-8?q?=5Fdet.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_aluno_det.php | 134 ++++++++++++++------------ 1 file changed, 74 insertions(+), 60 deletions(-) diff --git a/ieducar/intranet/educar_aluno_det.php b/ieducar/intranet/educar_aluno_det.php index 072d55af70..75ebe4bc2d 100644 --- a/ieducar/intranet/educar_aluno_det.php +++ b/ieducar/intranet/educar_aluno_det.php @@ -1,33 +1,5 @@ - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Prefeitura Municipal de Itajaí - * @category i-Educar - * @license @@license@@ - * @package iEd_Pmieducar - * @since Arquivo disponível desde a versão 1.0.0 - * @version $Id$ - */ - require_once 'include/clsBase.inc.php'; require_once 'include/clsDetalhe.inc.php'; require_once 'include/clsBanco.inc.php'; @@ -238,7 +210,8 @@ function Gerar() $obj_deficiencia_pessoa_lista = $obj_deficiencia_pessoa->lista($this->ref_idpes); $obj_beneficios = new clsPmieducarAlunoBeneficio(); - $obj_beneficios_lista = $obj_beneficios->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->cod_aluno); + $obj_beneficios_lista = $obj_beneficios->lista(null, null, null, null, null, null, null, null, null, null, + $this->cod_aluno); if ($obj_deficiencia_pessoa_lista) { $deficiencia_pessoa = array(); @@ -365,7 +338,7 @@ function Gerar() // código inep $alunoMapper = new Educacenso_Model_AlunoDataMapper(); - $alunoInep = NULL; + $alunoInep = null; try { $alunoInep = $alunoMapper->find(array('aluno' => $this->cod_aluno)); @@ -394,7 +367,10 @@ function Gerar() if ($registro['nome_aluno']) { if ($caminhoFoto != null and $caminhoFoto != '') { - $this->addDetalhe(array('Nome Aluno', $registro['nome_aluno'] . '

')); + $this->addDetalhe(array( + 'Nome Aluno', + $registro['nome_aluno'] . '

' + )); } else { $this->addDetalhe(array('Nome Aluno', $registro['nome_aluno'])); } @@ -660,27 +636,29 @@ function Gerar() if (!$registro['tipo_cert_civil'] && $registro['certidao_nascimento']) { $this->addDetalhe(array('Tipo Certidão Civil', 'Nascimento (novo formato)')); $this->addDetalhe(array('Número Certidão Civil', $registro['certidao_nascimento'])); - } else if (!$registro['tipo_cert_civil'] && $registro['certidao_casamento']) { - $this->addDetalhe(array('Tipo Certidão Civil', 'Casamento (novo formato)')); - $this->addDetalhe(array('Número Certidão Civil', $registro['certidao_casamento'])); } else { - $lista_tipo_cert_civil = array(); - $lista_tipo_cert_civil["0"] = 'Selecione'; - $lista_tipo_cert_civil[91] = 'Nascimento (antigo formato)'; - $lista_tipo_cert_civil[92] = 'Casamento (antigo formato)'; + if (!$registro['tipo_cert_civil'] && $registro['certidao_casamento']) { + $this->addDetalhe(array('Tipo Certidão Civil', 'Casamento (novo formato)')); + $this->addDetalhe(array('Número Certidão Civil', $registro['certidao_casamento'])); + } else { + $lista_tipo_cert_civil = array(); + $lista_tipo_cert_civil["0"] = 'Selecione'; + $lista_tipo_cert_civil[91] = 'Nascimento (antigo formato)'; + $lista_tipo_cert_civil[92] = 'Casamento (antigo formato)'; - $this->addDetalhe(array('Tipo Certidão Civil', $lista_tipo_cert_civil[$registro['tipo_cert_civil']])); + $this->addDetalhe(array('Tipo Certidão Civil', $lista_tipo_cert_civil[$registro['tipo_cert_civil']])); - if ($registro['num_termo']) { - $this->addDetalhe(array('Termo', $registro['num_termo'])); - } + if ($registro['num_termo']) { + $this->addDetalhe(array('Termo', $registro['num_termo'])); + } - if ($registro['num_livro']) { - $this->addDetalhe(array('Livro', $registro['num_livro'])); - } + if ($registro['num_livro']) { + $this->addDetalhe(array('Livro', $registro['num_livro'])); + } - if ($registro['num_folha']) { - $this->addDetalhe(array('Folha', $registro['num_folha'])); + if ($registro['num_folha']) { + $this->addDetalhe(array('Folha', $registro['num_folha'])); + } } } @@ -710,13 +688,16 @@ function Gerar() // Transporte escolar. $transporteMapper = new Transporte_Model_AlunoDataMapper(); - $transporteAluno = NULL; + $transporteAluno = null; try { $transporteAluno = $transporteMapper->find(array('aluno' => $this->cod_aluno)); } catch (Exception $e) { } - $this->addDetalhe(array('Transporte escolar', isset($transporteAluno) && $transporteAluno->responsavel != 'Não utiliza' ? 'Sim' : 'Não utiliza')); + $this->addDetalhe(array( + 'Transporte escolar', + isset($transporteAluno) && $transporteAluno->responsavel != 'Não utiliza' ? 'Sim' : 'Não utiliza' + )); if ($transporteAluno && $transporteAluno->responsavel != 'Não utiliza') { $this->addDetalhe(array('Responsável transporte', $transporteAluno->responsavel)); } @@ -758,19 +739,28 @@ function Gerar() $this->addDetalhe(array('Número do cartão do SUS', $this->sus)); } - $this->addDetalhe(array('Possui alergia a algum medicamento', ($reg['alergia_medicamento'] == 'S' ? 'Sim' : 'Não'))); + $this->addDetalhe(array( + 'Possui alergia a algum medicamento', + ($reg['alergia_medicamento'] == 'S' ? 'Sim' : 'Não') + )); if (trim($reg['desc_alergia_medicamento']) != '') { $this->addDetalhe(array('Quais', $reg['desc_alergia_medicamento'])); } - $this->addDetalhe(array('Possui alergia a algum alimento', ($reg['alergia_alimento'] == 'S' ? 'Sim' : 'Não'))); + $this->addDetalhe(array( + 'Possui alergia a algum alimento', + ($reg['alergia_alimento'] == 'S' ? 'Sim' : 'Não') + )); if (trim($reg['desc_alergia_alimento']) != '') { $this->addDetalhe(array('Quais', $reg['desc_alergia_alimento'])); } - $this->addDetalhe(array('Possui alguma doenca congênita', ($reg['doenca_congenita'] == 'S' ? 'Sim' : 'Não'))); + $this->addDetalhe(array( + 'Possui alguma doenca congênita', + ($reg['doenca_congenita'] == 'S' ? 'Sim' : 'Não') + )); if (trim($reg['desc_doenca_congenita']) != '') { $this->addDetalhe(array('Quais', $reg['desc_doenca_congenita'])); @@ -801,19 +791,28 @@ function Gerar() $this->addDetalhe(array('Qual', $reg['desc_tratamento_medico'])); } - $this->addDetalhe(array('Ingere medicação específica', ($reg['medicacao_especifica'] == 'S' ? 'Sim' : 'Não'))); + $this->addDetalhe(array( + 'Ingere medicação específica', + ($reg['medicacao_especifica'] == 'S' ? 'Sim' : 'Não') + )); if (trim($reg['desc_medicacao_especifica']) != '') { $this->addDetalhe(array('Qual', $reg['desc_medicacao_especifica'])); } - $this->addDetalhe(array('Acompanhamento médico ou psicológico', ($reg['acomp_medico_psicologico'] == 'S' ? 'Sim' : 'Não'))); + $this->addDetalhe(array( + 'Acompanhamento médico ou psicológico', + ($reg['acomp_medico_psicologico'] == 'S' ? 'Sim' : 'Não') + )); if (trim($reg['desc_acomp_medico_psicologico']) != '') { $this->addDetalhe(array('Motivo', $reg['desc_acomp_medico_psicologico'])); } - $this->addDetalhe(array('Restrição para atividades físicas', ($reg['restricao_atividade_fisica'] == 'S' ? 'Sim' : 'Não'))); + $this->addDetalhe(array( + 'Restrição para atividades físicas', + ($reg['restricao_atividade_fisica'] == 'S' ? 'Sim' : 'Não') + )); if (trim($reg['desc_restricao_atividade_fisica']) != '') { $this->addDetalhe(array('Qual', $reg['desc_restricao_atividade_fisica'])); @@ -848,17 +847,32 @@ function Gerar() if ($reg) { if (dbBool($reg["kit_completo"])) { $this->addDetalhe(array("Recebeu kit completo", "Sim")); - $this->addDetalhe(array("" . Portabilis_String_Utils::toLatin1('Data da distribuição'), Portabilis_Date_Utils::pgSQLToBr($reg['data']))); + $this->addDetalhe(array( + "" . Portabilis_String_Utils::toLatin1('Data da distribuição'), + Portabilis_Date_Utils::pgSQLToBr($reg['data']) + )); } else { - $this->addDetalhe(array("Recebeu kit completo", Portabilis_String_Utils::toLatin1("Não"))); - $this->addDetalhe(array(Portabilis_String_Utils::toLatin1('Data da distribuição'), Portabilis_Date_Utils::pgSQLToBr($reg['data']))); - $this->addDetalhe(array(Portabilis_String_Utils::toLatin1("Quantidade de agasalhos (jaqueta e calça)"), $reg['agasalho_qtd'] ?: '0')); + $this->addDetalhe(array( + "Recebeu kit completo", + Portabilis_String_Utils::toLatin1("Não") + )); + $this->addDetalhe(array( + Portabilis_String_Utils::toLatin1('Data da distribuição'), + Portabilis_Date_Utils::pgSQLToBr($reg['data']) + )); + $this->addDetalhe(array( + Portabilis_String_Utils::toLatin1("Quantidade de agasalhos (jaqueta e calça)"), + $reg['agasalho_qtd'] ?: '0' + )); $this->addDetalhe(array("Quantidade de camisetas (manga curta)", $reg['camiseta_curta_qtd'] ?: '0')); $this->addDetalhe(array("Quantidade de camisetas (manga longa)", $reg['camiseta_longa_qtd'] ?: '0')); $this->addDetalhe(array("Quantidade de meias", $reg['meias_qtd'] ?: '0')); $this->addDetalhe(array("Bermudas tectels (masculino)", $reg['bermudas_tectels_qtd'] ?: '0')); $this->addDetalhe(array("Bermudas coton (feminino)", $reg['bermudas_coton_qtd'] ?: '0')); - $this->addDetalhe(array("" . Portabilis_String_Utils::toLatin1("Quantidade de tênis"), $reg['tenis_qtd'] ?: '0')); + $this->addDetalhe(array( + "" . Portabilis_String_Utils::toLatin1("Quantidade de tênis"), + $reg['tenis_qtd'] ?: '0' + )); } } From 80a35dbff1caf198bbde8fa457e2255bd2f8244a Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Mon, 23 Jul 2018 10:59:18 -0300 Subject: [PATCH 40/73] Corrige quebra de linha incorreta --- ieducar/intranet/educar_aluno_det.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ieducar/intranet/educar_aluno_det.php b/ieducar/intranet/educar_aluno_det.php index 75ebe4bc2d..853d2353b7 100644 --- a/ieducar/intranet/educar_aluno_det.php +++ b/ieducar/intranet/educar_aluno_det.php @@ -210,8 +210,7 @@ function Gerar() $obj_deficiencia_pessoa_lista = $obj_deficiencia_pessoa->lista($this->ref_idpes); $obj_beneficios = new clsPmieducarAlunoBeneficio(); - $obj_beneficios_lista = $obj_beneficios->lista(null, null, null, null, null, null, null, null, null, null, - $this->cod_aluno); + $obj_beneficios_lista = $obj_beneficios->lista(null, null, null, null, null, null, null, null, null, null, $this->cod_aluno); if ($obj_deficiencia_pessoa_lista) { $deficiencia_pessoa = array(); From 36b8bad81fa5703c63e4643c9d2f873038142d59 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Tue, 24 Jul 2018 15:50:29 -0300 Subject: [PATCH 41/73] =?UTF-8?q?Migra=20campo=20turma=20unificada=20da=20?= =?UTF-8?q?turma=20para=20enturma=C3=A7=C3=A3o=20da=20matr=C3=ADcula;=20Re?= =?UTF-8?q?fs=20#3976?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Criar migration para criar campo enturmação da matrícula, criar script para migração dos valores, remove campo da turma; Remove campo da tela de turma; Cria tela para alterar o valor do novo campo; Adicionado botão "Etapa da turma unificada" no detalhes da matrícula para acessar nova tela; --- ieducar/intranet/educar_matricula_det.php | 8 + .../educar_matricula_turma_unificada_cad.php | 155 + ieducar/intranet/educar_turma_cad.php | 1 - .../clsPmieducarMatriculaTurma.inc.php | 24 +- .../pmieducar/clsPmieducarTurma.inc.php | 5251 ++++++++--------- ieducar/lib/App/Model/Educacenso.php | 5 + ..._migra_turma_unificada_para_enturmacao.php | 26 + .../Cadastro/Assets/Javascripts/Turma.js | 27 +- 8 files changed, 2835 insertions(+), 2662 deletions(-) create mode 100644 ieducar/intranet/educar_matricula_turma_unificada_cad.php create mode 100755 ieducar/misc/database/migrations/20180724151229_migra_turma_unificada_para_enturmacao.php diff --git a/ieducar/intranet/educar_matricula_det.php b/ieducar/intranet/educar_matricula_det.php index 0a9c1c1294..49237cd3e7 100644 --- a/ieducar/intranet/educar_matricula_det.php +++ b/ieducar/intranet/educar_matricula_det.php @@ -183,6 +183,7 @@ function Gerar() $existeTurma = false; $existeTurmaMulti = false; + $existeTurmaUnificada = false; $nomesTurmas = array(); $datasEnturmacoes = array(); foreach ($enturmacoes as $enturmacao) { @@ -193,6 +194,9 @@ function Gerar() if (in_array($turma['etapa_educacenso'], App_Model_Educacenso::etapas_multisseriadas())) { $existeTurmaMulti = true; } + if (in_array($turma['etapa_educacenso'], App_Model_Educacenso::etapasEnsinoUnificadas())) { + $existeTurmaUnificada = true; + } } $nomesTurmas = implode('
', $nomesTurmas); $datasEnturmacoes = implode('
', $datasEnturmacoes); @@ -342,6 +346,10 @@ function Gerar() $this->array_botao_url_script[] = "go(\"educar_matricula_etapa_turma_cad.php?ref_cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}\")"; } + if ($existeTurmaUnificada) { + $this->array_botao[] = 'Etapa da turma unificada'; + $this->array_botao_url_script[] = "go(\"educar_matricula_turma_unificada_cad.php?ref_cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}\")"; + } if ($registro['aprovado'] != 4 && $registro['aprovado'] != 6) { if (is_array($lst_transferencia) && isset($data_transferencia)) { $this->array_botao[] = 'Cancelar solicitação transferência'; diff --git a/ieducar/intranet/educar_matricula_turma_unificada_cad.php b/ieducar/intranet/educar_matricula_turma_unificada_cad.php new file mode 100644 index 0000000000..d41bf3477b --- /dev/null +++ b/ieducar/intranet/educar_matricula_turma_unificada_cad.php @@ -0,0 +1,155 @@ +SetTitulo("{$this->_instituicao} i-Educar - Etapa da turma unificada"); + $this->processoAp = "578"; + $this->addEstilo("localizacaoSistema"); + } +} + +class indice extends clsCadastro +{ + public $cod_matricula; + public $ref_cod_aluno; + public $etapas_educacenso; + + public function Formular() + { + $this->nome_url_cancelar = "Voltar"; + $this->url_cancelar = "educar_matricula_det.php?cod_matricula={$this->cod_matricula}"; + $this->montaLocalizacao(); + } + + public function Inicializar() + { + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + $this->cod_matricula = $_GET["ref_cod_matricula"]; + $this->ref_cod_aluno = $_GET["ref_cod_aluno"]; + + $this->validaPermissao(); + $this->validaParametros(); + return 'Editar'; + } + + public function Gerar() + { + $this->campoOculto("cod_matricula", $this->cod_matricula); + $this->campoOculto("ref_cod_aluno", $this->ref_cod_aluno); + + $obj_aluno = new clsPmieducarAluno(); + $lst_aluno = $obj_aluno->lista($this->ref_cod_aluno, null, null, null, null, null, null, null, null, null, 1); + if (is_array($lst_aluno)) { + $det_aluno = array_shift($lst_aluno); + $this->nm_aluno = $det_aluno["nome_aluno"]; + $this->campoRotulo("nm_aluno", "Aluno", $this->nm_aluno); + } + $enturmacoes = new clsPmieducarMatriculaTurma(); + $enturmacoes = $enturmacoes->lista( + $this->cod_matricula, null, null, + null, null, null, null, null, 1, null, null, null, + null, null, null, null, null, null, null, null, false, + null, null, null, false, false, false, null, null, + false, null, false, false, false, null, false, true + ); + + $todasEtapasEducacenso = loadJson('educacenso_json/etapas_ensino.json'); + + foreach ($enturmacoes as $enturmacao) { + $resources = array( + 0 => 'Selecione', + 1 => 'Creche', + 2 => Portabilis_String_Utils::toLatin1('Pré-escola'), + ); + + $this->campoLista("etapas_educacenso[{$enturmacao['ref_cod_turma']}-{$enturmacao['sequencial']}]", "Etapa da turma unificada: {$enturmacao['nm_turma']}", $resources, $enturmacao['turma_unificada'], '', false, '', '', false, false); + } + } + + public function Editar() + { + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + $this->validaPermissao(); + $this->validaParametros(); + + foreach ($this->etapas_educacenso as $codTurmaESequencial => $etapaEducacenso) { + // Necessário pois chave é Turma + Matrícula + Sequencial + $codTurmaESequencial = explode('-', $codTurmaESequencial); + $codTurma = $codTurmaESequencial[0]; + $sequencial = $codTurmaESequencial[1]; + $obj = new clsPmieducarMatriculaTurma($this->cod_matricula, $codTurma, $this->pessoa_logada); + $obj->sequencial = $sequencial; + $obj->turma_unificada = $etapaEducacenso; + $obj->edita(); + } + + $this->mensagem .= "Etapas atualizadas com sucesso.
"; + return true; + } + + private function montaLocalizacao() + { + $localizacao = new LocalizacaoSistema(); + $localizacao->entradaCaminhos(array( + $_SERVER['SERVER_NAME'] . "/intranet" => "Início", + "educar_index.php" => "Escola", + "" => "Etapa da turma unificada", + )); + $this->enviaLocalizacao($localizacao->montar()); + } + + private function validaPermissao() + { + $obj_permissoes = new clsPermissoes(); + $obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7, "educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}"); + } + + private function validaParametros() + { + $obj_matricula = new clsPmieducarMatricula($this->cod_matricula); + $det_matricula = $obj_matricula->detalhe(); + + if (!$det_matricula) { + header("location: educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}"); + } + + } + + /** + * Filtering a array by its keys using a callback. + * + * @param $array array The array to filter + * @param $callback Callback The filter callback, that will get the key as first argument. + * + * @return array The remaining key => value combinations from $array. + */ + public function array_filter_key(array $array, $callback) + { + $matchedKeys = array_filter(array_keys($array), $callback); + return array_intersect_key($array, array_flip($matchedKeys)); + } +} + +// cria uma extensao da classe base +$pagina = new clsIndexBase(); +// cria o conteudo +$miolo = new indice(); +// adiciona o conteudo na clsBase +$pagina->addForm($miolo); +// gera o html +$pagina->MakeAll(); diff --git a/ieducar/intranet/educar_turma_cad.php b/ieducar/intranet/educar_turma_cad.php index 8f293ced1b..b19b1cd516 100644 --- a/ieducar/intranet/educar_turma_cad.php +++ b/ieducar/intranet/educar_turma_cad.php @@ -121,7 +121,6 @@ class indice extends clsCadastro var $atividades_complementares; var $atividades_aee; var $cod_curso_profissional; - var $turma_unificada; var $etapa_educacenso; var $ref_cod_disciplina_dispensada; var $codigo_inep_educacenso; diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarMatriculaTurma.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarMatriculaTurma.inc.php index 9f297fa842..19b34f0255 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarMatriculaTurma.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarMatriculaTurma.inc.php @@ -60,6 +60,7 @@ class clsPmieducarMatriculaTurma var $removerSequencial; var $reabrirMatricula; var $etapa_educacenso; + var $turma_unificada; /** * Armazena o total de resultados obtidos na última chamada ao método lista(). @@ -128,7 +129,7 @@ function __construct($ref_cod_matricula = NULL, $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); - $this->_campos_lista = $this->_todos_campos = "mt.ref_cod_matricula, mt.abandono, mt.reclassificado, mt.remanejado, mt.transferido, mt.falecido, mt.ref_cod_turma, mt.etapa_educacenso, mt.ref_usuario_exc, mt.ref_usuario_cad, mt.data_cadastro, mt.data_exclusao, mt.ativo, mt.sequencial, mt.data_enturmacao, (SELECT pes.nome FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome, (SELECT (pes.nome) FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome_ascii"; + $this->_campos_lista = $this->_todos_campos = "mt.ref_cod_matricula, mt.abandono, mt.reclassificado, mt.remanejado, mt.transferido, mt.falecido, mt.ref_cod_turma, mt.etapa_educacenso, mt.turma_unificada, mt.ref_usuario_exc, mt.ref_usuario_cad, mt.data_cadastro, mt.data_exclusao, mt.ativo, mt.sequencial, mt.data_enturmacao, (SELECT pes.nome FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome, (SELECT (pes.nome) FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome_ascii"; if (is_numeric($ref_usuario_exc)) { if (class_exists("clsPmieducarUsuario")) { @@ -296,6 +297,12 @@ function cadastra() $gruda = ", "; } + if(is_numeric($this->turma_unificada)) { + $campos .= "{$gruda}turma_unificada"; + $valores .= "{$gruda}{$this->turma_unificada}"; + $gruda = ", "; + } + $this->sequencial = $this->buscaSequencialMax(); $campos .= "{$gruda}sequencial"; @@ -380,6 +387,11 @@ function edita() $gruda = ", "; } + if (is_numeric($this->turma_unificada)){ + $set .= "{$gruda}turma_unificada = {$this->turma_unificada}"; + $gruda = ", "; + } + if (is_numeric($this->ativo)) { $set .= "{$gruda}ativo = '{$this->ativo}'"; $gruda = ", "; @@ -448,7 +460,7 @@ function lista($int_ref_cod_matricula = NULL, $int_ref_cod_turma = NULL, $int_ref_cod_serie_mult = NULL, $int_semestre = NULL, $pegar_ano_em_andamento = FALSE, $parar=NULL, $diario = FALSE, $int_turma_turno_id = FALSE, $int_ano_turma = FALSE, $dependencia = NULL, - $apenasTurmasMultiSeriadas = FALSE) + $apenasTurmasMultiSeriadas = FALSE, $apenasTurmasUnificadas = FALSE) { if ($bool_get_nome_aluno === true) { $nome = " ,(SELECT (nome) @@ -482,7 +494,7 @@ function lista($int_ref_cod_matricula = NULL, $int_ref_cod_turma = NULL, } } - $sql = "SELECT {$this->_campos_lista}, mt.sequencial_fechamento, c.nm_curso, t.nm_turma, i.nm_instituicao, m.ref_ref_cod_serie, m.ref_cod_curso, m.ref_ref_cod_escola, c.ref_cod_instituicao, m.ref_cod_aluno,t.hora_inicial, t.etapa_educacenso as etapa_ensino $nome FROM {$this->_tabela} mt, {$this->_schema}matricula m, {$this->_schema}curso c, {$this->_schema}turma t,{$this->_schema}aluno al, {$this->_schema}instituicao i{$tab_aluno} {$from}, cadastro.pessoa "; + $sql = "SELECT {$this->_campos_lista}, mt.sequencial_fechamento, c.nm_curso, t.nm_turma, i.nm_instituicao, m.ref_ref_cod_serie, m.ref_cod_curso, m.ref_ref_cod_escola, c.ref_cod_instituicao, m.ref_cod_aluno,t.hora_inicial, mt.turma_unificada, t.etapa_educacenso as etapa_ensino $nome FROM {$this->_tabela} mt, {$this->_schema}matricula m, {$this->_schema}curso c, {$this->_schema}turma t,{$this->_schema}aluno al, {$this->_schema}instituicao i{$tab_aluno} {$from}, cadastro.pessoa "; $whereAnd = " AND "; $filtros = " WHERE mt.ref_cod_matricula = m.cod_matricula AND idpes = al.ref_idpes AND al.cod_aluno = m.ref_cod_aluno AND al.ativo=1 AND m.ref_cod_curso = c.cod_curso AND t.cod_turma = mt.ref_cod_turma AND i.cod_instituicao = c.ref_cod_instituicao {$where_nm_aluno} {$where}"; @@ -603,6 +615,12 @@ function lista($int_ref_cod_matricula = NULL, $int_ref_cod_turma = NULL, $whereAnd = " AND "; } + if ($apenasTurmasUnificadas === TRUE) { + $etapas = implode(',', App_Model_Educacenso::etapasEnsinoUnificadas()); + $filtros .= "{$whereAnd} t.etapa_educacenso IN ({$etapas}) "; + $whereAnd = " AND "; + } + if (is_array($aprovado)) { $filtros .= "{$whereAnd} ( "; $whereAnd = ""; diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php index 5854c2f945..4d723b39c0 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php @@ -1,2633 +1,2618 @@ -_schema = "pmieducar."; - $this->_tabela = "{$this->_schema}turma"; - - $this->_campos_lista = $this->_todos_campos = "t.cod_turma, t.ref_usuario_exc, t.ref_usuario_cad, t.ref_ref_cod_serie, t.ref_ref_cod_escola, t.ref_cod_infra_predio_comodo, t.nm_turma, t.sgl_turma, t.max_aluno, t.multiseriada, t.data_cadastro, t.data_exclusao, t.ativo, t.ref_cod_turma_tipo, t.hora_inicial, t.hora_final, t.hora_inicio_intervalo, t.hora_fim_intervalo, t.ref_cod_regente, t.ref_cod_instituicao_regente,t.ref_cod_instituicao, t.ref_cod_curso, t.ref_ref_cod_serie_mult, t.ref_ref_cod_escola_mult, t.visivel, t.turma_turno_id, t.tipo_boletim, t.tipo_boletim_diferenciado, t.ano, - t.tipo_atendimento, t.turma_mais_educacao, t.atividade_complementar_1, t.atividade_complementar_2, t.atividade_complementar_3, t.atividade_complementar_4, t.atividade_complementar_5, t.atividade_complementar_6, t.aee_braille, t.aee_recurso_optico, t.aee_estrategia_desenvolvimento, t.aee_tecnica_mobilidade, t.aee_libras, t.aee_caa, t.aee_curricular, t.aee_soroban, t.aee_informatica, t.aee_lingua_escrita, t.aee_autonomia, t.cod_curso_profissional, t.turma_unificada, t.etapa_educacenso, t.ref_cod_disciplina_dispensada, t.parecer_1_etapa, t.parecer_2_etapa, - t.parecer_3_etapa, t.parecer_4_etapa, t.nao_informar_educacenso, t.tipo_mediacao_didatico_pedagogico, t.dias_semana, t.atividades_complementares, t.atividades_aee "; - - if( is_numeric( $ref_cod_turma_tipo ) ) - { - if( class_exists( "clsPmieducarTurmaTipo" ) ) - { - $tmp_obj = new clsPmieducarTurmaTipo( $ref_cod_turma_tipo ); - if( method_exists( $tmp_obj, "existe") ) - { - if( $tmp_obj->existe() ) - { - $this->ref_cod_turma_tipo = $ref_cod_turma_tipo; - } - } - else if( method_exists( $tmp_obj, "detalhe") ) - { - if( $tmp_obj->detalhe() ) - { - $this->ref_cod_turma_tipo = $ref_cod_turma_tipo; - } - } - } - else - { - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.turma_tipo WHERE cod_turma_tipo = '{$ref_cod_turma_tipo}'" ) ) - { - $this->ref_cod_turma_tipo = $ref_cod_turma_tipo; - } - } - } - if( is_numeric( $ref_ref_cod_escola ) && is_numeric( $ref_ref_cod_serie ) ) - { - if( class_exists( "clsPmieducarEscolaSerie" ) ) - { - $tmp_obj = new clsPmieducarEscolaSerie( $ref_ref_cod_escola, $ref_ref_cod_serie ); - if( method_exists( $tmp_obj, "existe") ) - { - if( $tmp_obj->existe() ) - { - $this->ref_ref_cod_escola = $ref_ref_cod_escola; - $this->ref_ref_cod_serie = $ref_ref_cod_serie; - } - } - else if( method_exists( $tmp_obj, "detalhe") ) - { - if( $tmp_obj->detalhe() ) - { - $this->ref_ref_cod_escola = $ref_ref_cod_escola; - $this->ref_ref_cod_serie = $ref_ref_cod_serie; - } - } - } - else - { - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.escola_serie WHERE ref_cod_escola = '{$ref_ref_cod_escola}' AND ref_cod_serie = '{$ref_ref_cod_serie}'" ) ) - { - $this->ref_ref_cod_escola = $ref_ref_cod_escola; - $this->ref_ref_cod_serie = $ref_ref_cod_serie; - } - } - } - if( is_numeric( $ref_cod_infra_predio_comodo ) ) - { - if( class_exists( "clsPmieducarInfraPredioComodo" ) ) - { - $tmp_obj = new clsPmieducarInfraPredioComodo( $ref_cod_infra_predio_comodo ); - if( method_exists( $tmp_obj, "existe") ) - { - if( $tmp_obj->existe() ) - { - $this->ref_cod_infra_predio_comodo = $ref_cod_infra_predio_comodo; - } - } - else if( method_exists( $tmp_obj, "detalhe") ) - { - if( $tmp_obj->detalhe() ) - { - $this->ref_cod_infra_predio_comodo = $ref_cod_infra_predio_comodo; - } - } - } - else - { - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.infra_predio_comodo WHERE cod_infra_predio_comodo = '{$ref_cod_infra_predio_comodo}'" ) ) - { - $this->ref_cod_infra_predio_comodo = $ref_cod_infra_predio_comodo; - } - } - } - 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; - } - } - else if( 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; - } - } - } - 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; - } - } - else if( 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; - } - } - } - - if( is_numeric( $ref_cod_regente ) && is_numeric( $ref_cod_instituicao_regente ) ) - { - if( class_exists( "clsPmieducarServidor" ) ) - { - $tmp_obj = new clsPmieducarServidor($ref_cod_regente,null,null,null,null,null,null,$ref_cod_instituicao_regente,null); - if( method_exists( $tmp_obj, "existe") ) - { - if( $tmp_obj->existe() ) - { - $this->ref_cod_regente = $ref_cod_regente; - $this->ref_cod_instituicao_regente = $ref_cod_instituicao_regente; - } - } - else if( method_exists( $tmp_obj, "detalhe") ) - { - if( $tmp_obj->detalhe() ) - { - $this->ref_cod_regente = $ref_cod_regente; - $this->ref_cod_instituicao_regente = $ref_cod_instituicao_regente; - } - } - } - else - { - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.servidor WHERE ref_cod_regente = '{$ref_cod_regente}' AND ref_cod_instituicao_regente = '{$ref_cod_instituicao_regente}'" ) ) - { - $this->ref_cod_regente = $ref_cod_regente; - $this->ref_cod_instituicao_regente = $ref_cod_instituicao_regente; - } - } - } - - if( is_numeric( $cod_turma ) ) - { - $this->cod_turma = $cod_turma; - } - if( is_string( $nm_turma ) ) - { - $this->nm_turma = $nm_turma; - } - if( is_string( $sgl_turma ) ) - { - $this->sgl_turma = $sgl_turma; - } - if( is_numeric( $max_aluno ) ) - { - $this->max_aluno = $max_aluno; - } - if( is_numeric( $multiseriada ) ) - { - $this->multiseriada = $multiseriada; - } - if( is_string( $data_cadastro ) ) - { - $this->data_cadastro = $data_cadastro; - } - if( is_string( $data_exclusao ) ) - { - $this->data_exclusao = $data_exclusao; - } - if( is_numeric( $ativo ) ) - { - $this->ativo = $ativo; - } - if( ( $hora_inicial ) ) - { - $this->hora_inicial = $hora_inicial; - } - if( ( $hora_final ) ) - { - $this->hora_final = $hora_final; - } - if( ( $hora_inicio_intervalo ) ) - { - $this->hora_inicio_intervalo = $hora_inicio_intervalo; - } - if( ( $hora_fim_intervalo ) ) - { - $this->hora_fim_intervalo = $hora_fim_intervalo; - } - - if( is_numeric( $ref_cod_instituicao ) ) - { - if( class_exists( "clsPmieducarInstituicao" ) ) - { - $tmp_obj = new clsPmieducarInstituicao( $ref_cod_instituicao ); - if( method_exists( $tmp_obj, "existe") ) - { - if( $tmp_obj->existe() ) - { - $this->ref_cod_instituicao = $ref_cod_instituicao; - } - } - else if( method_exists( $tmp_obj, "detalhe") ) - { - if( $tmp_obj->detalhe() ) - { - $this->ref_cod_instituicao = $ref_cod_instituicao; - } - } - } - else - { - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.instituicao WHERE cod_instituicao = '{$ref_cod_instituicao}'" ) ) - { - $this->ref_cod_instituicao = $ref_cod_instituicao; - } - } - } - - if( is_numeric( $ref_cod_curso ) ) - { - if( class_exists( "clsPmieducarCurso" ) ) - { - $tmp_obj = new clsPmieducarCurso( $ref_cod_curso ); - if( method_exists( $tmp_obj, "existe") ) - { - if( $tmp_obj->existe() ) - { - $this->ref_cod_curso = $ref_cod_curso; - } - } - else if( method_exists( $tmp_obj, "detalhe") ) - { - if( $tmp_obj->detalhe() ) - { - $this->ref_cod_curso = $ref_cod_curso; - } - } - } - else - { - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.curso WHERE cod_curso = '{$ref_cod_curso}'" ) ) - { - $this->ref_cod_curso = $ref_cod_curso; - } - } - } - - if( is_numeric( $ref_ref_cod_escola_mult ) && is_numeric( $ref_ref_cod_serie_mult ) ) - { - if( class_exists( "clsPmieducarEscolaSerie" ) ) - { - $tmp_obj = new clsPmieducarEscolaSerie( $ref_ref_cod_escola_mult, $ref_ref_cod_serie_mult ); - if( method_exists( $tmp_obj, "existe") ) - { - if( $tmp_obj->existe() ) - { - $this->ref_ref_cod_escola_mult = $ref_ref_cod_escola_mult; - $this->ref_ref_cod_serie_mult = $ref_ref_cod_serie_mult; - } - } - else if( method_exists( $tmp_obj, "detalhe") ) - { - if( $tmp_obj->detalhe() ) - { - $this->ref_ref_cod_escola_mult = $ref_ref_cod_escola_mult; - $this->ref_ref_cod_serie_mult = $ref_ref_cod_serie_mult; - } - } - } - else - { - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.escola_serie WHERE ref_cod_escola = '{$ref_ref_cod_escola_mult}' AND ref_cod_serie = '{$ref_ref_cod_serie_mult}'" ) ) - { - $this->ref_ref_cod_escola_mult = $ref_ref_cod_escola_mult; - $this->ref_ref_cod_serie_mult = $ref_ref_cod_serie_mult; - } - } - } - if (is_bool($visivel)) - { - $this->visivel = dbBool($visivel); - } - - $this->turma_turno_id = $turma_turno_id; - $this->tipo_boletim = $tipo_boletim; - $this->ano = $ano; - $this->data_fechamento = $data_fechamento; - - if (is_numeric($ref_cod_disciplina_dispensada) || is_null($ref_cod_disciplina_dispensada)){ - $this->ref_cod_disciplina_dispensada = $ref_cod_disciplina_dispensada; - } - - } - - /** - * Cria um novo registro - * - * @return bool - */ - function cadastra() - { - if( is_numeric( $this->ref_usuario_cad ) /*&& is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_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 ) ) - { - $db = new clsBanco(); - - $campos = ""; - $valores = ""; - $gruda = ""; - - if( is_numeric( $this->ref_usuario_cad ) ) - { - $campos .= "{$gruda}ref_usuario_cad"; - $valores .= "{$gruda}'{$this->ref_usuario_cad}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_ref_cod_serie ) ) - { - $campos .= "{$gruda}ref_ref_cod_serie"; - $valores .= "{$gruda}'{$this->ref_ref_cod_serie}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_ref_cod_escola ) ) - { - $campos .= "{$gruda}ref_ref_cod_escola"; - $valores .= "{$gruda}'{$this->ref_ref_cod_escola}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_infra_predio_comodo ) ) - { - $campos .= "{$gruda}ref_cod_infra_predio_comodo"; - $valores .= "{$gruda}'{$this->ref_cod_infra_predio_comodo}'"; - $gruda = ", "; - } - if( is_string( $this->nm_turma ) ) - { - $campos .= "{$gruda}nm_turma"; - $valores .= "{$gruda}'{$this->nm_turma}'"; - $gruda = ", "; - } - if( is_string( $this->sgl_turma ) ) - { - $campos .= "{$gruda}sgl_turma"; - $valores .= "{$gruda}'{$this->sgl_turma}'"; - $gruda = ", "; - } - if( is_numeric( $this->max_aluno ) ) - { - $campos .= "{$gruda}max_aluno"; - $valores .= "{$gruda}'{$this->max_aluno}'"; - $gruda = ", "; - } - if( is_numeric( $this->multiseriada ) ) - { - $campos .= "{$gruda}multiseriada"; - $valores .= "{$gruda}'{$this->multiseriada}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_regente ) ) - { - $campos .= "{$gruda}ref_cod_regente"; - $valores .= "{$gruda}'{$this->ref_cod_regente}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_instituicao_regente ) ) - { - $campos .= "{$gruda}ref_cod_instituicao_regente"; - $valores .= "{$gruda}'{$this->ref_cod_instituicao_regente}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_instituicao ) ) - { - $campos .= "{$gruda}ref_cod_instituicao"; - $valores .= "{$gruda}'{$this->ref_cod_instituicao}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_curso ) ) - { - $campos .= "{$gruda}ref_cod_curso"; - $valores .= "{$gruda}'{$this->ref_cod_curso}'"; - $gruda = ", "; - } - $campos .= "{$gruda}data_cadastro"; - $valores .= "{$gruda}NOW()"; - $gruda = ", "; - $campos .= "{$gruda}ativo"; - $valores .= "{$gruda}'1'"; - $gruda = ", "; - if( is_numeric( $this->ref_cod_turma_tipo ) ) - { - $campos .= "{$gruda}ref_cod_turma_tipo"; - $valores .= "{$gruda}'{$this->ref_cod_turma_tipo}'"; - $gruda = ", "; - } - if( ( $this->hora_inicial ) ) - { - $campos .= "{$gruda}hora_inicial"; - $valores .= "{$gruda}'{$this->hora_inicial}'"; - $gruda = ", "; - } - if( ( $this->hora_final ) ) - { - $campos .= "{$gruda}hora_final"; - $valores .= "{$gruda}'{$this->hora_final}'"; - $gruda = ", "; - } - if( ( $this->hora_inicio_intervalo ) ) - { - $campos .= "{$gruda}hora_inicio_intervalo"; - $valores .= "{$gruda}'{$this->hora_inicio_intervalo}'"; - $gruda = ", "; - } - if( ( $this->hora_fim_intervalo ) ) - { - $campos .= "{$gruda}hora_fim_intervalo"; - $valores .= "{$gruda}'{$this->hora_fim_intervalo}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_ref_cod_escola_mult ) ) - { - $campos .= "{$gruda}ref_ref_cod_escola_mult"; - $valores .= "{$gruda}'{$this->ref_ref_cod_escola_mult}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_ref_cod_serie_mult ) ) - { - $campos .= "{$gruda}ref_ref_cod_serie_mult"; - $valores .= "{$gruda}'{$this->ref_ref_cod_serie_mult}'"; - $gruda = ", "; - } - $this->visivel = dbBool($this->visivel) ? "TRUE" : "FALSE"; - $campos .= "{$gruda}visivel"; - $valores .= "{$gruda}'{$this->visivel}'"; - $gruda = ", "; - - if(is_numeric($this->turma_turno_id)){ - $campos .= "{$gruda}turma_turno_id"; - $valores .= "{$gruda}'{$this->turma_turno_id}'"; - $gruda = ", "; - } - - if(is_numeric($this->tipo_boletim)){ - $campos .= "{$gruda}tipo_boletim"; - $valores .= "{$gruda}'{$this->tipo_boletim}'"; - $gruda = ", "; - } - - if(is_numeric($this->tipo_boletim_diferenciado)){ - $campos .= "{$gruda}tipo_boletim_diferenciado"; - $valores .= "{$gruda}'{$this->tipo_boletim_diferenciado}'"; - $gruda = ", "; - } - - if(is_numeric($this->ano)){ - $campos .= "{$gruda}ano"; - $valores .= "{$gruda}'{$this->ano}'"; - $gruda = ", "; - } - - if(is_string($this->data_fechamento) && $this->data_fechamento!=''){ - $campos .= "{$gruda}data_fechamento"; - $valores .= "{$gruda}'{$this->data_fechamento}'"; - $gruda = ", "; - } - - if(is_numeric($this->tipo_atendimento)){ - $campos .= "{$gruda}tipo_atendimento"; - $valores .= "{$gruda}'{$this->tipo_atendimento}'"; - $gruda = ", "; - } - - if(is_numeric($this->turma_mais_educacao)){ - $campos .= "{$gruda}turma_mais_educacao"; - $valores .= "{$gruda}'{$this->turma_mais_educacao}'"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_1)){ - $campos .= "{$gruda}atividade_complementar_1"; - $valores .= "{$gruda}'{$this->atividade_complementar_1}'"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_2)){ - $campos .= "{$gruda}atividade_complementar_2"; - $valores .= "{$gruda}'{$this->atividade_complementar_2}'"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_3)){ - $campos .= "{$gruda}atividade_complementar_3"; - $valores .= "{$gruda}'{$this->atividade_complementar_3}'"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_4)){ - $campos .= "{$gruda}atividade_complementar_4"; - $valores .= "{$gruda}'{$this->atividade_complementar_4}'"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_5)){ - $campos .= "{$gruda}atividade_complementar_5"; - $valores .= "{$gruda}'{$this->atividade_complementar_5}'"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_6)){ - $campos .= "{$gruda}atividade_complementar_6"; - $valores .= "{$gruda}'{$this->atividade_complementar_6}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_braille)){ - $campos .= "{$gruda}aee_braille"; - $valores .= "{$gruda}'{$this->aee_braille}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_recurso_optico)){ - $campos .= "{$gruda}aee_recurso_optico"; - $valores .= "{$gruda}'{$this->aee_recurso_optico}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_estrategia_desenvolvimento)){ - $campos .= "{$gruda}aee_estrategia_desenvolvimento"; - $valores .= "{$gruda}'{$this->aee_estrategia_desenvolvimento}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_tecnica_mobilidade)){ - $campos .= "{$gruda}aee_tecnica_mobilidade"; - $valores .= "{$gruda}'{$this->aee_tecnica_mobilidade}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_libras)){ - $campos .= "{$gruda}aee_libras"; - $valores .= "{$gruda}'{$this->aee_libras}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_caa)){ - $campos .= "{$gruda}aee_caa"; - $valores .= "{$gruda}'{$this->aee_caa}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_curricular)){ - $campos .= "{$gruda}aee_curricular"; - $valores .= "{$gruda}'{$this->aee_curricular}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_soroban)){ - $campos .= "{$gruda}aee_soroban"; - $valores .= "{$gruda}'{$this->aee_soroban}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_informatica)){ - $campos .= "{$gruda}aee_informatica"; - $valores .= "{$gruda}'{$this->aee_informatica}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_lingua_escrita)){ - $campos .= "{$gruda}aee_lingua_escrita"; - $valores .= "{$gruda}'{$this->aee_lingua_escrita}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_autonomia)){ - $campos .= "{$gruda}aee_autonomia"; - $valores .= "{$gruda}'{$this->aee_autonomia}'"; - $gruda = ", "; - } - - if(is_numeric($this->cod_curso_profissional)){ - $campos .= "{$gruda}cod_curso_profissional"; - $valores .= "{$gruda}'{$this->cod_curso_profissional}'"; - $gruda = ", "; - } - - if(is_numeric($this->turma_unificada)){ - $campos .= "{$gruda}turma_unificada"; - $valores .= "{$gruda}'{$this->turma_unificada}'"; - $gruda = ", "; - } - - if(is_numeric($this->etapa_educacenso)){ - $campos .= "{$gruda}etapa_educacenso"; - $valores .= "{$gruda}'{$this->etapa_educacenso}'"; - $gruda = ", "; - } - - if(is_numeric($this->ref_cod_disciplina_dispensada)){ - $campos .= "{$gruda}ref_cod_disciplina_dispensada"; - $valores .= "{$gruda}'{$this->ref_cod_disciplina_dispensada}'"; - $gruda = ", "; - }elseif(is_null($this->ref_cod_disciplina_dispensada)){ - $campos .= "{$gruda}ref_cod_disciplina_dispensada"; - $valores .= "{$gruda}NULL"; - $gruda = ", "; - } - - if(is_numeric($this->nao_informar_educacenso)){ - $campos .= "{$gruda}nao_informar_educacenso"; - $valores .= "{$gruda}'{$this->nao_informar_educacenso}'"; - $gruda = ", "; - } - - if(is_numeric($this->tipo_mediacao_didatico_pedagogico)){ - $campos .= "{$gruda}tipo_mediacao_didatico_pedagogico"; - $valores .= "{$gruda}'{$this->tipo_mediacao_didatico_pedagogico}'"; - $gruda = ", "; - } - - if(is_string($this->dias_semana)){ - $campos .= "{$gruda}dias_semana"; - $valores .= "{$gruda}'{$this->dias_semana}'"; - $gruda = ", "; - } - - if(is_string($this->atividades_complementares)){ - $campos .= "{$gruda}atividades_complementares"; - $valores .= "{$gruda}'{$this->atividades_complementares}'"; - $gruda = ", "; - } - - if(is_string($this->atividades_aee)){ - $campos .= "{$gruda}atividades_aee"; - $valores .= "{$gruda}'{$this->atividades_aee}'"; - $gruda = ", "; - } - - $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" ); - return $db->InsertId( "{$this->_tabela}_cod_turma_seq"); - } - return false; - } - - /** - * Edita os dados de um registro - * - * @return bool - */ - function edita() - { - if( is_numeric( $this->cod_turma ) && is_numeric( $this->ref_usuario_exc ) ) - { - - $db = new clsBanco(); - $set = ""; - - if( is_numeric( $this->ref_usuario_exc ) ) - { - $set .= "{$gruda}ref_usuario_exc = '{$this->ref_usuario_exc}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_usuario_cad ) ) - { - $set .= "{$gruda}ref_usuario_cad = '{$this->ref_usuario_cad}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_ref_cod_serie ) ) - { - $set .= "{$gruda}ref_ref_cod_serie = '{$this->ref_ref_cod_serie}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_ref_cod_escola ) ) - { - $set .= "{$gruda}ref_ref_cod_escola = '{$this->ref_ref_cod_escola}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_infra_predio_comodo ) ) - { - $set .= "{$gruda}ref_cod_infra_predio_comodo = '{$this->ref_cod_infra_predio_comodo}'"; - $gruda = ", "; - }elseif( is_null( $this->ref_cod_infra_predio_comodo ) ) - { - $set .= "{$gruda}ref_cod_infra_predio_comodo = NULL"; - $gruda = ", "; - } - if( is_string( $this->nm_turma ) ) - { - $set .= "{$gruda}nm_turma = '{$this->nm_turma}'"; - $gruda = ", "; - } - if( is_string( $this->sgl_turma ) ) - { - $set .= "{$gruda}sgl_turma = '{$this->sgl_turma}'"; - $gruda = ", "; - } - if( is_numeric( $this->max_aluno ) ) - { - $set .= "{$gruda}max_aluno = '{$this->max_aluno}'"; - $gruda = ", "; - } - if( is_numeric( $this->multiseriada ) ) - { - $set .= "{$gruda}multiseriada = '{$this->multiseriada}'"; - $gruda = ", "; - } - - if( is_string( $this->data_cadastro ) ) - { - $set .= "{$gruda}data_cadastro = '{$this->data_cadastro}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_regente ) ) - { - $set .= "{$gruda}ref_cod_regente = '{$this->ref_cod_regente}'"; - $gruda = ", "; - } - else - { - $set .= "{$gruda}ref_cod_regente = null"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_instituicao_regente ) ) - { - $set .= "{$gruda}ref_cod_instituicao_regente = '{$this->ref_cod_instituicao_regente}'"; - $gruda = ", "; - } - $set .= "{$gruda}data_exclusao = NOW()"; - $gruda = ", "; - if( is_numeric( $this->ativo ) ) - { - $set .= "{$gruda}ativo = '{$this->ativo}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_turma_tipo ) ) - { - $set .= "{$gruda}ref_cod_turma_tipo = '{$this->ref_cod_turma_tipo}'"; - $gruda = ", "; - } - if( ( $this->hora_inicial ) ) - { - $set .= "{$gruda}hora_inicial = '{$this->hora_inicial}'"; - $gruda = ", "; - } - if( ( $this->hora_final ) ) - { - $set .= "{$gruda}hora_final = '{$this->hora_final}'"; - $gruda = ", "; - } - if( ( $this->hora_inicio_intervalo ) ) - { - $set .= "{$gruda}hora_inicio_intervalo = '{$this->hora_inicio_intervalo}'"; - $gruda = ", "; - } - if( ( $this->hora_fim_intervalo ) ) - { - $set .= "{$gruda}hora_fim_intervalo = '{$this->hora_fim_intervalo}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_instituicao ) ) - { - $set .= "{$gruda}ref_cod_instituicao = '{$this->ref_cod_instituicao}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_cod_curso ) ) - { - $set .= "{$gruda}ref_cod_curso = '{$this->ref_cod_curso}'"; - $gruda = ", "; - } - if( is_numeric( $this->ref_ref_cod_escola_mult ) ) - { - $set .= "{$gruda}ref_ref_cod_escola_mult = '{$this->ref_ref_cod_escola_mult}'"; - $gruda = ", "; - } - - if( is_numeric( $this->ref_ref_cod_serie_mult ) ) - { - $set .= "{$gruda}ref_ref_cod_serie_mult = '{$this->ref_ref_cod_serie_mult}'"; - $gruda = ", "; - } - - if (is_bool($this->visivel)) { - $this->visivel = dbBool($this->visivel) ? "TRUE" : "FALSE"; - $set .= "{$gruda}visivel = '{$this->visivel}'"; - $gruda = ", "; - } - - if(is_numeric($this->turma_turno_id)) { - $set .= "{$gruda}turma_turno_id = '{$this->turma_turno_id}'"; - $gruda = ", "; - } - - if(is_numeric($this->tipo_boletim)) { - $set .= "{$gruda}tipo_boletim = '{$this->tipo_boletim}'"; - $gruda = ", "; - } - - if(is_numeric($this->tipo_boletim_diferenciado)) { - $set .= "{$gruda}tipo_boletim_diferenciado = '{$this->tipo_boletim_diferenciado}'"; - $gruda = ", "; - } - - if(is_numeric($this->ano)) { - $set .= "{$gruda}ano = '{$this->ano}'"; - $gruda = ", "; - } - - if(is_string($this->data_fechamento) && $this->data_fechamento!='') { - $set .= "{$gruda}data_fechamento = '{$this->data_fechamento}'"; - $gruda = ", "; - } - - if(is_numeric($this->tipo_atendimento)) { - $set .= "{$gruda}tipo_atendimento = '{$this->tipo_atendimento}'"; - $gruda = ", "; - } - - if(is_numeric($this->turma_mais_educacao)) { - $set .= "{$gruda}turma_mais_educacao = '{$this->turma_mais_educacao}'"; - $gruda = ", "; - } else { - $set .= "{$gruda}turma_mais_educacao = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_1)) { - $set .= "{$gruda}atividade_complementar_1 = '{$this->atividade_complementar_1}'"; - $gruda = ", "; - }elseif(trim($this->atividade_complementar_1) == ""){ - $set .= "{$gruda}atividade_complementar_1 = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_2)) { - $set .= "{$gruda}atividade_complementar_2 = '{$this->atividade_complementar_2}'"; - $gruda = ", "; - }elseif(trim($this->atividade_complementar_2) == ""){ - $set .= "{$gruda}atividade_complementar_2 = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_3)) { - $set .= "{$gruda}atividade_complementar_3 = '{$this->atividade_complementar_3}'"; - $gruda = ", "; - }elseif(trim($this->atividade_complementar_3) == ""){ - $set .= "{$gruda}atividade_complementar_3 = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_4)) { - $set .= "{$gruda}atividade_complementar_4 = '{$this->atividade_complementar_4}'"; - $gruda = ", "; - }elseif(trim($this->atividade_complementar_4) == ""){ - $set .= "{$gruda}atividade_complementar_4 = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_5)) { - $set .= "{$gruda}atividade_complementar_5 = '{$this->atividade_complementar_5}'"; - $gruda = ", "; - }elseif(trim($this->atividade_complementar_5) == ""){ - $set .= "{$gruda}atividade_complementar_5 = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->atividade_complementar_6)) { - $set .= "{$gruda}atividade_complementar_6 = '{$this->atividade_complementar_6}'"; - $gruda = ", "; - }elseif(trim($this->atividade_complementar_6) == ""){ - $set .= "{$gruda}atividade_complementar_6 = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->aee_braille)) { - $set .= "{$gruda}aee_braille = '{$this->aee_braille}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_recurso_optico)) { - $set .= "{$gruda}aee_recurso_optico = '{$this->aee_recurso_optico}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_estrategia_desenvolvimento)) { - $set .= "{$gruda}aee_estrategia_desenvolvimento = '{$this->aee_estrategia_desenvolvimento}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_tecnica_mobilidade)) { - $set .= "{$gruda}aee_tecnica_mobilidade = '{$this->aee_tecnica_mobilidade}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_libras)) { - $set .= "{$gruda}aee_libras = '{$this->aee_libras}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_caa)) { - $set .= "{$gruda}aee_caa = '{$this->aee_caa}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_curricular)) { - $set .= "{$gruda}aee_curricular = '{$this->aee_curricular}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_soroban)) { - $set .= "{$gruda}aee_soroban = '{$this->aee_soroban}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_informatica)) { - $set .= "{$gruda}aee_informatica = '{$this->aee_informatica}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_lingua_escrita)) { - $set .= "{$gruda}aee_lingua_escrita = '{$this->aee_lingua_escrita}'"; - $gruda = ", "; - } - - if(is_numeric($this->aee_autonomia)) { - $set .= "{$gruda}aee_autonomia = '{$this->aee_autonomia}'"; - $gruda = ", "; - } - - if(is_numeric($this->cod_curso)) { - $set .= "{$gruda}cod_curso = '{$this->cod_curso}'"; - $gruda = ", "; - } - - if(is_numeric($this->cod_curso_profissional)) { - $set .= "{$gruda}cod_curso_profissional = '{$this->cod_curso_profissional}'"; - $gruda = ", "; - } else { - $set .= "{$gruda}cod_curso_profissional = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->turma_unificada)) { - $set .= "{$gruda}turma_unificada = '{$this->turma_unificada}'"; - $gruda = ", "; - } elseif (is_null($this->turma_unificada)) { - $set .= "{$gruda}turma_unificada = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->etapa_educacenso)) { - $set .= "{$gruda}etapa_educacenso = '{$this->etapa_educacenso}'"; - $gruda = ", "; - } elseif (is_null($this->etapa_educacenso)) { - $set .= "{$gruda}etapa_educacenso = NULL"; - $gruda = ", "; - } - - if(is_numeric($this->ref_cod_disciplina_dispensada)){ - $set .= "{$gruda}ref_cod_disciplina_dispensada = {$this->ref_cod_disciplina_dispensada}"; - $gruda = ", "; - }elseif(is_null($this->ref_cod_disciplina_dispensada)){ - $set .= "{$gruda}ref_cod_disciplina_dispensada = NULL"; - $gruda = ", "; - } - if(is_numeric($this->nao_informar_educacenso)) { - $set .= "{$gruda}nao_informar_educacenso = '{$this->nao_informar_educacenso}'"; - $gruda = ", "; - } - if(is_string($this->parecer_1_etapa)) { - $set .= "{$gruda}parecer_1_etapa = '{$this->parecer_1_etapa}'"; - $gruda = ", "; - } - if(is_string($this->parecer_2_etapa)) { - $set .= "{$gruda}parecer_2_etapa = '{$this->parecer_2_etapa}'"; - $gruda = ", "; - } - if(is_string($this->parecer_3_etapa)) { - $set .= "{$gruda}parecer_3_etapa = '{$this->parecer_3_etapa}'"; - $gruda = ", "; - } - if(is_string($this->parecer_4_etapa)) { - $set .= "{$gruda}parecer_4_etapa = '{$this->parecer_4_etapa}'"; - $gruda = ", "; - } - - if(is_numeric($this->tipo_mediacao_didatico_pedagogico)){ - $set .= "{$gruda}tipo_mediacao_didatico_pedagogico = '{$this->tipo_mediacao_didatico_pedagogico}'"; - $gruda = ", "; - } - - if(is_string($this->dias_semana)){ - $set .= "{$gruda}dias_semana = '{$this->dias_semana}'"; - $gruda = ", "; - } - - if(is_string($this->atividades_complementares)){ - $set .= "{$gruda}atividades_complementares = '{$this->atividades_complementares}'"; - $gruda = ", "; - } - - if(is_string($this->atividades_aee)){ - $set .= "{$gruda}atividades_aee = '{$this->atividades_aee}'"; - $gruda = ", "; - } - - if( $set ) - { - $db->Consulta( "UPDATE {$this->_tabela} SET $set WHERE cod_turma = '{$this->cod_turma}'" ); - return true; - } - } - return false; - } - - /** - * Retorna os alunos matriculados nessa turma - * - * @return bool - */ - function matriculados() - { - $retorno = array(); - if( is_numeric( $this->cod_turma ) ) - { - $db = new clsBanco(); - - $db->Consulta("SELECT cod_matricula FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ativo = 1 AND aprovado = 3"); - if( $db->numLinhas() ) - { - while ( $db->ProximoRegistro() ) - { - list($matricula) = $db->Tupla(); - $retorno[$matricula] = $matricula; - } - return $retorno; - } - } - return false; - } - - /** - * Retorna o menor modulo dos alunos matriculados nessa turma - * - * @return bool - */ - function moduloMinimo() - { - if( is_numeric( $this->cod_turma ) ) - { - $db = new clsBanco(); - - // verifica se ainda existe alguem no primeiro modulo - $modulo = $db->CampoUnico(" - SELECT COALESCE(MIN(modulo),1) AS modulo - FROM pmieducar.v_matricula_matricula_turma - WHERE ref_cod_turma = '{$this->cod_turma}' - AND aprovado = 3 AND ativo = 1 - "); - return $modulo; - } - } - - /** - * Retorna as disciplinas do menor modulo - * - * @return bool - */ - function moduloMinimoDisciplina() - { - if( is_numeric( $this->cod_turma ) ) - { - $disciplinas = array(); - $modulo = $this->moduloMinimo(); - - $db = new clsBanco(); - $db->Consulta("SELECT ref_ref_cod_serie, ref_ref_cod_escola, multiseriada, ref_ref_cod_serie_mult, ref_ref_cod_escola_mult FROM pmieducar.turma WHERE cod_turma = '{$this->cod_turma}'"); - - $db->ProximoRegistro(); - list($cod_serie,$cod_escola,$multiseriada,$cod_serie_mult,$cod_escola_mult) = $db->Tupla(); - - // ve se existe alguem que nao tem nenhuma nota nesse modulo - $todas_disciplinas = $db->CampoUnico(" - SELECT 1 FROM - ( - SELECT cod_matricula - , ( SELECT COUNT(0) FROM pmieducar.nota_aluno n WHERE n.ativo = 1 AND n.ref_cod_matricula = cod_matricula AND n.modulo = '{$modulo}' ) - + ( SELECT COUNT(0) FROM pmieducar.dispensa_disciplina d WHERE d.ativo = 1 AND d.ref_cod_matricula = cod_matricula ) AS notas - FROM pmieducar.v_matricula_matricula_turma - WHERE ativo = 1 - AND aprovado = 3 - AND ref_cod_turma = '{$this->cod_turma}' - ) AS sub1 - WHERE notas = 0 - "); - - if( $todas_disciplinas ) - { - // existe um aluno que nao tem nenhuma nota nesse modulo - if( $multiseriada ) - { - $aluno_normal = false; - $aluno_multi = false; - $filtro = ""; - - // ve se tem algum aluno cadastrado na serie normal - $db->Consulta("SELECT 1 FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ref_cod_escola = '{$cod_escola}' AND ref_cod_serie = '{$cod_serie}' AND aprovado = 3 AND ativo = 1 "); - if ($db->ProximoRegistro()) - { - $aluno_normal = true; - } - - if(is_numeric($cod_serie_mult)) - { - // ve se tem algum aluno na serie alterantiva - $db->Consulta("SELECT 1 FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ref_cod_escola = '{$cod_escola}' AND ref_cod_serie = '{$cod_serie_mult}' AND aprovado = 3 AND ativo = 1 "); - if ($db->ProximoRegistro()) - { - $aluno_multi = true; - } - } - - // monta o filtro de acordo com os alunos na serie normal ou alternativa - if ($aluno_normal || $aluno_multi) - { - if ($aluno_normal) - { - if($aluno_multi) - { - $filtro = " AND ( ref_ref_cod_serie = '{$cod_serie}' OR ref_ref_cod_serie = '{$cod_serie_mult}' )"; - } - else - { - $filtro = " AND ref_ref_cod_serie = '{$cod_serie}'"; - } - } - else - { - $filtro = " AND ref_ref_cod_serie = '{$cod_serie_mult}'"; - } - } - - $db->Consulta("SELECT ref_cod_disciplina, ref_ref_cod_serie FROM pmieducar.escola_serie_disciplina WHERE ref_ref_cod_escola = '{$cod_escola}' {$filtro} AND ativo = 1"); - } - else - { - // nao eh multi-seriada - $db->Consulta("SELECT ref_cod_disciplina, ref_ref_cod_serie FROM pmieducar.escola_serie_disciplina WHERE ref_ref_cod_escola = '{$cod_escola}' AND ref_ref_cod_serie = '{$cod_serie}' AND ativo = 1"); - } - } - else - { - // todos os alunos tem pelo menos uma nota, vamos ver quais as disciplinas que estao faltando - $qtd_alunos = $db->CampoUnico("SELECT COUNT(0) FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ref_cod_serie = '{$cod_serie}' AND aprovado = 3 AND ativo = 1"); - if( $multiseriada ) - { - $qtd_alunos_mult = $db->CampoUnico("SELECT COUNT(0) FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ref_cod_serie = '{$cod_serie_mult}' AND aprovado = 3 AND ativo = 1"); -// encontra as disciplinas que ainda precisam receber nota - $sql = " - ( - SELECT ref_cod_disciplina, serie FROM - ( - SELECT ds.ref_cod_disciplina, {$cod_serie} AS serie - , ( SELECT COUNT(0) FROM pmieducar.dispensa_disciplina dd, pmieducar.v_matricula_matricula_turma mmt WHERE dd.ativo = 1 AND dd.ref_cod_disciplina = ds.ref_cod_disciplina AND mmt.cod_matricula = dd.ref_cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola}' AND mmt.ref_cod_serie = '{$cod_serie}' ) AS dispensas - , ( SELECT COUNT(0) FROM pmieducar.nota_aluno na, pmieducar.v_matricula_matricula_turma mmt WHERE na.ativo = 1 AND na.ref_cod_disciplina = ds.ref_cod_disciplina AND na.modulo = '{$modulo}' AND na.ref_cod_matricula = mmt.cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola}' AND mmt.ref_cod_serie = '{$cod_serie}' ) AS notas - FROM pmieducar.escola_serie_disciplina ds WHERE ds.ativo = 1 AND ref_ref_cod_serie = '{$cod_serie}' AND ref_ref_cod_escola = '{$cod_escola}' - ) AS sub1 WHERE dispensas + notas < $qtd_alunos - ) - UNION - ( - SELECT ref_cod_disciplina, serie FROM - ( - SELECT ds.ref_cod_disciplina, {$cod_serie_mult} AS serie - , ( SELECT COUNT(0) FROM pmieducar.dispensa_disciplina dd, pmieducar.v_matricula_matricula_turma mmt WHERE dd.ativo = 1 AND dd.ref_cod_disciplina = ds.ref_cod_disciplina AND mmt.cod_matricula = dd.ref_cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola_mult}' AND mmt.ref_cod_serie = '{$cod_serie_mult}' ) AS dispensas - , ( SELECT COUNT(0) FROM pmieducar.nota_aluno na, pmieducar.v_matricula_matricula_turma mmt WHERE na.ativo = 1 AND na.ref_cod_disciplina = ds.ref_cod_disciplina AND na.modulo = '{$modulo}' AND na.ref_cod_matricula = mmt.cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola_mult}' AND mmt.ref_cod_serie = '{$cod_serie_mult}' ) AS notas - FROM pmieducar.escola_serie_disciplina ds WHERE ds.ativo = 1 AND ref_ref_cod_serie = '{$cod_serie_mult}' AND ref_ref_cod_escola = '{$cod_escola_mult}' - ) AS sub2 WHERE dispensas + notas < $qtd_alunos_mult - ) - "; - - } - else - { - $sql = " - SELECT ref_cod_disciplina, serie FROM - ( - SELECT ds.ref_cod_disciplina, {$cod_serie} AS serie - , ( SELECT COUNT(0) FROM pmieducar.dispensa_disciplina dd, pmieducar.v_matricula_matricula_turma mmt WHERE dd.ativo = 1 AND dd.ref_cod_disciplina = ds.ref_cod_disciplina AND mmt.cod_matricula = dd.ref_cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola}' AND mmt.ref_cod_serie = '{$cod_serie}' ) AS dispensas - , ( SELECT COUNT(0) FROM pmieducar.nota_aluno na, pmieducar.v_matricula_matricula_turma mmt WHERE na.ativo = 1 AND na.ref_cod_disciplina = ds.ref_cod_disciplina AND na.modulo = '{$modulo}' AND na.ref_cod_matricula = mmt.cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola}' AND mmt.ref_cod_serie = '{$cod_serie}' ) AS notas - FROM pmieducar.escola_serie_disciplina ds WHERE ds.ativo = 1 AND ref_ref_cod_serie = '{$cod_serie}' AND ref_ref_cod_escola = '{$cod_escola}' - ) AS sub1 WHERE dispensas + notas < $qtd_alunos - "; - } - $db->Consulta($sql); - } - while( $db->ProximoRegistro() ) - { - list($cod_disciplina,$cod_serie)=$db->Tupla(); - $disciplinas[] = array( "cod_disciplina" => $cod_disciplina, "cod_serie" => $cod_serie ); - } - return $disciplinas; - } - return false; - } - - /** - * Retorna as disciplinas do exame - * - * @return bool - */ - function moduloExameDisciplina($verifica_aluno_possui_nota = false) - { - if( is_numeric( $this->cod_turma ) ) - { - $cod_curso = $this->getCurso(); - $objCurso = new clsPmieducarCurso($cod_curso); - $detCurso = $objCurso->detalhe(); - - $modulos = $this->maxModulos(); - $objNotaAluno = new clsPmieducarNotaAluno(); - return $objNotaAluno->getDisciplinasExame($this->cod_turma,$modulos,$detCurso["media"], $verifica_aluno_possui_nota); - } - return false; - } - - /** - * Retorna os alunos do exame - * - * @return bool - */ - function moduloExameAlunos($cod_disciplina_exame = null) - { - if( is_numeric( $this->cod_turma ) ) - { - $cod_curso = $this->getCurso(); - $objCurso = new clsPmieducarCurso($cod_curso); - $detCurso = $objCurso->detalhe(); - - $modulos = $this->maxModulos(); - $objNotaAluno = new clsPmieducarNotaAluno(); - return $objNotaAluno->getAlunosExame($this->cod_turma,$modulos,$detCurso["media"],$cod_disciplina_exame); - } - return false; - } - - /** - * encontra as matriculas dessa turma que ainda nao receberam nota da disciplina $cod_disciplina da serie $cod_serie no modulo $modulo - * - * @param int $cod_disciplina - * @param int $cod_serie - * @param int $modulo - * @return array - */ - function matriculados_modulo_disciplina_sem_nota( $cod_disciplina, $cod_serie, $modulo ) - { - $matriculas = array(); - - $db = new clsBanco(); - $db->Consulta(" - SELECT cod_matricula FROM pmieducar.v_matricula_matricula_turma - WHERE ref_cod_turma = '{$this->cod_turma}' - AND aprovado = 3 - AND ativo = 1 - AND cod_matricula NOT IN ( - SELECT ref_cod_matricula - FROM pmieducar.nota_aluno - WHERE ref_cod_disciplina = '{$cod_disciplina}' - AND ref_cod_serie = '{$cod_serie}' - AND modulo = '{$modulo}' - AND ativo = 1 - ) - AND cod_matricula NOT IN ( - SELECT ref_cod_matricula FROM pmieducar.dispensa_disciplina WHERE ref_cod_disciplina = '{$cod_disciplina}' AND ativo = 1 - ) - "); - - if( $db->numLinhas() ) - { - while ( $db->ProximoRegistro() ) - { - list($matricula) = $db->Tupla(); - $matriculas[$matricula] = $matricula; - } - } - return $matriculas; - } - - /** - * volta o maior modulo comum (antes do exame) permitido nessa turma - * - * @return unknown - */ - function maxModulos() - { - if( is_numeric($this->cod_turma) ) - { - $db = new clsBanco(); - // ve se o curso segue o padrao escolar - $padrao = $db->CampoUnico("SELECT c.padrao_ano_escolar FROM {$this->_schema}curso c, {$this->_tabela} t WHERE cod_turma = {$this->cod_turma} AND c.cod_curso = t.ref_cod_curso AND c.ativo = 1 AND t.ativo = 1"); - if( $padrao ) - { - // segue o padrao - $cod_escola = $db->CampoUnico("SELECT ref_ref_cod_escola FROM {$this->_tabela} WHERE cod_turma = {$this->cod_turma} AND ativo = 1"); - $ano = $db->CampoUnico("SELECT COALESCE(MAX(ano),0) FROM {$this->_schema}escola_ano_letivo WHERE ref_cod_escola = {$cod_escola} AND andamento = 1 AND ativo = 1"); - if( $ano ) - { - return $db->CampoUnico("SELECT COALESCE(MAX(sequencial),0) FROM {$this->_schema}ano_letivo_modulo WHERE ref_ref_cod_escola = {$cod_escola} AND ref_ano = {$ano}"); - } - } - else - { - // nao segue o padrao escolar - return $db->CampoUnico("SELECT COALESCE(MAX(sequencial),0) FROM {$this->_schema}turma_modulo WHERE ref_cod_turma = {$this->cod_turma}"); - } - } - return false; - } - - function getCurso() - { - if( is_numeric($this->cod_turma) ) - { - $db = new clsBanco(); - $db->Consulta("SELECT ref_cod_curso, ref_ref_cod_serie FROM {$this->_tabela} WHERE cod_turma = '{$this->cod_turma}'"); - $db->ProximoRegistro(); - list($cod_curso,$cod_serie) = $db->Tupla(); - if( is_numeric($cod_curso) ) - { - return $cod_curso; - } - - if(is_numeric($cod_serie)) - { - $db->Consulta("SELECT ref_cod_curso FROM {$this->_schema}serie WHERE cod_serie = '{$cod_serie}'"); - $db->ProximoRegistro(); - list($cod_curso) = $db->Tupla(); - if( is_numeric($cod_curso) ) - { - return $cod_curso; - } - } - - return false; - } - } - - /** - * Retorna uma lista filtrados de acordo com os parametros - * - * @return array - */ - function lista( $int_cod_turma = null, z$int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = 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_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $bool_verifica_serie_multiseriada = false, $bool_tem_alunos_aguardando_nota = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null, $somenteAnoLetivoEmAndamento = FALSE) - { - - $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela} t"; - $filtros = ""; - - $whereAnd = " WHERE "; - - if( is_numeric( $int_cod_turma ) ) - { - $filtros .= "{$whereAnd} t.cod_turma = '{$int_cod_turma}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_usuario_exc ) ) - { - $filtros .= "{$whereAnd} t.ref_usuario_exc = '{$int_ref_usuario_exc}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_usuario_cad ) ) - { - $filtros .= "{$whereAnd} t.ref_usuario_cad = '{$int_ref_usuario_cad}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_serie ) ) - { - if($bool_verifica_serie_multiseriada == true) - { - $mult = " OR t.ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie}' "; - } - - $filtros .= "{$whereAnd} ( t.ref_ref_cod_serie = '{$int_ref_ref_cod_serie}' $mult )"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_escola ) ) - { - /*if($bool_verifica_serie_multiseriada === true) - { - $mult = " OR t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola}' "; - }*/ - - $filtros .= "{$whereAnd} ( t.ref_ref_cod_escola = '{$int_ref_ref_cod_escola}' )"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_infra_predio_comodo ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_infra_predio_comodo = '{$int_ref_cod_infra_predio_comodo}'"; - $whereAnd = " AND "; - } - if( is_string( $str_nm_turma ) ) - { - $filtros .= "{$whereAnd} translate(upper(t.nm_turma),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_turma}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; - $whereAnd = " AND "; - } - if( is_string( $str_sgl_turma ) ) - { - $filtros .= "{$whereAnd} t.sgl_turma LIKE '%{$str_sgl_turma}%'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_max_aluno ) ) - { - $filtros .= "{$whereAnd} t.max_aluno = '{$int_max_aluno}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_multiseriada ) ) - { - $filtros .= "{$whereAnd} t.multiseriada = '{$int_multiseriada}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_cadastro_ini ) ) - { - $filtros .= "{$whereAnd} t.data_cadastro >= '{$date_data_cadastro_ini}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_cadastro_fim ) ) - { - $filtros .= "{$whereAnd} t.data_cadastro <= '{$date_data_cadastro_fim}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_exclusao_ini ) ) - { - $filtros .= "{$whereAnd} t.data_exclusao >= '{$date_data_exclusao_ini}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_exclusao_fim ) ) - { - $filtros .= "{$whereAnd} t.data_exclusao <= '{$date_data_exclusao_fim}'"; - $whereAnd = " AND "; - } - if( is_null( $int_ativo ) || $int_ativo ) - { - $filtros .= "{$whereAnd} t.ativo = '1'"; - $whereAnd = " AND "; - } - else - { - $filtros .= "{$whereAnd} t.ativo = '0'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_turma_tipo ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_turma_tipo = '{$int_ref_cod_turma_tipo}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicial_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_inicial >= '{$time_hora_inicial_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicial_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_inicial <= '{$time_hora_inicial_fim}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_final_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_final >= '{$time_hora_final_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_final_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_final <= '{$time_hora_final_fim}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicio_intervalo_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_inicio_intervalo >= '{$time_hora_inicio_intervalo_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicio_intervalo_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_inicio_intervalo <= '{$time_hora_inicio_intervalo_fim}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_fim_intervalo_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_fim_intervalo >= '{$time_hora_fim_intervalo_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_fim_intervalo_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_fim_intervalo <= '{$time_hora_fim_intervalo_fim}'"; - $whereAnd = " AND "; - } - /* if( is_numeric( $int_ref_cod_curso ) ) - { - $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_instituicao ) ) - { - $filtros .= "{$whereAnd} e.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; - $whereAnd = " AND "; - }*/ - if( is_numeric( $int_ref_cod_regente ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_regente = '{$int_ref_cod_regente}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_instituicao_regente ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_instituicao_regente = '{$int_ref_cod_instituicao_regente}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_instituicao ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_curso )) - { - $filtros .= "{$whereAnd} t.ref_cod_curso = '{$int_ref_cod_curso}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_escola_mult ) ) - { - $filtros .= "{$whereAnd} t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola_mult}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_serie_mult )) - { - $filtros .= "{$whereAnd} t.ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie_mult}'"; - $whereAnd = " AND "; - } - if( is_numeric($int_qtd_min_alunos_matriculados) ) - { - $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.matricula_turma WHERE ref_cod_turma = t.cod_turma) >= '{$int_qtd_min_alunos_matriculados}' "; - $whereAnd = " AND "; - } - - if (is_bool($bool_tem_alunos_aguardando_nota) ) - { - if ($bool_tem_alunos_aguardando_nota) - { - $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.v_matricula_matricula_turma mmt WHERE mmt.ref_cod_turma = t.cod_turma AND mmt.aprovado = 3 AND mmt.ativo = 1 ) > 0 "; - $whereAnd = " AND "; - } - } - if (is_bool($visivel)) - { - if ($visivel) - { - $filtros .= "{$whereAnd} t.visivel = TRUE"; - $whereAnd = " AND "; - } - else - { - $filtros .= "{$whereAnd} t.visivel = FALSE"; - $whereAnd = " AND "; - } - } - elseif (is_array($visivel) && count($visivel)) - { - $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; - $whereAnd = " AND "; - } - else - { - $filtros .= "{$whereAnd} t.visivel = TRUE"; - $whereAnd = " AND "; - } - - if( is_numeric( $turma_turno_id ) ) { - $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; - $whereAnd = " AND "; - } - - if( is_numeric( $tipo_boletim ) ) { - $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; - $whereAnd = " AND "; - } - - if( is_numeric( $ano ) ) { - $filtros .= "{$whereAnd} t.ano = '{$ano}'"; - $whereAnd = " AND "; - } - - if( $somenteAnoLetivoEmAndamento ) { - $filtros .= "{$whereAnd} t.ano in (SELECT ano FROM pmieducar.escola_ano_letivo WHERE andamento = 1 AND ativo = 1 AND ref_cod_escola = t.ref_ref_cod_escola)"; - $whereAnd = " AND "; - } - - if (!$this->listarNaoInformarEducacenso) { - $filtros .= "{$whereAnd} COALESCE(t.nao_informar_educacenso,0) <> 1"; - $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} t, {$this->_schema}escola_serie es, {$this->_schema}serie s, {$this->_schema}escola e {$filtros}" ); - $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t {$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; - } - - /** - * Retorna uma lista filtrados de acordo com os parametros - * - * @return array - */ - function lista2( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = 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_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null ) - { - - /*$nm_escola = "( - SELECT c.nm_escola AS nm_escola - FROM pmieducar.escola_complemento c - WHERE c.ref_cod_escola = t.ref_ref_cod_escola -AND e.cod_escola = t.ref_ref_cod_escola - -UNION - SELECT j.fantasia AS nm_escola - FROM cadastro.juridica j - WHERE j.idpes = e.ref_idpes -and e.cod_escola = t.ref_ref_cod_escola - ) AS nm_escola ";a*/ - $sql = "SELECT {$this->_campos_lista},c.nm_curso,s.nm_serie,i.nm_instituicao FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c, {$this->_schema}instituicao i "; - $filtros = ""; - - $whereAnd = " WHERE t.ref_cod_curso = c.cod_curso AND c.ref_cod_instituicao = i.cod_instituicao AND "; - - if( is_numeric( $int_cod_turma ) ) - { - $filtros .= "{$whereAnd} t.cod_turma = '{$int_cod_turma}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_usuario_exc ) ) - { - $filtros .= "{$whereAnd} t.ref_usuario_exc = '{$int_ref_usuario_exc}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_usuario_cad ) ) - { - $filtros .= "{$whereAnd} t.ref_usuario_cad = '{$int_ref_usuario_cad}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_serie ) ) - { - $filtros .= "{$whereAnd} t.ref_ref_cod_serie = '{$int_ref_ref_cod_serie}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_escola ) ) - { - $filtros .= "{$whereAnd} t.ref_ref_cod_escola = '{$int_ref_ref_cod_escola}'"; - $whereAnd = " AND "; - } - elseif ($this->codUsuario) { - $filtros .= "{$whereAnd} EXISTS (SELECT 1 - FROM pmieducar.escola_usuario - WHERE escola_usuario.ref_cod_escola = t.ref_ref_cod_escola - AND escola_usuario.ref_cod_usuario = '{$this->codUsuario}')"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_infra_predio_comodo ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_infra_predio_comodo = '{$int_ref_cod_infra_predio_comodo}'"; - $whereAnd = " AND "; - } - if( is_string( $str_nm_turma ) ) - { - $filtros .= "{$whereAnd} translate(upper(t.nm_turma),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_turma}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; - $whereAnd = " AND "; - } - if( is_string( $str_sgl_turma ) ) - { - $filtros .= "{$whereAnd} t.sgl_turma LIKE '%{$str_sgl_turma}%'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_max_aluno ) ) - { - $filtros .= "{$whereAnd} t.max_aluno = '{$int_max_aluno}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_multiseriada ) ) - { - $filtros .= "{$whereAnd} t.multiseriada = '{$int_multiseriada}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_cadastro_ini ) ) - { - $filtros .= "{$whereAnd} t.data_cadastro >= '{$date_data_cadastro_ini}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_cadastro_fim ) ) - { - $filtros .= "{$whereAnd} t.data_cadastro <= '{$date_data_cadastro_fim}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_exclusao_ini ) ) - { - $filtros .= "{$whereAnd} t.data_exclusao >= '{$date_data_exclusao_ini}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_exclusao_fim ) ) - { - $filtros .= "{$whereAnd} t.data_exclusao <= '{$date_data_exclusao_fim}'"; - $whereAnd = " AND "; - } - if( is_null( $int_ativo ) || $int_ativo ) - { - $filtros .= "{$whereAnd} t.ativo = '1'"; - $whereAnd = " AND "; - } - else - { - $filtros .= "{$whereAnd} t.ativo = '0'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_turma_tipo ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_turma_tipo = '{$int_ref_cod_turma_tipo}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicial_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_inicial >= '{$time_hora_inicial_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicial_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_inicial <= '{$time_hora_inicial_fim}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_final_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_final >= '{$time_hora_final_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_final_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_final <= '{$time_hora_final_fim}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicio_intervalo_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_inicio_intervalo >= '{$time_hora_inicio_intervalo_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicio_intervalo_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_inicio_intervalo <= '{$time_hora_inicio_intervalo_fim}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_fim_intervalo_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_fim_intervalo >= '{$time_hora_fim_intervalo_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_fim_intervalo_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_fim_intervalo <= '{$time_hora_fim_intervalo_fim}'"; - $whereAnd = " AND "; - } - /* if( is_numeric( $int_ref_cod_curso ) ) - { - $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_instituicao ) ) - { - $filtros .= "{$whereAnd} e.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; - $whereAnd = " AND "; - }*/ - if( is_numeric( $int_ref_cod_regente ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_regente = '{$int_ref_cod_regente}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_instituicao_regente ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_instituicao_regente = '{$int_ref_cod_instituicao_regente}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_instituicao ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_curso ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_curso = '{$int_ref_cod_curso}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_escola_mult ) ) - { - $filtros .= "{$whereAnd} t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola_mult}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_serie_mult ) ) - { - $filtros .= "{$whereAnd} t.int_ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie_mult}'"; - $whereAnd = " AND "; - } - if( is_numeric($int_qtd_min_alunos_matriculados) ) - { - $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.matricula_turma WHERE ref_cod_turma = t.cod_turma) >= '{$int_qtd_min_alunos_matriculados}' "; - $whereAnd = " AND "; - } - if (is_bool($visivel)) - { - if ($visivel) - { - $filtros .= "{$whereAnd} t.visivel = TRUE"; - $whereAnd = " AND "; - } - else - { - $filtros .= "{$whereAnd} t.visivel = FALSE"; - $whereAnd = " AND "; - } - } - elseif (is_array($visivel) && count($visivel)) - { - $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; - $whereAnd = " AND "; - } - else - { - $filtros .= "{$whereAnd} t.visivel = TRUE"; - $whereAnd = " AND "; - } - - if( is_numeric( $turma_turno_id ) ) { - $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; - $whereAnd = " AND "; - } - - if( is_numeric( $tipo_boletim ) ) { - $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; - $whereAnd = " AND "; - } - - if( is_numeric( $ano ) ) { - $filtros .= "{$whereAnd} t.ano = '{$ano}'"; - $whereAnd = " AND "; - } - - $db = new clsBanco(); - $countCampos = count( explode( ",", $this->_campos_lista ) ); - $resultado = array(); - - $sql .= $filtros . $this->getOrderby() . $this->getLimite(); -// echo ""; - -// $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t, {$this->_schema}escola_serie es, {$this->_schema}serie s, {$this->_schema}escola e {$filtros}" ); - $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c , {$this->_schema}instituicao i {$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; - } - -/** - * Retorna uma lista filtrados de acordo com os parametros - * (Modificação da lista2, agora trazendo somente turmas do ano atual) - * @return array - */ - function lista3( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = 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_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null ) - { - - /*$nm_escola = "( - SELECT c.nm_escola AS nm_escola - FROM pmieducar.escola_complemento c - WHERE c.ref_cod_escola = t.ref_ref_cod_escola -AND e.cod_escola = t.ref_ref_cod_escola - -UNION - SELECT j.fantasia AS nm_escola - FROM cadastro.juridica j - WHERE j.idpes = e.ref_idpes -and e.cod_escola = t.ref_ref_cod_escola - ) AS nm_escola ";a*/ - $sql = "SELECT {$this->_campos_lista},c.nm_curso,s.nm_serie,i.nm_instituicao FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c, {$this->_schema}instituicao i "; - $filtros = ""; - - $whereAnd = " WHERE t.ref_cod_curso = c.cod_curso AND c.ref_cod_instituicao = i.cod_instituicao AND "; - - if( is_numeric( $int_cod_turma ) ) - { - $filtros .= "{$whereAnd} t.cod_turma = '{$int_cod_turma}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_usuario_exc ) ) - { - $filtros .= "{$whereAnd} t.ref_usuario_exc = '{$int_ref_usuario_exc}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_usuario_cad ) ) - { - $filtros .= "{$whereAnd} t.ref_usuario_cad = '{$int_ref_usuario_cad}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_serie ) ) - { - $filtros .= "{$whereAnd} t.ref_ref_cod_serie = '{$int_ref_ref_cod_serie}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_escola ) ) - { - $filtros .= "{$whereAnd} t.ref_ref_cod_escola = '{$int_ref_ref_cod_escola}'"; - $whereAnd = " AND "; - } - elseif ($this->codUsuario) { - $filtros .= "{$whereAnd} EXISTS (SELECT 1 - FROM pmieducar.escola_usuario - WHERE escola_usuario.ref_cod_escola = t.ref_ref_cod_escola - AND escola_usuario.ref_cod_usuario = '{$this->codUsuario}')"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_infra_predio_comodo ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_infra_predio_comodo = '{$int_ref_cod_infra_predio_comodo}'"; - $whereAnd = " AND "; - } - if( is_string( $str_nm_turma ) ) - { - $filtros .= "{$whereAnd} translate(upper(t.nm_turma),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_turma}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; - $whereAnd = " AND "; - } - if( is_string( $str_sgl_turma ) ) - { - $filtros .= "{$whereAnd} t.sgl_turma LIKE '%{$str_sgl_turma}%'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_max_aluno ) ) - { - $filtros .= "{$whereAnd} t.max_aluno = '{$int_max_aluno}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_multiseriada ) ) - { - $filtros .= "{$whereAnd} t.multiseriada = '{$int_multiseriada}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_cadastro_ini ) ) - { - $filtros .= "{$whereAnd} t.data_cadastro >= '{$date_data_cadastro_ini}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_cadastro_fim ) ) - { - $filtros .= "{$whereAnd} t.data_cadastro <= '{$date_data_cadastro_fim}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_exclusao_ini ) ) - { - $filtros .= "{$whereAnd} t.data_exclusao >= '{$date_data_exclusao_ini}'"; - $whereAnd = " AND "; - } - if( is_string( $date_data_exclusao_fim ) ) - { - $filtros .= "{$whereAnd} t.data_exclusao <= '{$date_data_exclusao_fim}'"; - $whereAnd = " AND "; - } - if( is_null( $int_ativo ) || $int_ativo ) - { - $filtros .= "{$whereAnd} t.ativo = '1'"; - $whereAnd = " AND "; - } - else - { - $filtros .= "{$whereAnd} t.ativo = '0'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_turma_tipo ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_turma_tipo = '{$int_ref_cod_turma_tipo}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicial_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_inicial >= '{$time_hora_inicial_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicial_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_inicial <= '{$time_hora_inicial_fim}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_final_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_final >= '{$time_hora_final_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_final_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_final <= '{$time_hora_final_fim}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicio_intervalo_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_inicio_intervalo >= '{$time_hora_inicio_intervalo_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_inicio_intervalo_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_inicio_intervalo <= '{$time_hora_inicio_intervalo_fim}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_fim_intervalo_ini ) ) - { - $filtros .= "{$whereAnd} t.hora_fim_intervalo >= '{$time_hora_fim_intervalo_ini}'"; - $whereAnd = " AND "; - } - if( ( $time_hora_fim_intervalo_fim ) ) - { - $filtros .= "{$whereAnd} t.hora_fim_intervalo <= '{$time_hora_fim_intervalo_fim}'"; - $whereAnd = " AND "; - } - /* if( is_numeric( $int_ref_cod_curso ) ) - { - $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_instituicao ) ) - { - $filtros .= "{$whereAnd} e.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; - $whereAnd = " AND "; - }*/ - if( is_numeric( $int_ref_cod_regente ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_regente = '{$int_ref_cod_regente}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_instituicao_regente ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_instituicao_regente = '{$int_ref_cod_instituicao_regente}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_instituicao ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_cod_curso ) ) - { - $filtros .= "{$whereAnd} t.ref_cod_curso = '{$int_ref_cod_curso}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_escola_mult ) ) - { - $filtros .= "{$whereAnd} t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola_mult}'"; - $whereAnd = " AND "; - } - if( is_numeric( $int_ref_ref_cod_serie_mult ) ) - { - $filtros .= "{$whereAnd} t.int_ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie_mult}'"; - $whereAnd = " AND "; - } - if( is_numeric($int_qtd_min_alunos_matriculados) ) - { - $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.matricula_turma WHERE ref_cod_turma = t.cod_turma) >= '{$int_qtd_min_alunos_matriculados}' "; - $whereAnd = " AND "; - } - if (is_bool($visivel)) - { - if ($visivel) - { - $filtros .= "{$whereAnd} t.visivel = TRUE"; - $whereAnd = " AND "; - } - else - { - $filtros .= "{$whereAnd} t.visivel = FALSE"; - $whereAnd = " AND "; - } - } - elseif (is_array($visivel) && count($visivel)) - { - $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; - $whereAnd = " AND "; - } - else - { - $filtros .= "{$whereAnd} t.visivel = TRUE"; - $whereAnd = " AND "; - } - - if( is_numeric( $turma_turno_id ) ) { - $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; - $whereAnd = " AND "; - } - - if( is_numeric( $tipo_boletim ) ) { - $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; - $whereAnd = " AND "; - } - - if( is_numeric( $ano ) ) { - $filtros .= "{$whereAnd} t.ano = '{$ano}'"; - $whereAnd = " AND "; - } - - // Retirar OR quando todas turmas tiverem a coluna ANO definido. - //$filtros .= "{$whereAnd} t.ano = ( SELECT ano FROM pmieducar.escola_ano_letivo enl WHERE enl.ref_cod_escola = t.ref_ref_cod_escola AND andamento = 1 and ativo = 1)"; - - $db = new clsBanco(); - $countCampos = count( explode( ",", $this->_campos_lista ) ); - $resultado = array(); - - $sql .= $filtros . $this->getOrderby() . $this->getLimite(); -// echo ""; - -// $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t, {$this->_schema}escola_serie es, {$this->_schema}serie s, {$this->_schema}escola e {$filtros}" ); - $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c , {$this->_schema}instituicao i {$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; - } - /** - * Retorna um array com os dados de um registro - * - * @return array - */ - function detalhe() - { - if( is_numeric( $this->cod_turma ) ) - { - - $db = new clsBanco(); - $db->Consulta( "SELECT {$this->_todos_campos} FROM {$this->_tabela} t WHERE t.cod_turma = '{$this->cod_turma}'" ); - $db->ProximoRegistro(); - return $db->Tupla(); - } - return false; - } - - /** - * Retorna um array com os dados de um registro - * - * @return array - */ - function existe() - { - if( is_numeric( $this->cod_turma ) ) - { - - $db = new clsBanco(); - $db->Consulta( "SELECT 1 FROM {$this->_tabela} WHERE cod_turma = '{$this->cod_turma}'" ); - $db->ProximoRegistro(); - return $db->Tupla(); - } - return false; - } - - /** - * Exclui um registro - * - * @return bool - */ - function excluir() - { - if( is_numeric( $this->cod_turma ) && is_numeric( $this->ref_usuario_exc ) ) - { - - /* - delete - $db = new clsBanco(); - $db->Consulta( "DELETE FROM {$this->_tabela} WHERE cod_turma = '{$this->cod_turma}'" ); - return true; - */ - - $this->ativo = 0; - return $this->edita(); - } - return false; - } - - /** - * Define quais campos da tabela serao selecionados na invocacao do metodo lista - * - * @return null - */ - function setCamposLista( $str_campos ) - { - $this->_campos_lista = $str_campos; - } - - /** - * Define que o metodo Lista devera retornoar todos os campos da tabela - * - * @return null - */ - function resetCamposLista() - { - $this->_campos_lista = $this->_todos_campos; - } - - /** - * Define limites de retorno para o metodo lista - * - * @return null - */ - function setLimite( $intLimiteQtd, $intLimiteOffset = null ) - { - $this->_limite_quantidade = $intLimiteQtd; - $this->_limite_offset = $intLimiteOffset; - } - - /** - * Retorna a string com o trecho da query resposavel pelo Limite de registros - * - * @return string - */ - function getLimite() - { - if( is_numeric( $this->_limite_quantidade ) ) - { - $retorno = " LIMIT {$this->_limite_quantidade}"; - if( is_numeric( $this->_limite_offset ) ) - { - $retorno .= " OFFSET {$this->_limite_offset} "; - } - return $retorno; - } - return ""; - } - - /** - * Define campo para ser utilizado como ordenacao no metolo lista - * - * @return null - */ - function setOrderby( $strNomeCampo ) - { - // limpa a string de possiveis erros (delete, insert, etc) - //$strNomeCampo = eregi_replace(); - - if( is_string( $strNomeCampo ) && $strNomeCampo ) - { - $this->_campo_order_by = $strNomeCampo; - } - } - - /** - * Retorna a string com o trecho da query resposavel pela Ordenacao dos registros - * - * @return string - */ - function getOrderby() - { - if( is_string( $this->_campo_order_by ) ) - { - return " ORDER BY {$this->_campo_order_by} "; - } - return ""; - } - - function checaAnoLetivoEmAndamento() - { - if( is_numeric( $this->cod_turma ) ) - { - - $db = new clsBanco(); - $db->Consulta( "SELECT 1 FROM {$this->_tabela} WHERE cod_turma = '{$this->cod_turma}' AND turma.ano in( SELECT ano FROM pmieducar.escola_ano_letivo enl WHERE enl.ref_cod_escola = turma.ref_ref_cod_escola AND andamento = 1)" ); - $db->ProximoRegistro(); - return $db->Tupla(); - } - return false; - } - function maximoAlunosSala(){ - - $detTurma = $this->detalhe(); - $objInstituicao = new clsPmiEducarInstituicao($detTurma['ref_cod_instituicao']); - $detInstituicao = $objInstituicao->detalhe(); - $controlaEspacoUtilizacaoAluno = $detInstituicao["controlar_espaco_utilizacao_aluno"]; - //se o parametro de controle de utilização de espaço estiver setado como verdadeiro - if($controlaEspacoUtilizacaoAluno){ - $percentagemMaximaUtilizacaoSala = $detInstituicao["percentagem_maxima_ocupacao_salas"]; - $quantidadeAlunosPorMetroQuadrado = $detInstituicao["quantidade_alunos_metro_quadrado"]; - $codSalaUtilizada = $detTurma["ref_cod_infra_predio_comodo"]; - - $objInfraPredioComodo = new clsPmiEducarInfraPredioComodo($codSalaUtilizada); - $detInfraPredioComodo = $objInfraPredioComodo->detalhe(); - $areaSala = $detInfraPredioComodo["area"]; - - if(is_numeric($percentagemMaximaUtilizacaoSala) AND (is_numeric($quantidadeAlunosPorMetroQuadrado)) AND is_numeric($areaSala)){ - $metragemMaximaASerUtilizadaSala = ($areaSala * ($percentagemMaximaUtilizacaoSala/100.00)); - $maximoAlunosSala = ($quantidadeAlunosPorMetroQuadrado * $metragemMaximaASerUtilizadaSala); - return round($maximoAlunosSala); - } - } - return false; - } - - public static function verificaDisciplinaDispensada($turmaId, $componenteId){ - $sql = "SELECT ref_cod_disciplina_dispensada as disciplina_dispensada FROM pmieducar.turma WHERE cod_turma = $1"; - - $params = array('params' => $turmaId, 'return_only' => 'first-field'); - $disciplina_dispensada = Portabilis_Utils_Database::fetchPreparedQuery($sql, $params); - - return $disciplina_dispensada == $componenteId; - } - - public static function getDisciplinaDispensada($turmaId){ - $sql = "SELECT ref_cod_disciplina_dispensada as disciplina_dispensada FROM pmieducar.turma WHERE cod_turma = $1"; - - $params = array('params' => $turmaId, 'return_only' => 'first-field'); - $disciplina_dispensada = Portabilis_Utils_Database::fetchPreparedQuery($sql, $params); - - return $disciplina_dispensada; - } - public function possuiAlunosVinculados(){ - $sql = "SELECT 1 - from pmieducar.matricula - inner join pmieducar.matricula_turma on(matricula.cod_matricula = matricula_turma.ref_cod_matricula) - where matricula.ativo = 1 - and matricula_turma.ref_cod_turma = $1 - and matricula_turma.ativo = 1"; - $params = array('params' => $this->cod_turma, 'return_only' => 'first-field'); - return Portabilis_Utils_Database::fetchPreparedQuery($sql, $params); - } - - public function updateInep($codigo_inep_educacenso) { - if ($this->cod_turma) { - $db = new clsBanco(); - $db->Consulta("DELETE FROM modules.educacenso_cod_turma WHERE cod_turma = '{$this->cod_turma}'"); - - if ($codigo_inep_educacenso) { - $db->Consulta("INSERT INTO modules.educacenso_cod_turma (cod_turma, cod_turma_inep, created_at) - VALUES ('{$this->cod_turma}', '{$codigo_inep_educacenso}', NOW());"); - } - } - } - - public function getInep(){ - if ($this->cod_turma) { - $sql = "SELECT cod_turma_inep - FROM modules.educacenso_cod_turma - WHERE cod_turma = $1"; - $params = array('params' => $this->cod_turma, 'return_only' => 'first-field'); - return Portabilis_Utils_Database::fetchPreparedQuery($sql, $params); - } - } - -} -?> +_schema = "pmieducar."; + $this->_tabela = "{$this->_schema}turma"; + + $this->_campos_lista = $this->_todos_campos = "t.cod_turma, t.ref_usuario_exc, t.ref_usuario_cad, t.ref_ref_cod_serie, t.ref_ref_cod_escola, t.ref_cod_infra_predio_comodo, t.nm_turma, t.sgl_turma, t.max_aluno, t.multiseriada, t.data_cadastro, t.data_exclusao, t.ativo, t.ref_cod_turma_tipo, t.hora_inicial, t.hora_final, t.hora_inicio_intervalo, t.hora_fim_intervalo, t.ref_cod_regente, t.ref_cod_instituicao_regente,t.ref_cod_instituicao, t.ref_cod_curso, t.ref_ref_cod_serie_mult, t.ref_ref_cod_escola_mult, t.visivel, t.turma_turno_id, t.tipo_boletim, t.tipo_boletim_diferenciado, t.ano, + t.tipo_atendimento, t.turma_mais_educacao, t.atividade_complementar_1, t.atividade_complementar_2, t.atividade_complementar_3, t.atividade_complementar_4, t.atividade_complementar_5, t.atividade_complementar_6, t.aee_braille, t.aee_recurso_optico, t.aee_estrategia_desenvolvimento, t.aee_tecnica_mobilidade, t.aee_libras, t.aee_caa, t.aee_curricular, t.aee_soroban, t.aee_informatica, t.aee_lingua_escrita, t.aee_autonomia, t.cod_curso_profissional, t.etapa_educacenso, t.ref_cod_disciplina_dispensada, t.parecer_1_etapa, t.parecer_2_etapa, + t.parecer_3_etapa, t.parecer_4_etapa, t.nao_informar_educacenso, t.tipo_mediacao_didatico_pedagogico, t.dias_semana, t.atividades_complementares, t.atividades_aee "; + + if( is_numeric( $ref_cod_turma_tipo ) ) + { + if( class_exists( "clsPmieducarTurmaTipo" ) ) + { + $tmp_obj = new clsPmieducarTurmaTipo( $ref_cod_turma_tipo ); + if( method_exists( $tmp_obj, "existe") ) + { + if( $tmp_obj->existe() ) + { + $this->ref_cod_turma_tipo = $ref_cod_turma_tipo; + } + } + else if( method_exists( $tmp_obj, "detalhe") ) + { + if( $tmp_obj->detalhe() ) + { + $this->ref_cod_turma_tipo = $ref_cod_turma_tipo; + } + } + } + else + { + if( $db->CampoUnico( "SELECT 1 FROM pmieducar.turma_tipo WHERE cod_turma_tipo = '{$ref_cod_turma_tipo}'" ) ) + { + $this->ref_cod_turma_tipo = $ref_cod_turma_tipo; + } + } + } + if( is_numeric( $ref_ref_cod_escola ) && is_numeric( $ref_ref_cod_serie ) ) + { + if( class_exists( "clsPmieducarEscolaSerie" ) ) + { + $tmp_obj = new clsPmieducarEscolaSerie( $ref_ref_cod_escola, $ref_ref_cod_serie ); + if( method_exists( $tmp_obj, "existe") ) + { + if( $tmp_obj->existe() ) + { + $this->ref_ref_cod_escola = $ref_ref_cod_escola; + $this->ref_ref_cod_serie = $ref_ref_cod_serie; + } + } + else if( method_exists( $tmp_obj, "detalhe") ) + { + if( $tmp_obj->detalhe() ) + { + $this->ref_ref_cod_escola = $ref_ref_cod_escola; + $this->ref_ref_cod_serie = $ref_ref_cod_serie; + } + } + } + else + { + if( $db->CampoUnico( "SELECT 1 FROM pmieducar.escola_serie WHERE ref_cod_escola = '{$ref_ref_cod_escola}' AND ref_cod_serie = '{$ref_ref_cod_serie}'" ) ) + { + $this->ref_ref_cod_escola = $ref_ref_cod_escola; + $this->ref_ref_cod_serie = $ref_ref_cod_serie; + } + } + } + if( is_numeric( $ref_cod_infra_predio_comodo ) ) + { + if( class_exists( "clsPmieducarInfraPredioComodo" ) ) + { + $tmp_obj = new clsPmieducarInfraPredioComodo( $ref_cod_infra_predio_comodo ); + if( method_exists( $tmp_obj, "existe") ) + { + if( $tmp_obj->existe() ) + { + $this->ref_cod_infra_predio_comodo = $ref_cod_infra_predio_comodo; + } + } + else if( method_exists( $tmp_obj, "detalhe") ) + { + if( $tmp_obj->detalhe() ) + { + $this->ref_cod_infra_predio_comodo = $ref_cod_infra_predio_comodo; + } + } + } + else + { + if( $db->CampoUnico( "SELECT 1 FROM pmieducar.infra_predio_comodo WHERE cod_infra_predio_comodo = '{$ref_cod_infra_predio_comodo}'" ) ) + { + $this->ref_cod_infra_predio_comodo = $ref_cod_infra_predio_comodo; + } + } + } + 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; + } + } + else if( 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; + } + } + } + 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; + } + } + else if( 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; + } + } + } + + if( is_numeric( $ref_cod_regente ) && is_numeric( $ref_cod_instituicao_regente ) ) + { + if( class_exists( "clsPmieducarServidor" ) ) + { + $tmp_obj = new clsPmieducarServidor($ref_cod_regente,null,null,null,null,null,null,$ref_cod_instituicao_regente,null); + if( method_exists( $tmp_obj, "existe") ) + { + if( $tmp_obj->existe() ) + { + $this->ref_cod_regente = $ref_cod_regente; + $this->ref_cod_instituicao_regente = $ref_cod_instituicao_regente; + } + } + else if( method_exists( $tmp_obj, "detalhe") ) + { + if( $tmp_obj->detalhe() ) + { + $this->ref_cod_regente = $ref_cod_regente; + $this->ref_cod_instituicao_regente = $ref_cod_instituicao_regente; + } + } + } + else + { + if( $db->CampoUnico( "SELECT 1 FROM pmieducar.servidor WHERE ref_cod_regente = '{$ref_cod_regente}' AND ref_cod_instituicao_regente = '{$ref_cod_instituicao_regente}'" ) ) + { + $this->ref_cod_regente = $ref_cod_regente; + $this->ref_cod_instituicao_regente = $ref_cod_instituicao_regente; + } + } + } + + if( is_numeric( $cod_turma ) ) + { + $this->cod_turma = $cod_turma; + } + if( is_string( $nm_turma ) ) + { + $this->nm_turma = $nm_turma; + } + if( is_string( $sgl_turma ) ) + { + $this->sgl_turma = $sgl_turma; + } + if( is_numeric( $max_aluno ) ) + { + $this->max_aluno = $max_aluno; + } + if( is_numeric( $multiseriada ) ) + { + $this->multiseriada = $multiseriada; + } + if( is_string( $data_cadastro ) ) + { + $this->data_cadastro = $data_cadastro; + } + if( is_string( $data_exclusao ) ) + { + $this->data_exclusao = $data_exclusao; + } + if( is_numeric( $ativo ) ) + { + $this->ativo = $ativo; + } + if( ( $hora_inicial ) ) + { + $this->hora_inicial = $hora_inicial; + } + if( ( $hora_final ) ) + { + $this->hora_final = $hora_final; + } + if( ( $hora_inicio_intervalo ) ) + { + $this->hora_inicio_intervalo = $hora_inicio_intervalo; + } + if( ( $hora_fim_intervalo ) ) + { + $this->hora_fim_intervalo = $hora_fim_intervalo; + } + + if( is_numeric( $ref_cod_instituicao ) ) + { + if( class_exists( "clsPmieducarInstituicao" ) ) + { + $tmp_obj = new clsPmieducarInstituicao( $ref_cod_instituicao ); + if( method_exists( $tmp_obj, "existe") ) + { + if( $tmp_obj->existe() ) + { + $this->ref_cod_instituicao = $ref_cod_instituicao; + } + } + else if( method_exists( $tmp_obj, "detalhe") ) + { + if( $tmp_obj->detalhe() ) + { + $this->ref_cod_instituicao = $ref_cod_instituicao; + } + } + } + else + { + if( $db->CampoUnico( "SELECT 1 FROM pmieducar.instituicao WHERE cod_instituicao = '{$ref_cod_instituicao}'" ) ) + { + $this->ref_cod_instituicao = $ref_cod_instituicao; + } + } + } + + if( is_numeric( $ref_cod_curso ) ) + { + if( class_exists( "clsPmieducarCurso" ) ) + { + $tmp_obj = new clsPmieducarCurso( $ref_cod_curso ); + if( method_exists( $tmp_obj, "existe") ) + { + if( $tmp_obj->existe() ) + { + $this->ref_cod_curso = $ref_cod_curso; + } + } + else if( method_exists( $tmp_obj, "detalhe") ) + { + if( $tmp_obj->detalhe() ) + { + $this->ref_cod_curso = $ref_cod_curso; + } + } + } + else + { + if( $db->CampoUnico( "SELECT 1 FROM pmieducar.curso WHERE cod_curso = '{$ref_cod_curso}'" ) ) + { + $this->ref_cod_curso = $ref_cod_curso; + } + } + } + + if( is_numeric( $ref_ref_cod_escola_mult ) && is_numeric( $ref_ref_cod_serie_mult ) ) + { + if( class_exists( "clsPmieducarEscolaSerie" ) ) + { + $tmp_obj = new clsPmieducarEscolaSerie( $ref_ref_cod_escola_mult, $ref_ref_cod_serie_mult ); + if( method_exists( $tmp_obj, "existe") ) + { + if( $tmp_obj->existe() ) + { + $this->ref_ref_cod_escola_mult = $ref_ref_cod_escola_mult; + $this->ref_ref_cod_serie_mult = $ref_ref_cod_serie_mult; + } + } + else if( method_exists( $tmp_obj, "detalhe") ) + { + if( $tmp_obj->detalhe() ) + { + $this->ref_ref_cod_escola_mult = $ref_ref_cod_escola_mult; + $this->ref_ref_cod_serie_mult = $ref_ref_cod_serie_mult; + } + } + } + else + { + if( $db->CampoUnico( "SELECT 1 FROM pmieducar.escola_serie WHERE ref_cod_escola = '{$ref_ref_cod_escola_mult}' AND ref_cod_serie = '{$ref_ref_cod_serie_mult}'" ) ) + { + $this->ref_ref_cod_escola_mult = $ref_ref_cod_escola_mult; + $this->ref_ref_cod_serie_mult = $ref_ref_cod_serie_mult; + } + } + } + if (is_bool($visivel)) + { + $this->visivel = dbBool($visivel); + } + + $this->turma_turno_id = $turma_turno_id; + $this->tipo_boletim = $tipo_boletim; + $this->ano = $ano; + $this->data_fechamento = $data_fechamento; + + if (is_numeric($ref_cod_disciplina_dispensada) || is_null($ref_cod_disciplina_dispensada)){ + $this->ref_cod_disciplina_dispensada = $ref_cod_disciplina_dispensada; + } + + } + + /** + * Cria um novo registro + * + * @return bool + */ + function cadastra() + { + if( is_numeric( $this->ref_usuario_cad ) /*&& is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_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 ) ) + { + $db = new clsBanco(); + + $campos = ""; + $valores = ""; + $gruda = ""; + + if( is_numeric( $this->ref_usuario_cad ) ) + { + $campos .= "{$gruda}ref_usuario_cad"; + $valores .= "{$gruda}'{$this->ref_usuario_cad}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_ref_cod_serie ) ) + { + $campos .= "{$gruda}ref_ref_cod_serie"; + $valores .= "{$gruda}'{$this->ref_ref_cod_serie}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_ref_cod_escola ) ) + { + $campos .= "{$gruda}ref_ref_cod_escola"; + $valores .= "{$gruda}'{$this->ref_ref_cod_escola}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_infra_predio_comodo ) ) + { + $campos .= "{$gruda}ref_cod_infra_predio_comodo"; + $valores .= "{$gruda}'{$this->ref_cod_infra_predio_comodo}'"; + $gruda = ", "; + } + if( is_string( $this->nm_turma ) ) + { + $campos .= "{$gruda}nm_turma"; + $valores .= "{$gruda}'{$this->nm_turma}'"; + $gruda = ", "; + } + if( is_string( $this->sgl_turma ) ) + { + $campos .= "{$gruda}sgl_turma"; + $valores .= "{$gruda}'{$this->sgl_turma}'"; + $gruda = ", "; + } + if( is_numeric( $this->max_aluno ) ) + { + $campos .= "{$gruda}max_aluno"; + $valores .= "{$gruda}'{$this->max_aluno}'"; + $gruda = ", "; + } + if( is_numeric( $this->multiseriada ) ) + { + $campos .= "{$gruda}multiseriada"; + $valores .= "{$gruda}'{$this->multiseriada}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_regente ) ) + { + $campos .= "{$gruda}ref_cod_regente"; + $valores .= "{$gruda}'{$this->ref_cod_regente}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_instituicao_regente ) ) + { + $campos .= "{$gruda}ref_cod_instituicao_regente"; + $valores .= "{$gruda}'{$this->ref_cod_instituicao_regente}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_instituicao ) ) + { + $campos .= "{$gruda}ref_cod_instituicao"; + $valores .= "{$gruda}'{$this->ref_cod_instituicao}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_curso ) ) + { + $campos .= "{$gruda}ref_cod_curso"; + $valores .= "{$gruda}'{$this->ref_cod_curso}'"; + $gruda = ", "; + } + $campos .= "{$gruda}data_cadastro"; + $valores .= "{$gruda}NOW()"; + $gruda = ", "; + $campos .= "{$gruda}ativo"; + $valores .= "{$gruda}'1'"; + $gruda = ", "; + if( is_numeric( $this->ref_cod_turma_tipo ) ) + { + $campos .= "{$gruda}ref_cod_turma_tipo"; + $valores .= "{$gruda}'{$this->ref_cod_turma_tipo}'"; + $gruda = ", "; + } + if( ( $this->hora_inicial ) ) + { + $campos .= "{$gruda}hora_inicial"; + $valores .= "{$gruda}'{$this->hora_inicial}'"; + $gruda = ", "; + } + if( ( $this->hora_final ) ) + { + $campos .= "{$gruda}hora_final"; + $valores .= "{$gruda}'{$this->hora_final}'"; + $gruda = ", "; + } + if( ( $this->hora_inicio_intervalo ) ) + { + $campos .= "{$gruda}hora_inicio_intervalo"; + $valores .= "{$gruda}'{$this->hora_inicio_intervalo}'"; + $gruda = ", "; + } + if( ( $this->hora_fim_intervalo ) ) + { + $campos .= "{$gruda}hora_fim_intervalo"; + $valores .= "{$gruda}'{$this->hora_fim_intervalo}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_ref_cod_escola_mult ) ) + { + $campos .= "{$gruda}ref_ref_cod_escola_mult"; + $valores .= "{$gruda}'{$this->ref_ref_cod_escola_mult}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_ref_cod_serie_mult ) ) + { + $campos .= "{$gruda}ref_ref_cod_serie_mult"; + $valores .= "{$gruda}'{$this->ref_ref_cod_serie_mult}'"; + $gruda = ", "; + } + $this->visivel = dbBool($this->visivel) ? "TRUE" : "FALSE"; + $campos .= "{$gruda}visivel"; + $valores .= "{$gruda}'{$this->visivel}'"; + $gruda = ", "; + + if(is_numeric($this->turma_turno_id)){ + $campos .= "{$gruda}turma_turno_id"; + $valores .= "{$gruda}'{$this->turma_turno_id}'"; + $gruda = ", "; + } + + if(is_numeric($this->tipo_boletim)){ + $campos .= "{$gruda}tipo_boletim"; + $valores .= "{$gruda}'{$this->tipo_boletim}'"; + $gruda = ", "; + } + + if(is_numeric($this->tipo_boletim_diferenciado)){ + $campos .= "{$gruda}tipo_boletim_diferenciado"; + $valores .= "{$gruda}'{$this->tipo_boletim_diferenciado}'"; + $gruda = ", "; + } + + if(is_numeric($this->ano)){ + $campos .= "{$gruda}ano"; + $valores .= "{$gruda}'{$this->ano}'"; + $gruda = ", "; + } + + if(is_string($this->data_fechamento) && $this->data_fechamento!=''){ + $campos .= "{$gruda}data_fechamento"; + $valores .= "{$gruda}'{$this->data_fechamento}'"; + $gruda = ", "; + } + + if(is_numeric($this->tipo_atendimento)){ + $campos .= "{$gruda}tipo_atendimento"; + $valores .= "{$gruda}'{$this->tipo_atendimento}'"; + $gruda = ", "; + } + + if(is_numeric($this->turma_mais_educacao)){ + $campos .= "{$gruda}turma_mais_educacao"; + $valores .= "{$gruda}'{$this->turma_mais_educacao}'"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_1)){ + $campos .= "{$gruda}atividade_complementar_1"; + $valores .= "{$gruda}'{$this->atividade_complementar_1}'"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_2)){ + $campos .= "{$gruda}atividade_complementar_2"; + $valores .= "{$gruda}'{$this->atividade_complementar_2}'"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_3)){ + $campos .= "{$gruda}atividade_complementar_3"; + $valores .= "{$gruda}'{$this->atividade_complementar_3}'"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_4)){ + $campos .= "{$gruda}atividade_complementar_4"; + $valores .= "{$gruda}'{$this->atividade_complementar_4}'"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_5)){ + $campos .= "{$gruda}atividade_complementar_5"; + $valores .= "{$gruda}'{$this->atividade_complementar_5}'"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_6)){ + $campos .= "{$gruda}atividade_complementar_6"; + $valores .= "{$gruda}'{$this->atividade_complementar_6}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_braille)){ + $campos .= "{$gruda}aee_braille"; + $valores .= "{$gruda}'{$this->aee_braille}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_recurso_optico)){ + $campos .= "{$gruda}aee_recurso_optico"; + $valores .= "{$gruda}'{$this->aee_recurso_optico}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_estrategia_desenvolvimento)){ + $campos .= "{$gruda}aee_estrategia_desenvolvimento"; + $valores .= "{$gruda}'{$this->aee_estrategia_desenvolvimento}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_tecnica_mobilidade)){ + $campos .= "{$gruda}aee_tecnica_mobilidade"; + $valores .= "{$gruda}'{$this->aee_tecnica_mobilidade}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_libras)){ + $campos .= "{$gruda}aee_libras"; + $valores .= "{$gruda}'{$this->aee_libras}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_caa)){ + $campos .= "{$gruda}aee_caa"; + $valores .= "{$gruda}'{$this->aee_caa}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_curricular)){ + $campos .= "{$gruda}aee_curricular"; + $valores .= "{$gruda}'{$this->aee_curricular}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_soroban)){ + $campos .= "{$gruda}aee_soroban"; + $valores .= "{$gruda}'{$this->aee_soroban}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_informatica)){ + $campos .= "{$gruda}aee_informatica"; + $valores .= "{$gruda}'{$this->aee_informatica}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_lingua_escrita)){ + $campos .= "{$gruda}aee_lingua_escrita"; + $valores .= "{$gruda}'{$this->aee_lingua_escrita}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_autonomia)){ + $campos .= "{$gruda}aee_autonomia"; + $valores .= "{$gruda}'{$this->aee_autonomia}'"; + $gruda = ", "; + } + + if(is_numeric($this->cod_curso_profissional)){ + $campos .= "{$gruda}cod_curso_profissional"; + $valores .= "{$gruda}'{$this->cod_curso_profissional}'"; + $gruda = ", "; + } + + if(is_numeric($this->etapa_educacenso)){ + $campos .= "{$gruda}etapa_educacenso"; + $valores .= "{$gruda}'{$this->etapa_educacenso}'"; + $gruda = ", "; + } + + if(is_numeric($this->ref_cod_disciplina_dispensada)){ + $campos .= "{$gruda}ref_cod_disciplina_dispensada"; + $valores .= "{$gruda}'{$this->ref_cod_disciplina_dispensada}'"; + $gruda = ", "; + }elseif(is_null($this->ref_cod_disciplina_dispensada)){ + $campos .= "{$gruda}ref_cod_disciplina_dispensada"; + $valores .= "{$gruda}NULL"; + $gruda = ", "; + } + + if(is_numeric($this->nao_informar_educacenso)){ + $campos .= "{$gruda}nao_informar_educacenso"; + $valores .= "{$gruda}'{$this->nao_informar_educacenso}'"; + $gruda = ", "; + } + + if(is_numeric($this->tipo_mediacao_didatico_pedagogico)){ + $campos .= "{$gruda}tipo_mediacao_didatico_pedagogico"; + $valores .= "{$gruda}'{$this->tipo_mediacao_didatico_pedagogico}'"; + $gruda = ", "; + } + + if(is_string($this->dias_semana)){ + $campos .= "{$gruda}dias_semana"; + $valores .= "{$gruda}'{$this->dias_semana}'"; + $gruda = ", "; + } + + if(is_string($this->atividades_complementares)){ + $campos .= "{$gruda}atividades_complementares"; + $valores .= "{$gruda}'{$this->atividades_complementares}'"; + $gruda = ", "; + } + + if(is_string($this->atividades_aee)){ + $campos .= "{$gruda}atividades_aee"; + $valores .= "{$gruda}'{$this->atividades_aee}'"; + $gruda = ", "; + } + + $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" ); + return $db->InsertId( "{$this->_tabela}_cod_turma_seq"); + } + return false; + } + + /** + * Edita os dados de um registro + * + * @return bool + */ + function edita() + { + if( is_numeric( $this->cod_turma ) && is_numeric( $this->ref_usuario_exc ) ) + { + + $db = new clsBanco(); + $set = ""; + + if( is_numeric( $this->ref_usuario_exc ) ) + { + $set .= "{$gruda}ref_usuario_exc = '{$this->ref_usuario_exc}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_usuario_cad ) ) + { + $set .= "{$gruda}ref_usuario_cad = '{$this->ref_usuario_cad}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_ref_cod_serie ) ) + { + $set .= "{$gruda}ref_ref_cod_serie = '{$this->ref_ref_cod_serie}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_ref_cod_escola ) ) + { + $set .= "{$gruda}ref_ref_cod_escola = '{$this->ref_ref_cod_escola}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_infra_predio_comodo ) ) + { + $set .= "{$gruda}ref_cod_infra_predio_comodo = '{$this->ref_cod_infra_predio_comodo}'"; + $gruda = ", "; + }elseif( is_null( $this->ref_cod_infra_predio_comodo ) ) + { + $set .= "{$gruda}ref_cod_infra_predio_comodo = NULL"; + $gruda = ", "; + } + if( is_string( $this->nm_turma ) ) + { + $set .= "{$gruda}nm_turma = '{$this->nm_turma}'"; + $gruda = ", "; + } + if( is_string( $this->sgl_turma ) ) + { + $set .= "{$gruda}sgl_turma = '{$this->sgl_turma}'"; + $gruda = ", "; + } + if( is_numeric( $this->max_aluno ) ) + { + $set .= "{$gruda}max_aluno = '{$this->max_aluno}'"; + $gruda = ", "; + } + if( is_numeric( $this->multiseriada ) ) + { + $set .= "{$gruda}multiseriada = '{$this->multiseriada}'"; + $gruda = ", "; + } + + if( is_string( $this->data_cadastro ) ) + { + $set .= "{$gruda}data_cadastro = '{$this->data_cadastro}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_regente ) ) + { + $set .= "{$gruda}ref_cod_regente = '{$this->ref_cod_regente}'"; + $gruda = ", "; + } + else + { + $set .= "{$gruda}ref_cod_regente = null"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_instituicao_regente ) ) + { + $set .= "{$gruda}ref_cod_instituicao_regente = '{$this->ref_cod_instituicao_regente}'"; + $gruda = ", "; + } + $set .= "{$gruda}data_exclusao = NOW()"; + $gruda = ", "; + if( is_numeric( $this->ativo ) ) + { + $set .= "{$gruda}ativo = '{$this->ativo}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_turma_tipo ) ) + { + $set .= "{$gruda}ref_cod_turma_tipo = '{$this->ref_cod_turma_tipo}'"; + $gruda = ", "; + } + if( ( $this->hora_inicial ) ) + { + $set .= "{$gruda}hora_inicial = '{$this->hora_inicial}'"; + $gruda = ", "; + } + if( ( $this->hora_final ) ) + { + $set .= "{$gruda}hora_final = '{$this->hora_final}'"; + $gruda = ", "; + } + if( ( $this->hora_inicio_intervalo ) ) + { + $set .= "{$gruda}hora_inicio_intervalo = '{$this->hora_inicio_intervalo}'"; + $gruda = ", "; + } + if( ( $this->hora_fim_intervalo ) ) + { + $set .= "{$gruda}hora_fim_intervalo = '{$this->hora_fim_intervalo}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_instituicao ) ) + { + $set .= "{$gruda}ref_cod_instituicao = '{$this->ref_cod_instituicao}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_cod_curso ) ) + { + $set .= "{$gruda}ref_cod_curso = '{$this->ref_cod_curso}'"; + $gruda = ", "; + } + if( is_numeric( $this->ref_ref_cod_escola_mult ) ) + { + $set .= "{$gruda}ref_ref_cod_escola_mult = '{$this->ref_ref_cod_escola_mult}'"; + $gruda = ", "; + } + + if( is_numeric( $this->ref_ref_cod_serie_mult ) ) + { + $set .= "{$gruda}ref_ref_cod_serie_mult = '{$this->ref_ref_cod_serie_mult}'"; + $gruda = ", "; + } + + if (is_bool($this->visivel)) { + $this->visivel = dbBool($this->visivel) ? "TRUE" : "FALSE"; + $set .= "{$gruda}visivel = '{$this->visivel}'"; + $gruda = ", "; + } + + if(is_numeric($this->turma_turno_id)) { + $set .= "{$gruda}turma_turno_id = '{$this->turma_turno_id}'"; + $gruda = ", "; + } + + if(is_numeric($this->tipo_boletim)) { + $set .= "{$gruda}tipo_boletim = '{$this->tipo_boletim}'"; + $gruda = ", "; + } + + if(is_numeric($this->tipo_boletim_diferenciado)) { + $set .= "{$gruda}tipo_boletim_diferenciado = '{$this->tipo_boletim_diferenciado}'"; + $gruda = ", "; + } + + if(is_numeric($this->ano)) { + $set .= "{$gruda}ano = '{$this->ano}'"; + $gruda = ", "; + } + + if(is_string($this->data_fechamento) && $this->data_fechamento!='') { + $set .= "{$gruda}data_fechamento = '{$this->data_fechamento}'"; + $gruda = ", "; + } + + if(is_numeric($this->tipo_atendimento)) { + $set .= "{$gruda}tipo_atendimento = '{$this->tipo_atendimento}'"; + $gruda = ", "; + } + + if(is_numeric($this->turma_mais_educacao)) { + $set .= "{$gruda}turma_mais_educacao = '{$this->turma_mais_educacao}'"; + $gruda = ", "; + } else { + $set .= "{$gruda}turma_mais_educacao = NULL"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_1)) { + $set .= "{$gruda}atividade_complementar_1 = '{$this->atividade_complementar_1}'"; + $gruda = ", "; + }elseif(trim($this->atividade_complementar_1) == ""){ + $set .= "{$gruda}atividade_complementar_1 = NULL"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_2)) { + $set .= "{$gruda}atividade_complementar_2 = '{$this->atividade_complementar_2}'"; + $gruda = ", "; + }elseif(trim($this->atividade_complementar_2) == ""){ + $set .= "{$gruda}atividade_complementar_2 = NULL"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_3)) { + $set .= "{$gruda}atividade_complementar_3 = '{$this->atividade_complementar_3}'"; + $gruda = ", "; + }elseif(trim($this->atividade_complementar_3) == ""){ + $set .= "{$gruda}atividade_complementar_3 = NULL"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_4)) { + $set .= "{$gruda}atividade_complementar_4 = '{$this->atividade_complementar_4}'"; + $gruda = ", "; + }elseif(trim($this->atividade_complementar_4) == ""){ + $set .= "{$gruda}atividade_complementar_4 = NULL"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_5)) { + $set .= "{$gruda}atividade_complementar_5 = '{$this->atividade_complementar_5}'"; + $gruda = ", "; + }elseif(trim($this->atividade_complementar_5) == ""){ + $set .= "{$gruda}atividade_complementar_5 = NULL"; + $gruda = ", "; + } + + if(is_numeric($this->atividade_complementar_6)) { + $set .= "{$gruda}atividade_complementar_6 = '{$this->atividade_complementar_6}'"; + $gruda = ", "; + }elseif(trim($this->atividade_complementar_6) == ""){ + $set .= "{$gruda}atividade_complementar_6 = NULL"; + $gruda = ", "; + } + + if(is_numeric($this->aee_braille)) { + $set .= "{$gruda}aee_braille = '{$this->aee_braille}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_recurso_optico)) { + $set .= "{$gruda}aee_recurso_optico = '{$this->aee_recurso_optico}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_estrategia_desenvolvimento)) { + $set .= "{$gruda}aee_estrategia_desenvolvimento = '{$this->aee_estrategia_desenvolvimento}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_tecnica_mobilidade)) { + $set .= "{$gruda}aee_tecnica_mobilidade = '{$this->aee_tecnica_mobilidade}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_libras)) { + $set .= "{$gruda}aee_libras = '{$this->aee_libras}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_caa)) { + $set .= "{$gruda}aee_caa = '{$this->aee_caa}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_curricular)) { + $set .= "{$gruda}aee_curricular = '{$this->aee_curricular}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_soroban)) { + $set .= "{$gruda}aee_soroban = '{$this->aee_soroban}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_informatica)) { + $set .= "{$gruda}aee_informatica = '{$this->aee_informatica}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_lingua_escrita)) { + $set .= "{$gruda}aee_lingua_escrita = '{$this->aee_lingua_escrita}'"; + $gruda = ", "; + } + + if(is_numeric($this->aee_autonomia)) { + $set .= "{$gruda}aee_autonomia = '{$this->aee_autonomia}'"; + $gruda = ", "; + } + + if(is_numeric($this->cod_curso)) { + $set .= "{$gruda}cod_curso = '{$this->cod_curso}'"; + $gruda = ", "; + } + + if(is_numeric($this->cod_curso_profissional)) { + $set .= "{$gruda}cod_curso_profissional = '{$this->cod_curso_profissional}'"; + $gruda = ", "; + } else { + $set .= "{$gruda}cod_curso_profissional = NULL"; + $gruda = ", "; + } + + if(is_numeric($this->etapa_educacenso)) { + $set .= "{$gruda}etapa_educacenso = '{$this->etapa_educacenso}'"; + $gruda = ", "; + } elseif (is_null($this->etapa_educacenso)) { + $set .= "{$gruda}etapa_educacenso = NULL"; + $gruda = ", "; + } + + if(is_numeric($this->ref_cod_disciplina_dispensada)){ + $set .= "{$gruda}ref_cod_disciplina_dispensada = {$this->ref_cod_disciplina_dispensada}"; + $gruda = ", "; + }elseif(is_null($this->ref_cod_disciplina_dispensada)){ + $set .= "{$gruda}ref_cod_disciplina_dispensada = NULL"; + $gruda = ", "; + } + if(is_numeric($this->nao_informar_educacenso)) { + $set .= "{$gruda}nao_informar_educacenso = '{$this->nao_informar_educacenso}'"; + $gruda = ", "; + } + if(is_string($this->parecer_1_etapa)) { + $set .= "{$gruda}parecer_1_etapa = '{$this->parecer_1_etapa}'"; + $gruda = ", "; + } + if(is_string($this->parecer_2_etapa)) { + $set .= "{$gruda}parecer_2_etapa = '{$this->parecer_2_etapa}'"; + $gruda = ", "; + } + if(is_string($this->parecer_3_etapa)) { + $set .= "{$gruda}parecer_3_etapa = '{$this->parecer_3_etapa}'"; + $gruda = ", "; + } + if(is_string($this->parecer_4_etapa)) { + $set .= "{$gruda}parecer_4_etapa = '{$this->parecer_4_etapa}'"; + $gruda = ", "; + } + + if(is_numeric($this->tipo_mediacao_didatico_pedagogico)){ + $set .= "{$gruda}tipo_mediacao_didatico_pedagogico = '{$this->tipo_mediacao_didatico_pedagogico}'"; + $gruda = ", "; + } + + if(is_string($this->dias_semana)){ + $set .= "{$gruda}dias_semana = '{$this->dias_semana}'"; + $gruda = ", "; + } + + if(is_string($this->atividades_complementares)){ + $set .= "{$gruda}atividades_complementares = '{$this->atividades_complementares}'"; + $gruda = ", "; + } + + if(is_string($this->atividades_aee)){ + $set .= "{$gruda}atividades_aee = '{$this->atividades_aee}'"; + $gruda = ", "; + } + + if( $set ) + { + $db->Consulta( "UPDATE {$this->_tabela} SET $set WHERE cod_turma = '{$this->cod_turma}'" ); + return true; + } + } + return false; + } + + /** + * Retorna os alunos matriculados nessa turma + * + * @return bool + */ + function matriculados() + { + $retorno = array(); + if( is_numeric( $this->cod_turma ) ) + { + $db = new clsBanco(); + + $db->Consulta("SELECT cod_matricula FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ativo = 1 AND aprovado = 3"); + if( $db->numLinhas() ) + { + while ( $db->ProximoRegistro() ) + { + list($matricula) = $db->Tupla(); + $retorno[$matricula] = $matricula; + } + return $retorno; + } + } + return false; + } + + /** + * Retorna o menor modulo dos alunos matriculados nessa turma + * + * @return bool + */ + function moduloMinimo() + { + if( is_numeric( $this->cod_turma ) ) + { + $db = new clsBanco(); + + // verifica se ainda existe alguem no primeiro modulo + $modulo = $db->CampoUnico(" + SELECT COALESCE(MIN(modulo),1) AS modulo + FROM pmieducar.v_matricula_matricula_turma + WHERE ref_cod_turma = '{$this->cod_turma}' + AND aprovado = 3 AND ativo = 1 + "); + return $modulo; + } + } + + /** + * Retorna as disciplinas do menor modulo + * + * @return bool + */ + function moduloMinimoDisciplina() + { + if( is_numeric( $this->cod_turma ) ) + { + $disciplinas = array(); + $modulo = $this->moduloMinimo(); + + $db = new clsBanco(); + $db->Consulta("SELECT ref_ref_cod_serie, ref_ref_cod_escola, multiseriada, ref_ref_cod_serie_mult, ref_ref_cod_escola_mult FROM pmieducar.turma WHERE cod_turma = '{$this->cod_turma}'"); + + $db->ProximoRegistro(); + list($cod_serie,$cod_escola,$multiseriada,$cod_serie_mult,$cod_escola_mult) = $db->Tupla(); + + // ve se existe alguem que nao tem nenhuma nota nesse modulo + $todas_disciplinas = $db->CampoUnico(" + SELECT 1 FROM + ( + SELECT cod_matricula + , ( SELECT COUNT(0) FROM pmieducar.nota_aluno n WHERE n.ativo = 1 AND n.ref_cod_matricula = cod_matricula AND n.modulo = '{$modulo}' ) + + ( SELECT COUNT(0) FROM pmieducar.dispensa_disciplina d WHERE d.ativo = 1 AND d.ref_cod_matricula = cod_matricula ) AS notas + FROM pmieducar.v_matricula_matricula_turma + WHERE ativo = 1 + AND aprovado = 3 + AND ref_cod_turma = '{$this->cod_turma}' + ) AS sub1 + WHERE notas = 0 + "); + + if( $todas_disciplinas ) + { + // existe um aluno que nao tem nenhuma nota nesse modulo + if( $multiseriada ) + { + $aluno_normal = false; + $aluno_multi = false; + $filtro = ""; + + // ve se tem algum aluno cadastrado na serie normal + $db->Consulta("SELECT 1 FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ref_cod_escola = '{$cod_escola}' AND ref_cod_serie = '{$cod_serie}' AND aprovado = 3 AND ativo = 1 "); + if ($db->ProximoRegistro()) + { + $aluno_normal = true; + } + + if(is_numeric($cod_serie_mult)) + { + // ve se tem algum aluno na serie alterantiva + $db->Consulta("SELECT 1 FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ref_cod_escola = '{$cod_escola}' AND ref_cod_serie = '{$cod_serie_mult}' AND aprovado = 3 AND ativo = 1 "); + if ($db->ProximoRegistro()) + { + $aluno_multi = true; + } + } + + // monta o filtro de acordo com os alunos na serie normal ou alternativa + if ($aluno_normal || $aluno_multi) + { + if ($aluno_normal) + { + if($aluno_multi) + { + $filtro = " AND ( ref_ref_cod_serie = '{$cod_serie}' OR ref_ref_cod_serie = '{$cod_serie_mult}' )"; + } + else + { + $filtro = " AND ref_ref_cod_serie = '{$cod_serie}'"; + } + } + else + { + $filtro = " AND ref_ref_cod_serie = '{$cod_serie_mult}'"; + } + } + + $db->Consulta("SELECT ref_cod_disciplina, ref_ref_cod_serie FROM pmieducar.escola_serie_disciplina WHERE ref_ref_cod_escola = '{$cod_escola}' {$filtro} AND ativo = 1"); + } + else + { + // nao eh multi-seriada + $db->Consulta("SELECT ref_cod_disciplina, ref_ref_cod_serie FROM pmieducar.escola_serie_disciplina WHERE ref_ref_cod_escola = '{$cod_escola}' AND ref_ref_cod_serie = '{$cod_serie}' AND ativo = 1"); + } + } + else + { + // todos os alunos tem pelo menos uma nota, vamos ver quais as disciplinas que estao faltando + $qtd_alunos = $db->CampoUnico("SELECT COUNT(0) FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ref_cod_serie = '{$cod_serie}' AND aprovado = 3 AND ativo = 1"); + if( $multiseriada ) + { + $qtd_alunos_mult = $db->CampoUnico("SELECT COUNT(0) FROM pmieducar.v_matricula_matricula_turma WHERE ref_cod_turma = '{$this->cod_turma}' AND ref_cod_serie = '{$cod_serie_mult}' AND aprovado = 3 AND ativo = 1"); +// encontra as disciplinas que ainda precisam receber nota + $sql = " + ( + SELECT ref_cod_disciplina, serie FROM + ( + SELECT ds.ref_cod_disciplina, {$cod_serie} AS serie + , ( SELECT COUNT(0) FROM pmieducar.dispensa_disciplina dd, pmieducar.v_matricula_matricula_turma mmt WHERE dd.ativo = 1 AND dd.ref_cod_disciplina = ds.ref_cod_disciplina AND mmt.cod_matricula = dd.ref_cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola}' AND mmt.ref_cod_serie = '{$cod_serie}' ) AS dispensas + , ( SELECT COUNT(0) FROM pmieducar.nota_aluno na, pmieducar.v_matricula_matricula_turma mmt WHERE na.ativo = 1 AND na.ref_cod_disciplina = ds.ref_cod_disciplina AND na.modulo = '{$modulo}' AND na.ref_cod_matricula = mmt.cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola}' AND mmt.ref_cod_serie = '{$cod_serie}' ) AS notas + FROM pmieducar.escola_serie_disciplina ds WHERE ds.ativo = 1 AND ref_ref_cod_serie = '{$cod_serie}' AND ref_ref_cod_escola = '{$cod_escola}' + ) AS sub1 WHERE dispensas + notas < $qtd_alunos + ) + UNION + ( + SELECT ref_cod_disciplina, serie FROM + ( + SELECT ds.ref_cod_disciplina, {$cod_serie_mult} AS serie + , ( SELECT COUNT(0) FROM pmieducar.dispensa_disciplina dd, pmieducar.v_matricula_matricula_turma mmt WHERE dd.ativo = 1 AND dd.ref_cod_disciplina = ds.ref_cod_disciplina AND mmt.cod_matricula = dd.ref_cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola_mult}' AND mmt.ref_cod_serie = '{$cod_serie_mult}' ) AS dispensas + , ( SELECT COUNT(0) FROM pmieducar.nota_aluno na, pmieducar.v_matricula_matricula_turma mmt WHERE na.ativo = 1 AND na.ref_cod_disciplina = ds.ref_cod_disciplina AND na.modulo = '{$modulo}' AND na.ref_cod_matricula = mmt.cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola_mult}' AND mmt.ref_cod_serie = '{$cod_serie_mult}' ) AS notas + FROM pmieducar.escola_serie_disciplina ds WHERE ds.ativo = 1 AND ref_ref_cod_serie = '{$cod_serie_mult}' AND ref_ref_cod_escola = '{$cod_escola_mult}' + ) AS sub2 WHERE dispensas + notas < $qtd_alunos_mult + ) + "; + + } + else + { + $sql = " + SELECT ref_cod_disciplina, serie FROM + ( + SELECT ds.ref_cod_disciplina, {$cod_serie} AS serie + , ( SELECT COUNT(0) FROM pmieducar.dispensa_disciplina dd, pmieducar.v_matricula_matricula_turma mmt WHERE dd.ativo = 1 AND dd.ref_cod_disciplina = ds.ref_cod_disciplina AND mmt.cod_matricula = dd.ref_cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola}' AND mmt.ref_cod_serie = '{$cod_serie}' ) AS dispensas + , ( SELECT COUNT(0) FROM pmieducar.nota_aluno na, pmieducar.v_matricula_matricula_turma mmt WHERE na.ativo = 1 AND na.ref_cod_disciplina = ds.ref_cod_disciplina AND na.modulo = '{$modulo}' AND na.ref_cod_matricula = mmt.cod_matricula AND mmt.ativo = 1 AND mmt.aprovado = 3 AND mmt.ref_cod_turma = '{$this->cod_turma}' AND mmt.ref_cod_escola = '{$cod_escola}' AND mmt.ref_cod_serie = '{$cod_serie}' ) AS notas + FROM pmieducar.escola_serie_disciplina ds WHERE ds.ativo = 1 AND ref_ref_cod_serie = '{$cod_serie}' AND ref_ref_cod_escola = '{$cod_escola}' + ) AS sub1 WHERE dispensas + notas < $qtd_alunos + "; + } + $db->Consulta($sql); + } + while( $db->ProximoRegistro() ) + { + list($cod_disciplina,$cod_serie)=$db->Tupla(); + $disciplinas[] = array( "cod_disciplina" => $cod_disciplina, "cod_serie" => $cod_serie ); + } + return $disciplinas; + } + return false; + } + + /** + * Retorna as disciplinas do exame + * + * @return bool + */ + function moduloExameDisciplina($verifica_aluno_possui_nota = false) + { + if( is_numeric( $this->cod_turma ) ) + { + $cod_curso = $this->getCurso(); + $objCurso = new clsPmieducarCurso($cod_curso); + $detCurso = $objCurso->detalhe(); + + $modulos = $this->maxModulos(); + $objNotaAluno = new clsPmieducarNotaAluno(); + return $objNotaAluno->getDisciplinasExame($this->cod_turma,$modulos,$detCurso["media"], $verifica_aluno_possui_nota); + } + return false; + } + + /** + * Retorna os alunos do exame + * + * @return bool + */ + function moduloExameAlunos($cod_disciplina_exame = null) + { + if( is_numeric( $this->cod_turma ) ) + { + $cod_curso = $this->getCurso(); + $objCurso = new clsPmieducarCurso($cod_curso); + $detCurso = $objCurso->detalhe(); + + $modulos = $this->maxModulos(); + $objNotaAluno = new clsPmieducarNotaAluno(); + return $objNotaAluno->getAlunosExame($this->cod_turma,$modulos,$detCurso["media"],$cod_disciplina_exame); + } + return false; + } + + /** + * encontra as matriculas dessa turma que ainda nao receberam nota da disciplina $cod_disciplina da serie $cod_serie no modulo $modulo + * + * @param int $cod_disciplina + * @param int $cod_serie + * @param int $modulo + * @return array + */ + function matriculados_modulo_disciplina_sem_nota( $cod_disciplina, $cod_serie, $modulo ) + { + $matriculas = array(); + + $db = new clsBanco(); + $db->Consulta(" + SELECT cod_matricula FROM pmieducar.v_matricula_matricula_turma + WHERE ref_cod_turma = '{$this->cod_turma}' + AND aprovado = 3 + AND ativo = 1 + AND cod_matricula NOT IN ( + SELECT ref_cod_matricula + FROM pmieducar.nota_aluno + WHERE ref_cod_disciplina = '{$cod_disciplina}' + AND ref_cod_serie = '{$cod_serie}' + AND modulo = '{$modulo}' + AND ativo = 1 + ) + AND cod_matricula NOT IN ( + SELECT ref_cod_matricula FROM pmieducar.dispensa_disciplina WHERE ref_cod_disciplina = '{$cod_disciplina}' AND ativo = 1 + ) + "); + + if( $db->numLinhas() ) + { + while ( $db->ProximoRegistro() ) + { + list($matricula) = $db->Tupla(); + $matriculas[$matricula] = $matricula; + } + } + return $matriculas; + } + + /** + * volta o maior modulo comum (antes do exame) permitido nessa turma + * + * @return unknown + */ + function maxModulos() + { + if( is_numeric($this->cod_turma) ) + { + $db = new clsBanco(); + // ve se o curso segue o padrao escolar + $padrao = $db->CampoUnico("SELECT c.padrao_ano_escolar FROM {$this->_schema}curso c, {$this->_tabela} t WHERE cod_turma = {$this->cod_turma} AND c.cod_curso = t.ref_cod_curso AND c.ativo = 1 AND t.ativo = 1"); + if( $padrao ) + { + // segue o padrao + $cod_escola = $db->CampoUnico("SELECT ref_ref_cod_escola FROM {$this->_tabela} WHERE cod_turma = {$this->cod_turma} AND ativo = 1"); + $ano = $db->CampoUnico("SELECT COALESCE(MAX(ano),0) FROM {$this->_schema}escola_ano_letivo WHERE ref_cod_escola = {$cod_escola} AND andamento = 1 AND ativo = 1"); + if( $ano ) + { + return $db->CampoUnico("SELECT COALESCE(MAX(sequencial),0) FROM {$this->_schema}ano_letivo_modulo WHERE ref_ref_cod_escola = {$cod_escola} AND ref_ano = {$ano}"); + } + } + else + { + // nao segue o padrao escolar + return $db->CampoUnico("SELECT COALESCE(MAX(sequencial),0) FROM {$this->_schema}turma_modulo WHERE ref_cod_turma = {$this->cod_turma}"); + } + } + return false; + } + + function getCurso() + { + if( is_numeric($this->cod_turma) ) + { + $db = new clsBanco(); + $db->Consulta("SELECT ref_cod_curso, ref_ref_cod_serie FROM {$this->_tabela} WHERE cod_turma = '{$this->cod_turma}'"); + $db->ProximoRegistro(); + list($cod_curso,$cod_serie) = $db->Tupla(); + if( is_numeric($cod_curso) ) + { + return $cod_curso; + } + + if(is_numeric($cod_serie)) + { + $db->Consulta("SELECT ref_cod_curso FROM {$this->_schema}serie WHERE cod_serie = '{$cod_serie}'"); + $db->ProximoRegistro(); + list($cod_curso) = $db->Tupla(); + if( is_numeric($cod_curso) ) + { + return $cod_curso; + } + } + + return false; + } + } + + /** + * Retorna uma lista filtrados de acordo com os parametros + * + * @return array + */ + function lista( $int_cod_turma = null, z$int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = 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_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $bool_verifica_serie_multiseriada = false, $bool_tem_alunos_aguardando_nota = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null, $somenteAnoLetivoEmAndamento = FALSE) + { + + $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela} t"; + $filtros = ""; + + $whereAnd = " WHERE "; + + if( is_numeric( $int_cod_turma ) ) + { + $filtros .= "{$whereAnd} t.cod_turma = '{$int_cod_turma}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_usuario_exc ) ) + { + $filtros .= "{$whereAnd} t.ref_usuario_exc = '{$int_ref_usuario_exc}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_usuario_cad ) ) + { + $filtros .= "{$whereAnd} t.ref_usuario_cad = '{$int_ref_usuario_cad}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_serie ) ) + { + if($bool_verifica_serie_multiseriada == true) + { + $mult = " OR t.ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie}' "; + } + + $filtros .= "{$whereAnd} ( t.ref_ref_cod_serie = '{$int_ref_ref_cod_serie}' $mult )"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_escola ) ) + { + /*if($bool_verifica_serie_multiseriada === true) + { + $mult = " OR t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola}' "; + }*/ + + $filtros .= "{$whereAnd} ( t.ref_ref_cod_escola = '{$int_ref_ref_cod_escola}' )"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_infra_predio_comodo ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_infra_predio_comodo = '{$int_ref_cod_infra_predio_comodo}'"; + $whereAnd = " AND "; + } + if( is_string( $str_nm_turma ) ) + { + $filtros .= "{$whereAnd} translate(upper(t.nm_turma),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_turma}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; + $whereAnd = " AND "; + } + if( is_string( $str_sgl_turma ) ) + { + $filtros .= "{$whereAnd} t.sgl_turma LIKE '%{$str_sgl_turma}%'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_max_aluno ) ) + { + $filtros .= "{$whereAnd} t.max_aluno = '{$int_max_aluno}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_multiseriada ) ) + { + $filtros .= "{$whereAnd} t.multiseriada = '{$int_multiseriada}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_cadastro_ini ) ) + { + $filtros .= "{$whereAnd} t.data_cadastro >= '{$date_data_cadastro_ini}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_cadastro_fim ) ) + { + $filtros .= "{$whereAnd} t.data_cadastro <= '{$date_data_cadastro_fim}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_exclusao_ini ) ) + { + $filtros .= "{$whereAnd} t.data_exclusao >= '{$date_data_exclusao_ini}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_exclusao_fim ) ) + { + $filtros .= "{$whereAnd} t.data_exclusao <= '{$date_data_exclusao_fim}'"; + $whereAnd = " AND "; + } + if( is_null( $int_ativo ) || $int_ativo ) + { + $filtros .= "{$whereAnd} t.ativo = '1'"; + $whereAnd = " AND "; + } + else + { + $filtros .= "{$whereAnd} t.ativo = '0'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_turma_tipo ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_turma_tipo = '{$int_ref_cod_turma_tipo}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicial_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_inicial >= '{$time_hora_inicial_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicial_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_inicial <= '{$time_hora_inicial_fim}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_final_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_final >= '{$time_hora_final_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_final_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_final <= '{$time_hora_final_fim}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicio_intervalo_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_inicio_intervalo >= '{$time_hora_inicio_intervalo_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicio_intervalo_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_inicio_intervalo <= '{$time_hora_inicio_intervalo_fim}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_fim_intervalo_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_fim_intervalo >= '{$time_hora_fim_intervalo_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_fim_intervalo_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_fim_intervalo <= '{$time_hora_fim_intervalo_fim}'"; + $whereAnd = " AND "; + } + /* if( is_numeric( $int_ref_cod_curso ) ) + { + $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_instituicao ) ) + { + $filtros .= "{$whereAnd} e.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; + $whereAnd = " AND "; + }*/ + if( is_numeric( $int_ref_cod_regente ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_regente = '{$int_ref_cod_regente}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_instituicao_regente ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_instituicao_regente = '{$int_ref_cod_instituicao_regente}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_instituicao ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_curso )) + { + $filtros .= "{$whereAnd} t.ref_cod_curso = '{$int_ref_cod_curso}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_escola_mult ) ) + { + $filtros .= "{$whereAnd} t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola_mult}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_serie_mult )) + { + $filtros .= "{$whereAnd} t.ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie_mult}'"; + $whereAnd = " AND "; + } + if( is_numeric($int_qtd_min_alunos_matriculados) ) + { + $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.matricula_turma WHERE ref_cod_turma = t.cod_turma) >= '{$int_qtd_min_alunos_matriculados}' "; + $whereAnd = " AND "; + } + + if (is_bool($bool_tem_alunos_aguardando_nota) ) + { + if ($bool_tem_alunos_aguardando_nota) + { + $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.v_matricula_matricula_turma mmt WHERE mmt.ref_cod_turma = t.cod_turma AND mmt.aprovado = 3 AND mmt.ativo = 1 ) > 0 "; + $whereAnd = " AND "; + } + } + if (is_bool($visivel)) + { + if ($visivel) + { + $filtros .= "{$whereAnd} t.visivel = TRUE"; + $whereAnd = " AND "; + } + else + { + $filtros .= "{$whereAnd} t.visivel = FALSE"; + $whereAnd = " AND "; + } + } + elseif (is_array($visivel) && count($visivel)) + { + $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; + $whereAnd = " AND "; + } + else + { + $filtros .= "{$whereAnd} t.visivel = TRUE"; + $whereAnd = " AND "; + } + + if( is_numeric( $turma_turno_id ) ) { + $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; + $whereAnd = " AND "; + } + + if( is_numeric( $tipo_boletim ) ) { + $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; + $whereAnd = " AND "; + } + + if( is_numeric( $ano ) ) { + $filtros .= "{$whereAnd} t.ano = '{$ano}'"; + $whereAnd = " AND "; + } + + if( $somenteAnoLetivoEmAndamento ) { + $filtros .= "{$whereAnd} t.ano in (SELECT ano FROM pmieducar.escola_ano_letivo WHERE andamento = 1 AND ativo = 1 AND ref_cod_escola = t.ref_ref_cod_escola)"; + $whereAnd = " AND "; + } + + if (!$this->listarNaoInformarEducacenso) { + $filtros .= "{$whereAnd} COALESCE(t.nao_informar_educacenso,0) <> 1"; + $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} t, {$this->_schema}escola_serie es, {$this->_schema}serie s, {$this->_schema}escola e {$filtros}" ); + $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t {$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; + } + + /** + * Retorna uma lista filtrados de acordo com os parametros + * + * @return array + */ + function lista2( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = 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_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null ) + { + + /*$nm_escola = "( + SELECT c.nm_escola AS nm_escola + FROM pmieducar.escola_complemento c + WHERE c.ref_cod_escola = t.ref_ref_cod_escola +AND e.cod_escola = t.ref_ref_cod_escola + +UNION + SELECT j.fantasia AS nm_escola + FROM cadastro.juridica j + WHERE j.idpes = e.ref_idpes +and e.cod_escola = t.ref_ref_cod_escola + ) AS nm_escola ";a*/ + $sql = "SELECT {$this->_campos_lista},c.nm_curso,s.nm_serie,i.nm_instituicao FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c, {$this->_schema}instituicao i "; + $filtros = ""; + + $whereAnd = " WHERE t.ref_cod_curso = c.cod_curso AND c.ref_cod_instituicao = i.cod_instituicao AND "; + + if( is_numeric( $int_cod_turma ) ) + { + $filtros .= "{$whereAnd} t.cod_turma = '{$int_cod_turma}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_usuario_exc ) ) + { + $filtros .= "{$whereAnd} t.ref_usuario_exc = '{$int_ref_usuario_exc}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_usuario_cad ) ) + { + $filtros .= "{$whereAnd} t.ref_usuario_cad = '{$int_ref_usuario_cad}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_serie ) ) + { + $filtros .= "{$whereAnd} t.ref_ref_cod_serie = '{$int_ref_ref_cod_serie}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_escola ) ) + { + $filtros .= "{$whereAnd} t.ref_ref_cod_escola = '{$int_ref_ref_cod_escola}'"; + $whereAnd = " AND "; + } + elseif ($this->codUsuario) { + $filtros .= "{$whereAnd} EXISTS (SELECT 1 + FROM pmieducar.escola_usuario + WHERE escola_usuario.ref_cod_escola = t.ref_ref_cod_escola + AND escola_usuario.ref_cod_usuario = '{$this->codUsuario}')"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_infra_predio_comodo ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_infra_predio_comodo = '{$int_ref_cod_infra_predio_comodo}'"; + $whereAnd = " AND "; + } + if( is_string( $str_nm_turma ) ) + { + $filtros .= "{$whereAnd} translate(upper(t.nm_turma),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_turma}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; + $whereAnd = " AND "; + } + if( is_string( $str_sgl_turma ) ) + { + $filtros .= "{$whereAnd} t.sgl_turma LIKE '%{$str_sgl_turma}%'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_max_aluno ) ) + { + $filtros .= "{$whereAnd} t.max_aluno = '{$int_max_aluno}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_multiseriada ) ) + { + $filtros .= "{$whereAnd} t.multiseriada = '{$int_multiseriada}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_cadastro_ini ) ) + { + $filtros .= "{$whereAnd} t.data_cadastro >= '{$date_data_cadastro_ini}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_cadastro_fim ) ) + { + $filtros .= "{$whereAnd} t.data_cadastro <= '{$date_data_cadastro_fim}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_exclusao_ini ) ) + { + $filtros .= "{$whereAnd} t.data_exclusao >= '{$date_data_exclusao_ini}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_exclusao_fim ) ) + { + $filtros .= "{$whereAnd} t.data_exclusao <= '{$date_data_exclusao_fim}'"; + $whereAnd = " AND "; + } + if( is_null( $int_ativo ) || $int_ativo ) + { + $filtros .= "{$whereAnd} t.ativo = '1'"; + $whereAnd = " AND "; + } + else + { + $filtros .= "{$whereAnd} t.ativo = '0'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_turma_tipo ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_turma_tipo = '{$int_ref_cod_turma_tipo}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicial_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_inicial >= '{$time_hora_inicial_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicial_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_inicial <= '{$time_hora_inicial_fim}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_final_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_final >= '{$time_hora_final_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_final_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_final <= '{$time_hora_final_fim}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicio_intervalo_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_inicio_intervalo >= '{$time_hora_inicio_intervalo_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicio_intervalo_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_inicio_intervalo <= '{$time_hora_inicio_intervalo_fim}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_fim_intervalo_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_fim_intervalo >= '{$time_hora_fim_intervalo_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_fim_intervalo_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_fim_intervalo <= '{$time_hora_fim_intervalo_fim}'"; + $whereAnd = " AND "; + } + /* if( is_numeric( $int_ref_cod_curso ) ) + { + $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_instituicao ) ) + { + $filtros .= "{$whereAnd} e.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; + $whereAnd = " AND "; + }*/ + if( is_numeric( $int_ref_cod_regente ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_regente = '{$int_ref_cod_regente}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_instituicao_regente ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_instituicao_regente = '{$int_ref_cod_instituicao_regente}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_instituicao ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_curso ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_curso = '{$int_ref_cod_curso}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_escola_mult ) ) + { + $filtros .= "{$whereAnd} t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola_mult}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_serie_mult ) ) + { + $filtros .= "{$whereAnd} t.int_ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie_mult}'"; + $whereAnd = " AND "; + } + if( is_numeric($int_qtd_min_alunos_matriculados) ) + { + $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.matricula_turma WHERE ref_cod_turma = t.cod_turma) >= '{$int_qtd_min_alunos_matriculados}' "; + $whereAnd = " AND "; + } + if (is_bool($visivel)) + { + if ($visivel) + { + $filtros .= "{$whereAnd} t.visivel = TRUE"; + $whereAnd = " AND "; + } + else + { + $filtros .= "{$whereAnd} t.visivel = FALSE"; + $whereAnd = " AND "; + } + } + elseif (is_array($visivel) && count($visivel)) + { + $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; + $whereAnd = " AND "; + } + else + { + $filtros .= "{$whereAnd} t.visivel = TRUE"; + $whereAnd = " AND "; + } + + if( is_numeric( $turma_turno_id ) ) { + $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; + $whereAnd = " AND "; + } + + if( is_numeric( $tipo_boletim ) ) { + $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; + $whereAnd = " AND "; + } + + if( is_numeric( $ano ) ) { + $filtros .= "{$whereAnd} t.ano = '{$ano}'"; + $whereAnd = " AND "; + } + + $db = new clsBanco(); + $countCampos = count( explode( ",", $this->_campos_lista ) ); + $resultado = array(); + + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); +// echo ""; + +// $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t, {$this->_schema}escola_serie es, {$this->_schema}serie s, {$this->_schema}escola e {$filtros}" ); + $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c , {$this->_schema}instituicao i {$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; + } + +/** + * Retorna uma lista filtrados de acordo com os parametros + * (Modificação da lista2, agora trazendo somente turmas do ano atual) + * @return array + */ + function lista3( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = 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_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null ) + { + + /*$nm_escola = "( + SELECT c.nm_escola AS nm_escola + FROM pmieducar.escola_complemento c + WHERE c.ref_cod_escola = t.ref_ref_cod_escola +AND e.cod_escola = t.ref_ref_cod_escola + +UNION + SELECT j.fantasia AS nm_escola + FROM cadastro.juridica j + WHERE j.idpes = e.ref_idpes +and e.cod_escola = t.ref_ref_cod_escola + ) AS nm_escola ";a*/ + $sql = "SELECT {$this->_campos_lista},c.nm_curso,s.nm_serie,i.nm_instituicao FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c, {$this->_schema}instituicao i "; + $filtros = ""; + + $whereAnd = " WHERE t.ref_cod_curso = c.cod_curso AND c.ref_cod_instituicao = i.cod_instituicao AND "; + + if( is_numeric( $int_cod_turma ) ) + { + $filtros .= "{$whereAnd} t.cod_turma = '{$int_cod_turma}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_usuario_exc ) ) + { + $filtros .= "{$whereAnd} t.ref_usuario_exc = '{$int_ref_usuario_exc}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_usuario_cad ) ) + { + $filtros .= "{$whereAnd} t.ref_usuario_cad = '{$int_ref_usuario_cad}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_serie ) ) + { + $filtros .= "{$whereAnd} t.ref_ref_cod_serie = '{$int_ref_ref_cod_serie}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_escola ) ) + { + $filtros .= "{$whereAnd} t.ref_ref_cod_escola = '{$int_ref_ref_cod_escola}'"; + $whereAnd = " AND "; + } + elseif ($this->codUsuario) { + $filtros .= "{$whereAnd} EXISTS (SELECT 1 + FROM pmieducar.escola_usuario + WHERE escola_usuario.ref_cod_escola = t.ref_ref_cod_escola + AND escola_usuario.ref_cod_usuario = '{$this->codUsuario}')"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_infra_predio_comodo ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_infra_predio_comodo = '{$int_ref_cod_infra_predio_comodo}'"; + $whereAnd = " AND "; + } + if( is_string( $str_nm_turma ) ) + { + $filtros .= "{$whereAnd} translate(upper(t.nm_turma),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN') LIKE translate(upper('%{$str_nm_turma}%'),'ÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ','AAAAAAEEEEIIIIOOOOOUUUUCYN')"; + $whereAnd = " AND "; + } + if( is_string( $str_sgl_turma ) ) + { + $filtros .= "{$whereAnd} t.sgl_turma LIKE '%{$str_sgl_turma}%'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_max_aluno ) ) + { + $filtros .= "{$whereAnd} t.max_aluno = '{$int_max_aluno}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_multiseriada ) ) + { + $filtros .= "{$whereAnd} t.multiseriada = '{$int_multiseriada}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_cadastro_ini ) ) + { + $filtros .= "{$whereAnd} t.data_cadastro >= '{$date_data_cadastro_ini}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_cadastro_fim ) ) + { + $filtros .= "{$whereAnd} t.data_cadastro <= '{$date_data_cadastro_fim}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_exclusao_ini ) ) + { + $filtros .= "{$whereAnd} t.data_exclusao >= '{$date_data_exclusao_ini}'"; + $whereAnd = " AND "; + } + if( is_string( $date_data_exclusao_fim ) ) + { + $filtros .= "{$whereAnd} t.data_exclusao <= '{$date_data_exclusao_fim}'"; + $whereAnd = " AND "; + } + if( is_null( $int_ativo ) || $int_ativo ) + { + $filtros .= "{$whereAnd} t.ativo = '1'"; + $whereAnd = " AND "; + } + else + { + $filtros .= "{$whereAnd} t.ativo = '0'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_turma_tipo ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_turma_tipo = '{$int_ref_cod_turma_tipo}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicial_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_inicial >= '{$time_hora_inicial_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicial_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_inicial <= '{$time_hora_inicial_fim}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_final_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_final >= '{$time_hora_final_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_final_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_final <= '{$time_hora_final_fim}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicio_intervalo_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_inicio_intervalo >= '{$time_hora_inicio_intervalo_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_inicio_intervalo_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_inicio_intervalo <= '{$time_hora_inicio_intervalo_fim}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_fim_intervalo_ini ) ) + { + $filtros .= "{$whereAnd} t.hora_fim_intervalo >= '{$time_hora_fim_intervalo_ini}'"; + $whereAnd = " AND "; + } + if( ( $time_hora_fim_intervalo_fim ) ) + { + $filtros .= "{$whereAnd} t.hora_fim_intervalo <= '{$time_hora_fim_intervalo_fim}'"; + $whereAnd = " AND "; + } + /* if( is_numeric( $int_ref_cod_curso ) ) + { + $filtros .= "{$whereAnd} s.ref_cod_curso = '{$int_ref_cod_curso}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_instituicao ) ) + { + $filtros .= "{$whereAnd} e.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; + $whereAnd = " AND "; + }*/ + if( is_numeric( $int_ref_cod_regente ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_regente = '{$int_ref_cod_regente}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_instituicao_regente ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_instituicao_regente = '{$int_ref_cod_instituicao_regente}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_instituicao ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_cod_curso ) ) + { + $filtros .= "{$whereAnd} t.ref_cod_curso = '{$int_ref_cod_curso}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_escola_mult ) ) + { + $filtros .= "{$whereAnd} t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola_mult}'"; + $whereAnd = " AND "; + } + if( is_numeric( $int_ref_ref_cod_serie_mult ) ) + { + $filtros .= "{$whereAnd} t.int_ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie_mult}'"; + $whereAnd = " AND "; + } + if( is_numeric($int_qtd_min_alunos_matriculados) ) + { + $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.matricula_turma WHERE ref_cod_turma = t.cod_turma) >= '{$int_qtd_min_alunos_matriculados}' "; + $whereAnd = " AND "; + } + if (is_bool($visivel)) + { + if ($visivel) + { + $filtros .= "{$whereAnd} t.visivel = TRUE"; + $whereAnd = " AND "; + } + else + { + $filtros .= "{$whereAnd} t.visivel = FALSE"; + $whereAnd = " AND "; + } + } + elseif (is_array($visivel) && count($visivel)) + { + $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; + $whereAnd = " AND "; + } + else + { + $filtros .= "{$whereAnd} t.visivel = TRUE"; + $whereAnd = " AND "; + } + + if( is_numeric( $turma_turno_id ) ) { + $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; + $whereAnd = " AND "; + } + + if( is_numeric( $tipo_boletim ) ) { + $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; + $whereAnd = " AND "; + } + + if( is_numeric( $ano ) ) { + $filtros .= "{$whereAnd} t.ano = '{$ano}'"; + $whereAnd = " AND "; + } + + // Retirar OR quando todas turmas tiverem a coluna ANO definido. + //$filtros .= "{$whereAnd} t.ano = ( SELECT ano FROM pmieducar.escola_ano_letivo enl WHERE enl.ref_cod_escola = t.ref_ref_cod_escola AND andamento = 1 and ativo = 1)"; + + $db = new clsBanco(); + $countCampos = count( explode( ",", $this->_campos_lista ) ); + $resultado = array(); + + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); +// echo ""; + +// $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t, {$this->_schema}escola_serie es, {$this->_schema}serie s, {$this->_schema}escola e {$filtros}" ); + $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c , {$this->_schema}instituicao i {$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; + } + /** + * Retorna um array com os dados de um registro + * + * @return array + */ + function detalhe() + { + if( is_numeric( $this->cod_turma ) ) + { + + $db = new clsBanco(); + $db->Consulta( "SELECT {$this->_todos_campos} FROM {$this->_tabela} t WHERE t.cod_turma = '{$this->cod_turma}'" ); + $db->ProximoRegistro(); + return $db->Tupla(); + } + return false; + } + + /** + * Retorna um array com os dados de um registro + * + * @return array + */ + function existe() + { + if( is_numeric( $this->cod_turma ) ) + { + + $db = new clsBanco(); + $db->Consulta( "SELECT 1 FROM {$this->_tabela} WHERE cod_turma = '{$this->cod_turma}'" ); + $db->ProximoRegistro(); + return $db->Tupla(); + } + return false; + } + + /** + * Exclui um registro + * + * @return bool + */ + function excluir() + { + if( is_numeric( $this->cod_turma ) && is_numeric( $this->ref_usuario_exc ) ) + { + + /* + delete + $db = new clsBanco(); + $db->Consulta( "DELETE FROM {$this->_tabela} WHERE cod_turma = '{$this->cod_turma}'" ); + return true; + */ + + $this->ativo = 0; + return $this->edita(); + } + return false; + } + + /** + * Define quais campos da tabela serao selecionados na invocacao do metodo lista + * + * @return null + */ + function setCamposLista( $str_campos ) + { + $this->_campos_lista = $str_campos; + } + + /** + * Define que o metodo Lista devera retornoar todos os campos da tabela + * + * @return null + */ + function resetCamposLista() + { + $this->_campos_lista = $this->_todos_campos; + } + + /** + * Define limites de retorno para o metodo lista + * + * @return null + */ + function setLimite( $intLimiteQtd, $intLimiteOffset = null ) + { + $this->_limite_quantidade = $intLimiteQtd; + $this->_limite_offset = $intLimiteOffset; + } + + /** + * Retorna a string com o trecho da query resposavel pelo Limite de registros + * + * @return string + */ + function getLimite() + { + if( is_numeric( $this->_limite_quantidade ) ) + { + $retorno = " LIMIT {$this->_limite_quantidade}"; + if( is_numeric( $this->_limite_offset ) ) + { + $retorno .= " OFFSET {$this->_limite_offset} "; + } + return $retorno; + } + return ""; + } + + /** + * Define campo para ser utilizado como ordenacao no metolo lista + * + * @return null + */ + function setOrderby( $strNomeCampo ) + { + // limpa a string de possiveis erros (delete, insert, etc) + //$strNomeCampo = eregi_replace(); + + if( is_string( $strNomeCampo ) && $strNomeCampo ) + { + $this->_campo_order_by = $strNomeCampo; + } + } + + /** + * Retorna a string com o trecho da query resposavel pela Ordenacao dos registros + * + * @return string + */ + function getOrderby() + { + if( is_string( $this->_campo_order_by ) ) + { + return " ORDER BY {$this->_campo_order_by} "; + } + return ""; + } + + function checaAnoLetivoEmAndamento() + { + if( is_numeric( $this->cod_turma ) ) + { + + $db = new clsBanco(); + $db->Consulta( "SELECT 1 FROM {$this->_tabela} WHERE cod_turma = '{$this->cod_turma}' AND turma.ano in( SELECT ano FROM pmieducar.escola_ano_letivo enl WHERE enl.ref_cod_escola = turma.ref_ref_cod_escola AND andamento = 1)" ); + $db->ProximoRegistro(); + return $db->Tupla(); + } + return false; + } + function maximoAlunosSala(){ + + $detTurma = $this->detalhe(); + $objInstituicao = new clsPmiEducarInstituicao($detTurma['ref_cod_instituicao']); + $detInstituicao = $objInstituicao->detalhe(); + $controlaEspacoUtilizacaoAluno = $detInstituicao["controlar_espaco_utilizacao_aluno"]; + //se o parametro de controle de utilização de espaço estiver setado como verdadeiro + if($controlaEspacoUtilizacaoAluno){ + $percentagemMaximaUtilizacaoSala = $detInstituicao["percentagem_maxima_ocupacao_salas"]; + $quantidadeAlunosPorMetroQuadrado = $detInstituicao["quantidade_alunos_metro_quadrado"]; + $codSalaUtilizada = $detTurma["ref_cod_infra_predio_comodo"]; + + $objInfraPredioComodo = new clsPmiEducarInfraPredioComodo($codSalaUtilizada); + $detInfraPredioComodo = $objInfraPredioComodo->detalhe(); + $areaSala = $detInfraPredioComodo["area"]; + + if(is_numeric($percentagemMaximaUtilizacaoSala) AND (is_numeric($quantidadeAlunosPorMetroQuadrado)) AND is_numeric($areaSala)){ + $metragemMaximaASerUtilizadaSala = ($areaSala * ($percentagemMaximaUtilizacaoSala/100.00)); + $maximoAlunosSala = ($quantidadeAlunosPorMetroQuadrado * $metragemMaximaASerUtilizadaSala); + return round($maximoAlunosSala); + } + } + return false; + } + + public static function verificaDisciplinaDispensada($turmaId, $componenteId){ + $sql = "SELECT ref_cod_disciplina_dispensada as disciplina_dispensada FROM pmieducar.turma WHERE cod_turma = $1"; + + $params = array('params' => $turmaId, 'return_only' => 'first-field'); + $disciplina_dispensada = Portabilis_Utils_Database::fetchPreparedQuery($sql, $params); + + return $disciplina_dispensada == $componenteId; + } + + public static function getDisciplinaDispensada($turmaId){ + $sql = "SELECT ref_cod_disciplina_dispensada as disciplina_dispensada FROM pmieducar.turma WHERE cod_turma = $1"; + + $params = array('params' => $turmaId, 'return_only' => 'first-field'); + $disciplina_dispensada = Portabilis_Utils_Database::fetchPreparedQuery($sql, $params); + + return $disciplina_dispensada; + } + public function possuiAlunosVinculados(){ + $sql = "SELECT 1 + from pmieducar.matricula + inner join pmieducar.matricula_turma on(matricula.cod_matricula = matricula_turma.ref_cod_matricula) + where matricula.ativo = 1 + and matricula_turma.ref_cod_turma = $1 + and matricula_turma.ativo = 1"; + $params = array('params' => $this->cod_turma, 'return_only' => 'first-field'); + return Portabilis_Utils_Database::fetchPreparedQuery($sql, $params); + } + + public function updateInep($codigo_inep_educacenso) { + if ($this->cod_turma) { + $db = new clsBanco(); + $db->Consulta("DELETE FROM modules.educacenso_cod_turma WHERE cod_turma = '{$this->cod_turma}'"); + + if ($codigo_inep_educacenso) { + $db->Consulta("INSERT INTO modules.educacenso_cod_turma (cod_turma, cod_turma_inep, created_at) + VALUES ('{$this->cod_turma}', '{$codigo_inep_educacenso}', NOW());"); + } + } + } + + public function getInep(){ + if ($this->cod_turma) { + $sql = "SELECT cod_turma_inep + FROM modules.educacenso_cod_turma + WHERE cod_turma = $1"; + $params = array('params' => $this->cod_turma, 'return_only' => 'first-field'); + return Portabilis_Utils_Database::fetchPreparedQuery($sql, $params); + } + } + +} +?> diff --git a/ieducar/lib/App/Model/Educacenso.php b/ieducar/lib/App/Model/Educacenso.php index a14e202753..0feb044dfc 100644 --- a/ieducar/lib/App/Model/Educacenso.php +++ b/ieducar/lib/App/Model/Educacenso.php @@ -7,6 +7,11 @@ public static function etapas_multisseriadas() return array(12,13,22,23,24,72,56,64); } + public static function etapasEnsinoUnificadas() + { + return array(3); + } + public static function etapasDaTurma($etapaEnsino) { $etapas = array(); diff --git a/ieducar/misc/database/migrations/20180724151229_migra_turma_unificada_para_enturmacao.php b/ieducar/misc/database/migrations/20180724151229_migra_turma_unificada_para_enturmacao.php new file mode 100755 index 0000000000..30c56adddd --- /dev/null +++ b/ieducar/misc/database/migrations/20180724151229_migra_turma_unificada_para_enturmacao.php @@ -0,0 +1,26 @@ +execute(' + ALTER TABLE pmieducar.matricula_turma ADD turma_unificada SMALLINT; + UPDATE pmieducar.matricula_turma + SET turma_unificada = COALESCE(turma.turma_unificada,0) + FROM pmieducar.turma + WHERE turma.cod_turma = matricula_turma.ref_cod_turma; + ALTER TABLE pmieducar.turma DROP COLUMN turma_unificada; + '); + } + + public function down() + { + $this->execute(' + ALTER TABLE pmieducar.turma ADD turma_unificada SMALLINT; + ALTER TABLE pmieducar.matricula_turma DROP COLUMN turma_unificada; + '); + } +} diff --git a/ieducar/modules/Cadastro/Assets/Javascripts/Turma.js b/ieducar/modules/Cadastro/Assets/Javascripts/Turma.js index 419caa15d2..5e4a4e6fd7 100644 --- a/ieducar/modules/Cadastro/Assets/Javascripts/Turma.js +++ b/ieducar/modules/Cadastro/Assets/Javascripts/Turma.js @@ -39,13 +39,6 @@ let verificaEtapaEducacenso = ()=>{ } } -let verificaTurmaUnificada = () => { - $j('#turma_unificada').makeUnrequired(); - if (obrigarCamposCenso && $j('#etapa_educacenso').val() == '3') { - $j('#turma_unificada').makeRequired(); - } -} - $j('#tipo_atendimento').change(function() { mostraAtividadesComplementares(); mostraAtividadesAee(); @@ -55,8 +48,7 @@ $j('#tipo_atendimento').change(function() { verificaEtapaEducacenso(); $j('#etapa_educacenso').change(function() { - mostraCursoTecnico(); - verificaTurmaUnificada(); + mostraCursoTecnico();; }); function mostraAtividadesComplementares(){ @@ -161,7 +153,7 @@ function habilitaTurmaMaisEducacao() { $j('#dependencia_administrativa').val() == 3; var atendimentoClasseHospitalarAee = $j('#tipo_atendimento').val() == 1 || $j('#tipo_atendimento').val() == 5; - var atividadeComplementar = $j('#tipo_atendimento').val() == 4; + var atividadeComplementar = $j('#tipo_atendimento').val() == 4; var modalidadeEja = $j('#modalidade_curso').val() == 3; var etapaEducacenso = ($j('#etapa_educacenso').val() >= 4 && $j('#etapa_educacenso').val() <= 38) || @@ -304,7 +296,6 @@ $j(document).ready(function() { mostraAtividadesComplementares(); mostraAtividadesAee(); mostraCursoTecnico(); - mostraTurmaUnificada(); habilitaEtapaEducacenso(); }); @@ -315,20 +306,6 @@ $j(document).ready(function() { } }); - $j("#etapa_educacenso").change(function() { - mostraTurmaUnificada(); - }); - - function mostraTurmaUnificada() { - var etapaUnificada = $j("#etapa_educacenso").val() == 3; - - $j("#tr_turma_unificada").hide(); - - if (etapaUnificada) { - $j("#tr_turma_unificada").show(); - } - } - var submitForm = function(){ let canSubmit = validationUtils.validatesFields(true); if (canSubmit) { From c984a2058b941a95bffaedf87388c6312f0d4f40 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Tue, 24 Jul 2018 16:28:54 -0300 Subject: [PATCH 42/73] Remove campo turma unificada --- ieducar/intranet/educar_turma_cad.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ieducar/intranet/educar_turma_cad.php b/ieducar/intranet/educar_turma_cad.php index b19b1cd516..3ef5f6fb8c 100644 --- a/ieducar/intranet/educar_turma_cad.php +++ b/ieducar/intranet/educar_turma_cad.php @@ -565,14 +565,6 @@ function Gerar() $options = array('label' => 'Etapa de ensino', 'resources' => $etapas_educacenso, 'value' => $this->etapa_educacenso, 'required' => false, 'size' => 70,); $this->inputsHelper()->select('etapa_educacenso', $options); - $resources = array( - null => 'Selecione', - 1 => 'Creche', - 2 => Portabilis_String_Utils::toLatin1('Pré-escola'), - ); - $options = array('label' => 'Turma unificada', 'resources' => $resources,'label_hint' => 'Selecione somente se a turma for unificada', 'value' => $this->turma_unificada, 'required' => false, 'size' => 70,); - $this->inputsHelper()->select('turma_unificada', $options); - $cursos = loadJson('educacenso_json/cursos_da_educacao_profissional.json'); $helperOptions = array('objectName' => 'cod_curso_profissional', 'type' => 'single'); @@ -1025,7 +1017,6 @@ function montaObjetoTurma($codTurma = null, $usuarioCad = null, $usuarioExc = nu $objTurma->tipo_atendimento = $this->tipo_atendimento; $objTurma->turma_mais_educacao = $this->turma_mais_educacao; $objTurma->cod_curso_profissional = $this->cod_curso_profissional; - $objTurma->turma_unificada = $this->turma_unificada == "" ? NULL : $this->turma_unificada; $objTurma->etapa_educacenso = $this->etapa_educacenso == "" ? NULL : $this->etapa_educacenso; $objTurma->ref_ref_cod_serie_mult = $this->ref_cod_serie_mult == "" ? NULL : $this->ref_cod_serie_mult; $objTurma->ref_cod_disciplina_dispensada = $this->ref_cod_disciplina_dispensada == "" ? NULL : $this->ref_cod_disciplina_dispensada; From 397e425fd157866d45ec91b02f9ab33e4ca5eff7 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Tue, 24 Jul 2018 17:08:02 -0300 Subject: [PATCH 43/73] =?UTF-8?q?Ajusta=20exporta=C3=A7=C3=A3o=20censo,=20?= =?UTF-8?q?turma=20unificada=20na=20enturma=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Api/Views/EducacensoAnaliseController.php | 10 ++++++++++ .../Api/Views/EducacensoExportController.php | 15 +++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ieducar/modules/Api/Views/EducacensoAnaliseController.php b/ieducar/modules/Api/Views/EducacensoAnaliseController.php index 6dad9ef1cb..dbdf483749 100644 --- a/ieducar/modules/Api/Views/EducacensoAnaliseController.php +++ b/ieducar/modules/Api/Views/EducacensoAnaliseController.php @@ -35,6 +35,7 @@ require_once 'lib/Portabilis/Controller/ApiCoreController.php'; require_once 'intranet/include/clsBanco.inc.php'; require_once 'lib/Portabilis/Date/Utils.php'; +require_once 'lib/App/Model/Educacenso.php'; /** * Class EducacensoAnaliseController @@ -1400,6 +1401,7 @@ protected function analisaEducacensoRegistro80() { a.recebe_escolarizacao_em_outro_espaco AS recebe_escolarizacao_em_outro_espaco, t.etapa_educacenso AS etapa_ensino, mt.etapa_educacenso AS etapa_turma, + mt.turma_unificada AS turma_unificada, m.cod_matricula AS cod_matricula FROM pmieducar.aluno a INNER JOIN cadastro.fisica fis ON (fis.idpes = a.ref_idpes) @@ -1483,6 +1485,14 @@ protected function analisaEducacensoRegistro80() { "fail" => true); } } + if (in_array($aluno["etapa_ensino"], App_Model_Educacenso::etapasEnsinoUnificadas())) { + if (is_null($aluno["turma_unificada"])) { + $mensagem[] = array("text" => "Dados para formular o registro 80 do(a) aluno(a) {$nomeAluno} não encontrados. Verificamos que a etapa da turma unificada do aluno não foi informada.", + "path" => "(Escola > Cadastros > Alunos > Visualizar (matrícula do ano atual) > Etapa da turma unificada)", + "linkPath" => "/intranet/educar_matricula_turma_unificada_cad.php?ref_cod_matricula={$codMatricula}&ref_cod_aluno={$codAluno}", + "fail" => true); + } + } } return array('mensagens' => $mensagem, diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index e5a6f94c30..04b4ab2019 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -15,6 +15,7 @@ require_once 'Portabilis/Business/Professor.php'; require_once 'App/Model/IedFinder.php'; require_once 'ComponenteCurricular/Model/CodigoEducacenso.php'; +require_once 'lib/App/Model/Educacenso.php'; require_once __DIR__ . '/../../../lib/App/Model/Servidor.php'; /** @@ -1618,7 +1619,7 @@ protected function exportaDadosRegistro60($escolaId, $ano, $data_ini, $data_fim, $r60s16 = 0; $r60s17 = $r60s18 = $r60s19 = $r60s20 = $r60s21 = $r60s22 = $r60s23 = $r60s24 = $r60s25 = $r60s26 = $r60s27 = $r60s28 = $r60s29 = null; - + $r60s39 = null; // Define 'tipodeficiencia' => 'seqleiaute' @@ -1873,7 +1874,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, eca.cod_aluno_inep AS r80s3, a.cod_aluno AS r80s4, t.cod_turma AS r80s6, - t.turma_unificada AS r80s8, + mt.turma_unificada AS r80s8, mt.etapa_educacenso AS r80s9, a.recebe_escolarizacao_em_outro_espaco AS r80s10, ta.responsavel AS transporte_escolar, @@ -2015,7 +2016,6 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, $numeroRegistros = 24; $atividadeComplementar = 4; $atendimentoEducEspecializado = 5; - $educacaoInfantilUnificada = 3; foreach (Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($escolaId, $ano, $data_ini, $data_fim, $alunoId))) as $reg) { @@ -2025,7 +2025,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, $r80s10 = ''; } - if ($etapa_educacenso != $educacaoInfantilUnificada) { + if (!in_array($etapa_educacenso, App_Model_Educacenso::etapasEnsinoUnificadas())) { $r80s8 = ''; } @@ -2073,6 +2073,13 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, } } + if (in_array($etapa_educacenso, App_Model_Educacenso::etapasEnsinoUnificadas())) { + if (is_null($r80s8)) { + $this->msg .= "Dados para formular o registro 80 campo 8 da escola {$escolaId} com problemas. Verifique se o campo etapa da turma unificada foi preenchido para aluno {$alunoId}.
"; + $this->error = true; + } + } + // fim validações transporte escolar for ($i = 1; $i <= $numeroRegistros; $i++) { From 270dfba5aaea864982a7ec9ca8364febb3fb9438 Mon Sep 17 00:00:00 2001 From: Matheus Nicoski Date: Tue, 24 Jul 2018 17:32:43 -0300 Subject: [PATCH 44/73] =?UTF-8?q?Altera=20fun=C3=A7=C3=A3o=20de=20classe;?= =?UTF-8?q?=20ALterado=20fun=C3=A7=C3=A3o=20getTipoNotaComponenteSerie=20p?= =?UTF-8?q?ara=20a=20classe=20Iedfind,=20para=20ficar=20junto=20de=20outra?= =?UTF-8?q?s=20fun=C3=A7=C3=B5es=20'gets';=20Refs=20#3903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/lib/App/Model/IedFinder.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ieducar/lib/App/Model/IedFinder.php b/ieducar/lib/App/Model/IedFinder.php index cc1beef5a7..aa19549b5e 100644 --- a/ieducar/lib/App/Model/IedFinder.php +++ b/ieducar/lib/App/Model/IedFinder.php @@ -493,6 +493,17 @@ public static function getComponentesTurma($serieId, $escola, $turma, } } + public static function getTipoNotaComponenteSerie($componenteId, $serieId) + { + $sql = "SELECT tipo_nota + FROM modules.componente_curricular_ano_escolar + WHERE ano_escolar_id = $1 + AND componente_curricular_id = $2"; + + $tipoNota = Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($serieId, $componenteId), 'return_only' => 'first-row')); + return $tipoNota['tipo_nota']; + } + /** * Recupera instâncias persistidas de ComponenteCurricular_Model_Componente, * retornando-as com a carga horária padrão caso o componente identificado From d85f9c7bb89e49a498f17b4e8e25b9c10b0b5672 Mon Sep 17 00:00:00 2001 From: Matheus Nicoski Date: Tue, 24 Jul 2018 17:34:32 -0300 Subject: [PATCH 45/73] =?UTF-8?q?Altera=20chama=20da=20fun=C3=A7=C3=A3o=20?= =?UTF-8?q?getTipoNotaComponenteSerie;=20Alterado=20a=20chama=20da=20fun?= =?UTF-8?q?=C3=A7=C3=A3o;=20Refs=20#3903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Avaliacao/Views/DiarioApiController.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/ieducar/modules/Avaliacao/Views/DiarioApiController.php b/ieducar/modules/Avaliacao/Views/DiarioApiController.php index 74f30c0e96..91e03769df 100644 --- a/ieducar/modules/Avaliacao/Views/DiarioApiController.php +++ b/ieducar/modules/Avaliacao/Views/DiarioApiController.php @@ -532,7 +532,6 @@ protected function postNota() } $nota = new Avaliacao_Model_NotaComponente($array_nota); - $this->serviceBoletim()->addNota($nota); $this->trySaveServiceBoletim(); $this->inserirAuditoriaNotas($_notaAntiga, $nota); @@ -1169,7 +1168,7 @@ protected function loadComponentesCurricularesForMatricula($matriculaId, $turmaI foreach ($_componentesCurriculares as $_componente) { $componente = array(); $componenteId = $_componente->get('id'); - $tipoNota = $this->getTipoNotaComponenteSerie($componenteId, $serieId); + $tipoNota = App_Model_IedFinder::getTipoNotaComponenteSerie($componenteId, $serieId); if (clsPmieducarTurma::verificaDisciplinaDispensada($turmaId, $componenteId)) { continue; @@ -1239,18 +1238,6 @@ protected function loadComponentesCurricularesForMatricula($matriculaId, $turmaI return $componentesCurriculares; } - protected function getTipoNotaComponenteSerie($componenteId, $serieId) - { - $sql = "SELECT tipo_nota - FROM modules.componente_curricular_ano_escolar - WHERE ano_escolar_id = $1 - AND componente_curricular_id = $2"; - - $tipoNota = $this->fetchPreparedQuery($sql, array($serieId, $componenteId)); - - return $tipoNota[0]['tipo_nota']; - } - protected function getAreaConhecimento($componenteCurricularId = null) { if (is_null($componenteCurricularId)) { From 7deef37e44f5027997b168dfa0948b2c03c4809f Mon Sep 17 00:00:00 2001 From: Matheus Nicoski Date: Tue, 24 Jul 2018 17:36:28 -0300 Subject: [PATCH 46/73] =?UTF-8?q?Cria=20class=20com=20constantes=20para=20?= =?UTF-8?q?o=20tipo=20de=20nota=20dos=20componente=20da=20s=C3=A9rie;=20Re?= =?UTF-8?q?fs=20#3903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Model/TipoNotaComponenteSerie.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ieducar/modules/ComponenteCurricular/Model/TipoNotaComponenteSerie.php diff --git a/ieducar/modules/ComponenteCurricular/Model/TipoNotaComponenteSerie.php b/ieducar/modules/ComponenteCurricular/Model/TipoNotaComponenteSerie.php new file mode 100644 index 0000000000..19b4c0487f --- /dev/null +++ b/ieducar/modules/ComponenteCurricular/Model/TipoNotaComponenteSerie.php @@ -0,0 +1,19 @@ + 'Nota conceitual', + self::NUMERICA => 'Nota numérica', + ]; + + public static function getInstance() + { + return self::_getInstance(__CLASS__); + } +} From fd73017542363837acde84d82ac9034aadf3ba35 Mon Sep 17 00:00:00 2001 From: Matheus Nicoski Date: Tue, 24 Jul 2018 17:41:49 -0300 Subject: [PATCH 47/73] =?UTF-8?q?Adiciona=20valida=C3=A7=C3=A3o=20para=20a?= =?UTF-8?q?rredondamento=20de=20nota=20e=20m=C3=A9dia;=20-=20Criado=20fun?= =?UTF-8?q?=C3=A7=C3=B5es:=20=20-=20usaTabelaArredondamentoConceitual=20~?= =?UTF-8?q?=20Para=20saber=20se=20deve=20usar=20a=20tabela=20de=20arredond?= =?UTF-8?q?amento=20conceitual;=20=20-=20regraUsaTipoNotaNumericaConceitua?= =?UTF-8?q?l=20~=20Para=20saber=20se=20regra=20de=20avalia=C3=A7=C3=A3o=20?= =?UTF-8?q?=C3=A9=20do=20tipo=20n=C3=BAmerico-conceitual;=20=20-=20compone?= =?UTF-8?q?nteUsaNotaConceitual=20~Para=20saber=20se=20o=20componente=20?= =?UTF-8?q?=C3=A9=20do=20tipo=20conceitual;=20Refs=20#3903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/modules/Avaliacao/Service/Boletim.php | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/ieducar/modules/Avaliacao/Service/Boletim.php b/ieducar/modules/Avaliacao/Service/Boletim.php index 2738b17b49..2ae327d35e 100644 --- a/ieducar/modules/Avaliacao/Service/Boletim.php +++ b/ieducar/modules/Avaliacao/Service/Boletim.php @@ -34,6 +34,7 @@ require_once 'App/Model/Matricula.php'; require_once 'App/Model/MatriculaSituacao.php'; require_once 'include/pmieducar/clsPermissoes.inc.php'; +require_once 'ComponenteCurricular/Model/TipoNotaComponenteSerie.php'; /** * Avaliacao_Service_Boletim class. @@ -2307,7 +2308,6 @@ public function addNota(Avaliacao_Model_NotaComponente $nota) $nota = $this->_addValidators($nota); $nota = $this->_updateEtapa($nota); - $nota->notaArredondada = $this->arredondaNota($nota); $this->_notas[$key] = $nota; @@ -2669,7 +2669,9 @@ protected function _updateParecerEtapa(Avaliacao_Model_ParecerDescritivoAbstract */ public function arredondaNota($nota) { - if ($nota instanceof Avaliacao_Model_NotaComponente) { + $componenteId = $nota->get('componenteCurricular'); + + if ($nota instanceof Avaliacao_Model_NotaComponente) { $nota = $nota->nota; }elseif($nota instanceof Avaliacao_Model_NotaGeral){ $nota = $nota->nota; @@ -2682,9 +2684,39 @@ public function arredondaNota($nota) )); } + if ($this->usaTabelaArredondamentoConceitual($componenteId)) { + return $this->getRegra()->tabelaArredondamentoConceitual->round($nota, 1); + } + return $this->getRegra()->tabelaArredondamento->round($nota, 1); } + public function regraUsaTipoNotaNumericaConceitual() + { + if ($this->getRegra()->get('tipoNota') == RegraAvaliacao_Model_Nota_TipoValor::NUMERICACONCEITUAL) { + return true; + } + + return false; + } + + public function componenteUsaNotaConceitual($componenteId) + { + $serieId = $this->_options['matriculaData'][ref_ref_cod_serie]; + $tipoNota = App_Model_IedFinder::getTipoNotaComponenteSerie($componenteId, $serieId); + + if ($tipoNota == ComponenteSerie_Model_TipoNota::CONCEITUAL) { + return true; + } + + return false; + } + + public function usaTabelaArredondamentoConceitual ($componenteId) + { + return $this->regraUsaTipoNotaNumericaConceitual() && $this->componenteUsaNotaConceitual($componenteId); + } + /** * Arredonda uma nota através da tabela de arredondamento da regra de avaliação. * @param Avaliacao_Model_NotaComponente|int $nota @@ -2693,6 +2725,8 @@ public function arredondaNota($nota) */ public function arredondaMedia($media) { + $componenteId = $this->getCurrentComponenteCurricular(); + if ($media instanceof Avaliacao_Model_NotaComponenteMedia) { $media = $media->nota; } @@ -2704,6 +2738,10 @@ public function arredondaMedia($media) )); } + if ($this->usaTabelaArredondamentoConceitual($componenteId)) { + return $this->getRegra()->tabelaArredondamentoConceitual->round($media, 2); + } + return $this->getRegra()->tabelaArredondamento->round($media, 2); } From 64e23e66460d3138b00ae15ea43abd75c711b8ce Mon Sep 17 00:00:00 2001 From: Matheus Nicoski Date: Tue, 24 Jul 2018 17:52:47 -0300 Subject: [PATCH 48/73] =?UTF-8?q?Ajusta=20condi=C3=A7=C3=A3o=20para=20form?= =?UTF-8?q?atar=20nota;=20Refs=20#3903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/modules/Avaliacao/Service/Boletim.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ieducar/modules/Avaliacao/Service/Boletim.php b/ieducar/modules/Avaliacao/Service/Boletim.php index 2ae327d35e..66bf3caa1d 100644 --- a/ieducar/modules/Avaliacao/Service/Boletim.php +++ b/ieducar/modules/Avaliacao/Service/Boletim.php @@ -2671,11 +2671,9 @@ public function arredondaNota($nota) { $componenteId = $nota->get('componenteCurricular'); - if ($nota instanceof Avaliacao_Model_NotaComponente) { - $nota = $nota->nota; - }elseif($nota instanceof Avaliacao_Model_NotaGeral){ - $nota = $nota->nota; - } + if (($nota instanceof Avaliacao_Model_NotaComponente) || ($nota instanceof Avaliacao_Model_NotaGeral)) { + $nota = $nota->nota; + } if (!is_numeric($nota)) { require_once 'CoreExt/Exception/InvalidArgumentException.php'; From c2b9809df1c63971f0476f0a1dfbbbc7a2c67924 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Tue, 24 Jul 2018 19:06:19 -0300 Subject: [PATCH 49/73] =?UTF-8?q?Ajusta=20valida=C3=A7=C3=A3o=20turma=20un?= =?UTF-8?q?ificada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/modules/Api/Views/EducacensoAnaliseController.php | 2 +- ieducar/modules/Api/Views/EducacensoExportController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ieducar/modules/Api/Views/EducacensoAnaliseController.php b/ieducar/modules/Api/Views/EducacensoAnaliseController.php index dbdf483749..63760d89b1 100644 --- a/ieducar/modules/Api/Views/EducacensoAnaliseController.php +++ b/ieducar/modules/Api/Views/EducacensoAnaliseController.php @@ -1486,7 +1486,7 @@ protected function analisaEducacensoRegistro80() { } } if (in_array($aluno["etapa_ensino"], App_Model_Educacenso::etapasEnsinoUnificadas())) { - if (is_null($aluno["turma_unificada"])) { + if (empty($aluno["turma_unificada"])) { $mensagem[] = array("text" => "Dados para formular o registro 80 do(a) aluno(a) {$nomeAluno} não encontrados. Verificamos que a etapa da turma unificada do aluno não foi informada.", "path" => "(Escola > Cadastros > Alunos > Visualizar (matrícula do ano atual) > Etapa da turma unificada)", "linkPath" => "/intranet/educar_matricula_turma_unificada_cad.php?ref_cod_matricula={$codMatricula}&ref_cod_aluno={$codAluno}", diff --git a/ieducar/modules/Api/Views/EducacensoExportController.php b/ieducar/modules/Api/Views/EducacensoExportController.php index 04b4ab2019..0bfdd5db8b 100644 --- a/ieducar/modules/Api/Views/EducacensoExportController.php +++ b/ieducar/modules/Api/Views/EducacensoExportController.php @@ -2074,7 +2074,7 @@ protected function exportaDadosRegistro80($escolaId, $ano, $data_ini, $data_fim, } if (in_array($etapa_educacenso, App_Model_Educacenso::etapasEnsinoUnificadas())) { - if (is_null($r80s8)) { + if (empty($r80s8)) { $this->msg .= "Dados para formular o registro 80 campo 8 da escola {$escolaId} com problemas. Verifique se o campo etapa da turma unificada foi preenchido para aluno {$alunoId}.
"; $this->error = true; } From 179329fba959d8cab3d98055899ab4d7b04de9c4 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodrigues Date: Wed, 25 Jul 2018 08:19:04 -0300 Subject: [PATCH 50/73] =?UTF-8?q?Ajusta=20op=C3=A7=C3=B5es=20turma=20unifi?= =?UTF-8?q?cada,=20substitui=20"Selecione"=20por=20"Nenhuma"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_matricula_turma_unificada_cad.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/intranet/educar_matricula_turma_unificada_cad.php b/ieducar/intranet/educar_matricula_turma_unificada_cad.php index d41bf3477b..ac505a0099 100644 --- a/ieducar/intranet/educar_matricula_turma_unificada_cad.php +++ b/ieducar/intranet/educar_matricula_turma_unificada_cad.php @@ -69,7 +69,7 @@ public function Gerar() foreach ($enturmacoes as $enturmacao) { $resources = array( - 0 => 'Selecione', + 0 => 'Nenhuma', 1 => 'Creche', 2 => Portabilis_String_Utils::toLatin1('Pré-escola'), ); From 5ceb42c9bd930a418d424dcca8739012a0a1243c Mon Sep 17 00:00:00 2001 From: bonot Date: Wed, 25 Jul 2018 14:40:17 -0300 Subject: [PATCH 51/73] Adiciona indice nulo no inicio do array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O índice 0 estava sendo inserido ao final do array de regras. Sempre que a regra diferenciada era nula ele mostrava o primeiro item causando confusão --- ieducar/modules/RegraAvaliacao/Views/EditController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/modules/RegraAvaliacao/Views/EditController.php b/ieducar/modules/RegraAvaliacao/Views/EditController.php index 916d4d1b5a..570c249982 100644 --- a/ieducar/modules/RegraAvaliacao/Views/EditController.php +++ b/ieducar/modules/RegraAvaliacao/Views/EditController.php @@ -675,7 +675,7 @@ public function Gerar() ); $regras = CoreExt_Entity::entityFilterAttr($regras, 'id', 'nome'); - $regras[0] = 'Não utiliza'; + $regras = array_replace([0 => 'Não utiliza'], $regras); $this->campoLista( 'regraDiferenciada', From 856f9957b60af329e1af55db7593cdd05807c17c Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 1 Aug 2018 17:44:37 -0300 Subject: [PATCH 52/73] =?UTF-8?q?Adicona=20uft8=5Fencode=20no=20complement?= =?UTF-8?q?o=20do=20endere=C3=A7o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_importacao_educacenso.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ieducar/intranet/educar_importacao_educacenso.php b/ieducar/intranet/educar_importacao_educacenso.php index 19686c0aee..c23e83d8ab 100644 --- a/ieducar/intranet/educar_importacao_educacenso.php +++ b/ieducar/intranet/educar_importacao_educacenso.php @@ -186,7 +186,7 @@ function importaRegistro00($dadosRegistro) { $cep = $dadosRegistro[12]; // ep.cep $logradouro = $dadosRegistro[13]; // l.idtlog l.nome $enderecoNumero = $dadosRegistro[14]; // ep.numero - $complemento = $dadosRegistro[15]; // ep.complemento + $complemento = utf8_encode($dadosRegistro[15]); // ep.complemento $nomeBairro = $dadosRegistro[16]; // b.nome $ufIbge = $dadosRegistro[17]; // uf.cod_ibge $municipioIbge = $dadosRegistro[18]; // m.cod_ibge @@ -926,7 +926,7 @@ function importaRegistro40($dadosRegistro){ $cep = $dadosRegistro[7-1]; $endereco = $dadosRegistro[8-1]; $numero = $dadosRegistro[9-1]; - $complemento = $dadosRegistro[10-1]; + $complemento = utf8_encode($dadosRegistro[10-1]); $bairro = $dadosRegistro[11-1]; $ufIbge = $dadosRegistro[12-1]; $municipioIbge = $dadosRegistro[13-1]; @@ -1190,7 +1190,7 @@ function importaRegistro70($dadosRegistro){ $cep = $dadosRegistro[23-1]; $endereco = $dadosRegistro[24-1]; $numero = $dadosRegistro[25-1]; - $complemento = $dadosRegistro[26-1]; + $complemento = utf8_encode($dadosRegistro[26-1]); $bairro = $dadosRegistro[27-1]; $ufIbge = $dadosRegistro[28-1]; $municipioIbge = $dadosRegistro[29-1]; From 03d2c17e15b448d50b224e58b7b92958a664d05c Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 1 Aug 2018 18:00:38 -0300 Subject: [PATCH 53/73] =?UTF-8?q?Corrige=20chamada=20de=20m=C3=A9todo=20n?= =?UTF-8?q?=C3=A3o=20est=C3=A1tico=20e=20ignora=20erros=20ao=20alterar=20h?= =?UTF-8?q?eader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_importacao_educacenso.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ieducar/intranet/educar_importacao_educacenso.php b/ieducar/intranet/educar_importacao_educacenso.php index c23e83d8ab..8f1b122b1b 100644 --- a/ieducar/intranet/educar_importacao_educacenso.php +++ b/ieducar/intranet/educar_importacao_educacenso.php @@ -125,7 +125,7 @@ function Editar() $registros = explode("\n", $arquivo); foreach ($registros as $registro) { - header_remove('Set-Cookie'); + @header_remove('Set-Cookie'); $dadosRegistro = explode("|", $registro); $numeroRegistro = $dadosRegistro[0]; @@ -165,7 +165,7 @@ function Editar() } //echo 'Tempo para importar registro '.$numeroRegistro.': ' . (microtime(true) - $time_start) . '
'; } - header_remove('Set-Cookie'); + @header_remove('Set-Cookie'); $this->mensagem = "Arquivo importado!"; return true; } @@ -642,7 +642,7 @@ function getOrCreateComponenteCurricularTurma($codEscola, $codSerie, $codTurma, } function getOrCreateAreaConhecimento(){ - $dataMapper = Portabilis_DataMapper_Utils::getDataMapperFor('areaConhecimento', 'area'); + $dataMapper = (new Portabilis_DataMapper_Utils)->getDataMapperFor('areaConhecimento', 'area'); $areas = $dataMapper->findAll(array()); $codArea = null; From bf300bd20b72dacf6a010baf21c24768dd5d657d Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 1 Aug 2018 18:01:13 -0300 Subject: [PATCH 54/73] =?UTF-8?q?Remove=20chamada=20a=20vari=C3=A1vel=20in?= =?UTF-8?q?existente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intranet/include/pmieducar/clsPmieducarMatricula.inc.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarMatricula.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarMatricula.inc.php index 099146390e..84d94d8ab6 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarMatricula.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarMatricula.inc.php @@ -291,9 +291,6 @@ function __construct($cod_matricula = NULL, $ref_cod_reserva_vaga = NULL, if (is_string($data_cancel)) { $this->data_cancel = $data_cancel; } - if (is_bool($dependencia)) { - $this->dependencia = $dependencia; - } if (is_numeric($turno_id)) { $this->turno_id = $turno_id; } From 9b017fa41e666cd02d4e19edb401d873663e6410 Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 1 Aug 2018 18:23:47 -0300 Subject: [PATCH 55/73] =?UTF-8?q?Corrige=20chamada=20de=20m=C3=A9todo=20n?= =?UTF-8?q?=C3=A3o=20est=C3=A1tico?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/educar_importacao_educacenso.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ieducar/intranet/educar_importacao_educacenso.php b/ieducar/intranet/educar_importacao_educacenso.php index 8f1b122b1b..af5efc140b 100644 --- a/ieducar/intranet/educar_importacao_educacenso.php +++ b/ieducar/intranet/educar_importacao_educacenso.php @@ -604,7 +604,7 @@ function vinculaDisciplinaEscolaSerie($codDisciplina, $codEscola, $codSerie){ } function vinculaDisciplinaSerie($codDisciplina, $codSerie){ - $dataMapper = Portabilis_DataMapper_Utils::getDataMapperFor('componenteCurricular', 'anoEscolar'); + $dataMapper = (new Portabilis_DataMapper_Utils)->getDataMapperFor('componenteCurricular', 'anoEscolar'); $where = array('componente_curricular_id'=>$codDisciplina, 'ano_escolar_id' => $codSerie); $componenteAno = $dataMapper->findAll(array(), $where); @@ -622,7 +622,7 @@ function vinculaDisciplinaSerie($codDisciplina, $codSerie){ } function getOrCreateComponenteCurricularTurma($codEscola, $codSerie, $codTurma, $codDisciplina){ - $dataMapper = Portabilis_DataMapper_Utils::getDataMapperFor('componenteCurricular', 'turma'); + $dataMapper = (new Portabilis_DataMapper_Utils)->getDataMapperFor('componenteCurricular', 'turma'); $where = array('componente_curricular_id'=>$codDisciplina, 'turma_id' => $codTurma); $turmas = $dataMapper->findAll(array()); @@ -662,7 +662,7 @@ function getOrCreateDisciplina($disciplinaEducacenso){ $codArea = $this->getOrCreateAreaConhecimento(); - $dataMapper = Portabilis_DataMapper_Utils::getDataMapperFor('componenteCurricular', 'componente'); + $dataMapper = (new Portabilis_DataMapper_Utils)->getDataMapperFor('componenteCurricular', 'componente'); $where = array('codigo_educacenso' => $disciplinaEducacenso); $disciplinas = $dataMapper->findAll(array(), $where); @@ -1330,7 +1330,7 @@ function createOrUpdateAlunoTransporte($codAluno, $utilizaTransporte, $poderPubl 'created_at' => 'NOW()', ); - $dataMapper = Portabilis_DataMapper_Utils::getDataMapperFor('transporte', 'aluno'); + $dataMapper = (new Portabilis_DataMapper_Utils)->getDataMapperFor('transporte', 'aluno'); try { $entity = $dataMapper->find($codAluno); @@ -1805,7 +1805,7 @@ function atualizaCamposEscolaRegistro00( } function createAlunoEducacenso($codAluno, $inep){ - $dataMapper = Portabilis_DataMapper_Utils::getDataMapperFor('educacenso', 'aluno'); + $dataMapper = (new Portabilis_DataMapper_Utils)->getDataMapperFor('educacenso', 'aluno'); $data = array( 'aluno' => $codAluno, @@ -1822,7 +1822,7 @@ function createAlunoEducacenso($codAluno, $inep){ } function createEscolaEducacenso($codEscola, $inep){ - $dataMapper = Portabilis_DataMapper_Utils::getDataMapperFor('educacenso', 'escola'); + $dataMapper = (new Portabilis_DataMapper_Utils)->getDataMapperFor('educacenso', 'escola'); $data = array( 'escola' => $codEscola, From 61741b4370764e1a158961ce690371f15f7637ba Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 1 Aug 2018 18:46:45 -0300 Subject: [PATCH 56/73] =?UTF-8?q?Corrige=20alguns=20notices=20e=20warnings?= =?UTF-8?q?=20gerados=20por=20indices=20e=20vari=C3=A1veis=20inexistentes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/include/pessoa/clsFisica.inc.php | 1 + ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php | 1 + .../intranet/include/pmieducar/clsPmieducarServidor.inc.php | 1 + ieducar/lib/CoreExt/Entity.php | 4 ++-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ieducar/intranet/include/pessoa/clsFisica.inc.php b/ieducar/intranet/include/pessoa/clsFisica.inc.php index 144cb07c76..7c10ef6c6c 100644 --- a/ieducar/intranet/include/pessoa/clsFisica.inc.php +++ b/ieducar/intranet/include/pessoa/clsFisica.inc.php @@ -530,6 +530,7 @@ function edita() // verifica campos obrigatorios para edicao if( is_numeric($this->idpes) && $this->idpes_rev ) { + $set = ''; $gruda = ""; if($this->data_nasc) { diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php index 4ebaa7a7bb..f9dc5a2bf0 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php @@ -492,6 +492,7 @@ function edita() if (is_numeric($this->cod_aluno)) { $db = new clsBanco(); $set = ''; + $gruda = ''; if (is_numeric($this->ref_cod_religiao) || $this->ref_cod_religiao == "NULL") { $set .= "{$gruda}ref_cod_religiao = {$this->ref_cod_religiao}"; diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarServidor.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarServidor.inc.php index 9f4a85ecdc..65fd3a1da7 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarServidor.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarServidor.inc.php @@ -394,6 +394,7 @@ function edita() if (is_numeric($this->cod_servidor) && is_numeric($this->ref_cod_instituicao)) { $db = new clsBanco(); $set = ""; + $gruda = ''; if (is_numeric($this->ref_idesco)) { $set .= "{$gruda}ref_idesco = '{$this->ref_idesco}'"; $gruda = ", "; diff --git a/ieducar/lib/CoreExt/Entity.php b/ieducar/lib/CoreExt/Entity.php index 891bee3a45..d22c4246e0 100644 --- a/ieducar/lib/CoreExt/Entity.php +++ b/ieducar/lib/CoreExt/Entity.php @@ -482,7 +482,7 @@ public function setReferenceFile($key, $file) */ protected function _getReferenceValue($key) { - return $this->_references[$key]['value']; + return isset($this->_references[$key]['value']) ? $this->_references[$key]['value'] : null; } /** @@ -492,7 +492,7 @@ protected function _getReferenceValue($key) */ protected function _getReferenceClass($key) { - return $this->_references[$key]['class']; + return isset($this->_references[$key]['class']) ? $this->_references[$key]['class'] : null; } /** From f5d1581a5132c2f37ef5c2dee5f23a1bbe557e8d Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Wed, 1 Aug 2018 21:55:25 -0300 Subject: [PATCH 57/73] =?UTF-8?q?Corrige=20notice=20gerado=20por=20fun?= =?UTF-8?q?=C3=A7=C3=A3o=20sendo=20passada=20por=20refer=C3=AAncia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/lib/CoreExt/DataMapper.php | 6 ++++-- ieducar/lib/CoreExt/Entity.php | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ieducar/lib/CoreExt/DataMapper.php b/ieducar/lib/CoreExt/DataMapper.php index 65da29ff6f..4f5d36c8c6 100644 --- a/ieducar/lib/CoreExt/DataMapper.php +++ b/ieducar/lib/CoreExt/DataMapper.php @@ -317,8 +317,9 @@ protected function _getFindStatment($pkey) $where = array(); if (!is_array($pkey)){ + $keys = array_keys($this->_primaryKey); $pkey = array( - array_shift(array_keys($this->_primaryKey)) => $pkey + array_shift($keys) => $pkey ); } @@ -617,7 +618,8 @@ public function save(CoreExt_Entity $instance) $tmpEntry = $this->find($pkSave); $newInfo = $tmpEntry->toDataArray(); - $auditoria = new clsModulesAuditoriaGeral($this->_tableName, $pessoa_logada, $instance->get(array_shift(array_keys($this->_primaryKey)))); + $keys = array_keys($this->_primaryKey); + $auditoria = new clsModulesAuditoriaGeral($this->_tableName, $pessoa_logada, $instance->get(array_shift($keys))); $auditoria->alteracao($oldInfo, $newInfo); } diff --git a/ieducar/lib/CoreExt/Entity.php b/ieducar/lib/CoreExt/Entity.php index d22c4246e0..8de9394665 100644 --- a/ieducar/lib/CoreExt/Entity.php +++ b/ieducar/lib/CoreExt/Entity.php @@ -503,7 +503,8 @@ protected function _getReferenceClass($key) public function _isReferenceDataMapper($key) { $class = $this->_getReferenceClass($key); - return $this->_isReferenceOf($class, $this->_references[$key]['file'], + $reference = isset($this->_references[$key]['file']) ? $this->_references[$key]['file'] : null; + return $this->_isReferenceOf($class, $reference, 'CoreExt_DataMapper'); } From 7c89728171cbaa10ef75820579a08f877bc93c4f Mon Sep 17 00:00:00 2001 From: Everton Muniz Date: Thu, 2 Aug 2018 08:25:05 -0300 Subject: [PATCH 58/73] Corrige problema ao editar o campo Alojamento do Aluno --- .../intranet/include/pmieducar/clsPmieducarEscola.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarEscola.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarEscola.inc.php index a3a75ad22b..85fb91c923 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarEscola.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarEscola.inc.php @@ -1053,7 +1053,8 @@ function edita() { if (is_numeric($this->cod_escola)) { $db = new clsBanco(); - $set = ""; + $set = ''; + $gruda = ''; if (is_numeric($this->ref_usuario_cad)) { $set .= "{$gruda}ref_usuario_cad = '{$this->ref_usuario_cad}'"; @@ -1420,7 +1421,7 @@ function edita() } if (is_numeric($this->dependencia_alojamento_aluno)) { - $set .= "{$gruda}dependencia_alojamento_aluno = '{$this->dependencia_patio_coberto}'"; + $set .= "{$gruda}dependencia_alojamento_aluno = '{$this->dependencia_alojamento_aluno}'"; $gruda = ", "; } From 78bad14c6b4a59f0d846bdaba50ad617404edf9d Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Fri, 27 Jul 2018 16:41:05 -0300 Subject: [PATCH 59/73] =?UTF-8?q?Migra=20para=20o=20service=20boletim=20a?= =?UTF-8?q?=20valida=C3=A7=C3=A3o=20de=20notas=20e=20faltas=20das=20etapas?= =?UTF-8?q?=20anteriores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/modules/Avaliacao/Service/Boletim.php | 157 + .../Avaliacao/Views/DiarioApiController.php | 3659 ++++++++--------- 2 files changed, 1966 insertions(+), 1850 deletions(-) diff --git a/ieducar/modules/Avaliacao/Service/Boletim.php b/ieducar/modules/Avaliacao/Service/Boletim.php index 66bf3caa1d..90ba4bf9c4 100644 --- a/ieducar/modules/Avaliacao/Service/Boletim.php +++ b/ieducar/modules/Avaliacao/Service/Boletim.php @@ -3363,4 +3363,161 @@ public function deleteNotaGeral($etapa) return $this; } + /** + * Verifica se as notas das etapas anteriores foram lançadas para o + * componente curricular. Lança uma exceção caso contrário. + * + * @param int|string $etapaId + * @param int $componenteCurricularId + * + * @return bool + * + * @throws Exception + */ + public function verificaNotasLancadasNasEtapasAnteriores($etapaId, $componenteCurricularId) + { + $temEtapasAnterioresLancadas = true; + $etapasSemNotas = []; + $regra = $this->getRegra(); + $matriculaId = $this->getOption('matricula'); + $serieId = $this->getOption('ref_cod_serie'); + $escolaId = $this->getOption('ref_cod_escola'); + + // Pelo que eu entendi, caso a opção `definirComponentePorEtapa` é + // possível lançar notas para etapas futuras. + + if ($regra->get('definirComponentePorEtapa') == "1") { + return true; + } + + // Etapas com dispensa não teram notas, então não devem ser + // consideradas como bloqueantes. + + $existeEtapaDispensada = (array) App_Model_IedFinder::validaDispensaPorMatricula( + $matriculaId, $serieId, $escolaId, $componenteCurricularId + ); + + if ($etapaId == 'Rc') { + $etapaId = $this->getOption('etapas'); + } + + for ($etapa = 1; $etapa <= $etapaId; $etapa++) { + + $nota = $this->getNotaAtual($etapa, $componenteCurricularId); + + if (in_array($etapa, $existeEtapaDispensada)) { + continue; + } + + $etapaDiferenteOuRecuperacao = $etapa != $etapaId || $etapaId == 'Rc'; + + if ( + $etapaDiferenteOuRecuperacao + && empty($nota) + && !is_numeric($nota) + ) { + $temEtapasAnterioresLancadas = false; + $etapasSemNotas[] = $etapa; + } + } + + if ($temEtapasAnterioresLancadas) { + return true; + } + + throw new \Exception( + 'Nota somente pode ser lançada após lançar notas nas etapas: ' . + join(', ', $etapasSemNotas) . ' deste componente curricular.' + ); + } + + /** + * Verifica se as faltas das etapas anteriores foram lançadas para o + * componente curricular. Lança uma exceção caso contrário. + * + * @param int|string $etapaId + * @param int $componenteCurricularId + * + * @return bool + * + * @throws Exception + */ + public function verificaFaltasLancadasNasEtapasAnteriores($etapaId, $componenteCurricularId) + { + $temEtapasAnterioresLancadas = true; + $etapasSemFaltas = []; + $matriculaId = $this->getOption('matricula'); + $serieId = $this->getOption('ref_cod_serie'); + $escolaId = $this->getOption('ref_cod_escola'); + + $existeEtapaDispensada = (array) App_Model_IedFinder::validaDispensaPorMatricula($matriculaId, $serieId, $escolaId, $componenteCurricularId); + + for ($etapa = 1; $etapa <= $etapaId; $etapa++) { + + $faltas = $this->getFaltaAtual($etapa, $componenteCurricularId); + + if (in_array($etapa, $existeEtapaDispensada)) { + continue; + } + + if ($etapa != $etapaId && empty($faltas) && !is_numeric($faltas)) { + $temEtapasAnterioresLancadas = false; + $etapasSemFaltas[] = $etapa; + } + } + + if ($temEtapasAnterioresLancadas) { + return true; + } + + $mensagem = 'Falta somente pode ser lançada após lançar faltas nas ' + . 'etapas anteriores: ' . join(', ', $etapasSemFaltas); + + if ($this->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { + $mensagem .= ' deste componente curricular.'; + } + + throw new Exception($mensagem); + } + + /** + * Retorna a nota lançada na etapa para o componente curricular. + * + * @param int|string $etapa + * @param int $componenteCurricularId + * + * @return int|string + */ + public function getNotaAtual($etapa, $componenteCurricularId) + { + // FIXME não entendi o motivo deste urldecode + $nota = urldecode($this->getNotaComponente($componenteCurricularId, $etapa)->nota); + + return str_replace(',', '.', $nota); + } + + /** + * Retorna o número de faltas lançadas na etapa para o componente + * curricular. Caso não exista, retorna null. + * + * @param int|string $etapa + * @param int $componenteCurricularId + * + * @return int|null + */ + public function getFaltaAtual($etapa, $componenteCurricularId) + { + $faltas = null; + $tipoPresenca = $this->getRegra()->get('tipoPresenca'); + + if ($tipoPresenca == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { + $faltas = $this->getFalta($etapa, $componenteCurricularId)->quantidade; + } + + if ($tipoPresenca == RegraAvaliacao_Model_TipoPresenca::GERAL) { + $faltas = $this->getFalta($etapa)->quantidade; + } + + return $faltas; + } } diff --git a/ieducar/modules/Avaliacao/Views/DiarioApiController.php b/ieducar/modules/Avaliacao/Views/DiarioApiController.php index 91e03769df..b0b94142dc 100644 --- a/ieducar/modules/Avaliacao/Views/DiarioApiController.php +++ b/ieducar/modules/Avaliacao/Views/DiarioApiController.php @@ -1,1850 +1,1809 @@ -getOpcoesNotas()); - //return $this->validator->validatesValueInSetOf($this->getRequest()->att_value, $expectedValues, 'att_value'); - return true; - } - - protected function validatesCanChangeDiarioForAno() - { - $escola = App_Model_IedFinder::getEscola($this->getRequest()->escola_id); - - $ano = new clsPmieducarEscolaAnoLetivo(); - $ano->ref_cod_escola = $this->getRequest()->escola_id; - $ano->ano = $this->getRequest()->ano; - $ano = $ano->detalhe(); - - $anoLetivoEncerrado = is_array($ano) && count($ano) > 0 && - $ano['ativo'] == 1 && $ano['andamento'] == 2; - - if ($escola['bloquear_lancamento_diario_anos_letivos_encerrados'] == '1' && $anoLetivoEncerrado) { - $this->messenger->append("O ano letivo '{$this->getRequest()->ano}' está encerrado, esta escola está configurada para não permitir alterar o diário de anos letivos encerrados."); - return false; - } - - $objBloqueioAnoLetivo = new clsPmieducarBloqueioAnoLetivo($this->getRequest()->instituicao_id, $this->getRequest()->ano); - $bloqueioAnoLetivo = $objBloqueioAnoLetivo->detalhe(); - - if ($bloqueioAnoLetivo) { - $dataAtual = strtotime(date("Y-m-d")); - $data_inicio = strtotime($bloqueioAnoLetivo['data_inicio']); - $data_fim = strtotime($bloqueioAnoLetivo['data_fim']); - - if ($dataAtual < $data_inicio || $dataAtual > $data_fim) { - $this->messenger->append("O lançamento de notas nessa instituição está bloqueado nesta data."); - return false; - } - } - - return true; - } - - protected function validatesRegraAvaliacaoHasNota() - { - $isValid = $this->serviceBoletim()->getRegra()->get('tipoNota') != RegraAvaliacao_Model_Nota_TipoValor::NENHUM; - - if (!$isValid) { - $this->messenger->append("Nota não lançada, pois a regra de avaliação não utiliza nota."); - } - - return $isValid; - } - - protected function validatesRegraAvaliacaoHasFormulaRecuperacao() - { - $isValid = $this->getRequest()->etapa != 'Rc' || - !is_null($this->serviceBoletim()->getRegra()->formulaRecuperacao); - - if (!$isValid) { - $this->messenger->append("Nota de recuperação não lançada, pois a fórmula de recuperação não possui fórmula de recuperação."); - } - - return $isValid; - } - - protected function validatesRegraAvaliacaoHasFormulaRecuperacaoWithTypeRecuperacao() - { - $isValid = $this->getRequest()->etapa != 'Rc' || - ($this->serviceBoletim()->getRegra()->formulaRecuperacao->get('tipoFormula') == - FormulaMedia_Model_TipoFormula::MEDIA_RECUPERACAO); - - if (!$isValid) { - $this->messenger->append("Nota de recuperação não lançada, pois a fórmula de recuperação é diferente do tipo média recuperação."); - } - - return $isValid; - } - - protected function validatesPreviousNotasHasBeenSet() - { - $hasPreviousNotas = true; - $etapasWithoutNotas = array(); - $regra = $this->serviceBoletim()->getRegra(); - $matriculaId = $this->serviceBoletim()->getOption('matricula'); - $serieId = $this->serviceBoletim()->getOption('ref_cod_serie'); - $escolaId = $this->serviceBoletim()->getOption('ref_cod_escola'); - $disciplinaId = $this->getRequest()->componente_curricular_id; - - $existeEtapaDispensadaDisciplina = App_Model_IedFinder::validaDispensaPorMatricula($matriculaId, $serieId, $escolaId, $disciplinaId); - - if ($this->getRequest()->etapa == 'Rc') { - $etapaRequest = $this->serviceBoletim()->getOption('etapas'); - } else { - $etapaRequest = $this->getRequest()->etapa; - } - - for ($etapa = 1; $etapa <= $etapaRequest; $etapa++) { - - $nota = $this->getNotaAtual($etapa); - - if (is_array($existeEtapaDispensadaDisciplina) && in_array($etapa, $existeEtapaDispensadaDisciplina)) { - continue; - } - - if (($etapa != $this->getRequest()->etapa || $this->getRequest()->etapa == 'Rc') && - empty($nota) && !is_numeric($nota)) { - $hasPreviousNotas = false; - $etapasWithoutNotas[] = $etapa; - } - } - - if ($regra->get('definirComponentePorEtapa') == "1") { - return true; - } - - if (!$hasPreviousNotas) { - $this->messenger->append("Nota somente pode ser lançada após lançar notas nas etapas: " . - join(', ', $etapasWithoutNotas) . ' deste componente curricular.'); - return false; - } - - return true; - } - - // post falta validations - - protected function validatesPreviousFaltasHasBeenSet() - { - $hasPreviousFaltas = true; - $etapasWithoutFaltas = array(); - $matriculaId = $this->serviceBoletim()->getOption('matricula'); - $serieId = $this->serviceBoletim()->getOption('ref_cod_serie'); - $escolaId = $this->serviceBoletim()->getOption('ref_cod_escola'); - $disciplinaId = $this->getRequest()->componente_curricular_id; - - $existeEtapaDispensadaDisciplina = App_Model_IedFinder::validaDispensaPorMatricula($matriculaId, $serieId, $escolaId, $disciplinaId); - - for ($etapa = 1; $etapa <= $this->getRequest()->etapa; $etapa++) { - $falta = $this->getFaltaAtual($etapa); - - if (is_array($existeEtapaDispensadaDisciplina) && in_array($etapa, $existeEtapaDispensadaDisciplina)) { - continue; - } - - if ($etapa != $this->getRequest()->etapa && empty($falta) && !is_numeric($falta)) { - $hasPreviousFaltas = false; - $etapasWithoutFaltas[] = $etapa; - } - } - - if (!$hasPreviousFaltas) { - if ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { - $this->messenger->append("Falta somente pode ser lançada após lançar faltas nas etapas anteriores: " . - join(', ', $etapasWithoutFaltas) . ' deste componente curricular.'); - } else { - $this->messenger->append("Falta somente pode ser lançada após lançar faltas nas etapas anteriores: " . - join(', ', $etapasWithoutFaltas) . '.'); - } - } - - return $hasPreviousFaltas; - } - - // post/ delete parecer validations - - protected function validatesEtapaParecer() - { - $isValid = false; - $etapa = $this->getRequest()->etapa; - - $tiposParecerAnual = array(RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE, - RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL); - - $parecerAnual = in_array($this->serviceBoletim()->getRegra()->get('parecerDescritivo'), - $tiposParecerAnual); - - if ($parecerAnual && $etapa != 'An') { - $this->messenger->append("Valor inválido para o atributo 'etapa', é esperado 'An' e foi recebido '{$etapa}'."); - } elseif (!$parecerAnual && $etapa == 'An') { - $this->messenger->append("Valor inválido para o atributo 'etapa', é esperado um valor diferente de 'An'."); - } else { - $isValid = true; - } - - return $isValid; - } - - protected function validatesPresenceOfComponenteCurricularIdIfParecerComponente() - { - $tiposParecerComponente = array(RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE, - RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE); - - $parecerPorComponente = in_array($this->serviceBoletim()->getRegra()->get('parecerDescritivo'), - $tiposParecerComponente); - - return (!$parecerPorComponente) || $this->validatesPresenceOf('componente_curricular_id'); - } - - // post parecer validations - - protected function validatesRegraAvaliacaoHasParecer() - { - $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); - $isValid = $tpParecer != RegraAvaliacao_Model_TipoParecerDescritivo::NENHUM; - - if (!$isValid) { - $this->messenger->append("Parecer descritivo não lançado, pois a regra de avaliação não utiliza parecer."); - } - - return $isValid; - } - - // delete nota validations - - protected function validatesInexistenceOfNotaExame() - { - $isValid = true; - - if ($this->getRequest()->etapa != 'Rc') { - $notaExame = $this->getNotaAtual($etapa = 'Rc'); - $isValid = empty($notaExame); - - if (!$isValid) { - $this->messenger->append('Nota da matrícula ' . $this->getRequest()->matricula_id . ' somente pode ser removida, após remover nota do exame.', 'error'); - } - - } - - return $isValid; - } - - protected function validatesInexistenceNotasInNextEtapas() - { - $etapasComNota = array(); - - if (is_numeric($this->getRequest()->etapa)) { - $etapas = $this->serviceBoletim()->getOption('etapas'); - $etapa = $this->getRequest()->etapa + 1; - - for ($etapa; $etapa <= $etapas; $etapa++) { - $nota = $this->getNotaAtual($etapa); - - if (!empty($nota)) { - $etapasComNota[] = $etapa; - } - - } - - if (!empty($etapasComNota)) { - $msg = "Nota somente pode ser removida, após remover as notas lançadas nas etapas posteriores: " . - join(', ', $etapasComNota) . '.'; - $this->messenger->append($msg, 'error'); - } - } - - return empty($etapasComNota); - } - - // delete falta validations - - protected function validatesInexistenceFaltasInNextEtapas() - { - $etapasComFalta = array(); - - if (is_numeric($this->getRequest()->etapa)) { - $etapas = $this->serviceBoletim()->getOption('etapas'); - $etapa = $this->getRequest()->etapa + 1; - - for ($etapa; $etapa <= $etapas; $etapa++) { - $falta = $this->getFaltaAtual($etapa); - - if (!empty($falta)) { - $etapasComFalta[] = $etapa; - } - - } - - if (!empty($etapasComFalta)) { - $this->messenger->append("Falta somente pode ser removida, após remover as faltas lançadas nas etapas posteriores: " . join(', ', $etapasComFalta) . '.', 'error'); - } - - } - - return empty($etapasComFalta); - } - - protected function validatesPresenceOfMatriculaIdOrComponenteCurricularId() - { - if (empty($this->getRequest()->componente_curricular_id) && empty($this->getRequest()->matricula_id)) { - $this->messenger->append('É necessário receber matricula_id ou componente_curricular_id.', 'error'); - return false; - } - - return true; - } - - protected function validatesPeriodoLancamentoFaltasNotas() - { - - $bloqueioLancamentoFaltasNotas = new clsPmieducarBloqueioLancamentoFaltasNotas(null, - $this->getRequest()->ano_escolar, - $this->getRequest()->escola_id, - $this->getRequest()->etapa); - - $bloquearLancamento = $bloqueioLancamentoFaltasNotas->verificaPeriodo(); - - $user = $this->getSession()->id_pessoa; - $processoAp = 999849; - $obj_permissao = new clsPermissoes(); - - $permissaoLancamento = $obj_permissao->permissao_cadastra($processoAp, $user, 7); - - if ($bloquearLancamento || $permissaoLancamento) { - return true; - } - - $this->messenger->append('Não é permitido realizar esta alteração fora do período de lançamento de notas/faltas', 'error'); - return false; - } - - // responders validations - - protected function canGetMatriculas() - { - return $this->validatesPresenceOf(array('instituicao_id', - 'escola_id', - 'curso_id', - 'curso_id', - 'serie_id', - 'turma_id', - 'ano', - 'etapa')) && - $this->validatesPresenceOfMatriculaIdOrComponenteCurricularId() && - $this->validatesCanChangeDiarioForAno(); - } - - protected function canPost() - { - return $this->validatesPresenceOf('etapa') && - $this->validatesPresenceOf('matricula_id') && - $this->canChange() && - $this->validatesPeriodoLancamentoFaltasNotas(); - } - - protected function canPostNota() - { - return $this->canPost() && - $this->validatesIsNumeric('att_value') && - $this->validatesValueOfAttValueIsInOpcoesNotas(false) && - $this->validatesPresenceOf('componente_curricular_id') && - $this->validatesRegraAvaliacaoHasNota() && - $this->validatesRegraAvaliacaoHasFormulaRecuperacao() && - $this->validatesRegraAvaliacaoHasFormulaRecuperacaoWithTypeRecuperacao() && - $this->validatesPreviousNotasHasBeenSet(); - } - - protected function canPostNotaGeral() - { - return $this->canPost() && - $this->validatesIsNumeric('att_value'); - // $this->validatesRegraAvaliacaoHasNota() && - // $this->validatesRegraAvaliacaoHasFormulaRecuperacao() && - // $this->validatesRegraAvaliacaoHasFormulaRecuperacaoWithTypeRecuperacao() && - // $this->validatesPreviousNotasHasBeenSet(); - } - - protected function canPostFalta() - { - return $this->canPost() && - $this->validatesIsNumeric('att_value') && - $this->validatesPreviousFaltasHasBeenSet(); - } - - protected function canPostParecer() - { - - return $this->canPost() && - $this->validatesPresenceOf('att_value') && - $this->validatesEtapaParecer() && - $this->validatesRegraAvaliacaoHasParecer() && - $this->validatesPresenceOfComponenteCurricularIdIfParecerComponente(); - } - - protected function canDelete() - { - return $this->validatesPresenceOf('etapa'); - } - - protected function canDeleteNota() - { - return $this->canDelete() && - $this->validatesPresenceOf('componente_curricular_id') && - $this->validatesInexistenceOfNotaExame() && - $this->validatesInexistenceNotasInNextEtapas(); - } - - protected function canDeleteFalta() - { - return $this->canDelete() && - $this->validatesInexistenceFaltasInNextEtapas(); - } - - protected function canDeleteParecer() - { - return $this->canDelete() && - $this->validatesEtapaParecer() && - $this->validatesPresenceOfComponenteCurricularIdIfParecerComponente(); - } - - // responders - - // post - - protected function substituicaoMenorNotaRecuperacaoEspecifica($etapa = null, $componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - if (is_null($etapa)) { - $etapa = $this->getRequest()->etapa; - } - - // validacao - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Erro ao realizar operações de recuperação específica, pois não foi obtido componente curricular.'); - } - - $regra = $this->serviceBoletim()->getRegra(); - $tipoRecuperacaoParalela = $regra->get('tipoRecuperacaoParalela'); - - $regraRecuperacao = $regra->getRegraRecuperacaoByEtapa($etapa); - - if ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::USAR_POR_ETAPAS_ESPECIFICAS - && $regraRecuperacao && dbBool($regraRecuperacao->get('substituiMenorNota'))) { - - $nota_recuperacao = $this->serviceBoletim()->getNotaComponente($componenteCurricularId, $regraRecuperacao->getLastEtapa()) - ->notaRecuperacaoEspecifica; - - if (is_numeric($nota_recuperacao)) { - - $etapas = $regraRecuperacao->getEtapas(); - $menorNota = null; - - // itera pelas etapas para obter menor nota - foreach ($etapas as $key => $_etapa) { - $_notaEtapa = $this->serviceBoletim()->getNotaComponente($componenteCurricularId, $_etapa); - - // salva nota original para "zerar" possível nota substituída - $nota = new Avaliacao_Model_NotaComponente(array( - 'componenteCurricular' => $componenteCurricularId, - 'nota' => $_notaEtapa->notaOriginal, - 'etapa' => $_notaEtapa->etapa, - 'notaOriginal' => $_notaEtapa->notaOriginal, - 'notaRecuperacaoParalela' => $_notaEtapa->notaRecuperacaoParalela, - 'notaRecuperacaoEspecifica' => $_notaEtapa->notaRecuperacaoEspecifica, - )); - - $this->serviceBoletim()->addNota($nota); - $this->trySaveServiceBoletim(); - - // verifica menor nota - if (is_null($menorNota) || ($_notaEtapa->notaOriginal < $menorNota->notaOriginal)) { - $menorNota = $_notaEtapa; - } - } - - // Se nota de recuperação for maior que menor nota então substitui - if ($nota_recuperacao > $menorNota->notaOriginal) { - $nota = new Avaliacao_Model_NotaComponente(array( - 'componenteCurricular' => $componenteCurricularId, - 'nota' => $nota_recuperacao, - 'etapa' => $menorNota->etapa, - 'notaOriginal' => $menorNota->notaOriginal, - 'notaRecuperacaoParalela' => $menorNota->notaRecuperacaoParalela, - 'notaRecuperacaoEspecifica' => $menorNota->notaRecuperacaoEspecifica, - )); - - $this->serviceBoletim()->addNota($nota); - $this->trySaveServiceBoletim(); - } - } - } - } - - protected function postNota() - { - if ($this->canPostNota()) { - $array_nota = array( - 'componenteCurricular' => $this->getRequest()->componente_curricular_id, - 'nota' => urldecode($this->getRequest()->att_value), - 'etapa' => $this->getRequest()->etapa, - 'notaOriginal' => urldecode($this->getRequest()->nota_original)); - - if ($_notaAntiga = $this->serviceBoletim()->getNotaComponente($this->getRequest()->componente_curricular_id, $this->getRequest()->etapa)) { - $array_nota['notaRecuperacaoParalela'] = $_notaAntiga->notaRecuperacaoParalela; - $array_nota['notaRecuperacaoEspecifica'] = $_notaAntiga->notaRecuperacaoEspecifica; - } - - $nota = new Avaliacao_Model_NotaComponente($array_nota); - $this->serviceBoletim()->addNota($nota); - $this->trySaveServiceBoletim(); - $this->inserirAuditoriaNotas($_notaAntiga, $nota); - $this->messenger->append('Nota matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); - } - - $this->substituicaoMenorNotaRecuperacaoEspecifica(); - - $this->appendResponse('should_show_recuperacao_especifica', $this->shouldShowRecuperacaoEspecifica()); - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - $this->appendResponse('nota_necessaria_exame', $notaNecessariaExame = $this->getNotaNecessariaExame($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); - - if (!empty($notaNecessariaExame) && in_array($this->getSituacaoComponente(), array('Em exame', 'Aprovado após exame', 'Retido'))) { - $this->createOrUpdateNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id, $notaNecessariaExame); - } else { - $this->deleteNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id); - } - - } - - protected function postNotaGeral() - { - if ($this->canPostNotaGeral()) { - $notaGeral = urldecode($this->getRequest()->att_value); - $nota = new Avaliacao_Model_NotaGeral(array( - 'etapa' => $this->getRequest()->etapa, - 'nota' => $notaGeral)); - - $this->serviceBoletim()->updateMediaGeral(0, $this->getRequest()->etapa); - $this->serviceBoletim()->addNotaGeral($nota); - $this->trySaveServiceBoletim(); - $this->messenger->append('Nota geral da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); - } - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente($this->getRequest()->componente_curricular_id)); - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); - } - - protected function postMedia() - { - if ($this->canPostMedia()) { - $mediaLancada = urldecode($this->getRequest()->att_value); - $componenteCurricular = $this->getRequest()->componente_curricular_id; - $etapa = $this->getRequest()->etapa; - - $this->serviceBoletim()->updateMediaComponente($mediaLancada, $componenteCurricular, $etapa); - $this->messenger->append('Média da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente($this->getRequest()->componente_curricular_id)); - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); - } else { - $this->messenger->append('Usuário não possui permissão para alterar a média do aluno.', 'error'); - } - } - - protected function deleteMedia() - { - if ($this->canDeleteMedia()) { - - $media = $this->getMediaAtual(); - if (empty($media) && !is_numeric($media)) { - $this->messenger->append('Média matrícula ' . $this->getRequest()->matricula_id . ' inexistente ou já removida.', 'notice'); - } else { - $this->serviceBoletim()->updateMediaComponente(0, $this->getRequest()->componente_curricular_id, $this->getRequest()->etapa); - $this->messenger->append('Média matrícula ' . $this->getRequest()->matricula_id . ' removida com sucesso.', 'success'); - } - } - - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - } - - protected function canPostMedia() - { - return $this->canPostSituacaoAndNota(); - } - - protected function canDeleteMedia() - { - return true; - } - - protected function postNotaRecuperacaoParalela() - { - if ($this->canPostNota()) { - $notaOriginal = $this->getNotaOriginal(); - $notaRecuperacaoParalela = urldecode($this->getRequest()->att_value); - - $notaNova = (($notaRecuperacaoParalela > $notaOriginal) ? $notaRecuperacaoParalela : $notaOriginal); - - $nota = new Avaliacao_Model_NotaComponente(array( - 'componenteCurricular' => $this->getRequest()->componente_curricular_id, - 'etapa' => $this->getRequest()->etapa, - 'nota' => $notaNova, - 'notaRecuperacaoParalela' => urldecode($this->getRequest()->att_value), - 'notaOriginal' => $notaOriginal)); - - $this->serviceBoletim()->addNota($nota); - $this->trySaveServiceBoletim(); - $this->messenger->append('Nota de recuperação da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); - } - - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - $this->appendResponse('nota_necessaria_exame', $notaNecessariaExame = $this->getNotaNecessariaExame($this->getRequest()->componente_curricular_id)); - $this->appendResponse('nota_nova', ($notaNova > $notaOriginal ? $notaNova : null)); - $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); - - if (!empty($notaNecessariaExame) && in_array($this->getSituacaoComponente(), array('Em exame', 'Aprovado após exame', 'Retido'))) { - $this->createOrUpdateNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id, $notaNecessariaExame); - } else { - $this->deleteNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id); - } - - } - - protected function postNotaRecuperacaoEspecifica() - { - if ($this->canPostNota()) { - $notaOriginal = $this->getNotaOriginal(); - $notaRecuperacaoParalela = urldecode($this->getRequest()->att_value); - - $nota = new Avaliacao_Model_NotaComponente(array( - 'componenteCurricular' => $this->getRequest()->componente_curricular_id, - 'etapa' => $this->getRequest()->etapa, - 'nota' => $notaOriginal, - 'notaRecuperacaoEspecifica' => urldecode($this->getRequest()->att_value), - 'notaOriginal' => $notaOriginal)); - - $this->serviceBoletim()->addNota($nota); - $this->trySaveServiceBoletim(); - $this->messenger->append('Nota de recuperação da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); - } - - $this->substituicaoMenorNotaRecuperacaoEspecifica(); - - // Se está sendo lançada nota de recuperação, obviamente o campo deve ser visível - $this->appendResponse('should_show_recuperacao_especifica', true); - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - $this->appendResponse('nota_necessaria_exame', $notaNecessariaExame = $this->getNotaNecessariaExame($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); - - if (!empty($notaNecessariaExame) && in_array($this->getSituacaoComponente(), array('Em exame', 'Aprovado após exame', 'Retido'))) { - $this->createOrUpdateNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id, $notaNecessariaExame); - } else { - $this->deleteNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id); - } - - } - - // TODO mover validacao para canPostFalta - protected function postFalta() - { - - $canPost = $this->canPostFalta(); - if ($canPost && $this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { - $canPost = $this->validatesPresenceOf('componente_curricular_id'); - } - - if ($canPost) { - if ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { - $falta = $this->getFaltaComponente(); - } elseif ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) { - $falta = $this->getFaltaGeral(); - } - - $this->serviceBoletim()->addFalta($falta); - $this->trySaveServiceBoletimFaltas(); - $this->messenger->append('Falta matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); - } - - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - $this->appendResponse('should_show_recuperacao_especifica', $this->shouldShowRecuperacaoEspecifica()); - } - - protected function postParecer() - { - - if ($this->canPostParecer()) { - $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); - $cnsParecer = RegraAvaliacao_Model_TipoParecerDescritivo; - - if ($tpParecer == $cnsParecer::ETAPA_COMPONENTE || $tpParecer == $cnsParecer::ANUAL_COMPONENTE) { - $parecer = $this->getParecerComponente(); - } else { - $parecer = $this->getParecerGeral(); - } - - $this->serviceBoletim()->addParecer($parecer); - $this->trySaveServiceBoletim(); - $this->messenger->append('Parecer descritivo matricula ' . $this->getRequest()->matricula_id . ' alterado com sucesso.', 'success'); - } - - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - } - - // delete - - protected function deleteNota() - { - if ($this->canDeleteNota()) { - - $nota = $this->getNotaAtual(); - if (empty($nota) && !is_numeric($nota)) { - $this->messenger->append('Nota matrícula ' . $this->getRequest()->matricula_id . ' inexistente ou já removida.', 'notice'); - } else { - $_notaAntiga = $this->serviceBoletim()->getNotaComponente($this->getRequest()->componente_curricular_id, $this->getRequest()->etapa); - $this->serviceBoletim()->deleteNota($this->getRequest()->etapa, $this->getRequest()->componente_curricular_id); - $this->inserirAuditoriaNotas($_notaAntiga, $nota); - $this->messenger->append('Nota matrícula ' . $this->getRequest()->matricula_id . ' removida com sucesso.', 'success'); - } - } - - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); - } - - protected function deleteNotaRecuperacaoParalela() - { - if ($this->canDeleteNota()) { - $notaOriginal = $this->getNotaOriginal(); - $notaAtual = $this->getNotaAtual(); - $nota = new Avaliacao_Model_NotaComponente(array( - 'componenteCurricular' => $this->getRequest()->componente_curricular_id, - 'etapa' => $this->getRequest()->etapa, - 'nota' => $notaOriginal, - 'notaRecuperacaoEspecifica' => $notaRecuperacaoEspecifica, - 'notaOriginal' => $notaOriginal)); - - $this->serviceBoletim()->addNota($nota); - $this->trySaveServiceBoletim(); - $this->messenger->append('Nota de recuperação da matrícula ' . $this->getRequest()->matricula_id . ' excluída com sucesso.', 'success'); - - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - $this->appendResponse('nota_original', $notaOriginal); - $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); - } - } - - protected function deleteNotaRecuperacaoEspecifica() - { - if ($this->canDeleteNota()) { - $notaOriginal = $this->getNotaOriginal(); - $notaAtual = $this->getNotaAtual(); - $nota = new Avaliacao_Model_NotaComponente(array( - 'componenteCurricular' => $this->getRequest()->componente_curricular_id, - 'etapa' => $this->getRequest()->etapa, - 'nota' => $notaOriginal, - 'notaRecuperacaoParalela' => $notaRecuperacaoParalela, - 'notaOriginal' => $notaOriginal)); - - $this->serviceBoletim()->addNota($nota); - $this->trySaveServiceBoletim(); - $this->messenger->append('Nota de recuperação da matrícula ' . $this->getRequest()->matricula_id . ' excluída com sucesso.', 'success'); - - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - $this->appendResponse('nota_original', $notaOriginal); - $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); - $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); - } - } - - protected function deleteFalta() - { - $canDelete = $this->canDeleteFalta(); - $cnsPresenca = RegraAvaliacao_Model_TipoPresenca; - $tpPresenca = $this->serviceBoletim()->getRegra()->get('tipoPresenca'); - - if ($canDelete && $tpPresenca == $cnsPresenca::POR_COMPONENTE) { - $canDelete = $this->validatesPresenceOf('componente_curricular_id'); - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } else { - $componenteCurricularId = null; - } - - if ($canDelete && is_null($this->getFaltaAtual())) { - $this->messenger->append('Falta matrícula ' . $this->getRequest()->matricula_id . ' inexistente ou já removida.', 'notice'); - } elseif ($canDelete) { - $this->serviceBoletim()->deleteFalta($this->getRequest()->etapa, $componenteCurricularId); - $this->trySaveServiceBoletimFaltas(); - $this->messenger->append('Falta matrícula ' . $this->getRequest()->matricula_id . ' removida com sucesso.', 'success'); - } - - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - } - - protected function deleteParecer() - { - if ($this->canDeleteParecer()) { - $parecerAtual = $this->getParecerAtual(); - - if ((is_null($parecerAtual) || $parecerAtual == '')) { - $this->messenger->append('Parecer descritivo matrícula ' . $this->getRequest()->matricula_id . ' inexistente ou já removido.', 'notice'); - } else { - $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); - $cnsParecer = RegraAvaliacao_Model_TipoParecerDescritivo; - - if ($tpParecer == $cnsParecer::ANUAL_COMPONENTE || $tpParecer == $cnsParecer::ETAPA_COMPONENTE) { - $this->serviceBoletim()->deleteParecer($this->getRequest()->etapa, $this->getRequest()->componente_curricular_id); - } else { - $this->serviceBoletim()->deleteParecer($this->getRequest()->etapa); - } - - $this->trySaveServiceBoletim(); - $this->messenger->append('Parecer descritivo matrícula ' . $this->getRequest()->matricula_id . ' removido com sucesso.', 'success'); - } - } - - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - } - - protected function deleteNotaGeral() - { - $this->serviceBoletim()->updateMediaGeral(0, $this->getRequest()->etapa); - $this->serviceBoletim()->deleteNotaGeral($this->getRequest()->etapa); - - $this->trySaveServiceBoletim(); - - $this->messenger->append('Nota geral da matrícula ' . $this->getRequest()->matricula_id . ' removida com sucesso.', 'success'); - $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - $this->appendResponse('situacao', $this->getSituacaoComponente()); - } - - // get - - protected function getMatriculas() - { - $regras = $matriculas = array(); - - if ($this->canGetMatriculas()) { - $alunos = new clsPmieducarMatriculaTurma(); - $alunos->setOrderby("sequencial_fechamento , translate(pessoa.nome,'" . Portabilis_String_Utils::toLatin1(åáàãâäéèêëíìîïóòõôöúùüûçÿýñÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ) . "', '" . Portabilis_String_Utils::toLatin1(aaaaaaeeeeiiiiooooouuuucyynAAAAAAEEEEIIIIOOOOOUUUUCYN) . "')"); - - $alunos = $alunos->lista( - $this->getRequest()->matricula_id, - $this->getRequest()->turma_id, - null, - null, - null, - null, - null, - null, - 2, - $this->getRequest()->serie_id, - $this->getRequest()->curso_id, - $this->getRequest()->escola_id, - $this->getRequest()->instituicao_id, - $this->getRequest()->aluno_id, - null, - null, - null, - null, - $this->getRequest()->ano, - null, - true, - null, - null, - true, - null, - null, - null, - null, - null, - null, - null, - true - ); - - if (!is_array($alunos)) { - $alunos = array(); - } - - foreach ($alunos as $aluno) { - $matricula = array(); - $matriculaId = $aluno['ref_cod_matricula']; - $turmaId = $aluno['ref_cod_turma']; - $serieId = $aluno['ref_ref_cod_serie']; - - // seta id da matricula a ser usado pelo metodo serviceBoletim - $this->setCurrentMatriculaId($matriculaId); - - if (!(dbBool($aluno['remanejado']) || dbBool($aluno['transferido']) || dbBool($aluno['abandono']) || dbBool($aluno['reclassificado']) || dbBool($aluno['falecido']))) { - $matricula['componentes_curriculares'] = $this->loadComponentesCurricularesForMatricula($matriculaId, $turmaId, $serieId); - } - - $matricula['matricula_id'] = $aluno['ref_cod_matricula']; - $matricula['aluno_id'] = $aluno['ref_cod_aluno']; - $matricula['nome'] = $this->safeString($aluno['nome_aluno']); - - if (dbBool($aluno['remanejado'])) { - $matricula['situacao_deslocamento'] = 'Remanejado'; - } elseif (dbBool($aluno['transferido'])) { - $matricula['situacao_deslocamento'] = 'Transferido'; - } elseif (dbBool($aluno['abandono'])) { - $matricula['situacao_deslocamento'] = 'Abandono'; - } elseif (dbBool($aluno['reclassificado'])) { - $matricula['situacao_deslocamento'] = 'Reclassificado'; - } elseif (dbBool($aluno['falecido'])) { - $matricula['situacao_deslocamento'] = 'Falecido'; - } else { - $matricula['situacao_deslocamento'] = null; - } - - $matricula['regra'] = $this->getRegraAvaliacao(); - - $regras[$matricula['regra']['id']] = $matricula['regra']; - - $matriculas[] = $matricula; - } - } - - // adiciona regras de avaliacao - if (!empty($matriculas)) { - $this->appendResponse('details', array_values($regras)); - } - - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - - return $matriculas; - } - - // metodos auxiliares responders - - // TODO usar esta funcao onde é verificado se parecer geral - protected function parecerGeral() - { - $tiposParecerGeral = array(RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL, - RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_GERAL); - - return in_array($this->serviceBoletim()->getRegra()->get('parecerDescritivo'), $tiposParecerGeral); - } - - protected function setCurrentMatriculaId($matriculaId) - { - $this->_currentMatriculaId = $matriculaId; - } - - protected function getCurrentMatriculaId() - { - // caso tenha setado _currentMatriculaId, ignora matricula_id recebido nos parametros - if (!is_null($this->_currentMatriculaId)) { - $matriculaId = $this->_currentMatriculaId; - } elseif (!is_null($this->getRequest()->matricula_id)) { - $matriculaId = $this->getRequest()->matricula_id; - } else { - throw new CoreExt_Exception("Não foi possivel recuperar o id da matricula atual."); - } - - return $matriculaId; - } - - protected function serviceBoletim($reload = false) - { - $matriculaId = $this->getCurrentMatriculaId(); - - if (!isset($this->_boletimServiceInstances)) { - $this->_boletimServiceInstances = array(); - } - - // set service - if (!isset($this->_boletimServiceInstances[$matriculaId]) || $reload) { - try { - $params = array( - 'matricula' => $matriculaId, - 'usuario' => $this->getSession()->id_pessoa, - 'componenteCurricularId' => $this->getRequest()->componente_curricular_id, - ); - $this->_boletimServiceInstances[$matriculaId] = new Avaliacao_Service_Boletim($params); - } catch (Exception $e) { - $this->messenger->append("Erro ao instanciar serviço boletim para matricula {$matriculaId}: " . $e->getMessage(), 'error', true); - } - } - - // validates service - if (is_null($this->_boletimServiceInstances[$matriculaId])) { - throw new CoreExt_Exception("Não foi possivel instanciar o serviço boletim para a matricula $matriculaId."); - } - - return $this->_boletimServiceInstances[$matriculaId]; - } - - protected function trySaveServiceBoletim() - { - try { - $this->serviceBoletim()->save(); - } catch (CoreExt_Service_Exception $e) { - // excecoes ignoradas :( pois servico lanca excecoes de alertas, que não são exatamente erros. - // error_log('CoreExt_Service_Exception ignorada: ' . $e->getMessage()); - } - } - - protected function trySaveServiceBoletimFaltas() - { - try { - $this->serviceBoletim()->saveFaltas(); - $this->serviceBoletim()->promover(); - } catch (CoreExt_Service_Exception $e) { - } - } - - // metodos auxiliares getFalta - - protected function getQuantidadeFalta() - { - $quantidade = (int) $this->getRequest()->att_value; - - if ($quantidade < 0) { - $quantidade = 0; - } - - return $quantidade; - } - - protected function getFaltaGeral() - { - return new Avaliacao_Model_FaltaGeral(array( - 'quantidade' => $this->getQuantidadeFalta(), - 'etapa' => $this->getRequest()->etapa, - )); - } - - protected function getFaltaComponente() - { - return new Avaliacao_Model_FaltaComponente(array( - 'componenteCurricular' => $this->getRequest()->componente_curricular_id, - 'quantidade' => $this->getQuantidadeFalta(), - 'etapa' => $this->getRequest()->etapa, - )); - } - - // metodos auxiliares getParecer - - protected function getParecerComponente() - { - return new Avaliacao_Model_ParecerDescritivoComponente(array( - 'componenteCurricular' => $this->getRequest()->componente_curricular_id, - 'parecer' => $this->safeStringForDb($this->getRequest()->att_value), - 'etapa' => $this->getRequest()->etapa, - )); - } - - protected function getParecerGeral() - { - return new Avaliacao_Model_ParecerDescritivoGeral(array( - 'parecer' => $this->safeStringForDb($this->getRequest()->att_value), - 'etapa' => $this->getRequest()->etapa, - )); - } - - // metodos auxiliares getSituacaoComponente - - protected function getSituacaoComponente($ccId = null) - { - if (is_null($ccId)) { - $ccId = $this->getRequest()->componente_curricular_id; - } - - $situacao = null; - - $situacoes = $this->getSituacaoComponentes(); - if(isset($situacoes[$ccId])){ - $situacao = $situacoes[$ccId]; - } - - return $this->safeString($situacao); - } - - protected function getSituacaoComponentes() - { - $situacoes = array(); - - try { - $componentesCurriculares = $this->serviceBoletim()->getSituacaoComponentesCurriculares()->componentesCurriculares; - foreach($componentesCurriculares as $componenteCurricularId => $situacaoCc){ - $situacoes[$componenteCurricularId] = App_Model_MatriculaSituacao::getInstance()->getValue($situacaoCc->situacao); - } - - } catch (Exception $e) { - $matriculaId = $this->getRequest()->matricula_id; - $this->messenger->append("Erro ao recuperar situação da matrícula '$matriculaId': " . - $e->getMessage()); - } - - return $situacoes; - } - - // outros metodos auxiliares - - protected function loadComponentesCurricularesForMatricula($matriculaId, $turmaId, $serieId) - { - $componentesCurriculares = array(); - - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - $etapa = $this->getRequest()->etapa; - - $_componentesCurriculares = App_Model_IedFinder::getComponentesPorMatricula($matriculaId, null, null, $componenteCurricularId, $etapa, $turmaId); - - $turmaId = $this->getRequest()->turma_id; - $situacoes = $this->getSituacaoComponentes(); - - $slugify = new Slugify(); - - foreach ($_componentesCurriculares as $_componente) { - $componente = array(); - $componenteId = $_componente->get('id'); - $tipoNota = App_Model_IedFinder::getTipoNotaComponenteSerie($componenteId, $serieId); - - if (clsPmieducarTurma::verificaDisciplinaDispensada($turmaId, $componenteId)) { - continue; - } - - $componente['id'] = $componenteId; - $componente['nome'] = mb_strtoupper($_componente->get('nome'), 'UTF-8'); - $componente['nota_atual'] = $this->getNotaAtual($etapa = null, $componente['id']); - $componente['nota_exame'] = $this->getNotaExame($componente['id']); - $componente['falta_atual'] = $this->getFaltaAtual($etapa = null, $componente['id']); - $componente['parecer_atual'] = $this->getParecerAtual($componente['id']); - $componente['situacao'] = $this->safeString($situacoes[$componente['id']]); - $componente['tipo_nota'] = $tipoNota; - $componente['ultima_etapa'] = App_Model_IedFinder::getUltimaEtapaComponente($turmaId, $componenteId); - $gravaNotaExame = ($componente['situacao'] == 'Em exame' || $componente['situacao'] == 'Aprovado após exame' || $componente['situacao'] == 'Retido'); - - $componente['nota_necessaria_exame'] = ($gravaNotaExame ? $this->getNotaNecessariaExame($componente['id']) : null); - $componente['ordenamento'] = $_componente->get('ordenamento'); - $componente['nota_recuperacao_paralela'] = $this->getNotaRecuperacaoParalelaAtual($etapa, $componente['id']); - $componente['nota_recuperacao_especifica'] = $this->getNotaRecuperacaoEspecificaAtual($etapa, $componente['id']); - $componente['should_show_recuperacao_especifica'] = $this->shouldShowRecuperacaoEspecifica($etapa, $componente['id']); - $componente['nota_original'] = $this->getNotaOriginal($etapa, $componente['id']); - $componente['nota_geral_etapa'] = $this->getNotaGeral($etapa); - $componente['media'] = $this->getMediaAtual($componente['id']); - $componente['media_arredondada'] = $this->getMediaArredondadaAtual($componente['id']); - - if (!empty($componente['nota_necessaria_exame'])) { - $this->createOrUpdateNotaExame($matriculaId, $componente['id'], $componente['nota_necessaria_exame']); - } else { - $this->deleteNotaExame($matriculaId, $componente['id']); - } - - //buscando pela área do conhecimento - $area = $this->getAreaConhecimento($componente['id']); - $nomeArea = (($area->secao != '') ? $area->secao . ' - ' : '') . $area->nome; - $componente['ordenamento_ac'] = $area->ordenamento_ac; - $componente['area_id'] = $area->id; - $componente['area_nome'] = mb_strtoupper($nomeArea, 'UTF-8'); - - //criando chave para ordenamento temporário - //área de conhecimento + componente curricular - - $componente['ordem_nome_area_conhecimento'] = $slugify->slugify($nomeArea); - $componente['ordem_componente_curricular'] = $slugify->slugify($_componente->get('nome')); - $componentesCurriculares[] = $componente; - } - - $ordenamentoComponentes = array(); - - foreach ($componentesCurriculares as $chave => $componente) { - $ordenamentoComponentes['ordenamento_ac'][$chave] = $componente['ordenamento_ac']; - $ordenamentoComponentes['ordenamento'][$chave] = $componente['ordenamento']; - $ordenamentoComponentes['ordem_nome_area_conhecimento'][$chave] = $componente['ordem_nome_area_conhecimento']; - $ordenamentoComponentes['ordem_componente_curricular'][$chave] = $componente['ordem_componente_curricular']; - } - array_multisort($ordenamentoComponentes['ordenamento_ac'], SORT_ASC, SORT_NUMERIC, - $ordenamentoComponentes['ordem_nome_area_conhecimento'], SORT_ASC, - $ordenamentoComponentes['ordenamento'], SORT_ASC, SORT_NUMERIC, - $ordenamentoComponentes['ordem_componente_curricular'], SORT_ASC, - $componentesCurriculares); - - //removendo chave temporária - $len = count($componentesCurriculares); - for ($i = 0; $i < $len; $i++) { - unset($componentesCurriculares[$i]['my_order']); - } - return $componentesCurriculares; - } - - protected function getAreaConhecimento($componenteCurricularId = null) - { - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possível obter a área de conhecimento pois não foi recebido o id do componente curricular.'); - } - - require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php'; - $mapper = new ComponenteCurricular_Model_ComponenteDataMapper(); - - $where = array('id' => $componenteCurricularId); - - $area = $mapper->findAll(array('area_conhecimento'), $where); - - $areaConhecimento = new stdClass(); - $areaConhecimento->id = $area[0]->area_conhecimento->id; - $areaConhecimento->nome = $area[0]->area_conhecimento->nome; - $areaConhecimento->secao = $area[0]->area_conhecimento->secao; - $areaConhecimento->ordenamento_ac = $area[0]->area_conhecimento->ordenamento_ac; - - return $areaConhecimento; - } - - protected function createOrUpdateNotaExame($matriculaId, $componenteCurricularId, $notaExame) - { - - $obj = new clsModulesNotaExame($matriculaId, $componenteCurricularId, $notaExame); - - return ($obj->existe() ? $obj->edita() : $obj->cadastra()); - } - - protected function deleteNotaExame($matriculaId, $componenteCurricularId) - { - $obj = new clsModulesNotaExame($matriculaId, $componenteCurricularId); - return ($obj->excluir()); - } - - protected function getNotaAtual($etapa = null, $componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - if (is_null($etapa)) { - $etapa = $this->getRequest()->etapa; - } - - // validacao - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possivel obter a nota atual, pois não foi recebido o id do componente curricular.'); - } - - $nota = urldecode($this->serviceBoletim()->getNotaComponente($componenteCurricularId, $etapa)->nota); - - return str_replace(',', '.', $nota); - } - - protected function getNotaGeral($etapa = null) - { - - if (is_null($etapa)) { - $etapa = $this->getRequest()->etapa; - } - - $nota = urldecode($this->serviceBoletim()->getNotaGeral($etapa)->nota); - - return str_replace(',', '.', $nota); - - } - - protected function getMediaAtual($componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - // validacao - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possivel obter a média atual, pois não foi recebido o id do componente curricular.'); - } - - $media = urldecode($this->serviceBoletim()->getMediaComponente($componenteCurricularId)->media); - - // $media = round($media,1); - - return str_replace(',', '.', $media); - } - - protected function getMediaArredondadaAtual($componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - // validacao - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possivel obter a média atual, pois não foi recebido o id do componente curricular.'); - } - - $media = urldecode($this->serviceBoletim()->getMediaComponente($componenteCurricularId)->mediaArredondada); - - // $media = round($media,1); - - return str_replace(',', '.', $media); - } - - protected function getNotaRecuperacaoParalelaAtual($etapa = null, $componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - if (is_null($etapa)) { - $etapa = $this->getRequest()->etapa; - } - - // validacao - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possivel obter a nota de recuperação paralela atual, pois não foi recebido o id do componente curricular.'); - } - - $nota = urldecode($this->serviceBoletim()->getNotaComponente($componenteCurricularId, $etapa)->notaRecuperacaoParalela); - $nota = str_replace(',', '.', $nota); - return $nota; - } - - protected function shouldShowRecuperacaoEspecifica($etapa = null, $componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - if (is_null($etapa)) { - $etapa = $this->getRequest()->etapa; - } - - // validacao - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possivel obter a nota de recuperação específica atual, pois não foi recebido o id do componente curricular.'); - } - - $regra = $this->serviceBoletim()->getRegra(); - $tipoRecuperacaoParalela = $regra->get('tipoRecuperacaoParalela'); - - $regraRecuperacao = $regra->getRegraRecuperacaoByEtapa($etapa); - - if ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::USAR_POR_ETAPAS_ESPECIFICAS - && $regraRecuperacao && $regraRecuperacao->getLastEtapa() == $etapa) { - - $etapas = $regraRecuperacao->getEtapas(); - $sumNota = 0; - foreach ($etapas as $key => $_etapa) { - $sumNota += $this->getNotaOriginal($_etapa, $componenteCurricularId); - } - - // caso a média das notas da etapa seja menor que média definida na regra e a última nota tenha sido lançada - // deverá exibir a nota de recuperação - if ((($sumNota / count($etapas)) < $regraRecuperacao->get('media')) - && is_numeric($this->getNotaOriginal($etapa, $componenteCurricularId))) { - return true; - } else { - // Caso não exiba, já busca se existe a nota de recuperação e deleta ela - $notaRecuperacao = $this->serviceBoletim()->getNotaComponente($componenteCurricularId, $regraRecuperacao->getLastEtapa()); - - if ($notaRecuperacao) { - $nota = new Avaliacao_Model_NotaComponente(array( - 'componenteCurricular' => $componenteCurricularId, - 'nota' => $notaRecuperacao->notaOriginal, - 'etapa' => $notaRecuperacao->etapa, - 'notaOriginal' => $notaRecuperacao->notaOriginal, - 'notaRecuperacaoParalela' => $notaRecuperacao->notaRecuperacaoParalela, - )); - - $this->serviceBoletim()->addNota($nota); - $this->trySaveServiceBoletim(); - } - return false; - } - } - return false; - } - - protected function getNotaRecuperacaoEspecificaAtual($etapa = null, $componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - if (is_null($etapa)) { - $etapa = $this->getRequest()->etapa; - } - - // validacao - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possivel obter a nota de recuperação específica atual, pois não foi recebido o id do componente curricular.'); - } - - $nota = urldecode($this->serviceBoletim()->getNotaComponente($componenteCurricularId, $etapa)->notaRecuperacaoEspecifica); - $nota = str_replace(',', '.', $nota); - return $nota; - } - - protected function getNotaOriginal($etapa = null, $componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - if (is_null($etapa)) { - $etapa = $this->getRequest()->etapa; - } - - // validacao - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possivel obter a nota original, pois não foi recebido o id do componente curricular.'); - } - - $nota = urldecode($this->serviceBoletim()->getNotaComponente($componenteCurricularId, $etapa)->notaOriginal); - $nota = str_replace(',', '.', $nota); - return $nota; - } - - protected function getNotaExame($componenteCurricularId = null) - { - - $turmaId = $this->getRequest()->turma_id; - $regra = $this->serviceBoletim()->getRegra(); - $defineComponentePorEtapa = $regra->get('definirComponentePorEtapa') == 1; - $ultimaEtapa = $this->getRequest()->etapa == $this->serviceBoletim()->getOption('etapas'); - $ultimaEtapaComponente = App_Model_IedFinder::getUltimaEtapaComponente($turmaId, $componenteCurricularId); - - // somente recupera nota de exame se estiver buscando as matriculas da ultima etapa - // se existe nota de exame, esta é recuperada mesmo que a regra de avaliação não use mais exame - if ($ultimaEtapa || ($defineComponentePorEtapa && $ultimaEtapaComponente)) { - $nota = $this->getNotaAtual($etapa = 'Rc', $componenteCurricularId); - } else { - $nota = ''; - } - - return $nota; - } - - protected function getNotaNecessariaExame($componenteCurricularId = null) - { - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - $nota = urldecode($this->serviceBoletim()->preverNotaRecuperacao($componenteCurricularId)); - - return str_replace(',', '.', $nota); - } - - protected function getFaltaAtual($etapa = null, $componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - if (is_null($etapa)) { - $etapa = $this->getRequest()->etapa; - } - - if ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possivel obter a falta atual, pois não foi recebido o id do componente curricular.'); - } - - $falta = $this->serviceBoletim()->getFalta($etapa, $componenteCurricularId)->quantidade; - } elseif ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) { - $falta = $this->serviceBoletim()->getFalta($etapa)->quantidade; - } - - return $falta; - } - - protected function getEtapaParecer() - { - if ($this->getRequest()->etapa != 'An' && ($this->serviceBoletim()->getRegra()->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE || $this->serviceBoletim()->getRegra()->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL)) { - return 'An'; - } else { - return $this->getRequest()->etapa; - } - - } - - protected function getParecerAtual($componenteCurricularId = null) - { - // defaults - if (is_null($componenteCurricularId)) { - $componenteCurricularId = $this->getRequest()->componente_curricular_id; - } - - $etapaComponente = $this->serviceBoletim()->getRegra()->get('parecerDescritivo') == - RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE; - - $anualComponente = $this->serviceBoletim()->getRegra()->get('parecerDescritivo') == - RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE; - - if ($etapaComponente or $anualComponente) { - if (!is_numeric($componenteCurricularId)) { - throw new Exception('Não foi possivel obter o parecer descritivo atual, pois não foi recebido o id do componente curricular.'); - } - - $parecer = $this->serviceBoletim()->getParecerDescritivo($this->getEtapaParecer(), $componenteCurricularId)->parecer; - } else { - $parecer = $this->serviceBoletim()->getParecerDescritivo($this->getEtapaParecer())->parecer; - } - - return $this->safeString($parecer, $transform = false); - } - - protected function getOpcoesFaltas() - { - $opcoes = array(); - - foreach (range(0, 100, 1) as $f) { - $opcoes[$f] = $f; - } - - return $opcoes; - } - - protected function canGetOpcoesNotas() - { - return true; - } - - protected function getOpcoesNotas() - { - $opcoes = array(); - - if ($this->canGetOpcoesNotas()) { - $tpNota = $this->serviceBoletim()->getRegra()->get('tipoNota'); - $cnsNota = RegraAvaliacao_Model_Nota_TipoValor; - - if ($tpNota != $cnsNota::NENHUM) { - $tabela = $this->serviceBoletim()->getRegra()->tabelaArredondamento->findTabelaValor(); - - foreach ($tabela as $index => $item) { - if ($tpNota == $cnsNota::NUMERICA) { - $nota = str_replace(',', '.', (string) $item->nome); - $opcoes[$nota] = $nota; - } else { - // $nota = str_replace(',', '.', (string) $item->valorMaximo); - $opcoes[$index] = array('valor_minimo' => str_replace(',', '.', (string) $item->valorMinimo), - 'valor_maximo' => str_replace(',', '.', (string) $item->valorMaximo), - 'descricao' => $this->safeString($item->nome . ' (' . $item->descricao . ')')); - - } - } - } - } - - return $opcoes; - } - - //Usado apenas quando na regra o sistema de nota é "Numérica e conceitual" - protected function getOpcoesNotasConceituais() - { - $opcoes = array(); - - if ($this->canGetOpcoesNotas()) { - $tpNota = $this->serviceBoletim()->getRegra()->get('tipoNota'); - $cnsNota = RegraAvaliacao_Model_Nota_TipoValor; - - if ($tpNota != $cnsNota::NENHUM) { - $tabela = $this->serviceBoletim()->getRegra()->tabelaArredondamentoConceitual->findTabelaValor(); - - foreach ($tabela as $index => $item) { - if ($tpNota == $cnsNota::NUMERICA) { - $nota = str_replace(',', '.', (string) $item->nome); - $opcoes[$nota] = $nota; - } else { - // $nota = str_replace(',', '.', (string) $item->valorMaximo); - $opcoes[$index] = array('valor_minimo' => str_replace(',', '.', (string) $item->valorMinimo), - 'valor_maximo' => str_replace(',', '.', (string) $item->valorMaximo), - 'descricao' => $this->safeString($item->nome . ' (' . $item->descricao . ')')); - - } - } - } - } - - return $opcoes; - } - - protected function getNavegacaoTab() - { - return $this->getRequest()->navegacao_tab; - } - - protected function canGetRegraAvaliacao() - { - return true; - } - - protected function getRegraAvaliacao() - { - $itensRegra = array(); - - if ($this->canGetRegraAvaliacao()) { - $regra = $this->serviceBoletim()->getRegra(); - $itensRegra['id'] = $regra->get('id'); - $itensRegra['nome'] = $this->safeString($regra->get('nome')); - $itensRegra['nota_maxima_geral'] = $regra->get('notaMaximaGeral'); - $itensRegra['nota_minima_geral'] = $regra->get('notaMinimaGeral'); - $itensRegra['nota_maxima_exame_final'] = $regra->get('notaMaximaExameFinal'); - $itensRegra['qtd_casas_decimais'] = $regra->get('qtdCasasDecimais'); - $itensRegra['regra_diferenciada_id'] = $regra->get('regraDiferenciada'); - - // tipo presença - $cnsPresenca = RegraAvaliacao_Model_TipoPresenca; - $tpPresenca = $this->serviceBoletim()->getRegra()->get('tipoPresenca'); - - if ($tpPresenca == $cnsPresenca::GERAL) { - $itensRegra['tipo_presenca'] = 'geral'; - } elseif ($tpPresenca == $cnsPresenca::POR_COMPONENTE) { - $itensRegra['tipo_presenca'] = 'por_componente'; - } else { - $itensRegra['tipo_presenca'] = $tpPresenca; - } - - // tipo nota - $cnsNota = RegraAvaliacao_Model_Nota_TipoValor; - $tpNota = $this->serviceBoletim()->getRegra()->get('tipoNota'); - - if ($tpNota == $cnsNota::NENHUM) { - $itensRegra['tipo_nota'] = 'nenhum'; - } elseif ($tpNota == $cnsNota::NUMERICA) { - $itensRegra['tipo_nota'] = 'numerica'; - } elseif ($tpNota == $cnsNota::CONCEITUAL) { - $itensRegra['tipo_nota'] = 'conceitual'; - //incluido opcoes notas, pois notas conceituais requer isto para visualizar os nomes - } elseif ($tpNota == $cnsNota::NUMERICACONCEITUAL) { - $itensRegra['tipo_nota'] = 'numericaconceitual'; - } else { - $itensRegra['tipo_nota'] = $tpNota; - } - - //Lançamento de nota manual - $tpProgressao = $this->serviceBoletim()->getRegra()->get('tipoProgressao'); - $itensRegra['progressao_manual'] = ($tpProgressao == RegraAvaliacao_Model_TipoProgressao::NAO_CONTINUADA_MANUAL); - $itensRegra['progressao_continuada'] = ($tpProgressao == RegraAvaliacao_Model_TipoProgressao::CONTINUADA); - - // tipo parecer - $cnsParecer = RegraAvaliacao_Model_TipoParecerDescritivo; - $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); - - if ($tpParecer == $cnsParecer::NENHUM) { - $itensRegra['tipo_parecer_descritivo'] = 'nenhum'; - } elseif ($tpParecer == $cnsParecer::ETAPA_COMPONENTE) { - $itensRegra['tipo_parecer_descritivo'] = 'etapa_componente'; - } elseif ($tpParecer == $cnsParecer::ETAPA_GERAL) { - $itensRegra['tipo_parecer_descritivo'] = 'etapa_geral'; - } elseif ($tpParecer == $cnsParecer::ANUAL_COMPONENTE) { - $itensRegra['tipo_parecer_descritivo'] = 'anual_componente'; - } elseif ($tpParecer == $cnsParecer::ANUAL_GERAL) { - $itensRegra['tipo_parecer_descritivo'] = 'anual_geral'; - } else { - $itensRegra['tipo_parecer_descritivo'] = $tpParecer; - } - - // opcoes notas - $itensRegra['opcoes_notas'] = $this->getOpcoesNotas(); - if ($tpNota == $cnsNota::NUMERICACONCEITUAL) { - $itensRegra['opcoes_notas_conceituais'] = $this->getOpcoesNotasConceituais(); - } - - // etapas - $itensRegra['quantidade_etapas'] = $this->serviceBoletim()->getOption('etapas'); - } - - $itensRegra['nomenclatura_exame'] = ($GLOBALS['coreExt']['Config']->app->diario->nomenclatura_exame == 0 ? 'exame' : 'conselho'); - - //tipo de recuperação paralela - $tipoRecuperacaoParalela = $regra->get('tipoRecuperacaoParalela'); - - if ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::NAO_USAR) { - $itensRegra['tipo_recuperacao_paralela'] = 'nao_utiliza'; - } elseif ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::USAR_POR_ETAPA) { - $itensRegra['tipo_recuperacao_paralela'] = 'por_etapa'; - $itensRegra['media_recuperacao_paralela'] = $this->serviceBoletim()->getRegra()->get('mediaRecuperacaoParalela'); - } elseif ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::USAR_POR_ETAPAS_ESPECIFICAS) { - $itensRegra['tipo_recuperacao_paralela'] = 'etapas_especificas'; - - $etapa = $this->getRequest()->etapa; - if ($regraRecuperacao = $regra->getRegraRecuperacaoByEtapa($etapa)) { - $itensRegra['habilita_campo_etapa_especifica'] = $regraRecuperacao->getLastEtapa() == $etapa; - $itensRegra['tipo_recuperacao_paralela_nome'] = $regraRecuperacao->get('descricao'); - $itensRegra['tipo_recuperacao_paralela_nota_maxima'] = $regraRecuperacao->get('notaMaxima'); - } else { - $itensRegra['habilita_campo_etapa_especifica'] = false; - $itensRegra['tipo_recuperacao_paralela_nome'] = ''; - $itensRegra['tipo_recuperacao_paralela_nota_maxima'] = 0; - } - - } - if ($regra->get('notaGeralPorEtapa') == '1') { - $itensRegra['nota_geral_por_etapa'] = "SIM"; - } else { - $itensRegra['nota_geral_por_etapa'] = "NAO UTILIZA"; - } - - $itensRegra['definir_componente_por_etapa'] = $regra->get('definirComponentePorEtapa') == 1; - - return $itensRegra; - } - - protected function inserirAuditoriaNotas($notaAntiga, $notaNova) - { - if ($this->usaAuditoriaNotas()) { - $objAuditoria = new clsModulesAuditoriaNota($notaAntiga, $notaNova, $this->getRequest()->turma_id); - $objAuditoria->cadastra(); - } - } - - protected function usaAuditoriaNotas() - { - return ($GLOBALS['coreExt']['Config']->app->auditoria->notas == "1"); - } - - public function canChange() - { - $user = $this->getSession()->id_pessoa; - $processoAp = $this->_processoAp; - $obj_permissao = new clsPermissoes(); - - return $obj_permissao->permissao_cadastra($processoAp, $user, 7); - } - - public function postSituacao() - { - if ($this->canPostSituacaoAndNota()) { - $novaSituacao = $this->getRequest()->att_value; - $matriculaId = $this->getRequest()->matricula_id; - - $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); - - $this->serviceBoletim()->alterarSituacao($novaSituacao, $matriculaId); - $this->messenger->append('Situação da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); - } else { - $this->messenger->append('Usuário não possui permissão para alterar a situação da matrícula.', 'error'); - } - } - - public function canPostSituacaoAndNota() - { - - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - $acesso = new clsPermissoes(); - session_write_close(); - return $acesso->permissao_cadastra(630, $this->pessoa_logada, 7, null, true); - - } - - public function Gerar() - { - if ($this->isRequestFor('get', 'matriculas')) { - $this->appendResponse('matriculas', $this->getMatriculas()); - $this->appendResponse('navegacao_tab', $this->getNavegacaoTab()); - $this->appendResponse('can_change', $this->canChange()); - } elseif ($this->isRequestFor('post', 'nota') || $this->isRequestFor('post', 'nota_exame')) { - $this->postNota(); - } elseif ($this->isRequestFor('post', 'nota_recuperacao_paralela')) { - $this->postNotaRecuperacaoParalela(); - } elseif ($this->isRequestFor('post', 'nota_recuperacao_especifica')) { - $this->postNotaRecuperacaoEspecifica(); - } elseif ($this->isRequestFor('post', 'falta')) { - $this->postFalta(); - } elseif ($this->isRequestFor('post', 'parecer')) { - $this->postParecer(); - } elseif ($this->isRequestFor('post', 'nota_geral')) { - $this->postNotaGeral(); - } elseif ($this->isRequestFor('post', 'media')) { - $this->postMedia(); - } elseif ($this->isRequestFor('delete', 'media')) { - $this->deleteMedia(); - } elseif ($this->isRequestFor('post', 'situacao')) { - $this->postSituacao(); - } elseif ($this->isRequestFor('delete', 'nota') || $this->isRequestFor('delete', 'nota_exame')) { - $this->deleteNota(); - } elseif ($this->isRequestFor('delete', 'nota_recuperacao_paralela')) { - $this->deleteNotaRecuperacaoParalela(); - } elseif ($this->isRequestFor('delete', 'nota_recuperacao_especifica')) { - $this->deleteNotaRecuperacaoEspecifica(); - } elseif ($this->isRequestFor('delete', 'falta')) { - $this->deleteFalta(); - } elseif ($this->isRequestFor('delete', 'parecer')) { - $this->deleteParecer(); - } elseif ($this->isRequestFor('delete', 'nota_geral')) { - $this->deleteNotaGeral(); - } else { - $this->notImplementedOperationError(); - } - - } -} +getOpcoesNotas()); + //return $this->validator->validatesValueInSetOf($this->getRequest()->att_value, $expectedValues, 'att_value'); + return true; + } + + protected function validatesCanChangeDiarioForAno() + { + $escola = App_Model_IedFinder::getEscola($this->getRequest()->escola_id); + + $ano = new clsPmieducarEscolaAnoLetivo(); + $ano->ref_cod_escola = $this->getRequest()->escola_id; + $ano->ano = $this->getRequest()->ano; + $ano = $ano->detalhe(); + + $anoLetivoEncerrado = is_array($ano) && count($ano) > 0 && + $ano['ativo'] == 1 && $ano['andamento'] == 2; + + if ($escola['bloquear_lancamento_diario_anos_letivos_encerrados'] == '1' && $anoLetivoEncerrado) { + $this->messenger->append("O ano letivo '{$this->getRequest()->ano}' está encerrado, esta escola está configurada para não permitir alterar o diário de anos letivos encerrados."); + return false; + } + + $objBloqueioAnoLetivo = new clsPmieducarBloqueioAnoLetivo($this->getRequest()->instituicao_id, $this->getRequest()->ano); + $bloqueioAnoLetivo = $objBloqueioAnoLetivo->detalhe(); + + if ($bloqueioAnoLetivo) { + $dataAtual = strtotime(date("Y-m-d")); + $data_inicio = strtotime($bloqueioAnoLetivo['data_inicio']); + $data_fim = strtotime($bloqueioAnoLetivo['data_fim']); + + if ($dataAtual < $data_inicio || $dataAtual > $data_fim) { + $this->messenger->append("O lançamento de notas nessa instituição está bloqueado nesta data."); + return false; + } + } + + return true; + } + + protected function validatesRegraAvaliacaoHasNota() + { + $isValid = $this->serviceBoletim()->getRegra()->get('tipoNota') != RegraAvaliacao_Model_Nota_TipoValor::NENHUM; + + if (!$isValid) { + $this->messenger->append("Nota não lançada, pois a regra de avaliação não utiliza nota."); + } + + return $isValid; + } + + protected function validatesRegraAvaliacaoHasFormulaRecuperacao() + { + $isValid = $this->getRequest()->etapa != 'Rc' || + !is_null($this->serviceBoletim()->getRegra()->formulaRecuperacao); + + if (!$isValid) { + $this->messenger->append("Nota de recuperação não lançada, pois a fórmula de recuperação não possui fórmula de recuperação."); + } + + return $isValid; + } + + protected function validatesRegraAvaliacaoHasFormulaRecuperacaoWithTypeRecuperacao() + { + $isValid = $this->getRequest()->etapa != 'Rc' || + ($this->serviceBoletim()->getRegra()->formulaRecuperacao->get('tipoFormula') == + FormulaMedia_Model_TipoFormula::MEDIA_RECUPERACAO); + + if (!$isValid) { + $this->messenger->append("Nota de recuperação não lançada, pois a fórmula de recuperação é diferente do tipo média recuperação."); + } + + return $isValid; + } + + protected function validatesPreviousNotasHasBeenSet() + { + $etapaId = $this->getRequest()->etapa; + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + $serviceBoletim = $this->serviceBoletim(); + + try { + return $serviceBoletim->verificaNotasLancadasNasEtapasAnteriores( + $etapaId, $componenteCurricularId + ); + } catch (Exception $e) { + $this->messenger->append($e->getMessage()); + } + + return false; + } + + protected function validatesPreviousFaltasHasBeenSet() + { + $etapaId = $this->getRequest()->etapa; + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + $serviceBoletim = $this->serviceBoletim(); + + try { + return $serviceBoletim->verificaFaltasLancadasNasEtapasAnteriores( + $etapaId, $componenteCurricularId + ); + } catch (Exception $e) { + $this->messenger->append($e->getMessage()); + } + + return false; + } + + // post/ delete parecer validations + + protected function validatesEtapaParecer() + { + $isValid = false; + $etapa = $this->getRequest()->etapa; + + $tiposParecerAnual = array(RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE, + RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL); + + $parecerAnual = in_array($this->serviceBoletim()->getRegra()->get('parecerDescritivo'), + $tiposParecerAnual); + + if ($parecerAnual && $etapa != 'An') { + $this->messenger->append("Valor inválido para o atributo 'etapa', é esperado 'An' e foi recebido '{$etapa}'."); + } elseif (!$parecerAnual && $etapa == 'An') { + $this->messenger->append("Valor inválido para o atributo 'etapa', é esperado um valor diferente de 'An'."); + } else { + $isValid = true; + } + + return $isValid; + } + + protected function validatesPresenceOfComponenteCurricularIdIfParecerComponente() + { + $tiposParecerComponente = array(RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE, + RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE); + + $parecerPorComponente = in_array($this->serviceBoletim()->getRegra()->get('parecerDescritivo'), + $tiposParecerComponente); + + return (!$parecerPorComponente) || $this->validatesPresenceOf('componente_curricular_id'); + } + + // post parecer validations + + protected function validatesRegraAvaliacaoHasParecer() + { + $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); + $isValid = $tpParecer != RegraAvaliacao_Model_TipoParecerDescritivo::NENHUM; + + if (!$isValid) { + $this->messenger->append("Parecer descritivo não lançado, pois a regra de avaliação não utiliza parecer."); + } + + return $isValid; + } + + // delete nota validations + + protected function validatesInexistenceOfNotaExame() + { + $isValid = true; + + if ($this->getRequest()->etapa != 'Rc') { + $notaExame = $this->getNotaAtual($etapa = 'Rc'); + $isValid = empty($notaExame); + + if (!$isValid) { + $this->messenger->append('Nota da matrícula ' . $this->getRequest()->matricula_id . ' somente pode ser removida, após remover nota do exame.', 'error'); + } + + } + + return $isValid; + } + + protected function validatesInexistenceNotasInNextEtapas() + { + $etapasComNota = array(); + + if (is_numeric($this->getRequest()->etapa)) { + $etapas = $this->serviceBoletim()->getOption('etapas'); + $etapa = $this->getRequest()->etapa + 1; + + for ($etapa; $etapa <= $etapas; $etapa++) { + $nota = $this->getNotaAtual($etapa); + + if (!empty($nota)) { + $etapasComNota[] = $etapa; + } + + } + + if (!empty($etapasComNota)) { + $msg = "Nota somente pode ser removida, após remover as notas lançadas nas etapas posteriores: " . + join(', ', $etapasComNota) . '.'; + $this->messenger->append($msg, 'error'); + } + } + + return empty($etapasComNota); + } + + // delete falta validations + + protected function validatesInexistenceFaltasInNextEtapas() + { + $etapasComFalta = array(); + + if (is_numeric($this->getRequest()->etapa)) { + $etapas = $this->serviceBoletim()->getOption('etapas'); + $etapa = $this->getRequest()->etapa + 1; + + for ($etapa; $etapa <= $etapas; $etapa++) { + $falta = $this->getFaltaAtual($etapa); + + if (!empty($falta)) { + $etapasComFalta[] = $etapa; + } + + } + + if (!empty($etapasComFalta)) { + $this->messenger->append("Falta somente pode ser removida, após remover as faltas lançadas nas etapas posteriores: " . join(', ', $etapasComFalta) . '.', 'error'); + } + + } + + return empty($etapasComFalta); + } + + protected function validatesPresenceOfMatriculaIdOrComponenteCurricularId() + { + if (empty($this->getRequest()->componente_curricular_id) && empty($this->getRequest()->matricula_id)) { + $this->messenger->append('É necessário receber matricula_id ou componente_curricular_id.', 'error'); + return false; + } + + return true; + } + + protected function validatesPeriodoLancamentoFaltasNotas() + { + + $bloqueioLancamentoFaltasNotas = new clsPmieducarBloqueioLancamentoFaltasNotas(null, + $this->getRequest()->ano_escolar, + $this->getRequest()->escola_id, + $this->getRequest()->etapa); + + $bloquearLancamento = $bloqueioLancamentoFaltasNotas->verificaPeriodo(); + + $user = $this->getSession()->id_pessoa; + $processoAp = 999849; + $obj_permissao = new clsPermissoes(); + + $permissaoLancamento = $obj_permissao->permissao_cadastra($processoAp, $user, 7); + + if ($bloquearLancamento || $permissaoLancamento) { + return true; + } + + $this->messenger->append('Não é permitido realizar esta alteração fora do período de lançamento de notas/faltas', 'error'); + return false; + } + + // responders validations + + protected function canGetMatriculas() + { + return $this->validatesPresenceOf(array('instituicao_id', + 'escola_id', + 'curso_id', + 'curso_id', + 'serie_id', + 'turma_id', + 'ano', + 'etapa')) && + $this->validatesPresenceOfMatriculaIdOrComponenteCurricularId() && + $this->validatesCanChangeDiarioForAno(); + } + + protected function canPost() + { + return $this->validatesPresenceOf('etapa') && + $this->validatesPresenceOf('matricula_id') && + $this->canChange() && + $this->validatesPeriodoLancamentoFaltasNotas(); + } + + protected function canPostNota() + { + return $this->canPost() && + $this->validatesIsNumeric('att_value') && + $this->validatesValueOfAttValueIsInOpcoesNotas(false) && + $this->validatesPresenceOf('componente_curricular_id') && + $this->validatesRegraAvaliacaoHasNota() && + $this->validatesRegraAvaliacaoHasFormulaRecuperacao() && + $this->validatesRegraAvaliacaoHasFormulaRecuperacaoWithTypeRecuperacao() && + $this->validatesPreviousNotasHasBeenSet(); + } + + protected function canPostNotaGeral() + { + return $this->canPost() && + $this->validatesIsNumeric('att_value'); + // $this->validatesRegraAvaliacaoHasNota() && + // $this->validatesRegraAvaliacaoHasFormulaRecuperacao() && + // $this->validatesRegraAvaliacaoHasFormulaRecuperacaoWithTypeRecuperacao() && + // $this->validatesPreviousNotasHasBeenSet(); + } + + protected function canPostFalta() + { + return $this->canPost() && + $this->validatesIsNumeric('att_value') && + $this->validatesPreviousFaltasHasBeenSet(); + } + + protected function canPostParecer() + { + + return $this->canPost() && + $this->validatesPresenceOf('att_value') && + $this->validatesEtapaParecer() && + $this->validatesRegraAvaliacaoHasParecer() && + $this->validatesPresenceOfComponenteCurricularIdIfParecerComponente(); + } + + protected function canDelete() + { + return $this->validatesPresenceOf('etapa'); + } + + protected function canDeleteNota() + { + return $this->canDelete() && + $this->validatesPresenceOf('componente_curricular_id') && + $this->validatesInexistenceOfNotaExame() && + $this->validatesInexistenceNotasInNextEtapas(); + } + + protected function canDeleteFalta() + { + return $this->canDelete() && + $this->validatesInexistenceFaltasInNextEtapas(); + } + + protected function canDeleteParecer() + { + return $this->canDelete() && + $this->validatesEtapaParecer() && + $this->validatesPresenceOfComponenteCurricularIdIfParecerComponente(); + } + + // responders + + // post + + protected function substituicaoMenorNotaRecuperacaoEspecifica($etapa = null, $componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + if (is_null($etapa)) { + $etapa = $this->getRequest()->etapa; + } + + // validacao + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Erro ao realizar operações de recuperação específica, pois não foi obtido componente curricular.'); + } + + $regra = $this->serviceBoletim()->getRegra(); + $tipoRecuperacaoParalela = $regra->get('tipoRecuperacaoParalela'); + + $regraRecuperacao = $regra->getRegraRecuperacaoByEtapa($etapa); + + if ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::USAR_POR_ETAPAS_ESPECIFICAS + && $regraRecuperacao && dbBool($regraRecuperacao->get('substituiMenorNota'))) { + + $nota_recuperacao = $this->serviceBoletim()->getNotaComponente($componenteCurricularId, $regraRecuperacao->getLastEtapa()) + ->notaRecuperacaoEspecifica; + + if (is_numeric($nota_recuperacao)) { + + $etapas = $regraRecuperacao->getEtapas(); + $menorNota = null; + + // itera pelas etapas para obter menor nota + foreach ($etapas as $key => $_etapa) { + $_notaEtapa = $this->serviceBoletim()->getNotaComponente($componenteCurricularId, $_etapa); + + // salva nota original para "zerar" possível nota substituída + $nota = new Avaliacao_Model_NotaComponente(array( + 'componenteCurricular' => $componenteCurricularId, + 'nota' => $_notaEtapa->notaOriginal, + 'etapa' => $_notaEtapa->etapa, + 'notaOriginal' => $_notaEtapa->notaOriginal, + 'notaRecuperacaoParalela' => $_notaEtapa->notaRecuperacaoParalela, + 'notaRecuperacaoEspecifica' => $_notaEtapa->notaRecuperacaoEspecifica, + )); + + $this->serviceBoletim()->addNota($nota); + $this->trySaveServiceBoletim(); + + // verifica menor nota + if (is_null($menorNota) || ($_notaEtapa->notaOriginal < $menorNota->notaOriginal)) { + $menorNota = $_notaEtapa; + } + } + + // Se nota de recuperação for maior que menor nota então substitui + if ($nota_recuperacao > $menorNota->notaOriginal) { + $nota = new Avaliacao_Model_NotaComponente(array( + 'componenteCurricular' => $componenteCurricularId, + 'nota' => $nota_recuperacao, + 'etapa' => $menorNota->etapa, + 'notaOriginal' => $menorNota->notaOriginal, + 'notaRecuperacaoParalela' => $menorNota->notaRecuperacaoParalela, + 'notaRecuperacaoEspecifica' => $menorNota->notaRecuperacaoEspecifica, + )); + + $this->serviceBoletim()->addNota($nota); + $this->trySaveServiceBoletim(); + } + } + } + } + + protected function postNota() + { + if ($this->canPostNota()) { + $array_nota = array( + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, + 'nota' => urldecode($this->getRequest()->att_value), + 'etapa' => $this->getRequest()->etapa, + 'notaOriginal' => urldecode($this->getRequest()->nota_original)); + + if ($_notaAntiga = $this->serviceBoletim()->getNotaComponente($this->getRequest()->componente_curricular_id, $this->getRequest()->etapa)) { + $array_nota['notaRecuperacaoParalela'] = $_notaAntiga->notaRecuperacaoParalela; + $array_nota['notaRecuperacaoEspecifica'] = $_notaAntiga->notaRecuperacaoEspecifica; + } + + $nota = new Avaliacao_Model_NotaComponente($array_nota); + $this->serviceBoletim()->addNota($nota); + $this->trySaveServiceBoletim(); + $this->inserirAuditoriaNotas($_notaAntiga, $nota); + $this->messenger->append('Nota matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); + } + + $this->substituicaoMenorNotaRecuperacaoEspecifica(); + + $this->appendResponse('should_show_recuperacao_especifica', $this->shouldShowRecuperacaoEspecifica()); + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + $this->appendResponse('nota_necessaria_exame', $notaNecessariaExame = $this->getNotaNecessariaExame($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); + + if (!empty($notaNecessariaExame) && in_array($this->getSituacaoComponente(), array('Em exame', 'Aprovado após exame', 'Retido'))) { + $this->createOrUpdateNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id, $notaNecessariaExame); + } else { + $this->deleteNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id); + } + + } + + protected function postNotaGeral() + { + if ($this->canPostNotaGeral()) { + $notaGeral = urldecode($this->getRequest()->att_value); + $nota = new Avaliacao_Model_NotaGeral(array( + 'etapa' => $this->getRequest()->etapa, + 'nota' => $notaGeral)); + + $this->serviceBoletim()->updateMediaGeral(0, $this->getRequest()->etapa); + $this->serviceBoletim()->addNotaGeral($nota); + $this->trySaveServiceBoletim(); + $this->messenger->append('Nota geral da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); + } + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente($this->getRequest()->componente_curricular_id)); + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); + } + + protected function postMedia() + { + if ($this->canPostMedia()) { + $mediaLancada = urldecode($this->getRequest()->att_value); + $componenteCurricular = $this->getRequest()->componente_curricular_id; + $etapa = $this->getRequest()->etapa; + + $this->serviceBoletim()->updateMediaComponente($mediaLancada, $componenteCurricular, $etapa); + $this->messenger->append('Média da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente($this->getRequest()->componente_curricular_id)); + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); + } else { + $this->messenger->append('Usuário não possui permissão para alterar a média do aluno.', 'error'); + } + } + + protected function deleteMedia() + { + if ($this->canDeleteMedia()) { + + $media = $this->getMediaAtual(); + if (empty($media) && !is_numeric($media)) { + $this->messenger->append('Média matrícula ' . $this->getRequest()->matricula_id . ' inexistente ou já removida.', 'notice'); + } else { + $this->serviceBoletim()->updateMediaComponente(0, $this->getRequest()->componente_curricular_id, $this->getRequest()->etapa); + $this->messenger->append('Média matrícula ' . $this->getRequest()->matricula_id . ' removida com sucesso.', 'success'); + } + } + + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + } + + protected function canPostMedia() + { + return $this->canPostSituacaoAndNota(); + } + + protected function canDeleteMedia() + { + return true; + } + + protected function postNotaRecuperacaoParalela() + { + if ($this->canPostNota()) { + $notaOriginal = $this->getNotaOriginal(); + $notaRecuperacaoParalela = urldecode($this->getRequest()->att_value); + + $notaNova = (($notaRecuperacaoParalela > $notaOriginal) ? $notaRecuperacaoParalela : $notaOriginal); + + $nota = new Avaliacao_Model_NotaComponente(array( + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, + 'etapa' => $this->getRequest()->etapa, + 'nota' => $notaNova, + 'notaRecuperacaoParalela' => urldecode($this->getRequest()->att_value), + 'notaOriginal' => $notaOriginal)); + + $this->serviceBoletim()->addNota($nota); + $this->trySaveServiceBoletim(); + $this->messenger->append('Nota de recuperação da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); + } + + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + $this->appendResponse('nota_necessaria_exame', $notaNecessariaExame = $this->getNotaNecessariaExame($this->getRequest()->componente_curricular_id)); + $this->appendResponse('nota_nova', ($notaNova > $notaOriginal ? $notaNova : null)); + $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); + + if (!empty($notaNecessariaExame) && in_array($this->getSituacaoComponente(), array('Em exame', 'Aprovado após exame', 'Retido'))) { + $this->createOrUpdateNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id, $notaNecessariaExame); + } else { + $this->deleteNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id); + } + + } + + protected function postNotaRecuperacaoEspecifica() + { + if ($this->canPostNota()) { + $notaOriginal = $this->getNotaOriginal(); + $notaRecuperacaoParalela = urldecode($this->getRequest()->att_value); + + $nota = new Avaliacao_Model_NotaComponente(array( + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, + 'etapa' => $this->getRequest()->etapa, + 'nota' => $notaOriginal, + 'notaRecuperacaoEspecifica' => urldecode($this->getRequest()->att_value), + 'notaOriginal' => $notaOriginal)); + + $this->serviceBoletim()->addNota($nota); + $this->trySaveServiceBoletim(); + $this->messenger->append('Nota de recuperação da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); + } + + $this->substituicaoMenorNotaRecuperacaoEspecifica(); + + // Se está sendo lançada nota de recuperação, obviamente o campo deve ser visível + $this->appendResponse('should_show_recuperacao_especifica', true); + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + $this->appendResponse('nota_necessaria_exame', $notaNecessariaExame = $this->getNotaNecessariaExame($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); + + if (!empty($notaNecessariaExame) && in_array($this->getSituacaoComponente(), array('Em exame', 'Aprovado após exame', 'Retido'))) { + $this->createOrUpdateNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id, $notaNecessariaExame); + } else { + $this->deleteNotaExame($this->getRequest()->matricula_id, $this->getRequest()->componente_curricular_id); + } + + } + + // TODO mover validacao para canPostFalta + protected function postFalta() + { + + $canPost = $this->canPostFalta(); + if ($canPost && $this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { + $canPost = $this->validatesPresenceOf('componente_curricular_id'); + } + + if ($canPost) { + if ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { + $falta = $this->getFaltaComponente(); + } elseif ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) { + $falta = $this->getFaltaGeral(); + } + + $this->serviceBoletim()->addFalta($falta); + $this->trySaveServiceBoletimFaltas(); + $this->messenger->append('Falta matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); + } + + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + $this->appendResponse('should_show_recuperacao_especifica', $this->shouldShowRecuperacaoEspecifica()); + } + + protected function postParecer() + { + + if ($this->canPostParecer()) { + $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); + $cnsParecer = RegraAvaliacao_Model_TipoParecerDescritivo; + + if ($tpParecer == $cnsParecer::ETAPA_COMPONENTE || $tpParecer == $cnsParecer::ANUAL_COMPONENTE) { + $parecer = $this->getParecerComponente(); + } else { + $parecer = $this->getParecerGeral(); + } + + $this->serviceBoletim()->addParecer($parecer); + $this->trySaveServiceBoletim(); + $this->messenger->append('Parecer descritivo matricula ' . $this->getRequest()->matricula_id . ' alterado com sucesso.', 'success'); + } + + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + } + + // delete + + protected function deleteNota() + { + if ($this->canDeleteNota()) { + + $nota = $this->getNotaAtual(); + if (empty($nota) && !is_numeric($nota)) { + $this->messenger->append('Nota matrícula ' . $this->getRequest()->matricula_id . ' inexistente ou já removida.', 'notice'); + } else { + $_notaAntiga = $this->serviceBoletim()->getNotaComponente($this->getRequest()->componente_curricular_id, $this->getRequest()->etapa); + $this->serviceBoletim()->deleteNota($this->getRequest()->etapa, $this->getRequest()->componente_curricular_id); + $this->inserirAuditoriaNotas($_notaAntiga, $nota); + $this->messenger->append('Nota matrícula ' . $this->getRequest()->matricula_id . ' removida com sucesso.', 'success'); + } + } + + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); + } + + protected function deleteNotaRecuperacaoParalela() + { + if ($this->canDeleteNota()) { + $notaOriginal = $this->getNotaOriginal(); + $notaAtual = $this->getNotaAtual(); + $nota = new Avaliacao_Model_NotaComponente(array( + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, + 'etapa' => $this->getRequest()->etapa, + 'nota' => $notaOriginal, + 'notaRecuperacaoEspecifica' => $notaRecuperacaoEspecifica, + 'notaOriginal' => $notaOriginal)); + + $this->serviceBoletim()->addNota($nota); + $this->trySaveServiceBoletim(); + $this->messenger->append('Nota de recuperação da matrícula ' . $this->getRequest()->matricula_id . ' excluída com sucesso.', 'success'); + + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + $this->appendResponse('nota_original', $notaOriginal); + $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); + } + } + + protected function deleteNotaRecuperacaoEspecifica() + { + if ($this->canDeleteNota()) { + $notaOriginal = $this->getNotaOriginal(); + $notaAtual = $this->getNotaAtual(); + $nota = new Avaliacao_Model_NotaComponente(array( + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, + 'etapa' => $this->getRequest()->etapa, + 'nota' => $notaOriginal, + 'notaRecuperacaoParalela' => $notaRecuperacaoParalela, + 'notaOriginal' => $notaOriginal)); + + $this->serviceBoletim()->addNota($nota); + $this->trySaveServiceBoletim(); + $this->messenger->append('Nota de recuperação da matrícula ' . $this->getRequest()->matricula_id . ' excluída com sucesso.', 'success'); + + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + $this->appendResponse('nota_original', $notaOriginal); + $this->appendResponse('media', $this->getMediaAtual($this->getRequest()->componente_curricular_id)); + $this->appendResponse('media_arredondada', $this->getMediaArredondadaAtual($this->getRequest()->componente_curricular_id)); + } + } + + protected function deleteFalta() + { + $canDelete = $this->canDeleteFalta(); + $cnsPresenca = RegraAvaliacao_Model_TipoPresenca; + $tpPresenca = $this->serviceBoletim()->getRegra()->get('tipoPresenca'); + + if ($canDelete && $tpPresenca == $cnsPresenca::POR_COMPONENTE) { + $canDelete = $this->validatesPresenceOf('componente_curricular_id'); + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } else { + $componenteCurricularId = null; + } + + if ($canDelete && is_null($this->getFaltaAtual())) { + $this->messenger->append('Falta matrícula ' . $this->getRequest()->matricula_id . ' inexistente ou já removida.', 'notice'); + } elseif ($canDelete) { + $this->serviceBoletim()->deleteFalta($this->getRequest()->etapa, $componenteCurricularId); + $this->trySaveServiceBoletimFaltas(); + $this->messenger->append('Falta matrícula ' . $this->getRequest()->matricula_id . ' removida com sucesso.', 'success'); + } + + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + } + + protected function deleteParecer() + { + if ($this->canDeleteParecer()) { + $parecerAtual = $this->getParecerAtual(); + + if ((is_null($parecerAtual) || $parecerAtual == '')) { + $this->messenger->append('Parecer descritivo matrícula ' . $this->getRequest()->matricula_id . ' inexistente ou já removido.', 'notice'); + } else { + $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); + $cnsParecer = RegraAvaliacao_Model_TipoParecerDescritivo; + + if ($tpParecer == $cnsParecer::ANUAL_COMPONENTE || $tpParecer == $cnsParecer::ETAPA_COMPONENTE) { + $this->serviceBoletim()->deleteParecer($this->getRequest()->etapa, $this->getRequest()->componente_curricular_id); + } else { + $this->serviceBoletim()->deleteParecer($this->getRequest()->etapa); + } + + $this->trySaveServiceBoletim(); + $this->messenger->append('Parecer descritivo matrícula ' . $this->getRequest()->matricula_id . ' removido com sucesso.', 'success'); + } + } + + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + } + + protected function deleteNotaGeral() + { + $this->serviceBoletim()->updateMediaGeral(0, $this->getRequest()->etapa); + $this->serviceBoletim()->deleteNotaGeral($this->getRequest()->etapa); + + $this->trySaveServiceBoletim(); + + $this->messenger->append('Nota geral da matrícula ' . $this->getRequest()->matricula_id . ' removida com sucesso.', 'success'); + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + $this->appendResponse('situacao', $this->getSituacaoComponente()); + } + + // get + + protected function getMatriculas() + { + $regras = $matriculas = array(); + + if ($this->canGetMatriculas()) { + $alunos = new clsPmieducarMatriculaTurma(); + $alunos->setOrderby("sequencial_fechamento , translate(pessoa.nome,'" . Portabilis_String_Utils::toLatin1(åáàãâäéèêëíìîïóòõôöúùüûçÿýñÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ) . "', '" . Portabilis_String_Utils::toLatin1(aaaaaaeeeeiiiiooooouuuucyynAAAAAAEEEEIIIIOOOOOUUUUCYN) . "')"); + + $alunos = $alunos->lista( + $this->getRequest()->matricula_id, + $this->getRequest()->turma_id, + null, + null, + null, + null, + null, + null, + 2, + $this->getRequest()->serie_id, + $this->getRequest()->curso_id, + $this->getRequest()->escola_id, + $this->getRequest()->instituicao_id, + $this->getRequest()->aluno_id, + null, + null, + null, + null, + $this->getRequest()->ano, + null, + true, + null, + null, + true, + null, + null, + null, + null, + null, + null, + null, + true + ); + + if (!is_array($alunos)) { + $alunos = array(); + } + + foreach ($alunos as $aluno) { + $matricula = array(); + $matriculaId = $aluno['ref_cod_matricula']; + $turmaId = $aluno['ref_cod_turma']; + $serieId = $aluno['ref_ref_cod_serie']; + + // seta id da matricula a ser usado pelo metodo serviceBoletim + $this->setCurrentMatriculaId($matriculaId); + + if (!(dbBool($aluno['remanejado']) || dbBool($aluno['transferido']) || dbBool($aluno['abandono']) || dbBool($aluno['reclassificado']) || dbBool($aluno['falecido']))) { + $matricula['componentes_curriculares'] = $this->loadComponentesCurricularesForMatricula($matriculaId, $turmaId, $serieId); + } + + $matricula['matricula_id'] = $aluno['ref_cod_matricula']; + $matricula['aluno_id'] = $aluno['ref_cod_aluno']; + $matricula['nome'] = $this->safeString($aluno['nome_aluno']); + + if (dbBool($aluno['remanejado'])) { + $matricula['situacao_deslocamento'] = 'Remanejado'; + } elseif (dbBool($aluno['transferido'])) { + $matricula['situacao_deslocamento'] = 'Transferido'; + } elseif (dbBool($aluno['abandono'])) { + $matricula['situacao_deslocamento'] = 'Abandono'; + } elseif (dbBool($aluno['reclassificado'])) { + $matricula['situacao_deslocamento'] = 'Reclassificado'; + } elseif (dbBool($aluno['falecido'])) { + $matricula['situacao_deslocamento'] = 'Falecido'; + } else { + $matricula['situacao_deslocamento'] = null; + } + + $matricula['regra'] = $this->getRegraAvaliacao(); + + $regras[$matricula['regra']['id']] = $matricula['regra']; + + $matriculas[] = $matricula; + } + } + + // adiciona regras de avaliacao + if (!empty($matriculas)) { + $this->appendResponse('details', array_values($regras)); + } + + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + + return $matriculas; + } + + // metodos auxiliares responders + + // TODO usar esta funcao onde é verificado se parecer geral + protected function parecerGeral() + { + $tiposParecerGeral = array(RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL, + RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_GERAL); + + return in_array($this->serviceBoletim()->getRegra()->get('parecerDescritivo'), $tiposParecerGeral); + } + + protected function setCurrentMatriculaId($matriculaId) + { + $this->_currentMatriculaId = $matriculaId; + } + + protected function getCurrentMatriculaId() + { + // caso tenha setado _currentMatriculaId, ignora matricula_id recebido nos parametros + if (!is_null($this->_currentMatriculaId)) { + $matriculaId = $this->_currentMatriculaId; + } elseif (!is_null($this->getRequest()->matricula_id)) { + $matriculaId = $this->getRequest()->matricula_id; + } else { + throw new CoreExt_Exception("Não foi possivel recuperar o id da matricula atual."); + } + + return $matriculaId; + } + + protected function serviceBoletim($reload = false) + { + $matriculaId = $this->getCurrentMatriculaId(); + + if (!isset($this->_boletimServiceInstances)) { + $this->_boletimServiceInstances = array(); + } + + // set service + if (!isset($this->_boletimServiceInstances[$matriculaId]) || $reload) { + try { + $params = array( + 'matricula' => $matriculaId, + 'usuario' => $this->getSession()->id_pessoa, + 'componenteCurricularId' => $this->getRequest()->componente_curricular_id, + ); + $this->_boletimServiceInstances[$matriculaId] = new Avaliacao_Service_Boletim($params); + } catch (Exception $e) { + $this->messenger->append("Erro ao instanciar serviço boletim para matricula {$matriculaId}: " . $e->getMessage(), 'error', true); + } + } + + // validates service + if (is_null($this->_boletimServiceInstances[$matriculaId])) { + throw new CoreExt_Exception("Não foi possivel instanciar o serviço boletim para a matricula $matriculaId."); + } + + return $this->_boletimServiceInstances[$matriculaId]; + } + + protected function trySaveServiceBoletim() + { + try { + $this->serviceBoletim()->save(); + } catch (CoreExt_Service_Exception $e) { + // excecoes ignoradas :( pois servico lanca excecoes de alertas, que não são exatamente erros. + // error_log('CoreExt_Service_Exception ignorada: ' . $e->getMessage()); + } + } + + protected function trySaveServiceBoletimFaltas() + { + try { + $this->serviceBoletim()->saveFaltas(); + $this->serviceBoletim()->promover(); + } catch (CoreExt_Service_Exception $e) { + } + } + + // metodos auxiliares getFalta + + protected function getQuantidadeFalta() + { + $quantidade = (int) $this->getRequest()->att_value; + + if ($quantidade < 0) { + $quantidade = 0; + } + + return $quantidade; + } + + protected function getFaltaGeral() + { + return new Avaliacao_Model_FaltaGeral(array( + 'quantidade' => $this->getQuantidadeFalta(), + 'etapa' => $this->getRequest()->etapa, + )); + } + + protected function getFaltaComponente() + { + return new Avaliacao_Model_FaltaComponente(array( + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, + 'quantidade' => $this->getQuantidadeFalta(), + 'etapa' => $this->getRequest()->etapa, + )); + } + + // metodos auxiliares getParecer + + protected function getParecerComponente() + { + return new Avaliacao_Model_ParecerDescritivoComponente(array( + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, + 'parecer' => $this->safeStringForDb($this->getRequest()->att_value), + 'etapa' => $this->getRequest()->etapa, + )); + } + + protected function getParecerGeral() + { + return new Avaliacao_Model_ParecerDescritivoGeral(array( + 'parecer' => $this->safeStringForDb($this->getRequest()->att_value), + 'etapa' => $this->getRequest()->etapa, + )); + } + + // metodos auxiliares getSituacaoComponente + + protected function getSituacaoComponente($ccId = null) + { + if (is_null($ccId)) { + $ccId = $this->getRequest()->componente_curricular_id; + } + + $situacao = null; + + $situacoes = $this->getSituacaoComponentes(); + if(isset($situacoes[$ccId])){ + $situacao = $situacoes[$ccId]; + } + + return $this->safeString($situacao); + } + + protected function getSituacaoComponentes() + { + $situacoes = array(); + + try { + $componentesCurriculares = $this->serviceBoletim()->getSituacaoComponentesCurriculares()->componentesCurriculares; + foreach($componentesCurriculares as $componenteCurricularId => $situacaoCc){ + $situacoes[$componenteCurricularId] = App_Model_MatriculaSituacao::getInstance()->getValue($situacaoCc->situacao); + } + + } catch (Exception $e) { + $matriculaId = $this->getRequest()->matricula_id; + $this->messenger->append("Erro ao recuperar situação da matrícula '$matriculaId': " . + $e->getMessage()); + } + + return $situacoes; + } + + // outros metodos auxiliares + + protected function loadComponentesCurricularesForMatricula($matriculaId, $turmaId, $serieId) + { + $componentesCurriculares = array(); + + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + $etapa = $this->getRequest()->etapa; + + $_componentesCurriculares = App_Model_IedFinder::getComponentesPorMatricula($matriculaId, null, null, $componenteCurricularId, $etapa, $turmaId); + + $turmaId = $this->getRequest()->turma_id; + $situacoes = $this->getSituacaoComponentes(); + + $slugify = new Slugify(); + + foreach ($_componentesCurriculares as $_componente) { + $componente = array(); + $componenteId = $_componente->get('id'); + $tipoNota = App_Model_IedFinder::getTipoNotaComponenteSerie($componenteId, $serieId); + + if (clsPmieducarTurma::verificaDisciplinaDispensada($turmaId, $componenteId)) { + continue; + } + + $componente['id'] = $componenteId; + $componente['nome'] = mb_strtoupper($_componente->get('nome'), 'UTF-8'); + $componente['nota_atual'] = $this->getNotaAtual($etapa = null, $componente['id']); + $componente['nota_exame'] = $this->getNotaExame($componente['id']); + $componente['falta_atual'] = $this->getFaltaAtual($etapa = null, $componente['id']); + $componente['parecer_atual'] = $this->getParecerAtual($componente['id']); + $componente['situacao'] = $this->safeString($situacoes[$componente['id']]); + $componente['tipo_nota'] = $tipoNota; + $componente['ultima_etapa'] = App_Model_IedFinder::getUltimaEtapaComponente($turmaId, $componenteId); + $gravaNotaExame = ($componente['situacao'] == 'Em exame' || $componente['situacao'] == 'Aprovado após exame' || $componente['situacao'] == 'Retido'); + + $componente['nota_necessaria_exame'] = ($gravaNotaExame ? $this->getNotaNecessariaExame($componente['id']) : null); + $componente['ordenamento'] = $_componente->get('ordenamento'); + $componente['nota_recuperacao_paralela'] = $this->getNotaRecuperacaoParalelaAtual($etapa, $componente['id']); + $componente['nota_recuperacao_especifica'] = $this->getNotaRecuperacaoEspecificaAtual($etapa, $componente['id']); + $componente['should_show_recuperacao_especifica'] = $this->shouldShowRecuperacaoEspecifica($etapa, $componente['id']); + $componente['nota_original'] = $this->getNotaOriginal($etapa, $componente['id']); + $componente['nota_geral_etapa'] = $this->getNotaGeral($etapa); + $componente['media'] = $this->getMediaAtual($componente['id']); + $componente['media_arredondada'] = $this->getMediaArredondadaAtual($componente['id']); + + if (!empty($componente['nota_necessaria_exame'])) { + $this->createOrUpdateNotaExame($matriculaId, $componente['id'], $componente['nota_necessaria_exame']); + } else { + $this->deleteNotaExame($matriculaId, $componente['id']); + } + + //buscando pela área do conhecimento + $area = $this->getAreaConhecimento($componente['id']); + $nomeArea = (($area->secao != '') ? $area->secao . ' - ' : '') . $area->nome; + $componente['ordenamento_ac'] = $area->ordenamento_ac; + $componente['area_id'] = $area->id; + $componente['area_nome'] = mb_strtoupper($nomeArea, 'UTF-8'); + + //criando chave para ordenamento temporário + //área de conhecimento + componente curricular + + $componente['ordem_nome_area_conhecimento'] = $slugify->slugify($nomeArea); + $componente['ordem_componente_curricular'] = $slugify->slugify($_componente->get('nome')); + $componentesCurriculares[] = $componente; + } + + $ordenamentoComponentes = array(); + + foreach ($componentesCurriculares as $chave => $componente) { + $ordenamentoComponentes['ordenamento_ac'][$chave] = $componente['ordenamento_ac']; + $ordenamentoComponentes['ordenamento'][$chave] = $componente['ordenamento']; + $ordenamentoComponentes['ordem_nome_area_conhecimento'][$chave] = $componente['ordem_nome_area_conhecimento']; + $ordenamentoComponentes['ordem_componente_curricular'][$chave] = $componente['ordem_componente_curricular']; + } + array_multisort($ordenamentoComponentes['ordenamento_ac'], SORT_ASC, SORT_NUMERIC, + $ordenamentoComponentes['ordem_nome_area_conhecimento'], SORT_ASC, + $ordenamentoComponentes['ordenamento'], SORT_ASC, SORT_NUMERIC, + $ordenamentoComponentes['ordem_componente_curricular'], SORT_ASC, + $componentesCurriculares); + + //removendo chave temporária + $len = count($componentesCurriculares); + for ($i = 0; $i < $len; $i++) { + unset($componentesCurriculares[$i]['my_order']); + } + return $componentesCurriculares; + } + + protected function getAreaConhecimento($componenteCurricularId = null) + { + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possível obter a área de conhecimento pois não foi recebido o id do componente curricular.'); + } + + require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php'; + $mapper = new ComponenteCurricular_Model_ComponenteDataMapper(); + + $where = array('id' => $componenteCurricularId); + + $area = $mapper->findAll(array('area_conhecimento'), $where); + + $areaConhecimento = new stdClass(); + $areaConhecimento->id = $area[0]->area_conhecimento->id; + $areaConhecimento->nome = $area[0]->area_conhecimento->nome; + $areaConhecimento->secao = $area[0]->area_conhecimento->secao; + $areaConhecimento->ordenamento_ac = $area[0]->area_conhecimento->ordenamento_ac; + + return $areaConhecimento; + } + + protected function createOrUpdateNotaExame($matriculaId, $componenteCurricularId, $notaExame) + { + + $obj = new clsModulesNotaExame($matriculaId, $componenteCurricularId, $notaExame); + + return ($obj->existe() ? $obj->edita() : $obj->cadastra()); + } + + protected function deleteNotaExame($matriculaId, $componenteCurricularId) + { + $obj = new clsModulesNotaExame($matriculaId, $componenteCurricularId); + return ($obj->excluir()); + } + + /** + * @deprecated + * + * @see Avaliacao_Service_Boletim::getNotaAtual() + */ + protected function getNotaAtual($etapa = null, $componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + if (is_null($etapa)) { + $etapa = $this->getRequest()->etapa; + } + + // validacao + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possivel obter a nota atual, pois não foi recebido o id do componente curricular.'); + } + + $nota = urldecode($this->serviceBoletim()->getNotaComponente($componenteCurricularId, $etapa)->nota); + + return str_replace(',', '.', $nota); + } + + protected function getNotaGeral($etapa = null) + { + + if (is_null($etapa)) { + $etapa = $this->getRequest()->etapa; + } + + $nota = urldecode($this->serviceBoletim()->getNotaGeral($etapa)->nota); + + return str_replace(',', '.', $nota); + + } + + protected function getMediaAtual($componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + // validacao + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possivel obter a média atual, pois não foi recebido o id do componente curricular.'); + } + + $media = urldecode($this->serviceBoletim()->getMediaComponente($componenteCurricularId)->media); + + // $media = round($media,1); + + return str_replace(',', '.', $media); + } + + protected function getMediaArredondadaAtual($componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + // validacao + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possivel obter a média atual, pois não foi recebido o id do componente curricular.'); + } + + $media = urldecode($this->serviceBoletim()->getMediaComponente($componenteCurricularId)->mediaArredondada); + + // $media = round($media,1); + + return str_replace(',', '.', $media); + } + + protected function getNotaRecuperacaoParalelaAtual($etapa = null, $componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + if (is_null($etapa)) { + $etapa = $this->getRequest()->etapa; + } + + // validacao + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possivel obter a nota de recuperação paralela atual, pois não foi recebido o id do componente curricular.'); + } + + $nota = urldecode($this->serviceBoletim()->getNotaComponente($componenteCurricularId, $etapa)->notaRecuperacaoParalela); + $nota = str_replace(',', '.', $nota); + return $nota; + } + + protected function shouldShowRecuperacaoEspecifica($etapa = null, $componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + if (is_null($etapa)) { + $etapa = $this->getRequest()->etapa; + } + + // validacao + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possivel obter a nota de recuperação específica atual, pois não foi recebido o id do componente curricular.'); + } + + $regra = $this->serviceBoletim()->getRegra(); + $tipoRecuperacaoParalela = $regra->get('tipoRecuperacaoParalela'); + + $regraRecuperacao = $regra->getRegraRecuperacaoByEtapa($etapa); + + if ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::USAR_POR_ETAPAS_ESPECIFICAS + && $regraRecuperacao && $regraRecuperacao->getLastEtapa() == $etapa) { + + $etapas = $regraRecuperacao->getEtapas(); + $sumNota = 0; + foreach ($etapas as $key => $_etapa) { + $sumNota += $this->getNotaOriginal($_etapa, $componenteCurricularId); + } + + // caso a média das notas da etapa seja menor que média definida na regra e a última nota tenha sido lançada + // deverá exibir a nota de recuperação + if ((($sumNota / count($etapas)) < $regraRecuperacao->get('media')) + && is_numeric($this->getNotaOriginal($etapa, $componenteCurricularId))) { + return true; + } else { + // Caso não exiba, já busca se existe a nota de recuperação e deleta ela + $notaRecuperacao = $this->serviceBoletim()->getNotaComponente($componenteCurricularId, $regraRecuperacao->getLastEtapa()); + + if ($notaRecuperacao) { + $nota = new Avaliacao_Model_NotaComponente(array( + 'componenteCurricular' => $componenteCurricularId, + 'nota' => $notaRecuperacao->notaOriginal, + 'etapa' => $notaRecuperacao->etapa, + 'notaOriginal' => $notaRecuperacao->notaOriginal, + 'notaRecuperacaoParalela' => $notaRecuperacao->notaRecuperacaoParalela, + )); + + $this->serviceBoletim()->addNota($nota); + $this->trySaveServiceBoletim(); + } + return false; + } + } + return false; + } + + protected function getNotaRecuperacaoEspecificaAtual($etapa = null, $componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + if (is_null($etapa)) { + $etapa = $this->getRequest()->etapa; + } + + // validacao + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possivel obter a nota de recuperação específica atual, pois não foi recebido o id do componente curricular.'); + } + + $nota = urldecode($this->serviceBoletim()->getNotaComponente($componenteCurricularId, $etapa)->notaRecuperacaoEspecifica); + $nota = str_replace(',', '.', $nota); + return $nota; + } + + protected function getNotaOriginal($etapa = null, $componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + if (is_null($etapa)) { + $etapa = $this->getRequest()->etapa; + } + + // validacao + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possivel obter a nota original, pois não foi recebido o id do componente curricular.'); + } + + $nota = urldecode($this->serviceBoletim()->getNotaComponente($componenteCurricularId, $etapa)->notaOriginal); + $nota = str_replace(',', '.', $nota); + return $nota; + } + + protected function getNotaExame($componenteCurricularId = null) + { + + $turmaId = $this->getRequest()->turma_id; + $regra = $this->serviceBoletim()->getRegra(); + $defineComponentePorEtapa = $regra->get('definirComponentePorEtapa') == 1; + $ultimaEtapa = $this->getRequest()->etapa == $this->serviceBoletim()->getOption('etapas'); + $ultimaEtapaComponente = App_Model_IedFinder::getUltimaEtapaComponente($turmaId, $componenteCurricularId); + + // somente recupera nota de exame se estiver buscando as matriculas da ultima etapa + // se existe nota de exame, esta é recuperada mesmo que a regra de avaliação não use mais exame + if ($ultimaEtapa || ($defineComponentePorEtapa && $ultimaEtapaComponente)) { + $nota = $this->getNotaAtual($etapa = 'Rc', $componenteCurricularId); + } else { + $nota = ''; + } + + return $nota; + } + + protected function getNotaNecessariaExame($componenteCurricularId = null) + { + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + $nota = urldecode($this->serviceBoletim()->preverNotaRecuperacao($componenteCurricularId)); + + return str_replace(',', '.', $nota); + } + + /** + * @deprecated + * + * @see Avaliacao_Service_Boletim::getFaltaAtual() + */ + protected function getFaltaAtual($etapa = null, $componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + if (is_null($etapa)) { + $etapa = $this->getRequest()->etapa; + } + + if ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possivel obter a falta atual, pois não foi recebido o id do componente curricular.'); + } + + $falta = $this->serviceBoletim()->getFalta($etapa, $componenteCurricularId)->quantidade; + } elseif ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) { + $falta = $this->serviceBoletim()->getFalta($etapa)->quantidade; + } + + return $falta; + } + + protected function getEtapaParecer() + { + if ($this->getRequest()->etapa != 'An' && ($this->serviceBoletim()->getRegra()->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE || $this->serviceBoletim()->getRegra()->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL)) { + return 'An'; + } else { + return $this->getRequest()->etapa; + } + + } + + protected function getParecerAtual($componenteCurricularId = null) + { + // defaults + if (is_null($componenteCurricularId)) { + $componenteCurricularId = $this->getRequest()->componente_curricular_id; + } + + $etapaComponente = $this->serviceBoletim()->getRegra()->get('parecerDescritivo') == + RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE; + + $anualComponente = $this->serviceBoletim()->getRegra()->get('parecerDescritivo') == + RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE; + + if ($etapaComponente or $anualComponente) { + if (!is_numeric($componenteCurricularId)) { + throw new Exception('Não foi possivel obter o parecer descritivo atual, pois não foi recebido o id do componente curricular.'); + } + + $parecer = $this->serviceBoletim()->getParecerDescritivo($this->getEtapaParecer(), $componenteCurricularId)->parecer; + } else { + $parecer = $this->serviceBoletim()->getParecerDescritivo($this->getEtapaParecer())->parecer; + } + + return $this->safeString($parecer, $transform = false); + } + + protected function getOpcoesFaltas() + { + $opcoes = array(); + + foreach (range(0, 100, 1) as $f) { + $opcoes[$f] = $f; + } + + return $opcoes; + } + + protected function canGetOpcoesNotas() + { + return true; + } + + protected function getOpcoesNotas() + { + $opcoes = array(); + + if ($this->canGetOpcoesNotas()) { + $tpNota = $this->serviceBoletim()->getRegra()->get('tipoNota'); + $cnsNota = RegraAvaliacao_Model_Nota_TipoValor; + + if ($tpNota != $cnsNota::NENHUM) { + $tabela = $this->serviceBoletim()->getRegra()->tabelaArredondamento->findTabelaValor(); + + foreach ($tabela as $index => $item) { + if ($tpNota == $cnsNota::NUMERICA) { + $nota = str_replace(',', '.', (string) $item->nome); + $opcoes[$nota] = $nota; + } else { + // $nota = str_replace(',', '.', (string) $item->valorMaximo); + $opcoes[$index] = array('valor_minimo' => str_replace(',', '.', (string) $item->valorMinimo), + 'valor_maximo' => str_replace(',', '.', (string) $item->valorMaximo), + 'descricao' => $this->safeString($item->nome . ' (' . $item->descricao . ')')); + + } + } + } + } + + return $opcoes; + } + + //Usado apenas quando na regra o sistema de nota é "Numérica e conceitual" + protected function getOpcoesNotasConceituais() + { + $opcoes = array(); + + if ($this->canGetOpcoesNotas()) { + $tpNota = $this->serviceBoletim()->getRegra()->get('tipoNota'); + $cnsNota = RegraAvaliacao_Model_Nota_TipoValor; + + if ($tpNota != $cnsNota::NENHUM) { + $tabela = $this->serviceBoletim()->getRegra()->tabelaArredondamentoConceitual->findTabelaValor(); + + foreach ($tabela as $index => $item) { + if ($tpNota == $cnsNota::NUMERICA) { + $nota = str_replace(',', '.', (string) $item->nome); + $opcoes[$nota] = $nota; + } else { + // $nota = str_replace(',', '.', (string) $item->valorMaximo); + $opcoes[$index] = array('valor_minimo' => str_replace(',', '.', (string) $item->valorMinimo), + 'valor_maximo' => str_replace(',', '.', (string) $item->valorMaximo), + 'descricao' => $this->safeString($item->nome . ' (' . $item->descricao . ')')); + + } + } + } + } + + return $opcoes; + } + + protected function getNavegacaoTab() + { + return $this->getRequest()->navegacao_tab; + } + + protected function canGetRegraAvaliacao() + { + return true; + } + + protected function getRegraAvaliacao() + { + $itensRegra = array(); + + if ($this->canGetRegraAvaliacao()) { + $regra = $this->serviceBoletim()->getRegra(); + $itensRegra['id'] = $regra->get('id'); + $itensRegra['nome'] = $this->safeString($regra->get('nome')); + $itensRegra['nota_maxima_geral'] = $regra->get('notaMaximaGeral'); + $itensRegra['nota_minima_geral'] = $regra->get('notaMinimaGeral'); + $itensRegra['nota_maxima_exame_final'] = $regra->get('notaMaximaExameFinal'); + $itensRegra['qtd_casas_decimais'] = $regra->get('qtdCasasDecimais'); + $itensRegra['regra_diferenciada_id'] = $regra->get('regraDiferenciada'); + + // tipo presença + $cnsPresenca = RegraAvaliacao_Model_TipoPresenca; + $tpPresenca = $this->serviceBoletim()->getRegra()->get('tipoPresenca'); + + if ($tpPresenca == $cnsPresenca::GERAL) { + $itensRegra['tipo_presenca'] = 'geral'; + } elseif ($tpPresenca == $cnsPresenca::POR_COMPONENTE) { + $itensRegra['tipo_presenca'] = 'por_componente'; + } else { + $itensRegra['tipo_presenca'] = $tpPresenca; + } + + // tipo nota + $cnsNota = RegraAvaliacao_Model_Nota_TipoValor; + $tpNota = $this->serviceBoletim()->getRegra()->get('tipoNota'); + + if ($tpNota == $cnsNota::NENHUM) { + $itensRegra['tipo_nota'] = 'nenhum'; + } elseif ($tpNota == $cnsNota::NUMERICA) { + $itensRegra['tipo_nota'] = 'numerica'; + } elseif ($tpNota == $cnsNota::CONCEITUAL) { + $itensRegra['tipo_nota'] = 'conceitual'; + //incluido opcoes notas, pois notas conceituais requer isto para visualizar os nomes + } elseif ($tpNota == $cnsNota::NUMERICACONCEITUAL) { + $itensRegra['tipo_nota'] = 'numericaconceitual'; + } else { + $itensRegra['tipo_nota'] = $tpNota; + } + + //Lançamento de nota manual + $tpProgressao = $this->serviceBoletim()->getRegra()->get('tipoProgressao'); + $itensRegra['progressao_manual'] = ($tpProgressao == RegraAvaliacao_Model_TipoProgressao::NAO_CONTINUADA_MANUAL); + $itensRegra['progressao_continuada'] = ($tpProgressao == RegraAvaliacao_Model_TipoProgressao::CONTINUADA); + + // tipo parecer + $cnsParecer = RegraAvaliacao_Model_TipoParecerDescritivo; + $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); + + if ($tpParecer == $cnsParecer::NENHUM) { + $itensRegra['tipo_parecer_descritivo'] = 'nenhum'; + } elseif ($tpParecer == $cnsParecer::ETAPA_COMPONENTE) { + $itensRegra['tipo_parecer_descritivo'] = 'etapa_componente'; + } elseif ($tpParecer == $cnsParecer::ETAPA_GERAL) { + $itensRegra['tipo_parecer_descritivo'] = 'etapa_geral'; + } elseif ($tpParecer == $cnsParecer::ANUAL_COMPONENTE) { + $itensRegra['tipo_parecer_descritivo'] = 'anual_componente'; + } elseif ($tpParecer == $cnsParecer::ANUAL_GERAL) { + $itensRegra['tipo_parecer_descritivo'] = 'anual_geral'; + } else { + $itensRegra['tipo_parecer_descritivo'] = $tpParecer; + } + + // opcoes notas + $itensRegra['opcoes_notas'] = $this->getOpcoesNotas(); + if ($tpNota == $cnsNota::NUMERICACONCEITUAL) { + $itensRegra['opcoes_notas_conceituais'] = $this->getOpcoesNotasConceituais(); + } + + // etapas + $itensRegra['quantidade_etapas'] = $this->serviceBoletim()->getOption('etapas'); + } + + $itensRegra['nomenclatura_exame'] = ($GLOBALS['coreExt']['Config']->app->diario->nomenclatura_exame == 0 ? 'exame' : 'conselho'); + + //tipo de recuperação paralela + $tipoRecuperacaoParalela = $regra->get('tipoRecuperacaoParalela'); + + if ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::NAO_USAR) { + $itensRegra['tipo_recuperacao_paralela'] = 'nao_utiliza'; + } elseif ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::USAR_POR_ETAPA) { + $itensRegra['tipo_recuperacao_paralela'] = 'por_etapa'; + $itensRegra['media_recuperacao_paralela'] = $this->serviceBoletim()->getRegra()->get('mediaRecuperacaoParalela'); + } elseif ($tipoRecuperacaoParalela == RegraAvaliacao_Model_TipoRecuperacaoParalela::USAR_POR_ETAPAS_ESPECIFICAS) { + $itensRegra['tipo_recuperacao_paralela'] = 'etapas_especificas'; + + $etapa = $this->getRequest()->etapa; + if ($regraRecuperacao = $regra->getRegraRecuperacaoByEtapa($etapa)) { + $itensRegra['habilita_campo_etapa_especifica'] = $regraRecuperacao->getLastEtapa() == $etapa; + $itensRegra['tipo_recuperacao_paralela_nome'] = $regraRecuperacao->get('descricao'); + $itensRegra['tipo_recuperacao_paralela_nota_maxima'] = $regraRecuperacao->get('notaMaxima'); + } else { + $itensRegra['habilita_campo_etapa_especifica'] = false; + $itensRegra['tipo_recuperacao_paralela_nome'] = ''; + $itensRegra['tipo_recuperacao_paralela_nota_maxima'] = 0; + } + + } + if ($regra->get('notaGeralPorEtapa') == '1') { + $itensRegra['nota_geral_por_etapa'] = "SIM"; + } else { + $itensRegra['nota_geral_por_etapa'] = "NAO UTILIZA"; + } + + $itensRegra['definir_componente_por_etapa'] = $regra->get('definirComponentePorEtapa') == 1; + + return $itensRegra; + } + + protected function inserirAuditoriaNotas($notaAntiga, $notaNova) + { + if ($this->usaAuditoriaNotas()) { + $objAuditoria = new clsModulesAuditoriaNota($notaAntiga, $notaNova, $this->getRequest()->turma_id); + $objAuditoria->cadastra(); + } + } + + protected function usaAuditoriaNotas() + { + return ($GLOBALS['coreExt']['Config']->app->auditoria->notas == "1"); + } + + public function canChange() + { + $user = $this->getSession()->id_pessoa; + $processoAp = $this->_processoAp; + $obj_permissao = new clsPermissoes(); + + return $obj_permissao->permissao_cadastra($processoAp, $user, 7); + } + + public function postSituacao() + { + if ($this->canPostSituacaoAndNota()) { + $novaSituacao = $this->getRequest()->att_value; + $matriculaId = $this->getRequest()->matricula_id; + + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); + + $this->serviceBoletim()->alterarSituacao($novaSituacao, $matriculaId); + $this->messenger->append('Situação da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success'); + } else { + $this->messenger->append('Usuário não possui permissão para alterar a situação da matrícula.', 'error'); + } + } + + public function canPostSituacaoAndNota() + { + + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + $acesso = new clsPermissoes(); + session_write_close(); + return $acesso->permissao_cadastra(630, $this->pessoa_logada, 7, null, true); + + } + + public function Gerar() + { + if ($this->isRequestFor('get', 'matriculas')) { + $this->appendResponse('matriculas', $this->getMatriculas()); + $this->appendResponse('navegacao_tab', $this->getNavegacaoTab()); + $this->appendResponse('can_change', $this->canChange()); + } elseif ($this->isRequestFor('post', 'nota') || $this->isRequestFor('post', 'nota_exame')) { + $this->postNota(); + } elseif ($this->isRequestFor('post', 'nota_recuperacao_paralela')) { + $this->postNotaRecuperacaoParalela(); + } elseif ($this->isRequestFor('post', 'nota_recuperacao_especifica')) { + $this->postNotaRecuperacaoEspecifica(); + } elseif ($this->isRequestFor('post', 'falta')) { + $this->postFalta(); + } elseif ($this->isRequestFor('post', 'parecer')) { + $this->postParecer(); + } elseif ($this->isRequestFor('post', 'nota_geral')) { + $this->postNotaGeral(); + } elseif ($this->isRequestFor('post', 'media')) { + $this->postMedia(); + } elseif ($this->isRequestFor('delete', 'media')) { + $this->deleteMedia(); + } elseif ($this->isRequestFor('post', 'situacao')) { + $this->postSituacao(); + } elseif ($this->isRequestFor('delete', 'nota') || $this->isRequestFor('delete', 'nota_exame')) { + $this->deleteNota(); + } elseif ($this->isRequestFor('delete', 'nota_recuperacao_paralela')) { + $this->deleteNotaRecuperacaoParalela(); + } elseif ($this->isRequestFor('delete', 'nota_recuperacao_especifica')) { + $this->deleteNotaRecuperacaoEspecifica(); + } elseif ($this->isRequestFor('delete', 'falta')) { + $this->deleteFalta(); + } elseif ($this->isRequestFor('delete', 'parecer')) { + $this->deleteParecer(); + } elseif ($this->isRequestFor('delete', 'nota_geral')) { + $this->deleteNotaGeral(); + } else { + $this->notImplementedOperationError(); + } + + } +} From 951bc733fe60f3188a87db436f348665ce989811 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Fri, 27 Jul 2018 16:54:56 -0300 Subject: [PATCH 60/73] =?UTF-8?q?Valida=20se=20as=20notas=20das=20etapas?= =?UTF-8?q?=20anteriores=20foram=20lan=C3=A7adas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/Api/Views/DiarioController.php | 87 +++++++++++-------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/ieducar/modules/Api/Views/DiarioController.php b/ieducar/modules/Api/Views/DiarioController.php index b3a424f51e..a88470c6eb 100644 --- a/ieducar/modules/Api/Views/DiarioController.php +++ b/ieducar/modules/Api/Views/DiarioController.php @@ -173,53 +173,72 @@ protected function canPostPareceresPorEtapaGeral() protected function postNotas() { - if ($this->canPostNotas()) { - $etapa = $this->getRequest()->etapa; - $notas = $this->getRequest()->notas; + if (! $this->canPostNotas()) { + return false; + } - foreach ($notas as $turmaId => $notaTurma) { - foreach ($notaTurma as $alunoId => $notaTurmaAluno) { - $matriculaId = $this->findMatriculaByTurmaAndAluno($turmaId, $alunoId); + $etapa = $this->getRequest()->etapa; + $notas = $this->getRequest()->notas; - if (!empty($matriculaId)) { - foreach ($notaTurmaAluno as $componenteCurricularId => $notaTurmaAlunoDisciplina) { - if ($this->validateComponenteTurma($turmaId, $componenteCurricularId)) { - $valor = $notaTurmaAlunoDisciplina['nota']; - $notaRecuperacao = $notaTurmaAlunoDisciplina['recuperacao']; - $nomeCampoRecuperacao = $this->defineCampoTipoRecuperacao($matriculaId); - $valor = $this->truncate($valor, 4); + foreach ($notas as $turmaId => $notaTurma) { + foreach ($notaTurma as $alunoId => $notaTurmaAluno) { + $matriculaId = $this->findMatriculaByTurmaAndAluno($turmaId, $alunoId); - $recuperacaoEspecifica = $nomeCampoRecuperacao == 'notaRecuperacaoEspecifica'; + if (empty($matriculaId)) { + continue; + } - $notaAposRecuperacao = (($notaRecuperacao > $valor) ? $notaRecuperacao : $valor); + foreach ($notaTurmaAluno as $componenteCurricularId => $notaTurmaAlunoDisciplina) { + if (!$this->validateComponenteTurma($turmaId, $componenteCurricularId)) { + continue; + } - $valorNota = $recuperacaoEspecifica ? $valor : $notaAposRecuperacao; + $valor = $notaTurmaAlunoDisciplina['nota']; + $notaRecuperacao = $notaTurmaAlunoDisciplina['recuperacao']; + $nomeCampoRecuperacao = $this->defineCampoTipoRecuperacao($matriculaId); + $valor = $this->truncate($valor, 4); - $array_nota = [ - 'componenteCurricular' => $componenteCurricularId, - 'nota' => $valorNota, - 'etapa' => $etapa, - 'notaOriginal' => $valor]; + $recuperacaoEspecifica = $nomeCampoRecuperacao == 'notaRecuperacaoEspecifica'; - if (!empty($nomeCampoRecuperacao)) { - $array_nota[$nomeCampoRecuperacao] = $notaRecuperacao; - } + $notaAposRecuperacao = (($notaRecuperacao > $valor) ? $notaRecuperacao : $valor); - $nota = new Avaliacao_Model_NotaComponente($array_nota); + $valorNota = $recuperacaoEspecifica ? $valor : $notaAposRecuperacao; - if ($this->serviceBoletim($turmaId, $alunoId)) { - $this->serviceBoletim($turmaId, $alunoId)->addNota($nota); - $this->trySaveServiceBoletim($turmaId, $alunoId); + $array_nota = [ + 'componenteCurricular' => $componenteCurricularId, + 'nota' => $valorNota, + 'etapa' => $etapa, + 'notaOriginal' => $valor]; - $this->atualizaNotaNecessariaExame($turmaId, $alunoId, $componenteCurricularId); - } - } - } + if (!empty($nomeCampoRecuperacao)) { + $array_nota[$nomeCampoRecuperacao] = $notaRecuperacao; + } + + $nota = new Avaliacao_Model_NotaComponente($array_nota); + + if (! $serviceBoletim = $this->serviceBoletim($turmaId, $alunoId)) { + continue; } - } - $this->messenger->append('Notas postadas com sucesso!', 'success'); + try { + $serviceBoletim->verificaNotasLancadasNasEtapasAnteriores( + $etapa, $componenteCurricularId + ); + } catch (Exception $e) { + $this->messenger->append($e->getMessage(), 'error'); + + return false; + } + + $serviceBoletim->addNota($nota); + + $this->trySaveServiceBoletim($turmaId, $alunoId); + + $this->atualizaNotaNecessariaExame($turmaId, $alunoId, $componenteCurricularId); + } } + + $this->messenger->append('Notas postadas com sucesso!', 'success'); } } From c416d6e6637bf33de662220298b046a3d301623b Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Tue, 24 Jul 2018 15:40:03 -0300 Subject: [PATCH 61/73] =?UTF-8?q?Verifica=20se=20a=20fun=C3=A7=C3=A3o=20de?= =?UTF-8?q?bug()=20n=C3=A3o=20existes=20antes=20de=20registr=C3=A1-la?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/includes/bootstrap.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ieducar/includes/bootstrap.php b/ieducar/includes/bootstrap.php index c6c0b956e8..b6bc575db8 100644 --- a/ieducar/includes/bootstrap.php +++ b/ieducar/includes/bootstrap.php @@ -119,12 +119,14 @@ chdir($root . DS . 'intranet'); unset($root, $paths); -// função pra ajudar no debug -function debug($var) { - $backtrace = debug_backtrace(); - $template = '
%s linha %d
'; - echo sprintf($template, $backtrace[0]['file'], $backtrace[0]['line']); - echo '
';
-    print_r($var);
-    echo '
'; +if (! function_exists('debug')) { + + function debug($var) { + $backtrace = debug_backtrace(); + $template = '
%s linha %d
'; + echo sprintf($template, $backtrace[0]['file'], $backtrace[0]['line']); + echo '
';
+        print_r($var);
+        echo '
'; + } } From 2f611a28d138016f751804e841ba9e438312f154 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Tue, 24 Jul 2018 19:07:11 -0300 Subject: [PATCH 62/73] =?UTF-8?q?Inicializar=20par=C3=A2metros=20com=20val?= =?UTF-8?q?or=20default=20em=20clsCampos::campoTexto()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/include/clsCampos.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ieducar/intranet/include/clsCampos.inc.php b/ieducar/intranet/include/clsCampos.inc.php index 7ee08f96c4..f4b5324aca 100644 --- a/ieducar/intranet/include/clsCampos.inc.php +++ b/ieducar/intranet/include/clsCampos.inc.php @@ -958,8 +958,8 @@ public function campoTexto( $nome, $campo, $valor, - $tamanhovisivel, - $tamanhomaximo, + $tamanhovisivel = null, + $tamanhomaximo = null, $obrigatorio = false, $expressao = false, $duplo = false, @@ -1432,7 +1432,7 @@ classe = (classe == \'formmdtd\')? \'formlttd tr_\' + This.nome : \'formmdtd tr_ '; continue; } - + if (preg_match('/^(tab_name_[0-9]+)/', $nome) === 1) { $retorno .= "
"; $retorno .= ''; From 0973f1eb4b93f6a07e87adbaaeadf3bdc971ba70 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Thu, 26 Jul 2018 16:38:52 -0300 Subject: [PATCH 63/73] =?UTF-8?q?Define=20valor=20default=20para=20par?= =?UTF-8?q?=C3=A2metro=20no=20construtor=20de=20clsPmieducarBloqueioAnoLet?= =?UTF-8?q?ivo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../include/pmieducar/clsPmieducarBloqueioAnoLetivo.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarBloqueioAnoLetivo.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarBloqueioAnoLetivo.inc.php index 7e6b76c85b..feef4d64ee 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarBloqueioAnoLetivo.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarBloqueioAnoLetivo.inc.php @@ -100,7 +100,7 @@ class clsPmieducarBloqueioAnoLetivo /** * Constructor */ - function __construct( $ref_cod_instituicao = null, $ref_ano = null, $data_inicio = null, $data_fim) + function __construct( $ref_cod_instituicao = null, $ref_ano = null, $data_inicio = null, $data_fim = null) { $db = new clsBanco(); $this->_schema = "pmieducar."; From c2754e8ee5f78f56336cb5dab150150adee6e995 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Thu, 26 Jul 2018 16:39:39 -0300 Subject: [PATCH 64/73] Adiciona supressor de erros em CoreExt_Session_Storage_Default --- ieducar/lib/CoreExt/Session/Storage/Default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ieducar/lib/CoreExt/Session/Storage/Default.php b/ieducar/lib/CoreExt/Session/Storage/Default.php index 8e9e3cf702..37fea55ccb 100644 --- a/ieducar/lib/CoreExt/Session/Storage/Default.php +++ b/ieducar/lib/CoreExt/Session/Storage/Default.php @@ -108,7 +108,7 @@ public function remove($key) */ public function start() { - if (!$this->isStarted() && session_start()) { + if (!$this->isStarted() && @session_start()) { self::$_sessionStarted = TRUE; self::$_sessionId = session_id(); } @@ -161,4 +161,4 @@ public function getSessionData() { return $_SESSION; } -} \ No newline at end of file +} From e57745c9ecaba962a97e5c738518bf060eaad8b4 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Thu, 26 Jul 2018 16:43:32 -0300 Subject: [PATCH 65/73] =?UTF-8?q?Passa=20par=C3=A2metro=20obrigat=C3=B3rio?= =?UTF-8?q?=20para=20m=C3=A9todo=20input()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Avaliacao/Views/DiarioController.php | 198 +++++++++--------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/ieducar/modules/Avaliacao/Views/DiarioController.php b/ieducar/modules/Avaliacao/Views/DiarioController.php index 15a10a7252..117507ce5d 100644 --- a/ieducar/modules/Avaliacao/Views/DiarioController.php +++ b/ieducar/modules/Avaliacao/Views/DiarioController.php @@ -1,99 +1,99 @@ - - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Lucas D'Avila - * @category i-Educar - * @license @@license@@ - * @package Avaliacao - * @subpackage Modules - * @since Arquivo disponível desde a versão ? - * @version $Id$ - */ - -require_once 'Portabilis/Controller/Page/ListController.php'; -require_once 'lib/Portabilis/View/Helper/Application.php'; -require_once 'Portabilis/Business/Professor.php'; - -/** - * DiarioController class. - * - * @author Lucas D'Avila - * @category i-Educar - * @license @@license@@ - * @package Avaliacao - * @subpackage Modules - * @since Classe disponível desde a versão 1.1.0 - * @version @@package_version@@ - */ - -class DiarioController extends Portabilis_Controller_Page_ListController -{ - protected $_titulo = 'Lançamento por turma'; - protected $_processoAp = 642; - - public function Gerar() { - - $userId = Portabilis_Utils_User::currentUserId(); - $componenteRequired = $isProfessor = Portabilis_Business_Professor::isProfessor(false, $userId); - - $this->inputsHelper()->input('ano'); - $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie', 'turma', 'etapa')); - $this->inputsHelper()->dynamic(array('componenteCurricularForDiario'), array('required' => $componenteRequired)); - $this->inputsHelper()->dynamic(array('matricula'), array('required' => FALSE )); - - $navegacaoTab = array('1' => 'Horizontal(padrão)', - '2' => 'Vertical',); - - $options = array('label' =>'Navegação do cursor(tab)', - 'resources' => $navegacaoTab, - 'required' => false, - 'inline' => true, - 'value' => $navegacaoTab[1]); - - $this->inputsHelper()->select('navegacao_tab', $options); - - $this->inputsHelper()->hidden('mostrar_botao_replicar_todos', array('value' => $teste = $GLOBALS['coreExt']['Config']->app->faltas_notas->mostrar_botao_replicar)); - - $this->loadResourceAssets($this->getDispatcher()); - } - - protected function _preRender(){ - - parent::_preRender(); - - Portabilis_View_Helper_Application::loadStylesheet($this, 'intranet/styles/localizacaoSistema.css'); - - $localizacao = new LocalizacaoSistema(); - - $localizacao->entradaCaminhos( array( - $_SERVER['SERVER_NAME']."/intranet" => "Início", - "educar_index.php" => "Escola", - "" => "Lançamento de notas" - )); - $this->enviaLocalizacao($localizacao->montar(), true); - } -} -?> - + + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Lucas D'Avila + * @category i-Educar + * @license @@license@@ + * @package Avaliacao + * @subpackage Modules + * @since Arquivo disponível desde a versão ? + * @version $Id$ + */ + +require_once 'Portabilis/Controller/Page/ListController.php'; +require_once 'lib/Portabilis/View/Helper/Application.php'; +require_once 'Portabilis/Business/Professor.php'; + +/** + * DiarioController class. + * + * @author Lucas D'Avila + * @category i-Educar + * @license @@license@@ + * @package Avaliacao + * @subpackage Modules + * @since Classe disponível desde a versão 1.1.0 + * @version @@package_version@@ + */ + +class DiarioController extends Portabilis_Controller_Page_ListController +{ + protected $_titulo = 'Lançamento por turma'; + protected $_processoAp = 642; + + public function Gerar() { + + $userId = Portabilis_Utils_User::currentUserId(); + $componenteRequired = $isProfessor = Portabilis_Business_Professor::isProfessor(false, $userId); + + $this->inputsHelper()->input('ano', 'ano'); + $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie', 'turma', 'etapa')); + $this->inputsHelper()->dynamic(array('componenteCurricularForDiario'), array('required' => $componenteRequired)); + $this->inputsHelper()->dynamic(array('matricula'), array('required' => FALSE )); + + $navegacaoTab = array('1' => 'Horizontal(padrão)', + '2' => 'Vertical',); + + $options = array('label' =>'Navegação do cursor(tab)', + 'resources' => $navegacaoTab, + 'required' => false, + 'inline' => true, + 'value' => $navegacaoTab[1]); + + $this->inputsHelper()->select('navegacao_tab', $options); + + $this->inputsHelper()->hidden('mostrar_botao_replicar_todos', array('value' => $teste = $GLOBALS['coreExt']['Config']->app->faltas_notas->mostrar_botao_replicar)); + + $this->loadResourceAssets($this->getDispatcher()); + } + + protected function _preRender(){ + + parent::_preRender(); + + Portabilis_View_Helper_Application::loadStylesheet($this, 'intranet/styles/localizacaoSistema.css'); + + $localizacao = new LocalizacaoSistema(); + + $localizacao->entradaCaminhos( array( + $_SERVER['SERVER_NAME']."/intranet" => "Início", + "educar_index.php" => "Escola", + "" => "Lançamento de notas" + )); + $this->enviaLocalizacao($localizacao->montar(), true); + } +} +?> + From ee55c7e77400b7388884358b45f4259111b735e5 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Thu, 26 Jul 2018 16:51:21 -0300 Subject: [PATCH 66/73] =?UTF-8?q?Dispara=20exce=C3=A7=C3=A3o=20quando=20em?= =?UTF-8?q?=20modo=20debug=20ao=20inv=C3=A9s=20de=20enviar=20e-mail=20ou?= =?UTF-8?q?=20redirecionar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/include/clsBase.inc.php | 5 +++++ ieducar/module/index.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ieducar/intranet/include/clsBase.inc.php b/ieducar/intranet/include/clsBase.inc.php index a26f46897c..72dbfef1e7 100644 --- a/ieducar/intranet/include/clsBase.inc.php +++ b/ieducar/intranet/include/clsBase.inc.php @@ -870,6 +870,11 @@ function MakeAll() ); } } catch (Exception $e) { + + if (getenv('APP_DEBUG')) { + throw new \Exception($e->getMessage(), 0, $e); + } + $lastError = error_get_last(); @session_start(); diff --git a/ieducar/module/index.php b/ieducar/module/index.php index 2b819f57c1..01998e6159 100644 --- a/ieducar/module/index.php +++ b/ieducar/module/index.php @@ -72,6 +72,11 @@ print $frontController->getViewContents(); } catch (Exception $e) { + + if (getenv('APP_DEBUG')) { + throw $e; + } + $lastError = error_get_last(); @session_start(); From 8f0143d0c2008807bec558da21d8d67cbf71f3ee Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Thu, 26 Jul 2018 16:52:16 -0300 Subject: [PATCH 67/73] Converte stackTrace para JSON --- .../Error/Mailers/NotificationMailer.php | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/ieducar/modules/Error/Mailers/NotificationMailer.php b/ieducar/modules/Error/Mailers/NotificationMailer.php index a7f550feaa..baf1c5a5b6 100644 --- a/ieducar/modules/Error/Mailers/NotificationMailer.php +++ b/ieducar/modules/Error/Mailers/NotificationMailer.php @@ -122,25 +122,8 @@ protected function tryLoadUser() return $user; } - protected function stackTrace() { - $stack = debug_backtrace(); - $output = ''; - - $stackLen = count($stack); - for ($i = 1; $i < $stackLen; $i++) { - $entry = $stack[$i]; - - $func = $entry['function'] . '('; - $argsLen = count($entry['args']); - for ($j = 0; $j < $argsLen; $j++) { - $func .= $entry['args'][$j]; - if ($j < $argsLen - 1) $func .= ', '; - } - $func .= ')'; - - $output .= '#' . ($i - 1) . ' ' . $entry['file'] . ':' . $entry['line'] . ' - ' . $func . PHP_EOL; - } - - return $output; + protected function stackTrace() + { + return json_encode(debug_backtrace()); } } From e798d8b977a351fdb7520cdc503af16be8073713 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Sun, 29 Jul 2018 22:58:50 -0300 Subject: [PATCH 68/73] Define valor default para contrutor da classe clsPublicBairro --- ieducar/intranet/include/public/clsPublicBairro.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ieducar/intranet/include/public/clsPublicBairro.inc.php b/ieducar/intranet/include/public/clsPublicBairro.inc.php index a7198e92c7..0eeea1783b 100644 --- a/ieducar/intranet/include/public/clsPublicBairro.inc.php +++ b/ieducar/intranet/include/public/clsPublicBairro.inc.php @@ -128,7 +128,7 @@ class clsPublicBairro function __construct($idmun = NULL, $geom = NULL, $idbai = NULL, $nome = NULL, $idpes_rev = NULL, $data_rev = NULL, $origem_gravacao = NULL, $idpes_cad = NULL, $data_cad = NULL, $operacao = NULL, $idsis_rev = NULL, - $idsis_cad = NULL, $zona_localizacao = 1, $iddis) + $idsis_cad = NULL, $zona_localizacao = 1, $iddis = null) { $db = new clsBanco(); $this->_schema = 'public.'; @@ -795,4 +795,4 @@ function getOrderby() } return ''; } -} \ No newline at end of file +} From 1cfa402957028e85117a9d20daccedc38d812516 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Sun, 29 Jul 2018 22:59:48 -0300 Subject: [PATCH 69/73] =?UTF-8?q?Valor=20default=20para=20par=C3=A2metros?= =?UTF-8?q?=20de=20clsCampos::campoNumero?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/include/clsCampos.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ieducar/intranet/include/clsCampos.inc.php b/ieducar/intranet/include/clsCampos.inc.php index f4b5324aca..482567887d 100644 --- a/ieducar/intranet/include/clsCampos.inc.php +++ b/ieducar/intranet/include/clsCampos.inc.php @@ -826,8 +826,8 @@ public function campoNumero( $nome, $campo, $valor, - $tamanhovisivel, - $tamanhomaximo, + $tamanhovisivel = null, + $tamanhomaximo = null, $obrigatorio = false, $descricao = '', $descricao2 = '', From 7db29f02099d0f0f529a6a55e869e7dbb0200de1 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Sun, 29 Jul 2018 23:08:00 -0300 Subject: [PATCH 70/73] =?UTF-8?q?Remove=20par=C3=A2metro=20n=C3=A3o=20util?= =?UTF-8?q?izado=20em=20clsPublicUf::verificaDuplicidade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/include/public/clsPublicUf.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ieducar/intranet/include/public/clsPublicUf.inc.php b/ieducar/intranet/include/public/clsPublicUf.inc.php index dddf997a2a..37a79caeda 100644 --- a/ieducar/intranet/include/public/clsPublicUf.inc.php +++ b/ieducar/intranet/include/public/clsPublicUf.inc.php @@ -471,7 +471,7 @@ function getOrderby() return ""; } - function verificaDuplicidade($sigla_uf){ + function verificaDuplicidade(){ $db = new clsBanco(); $sql = "SELECT sigla_uf FROM public.uf @@ -481,4 +481,4 @@ function verificaDuplicidade($sigla_uf){ } } -?> \ No newline at end of file +?> From d092d1d99fff0afc410f0ce2c97c00e8667e6e64 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Mon, 30 Jul 2018 13:47:01 -0300 Subject: [PATCH 71/73] =?UTF-8?q?Corre=C3=A7=C3=B5es=20necess=C3=A1rias=20?= =?UTF-8?q?para=20a=20listagem=20de=20pa=C3=ADs=20funcionar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/intranet/include/clsCampos.inc.php | 6 ++--- ieducar/intranet/include/clsListagem.inc.php | 26 ++++++++++--------- .../include/clsMenuFuncionario.inc.php | 4 +-- ieducar/intranet/public_pais_lst.php | 4 +-- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ieducar/intranet/include/clsCampos.inc.php b/ieducar/intranet/include/clsCampos.inc.php index 482567887d..09be9ce81c 100644 --- a/ieducar/intranet/include/clsCampos.inc.php +++ b/ieducar/intranet/include/clsCampos.inc.php @@ -1397,7 +1397,7 @@ classe = (classe == \'formmdtd\')? \'formlttd tr_\' + This.nome : \'formmdtd tr_ $md = $md ? false : true; $index = 0; - while (list($nome, $componente) = each($arr_campos)) { + foreach ($arr_campos as $nome => $componente) { $nome_add = $nome; $campo_tabela = false; @@ -1758,7 +1758,7 @@ classe = (classe == \'formmdtd\')? \'formlttd tr_\' + This.nome : \'formmdtd tr_ $name = ''; } - $style = ($componente['tr_invisivel']) ? + $style = isset($componente['tr_invisivel']) ? 'style=\'visibility:collapse\'' : ''; $explicacao = ($componente[6]) ? @@ -2705,7 +2705,7 @@ function get_{$componente[11]}Done() break; } // endswitch - if ($this->erros[$nome]) { + if (isset($this->erros[$nome])) { $retorno .= '
' . $this->erros[$nome] . ''; } diff --git a/ieducar/intranet/include/clsListagem.inc.php b/ieducar/intranet/include/clsListagem.inc.php index d5e3ae118b..46edf3d8bd 100644 --- a/ieducar/intranet/include/clsListagem.inc.php +++ b/ieducar/intranet/include/clsListagem.inc.php @@ -396,7 +396,7 @@ function RenderHTML() if ($this->campos) { reset($this->campos); - while (list($nome, $componente) = each($this->campos)) { + foreach ($this->campos as $nome => $componente) { if ($componente[0] == 'oculto' || $componente[0] == 'rotulo') { $retorno .= ""; } @@ -454,7 +454,7 @@ function RenderHTML() $retorno .= ""; if ($this->exibirBotaoSubmit) { - if ($this->botao_submit) { + if (isset($this->botao_submit)) { $retorno .= "  "; } else { @@ -515,12 +515,14 @@ function RenderHTML() reset( $this->colunas ); } - $retorno .= ""; - $retorno .= ""; + $ordenacao = $_POST['ordenacao'] ?? ''; + $fonte = $_POST['fonte'] ?? ''; + $retorno .= ""; + $retorno .= ""; $retorno .= "
"; - while (list($i, $texto) = each($this->cabecalho)) { + foreach ($this->cabecalho as $i => $texto) { if (!empty( $this->colunas )) { list($i, $fmt) = each($this->colunas); } @@ -556,7 +558,7 @@ function RenderHTML() else { reset($this->linhas); - while (list($i, $linha) = each($this->linhas)) { + foreach ($this->linhas as $i => $linha) { $classe = ($i % 2) ? 'formmdtd' : 'formlttd'; $retorno .= " "; @@ -568,9 +570,9 @@ function RenderHTML() reset( $this->colunas ); } - while (list($i, $celula) = each($linha)) { + foreach ($linha as $i => $celula) { if (!empty( $this->colunas)) { - list($i, $fmt) = each($this->colunas); + list($fmt) = current($this->colunas); } else { $fmt = alTopLeft; @@ -721,10 +723,10 @@ function RenderHTML() $botao = ''; - if($this->acao_voltar) { + if(isset($this->acao_voltar)) { $botao = "   "; } - if($this->acao_imprimir) { + if(isset($this->acao_imprimir)) { $botao = "   "; } if ($this->acao && $this->show_botao_novo) { @@ -744,12 +746,12 @@ function RenderHTML()
"; - if (count($this->array_botao_script)) { + if (is_array($this->array_botao_script) && count($this->array_botao_script)) { for ($i = 0; $i < count($this->array_botao); $i++) { $retorno .= "  \n"; } } - else { + elseif (is_array($this->array_botao)) { for ($i = 0; $i < count($this->array_botao); $i++) { $retorno .= "  \n"; } diff --git a/ieducar/intranet/include/clsMenuFuncionario.inc.php b/ieducar/intranet/include/clsMenuFuncionario.inc.php index defe712e3b..29269622f6 100644 --- a/ieducar/intranet/include/clsMenuFuncionario.inc.php +++ b/ieducar/intranet/include/clsMenuFuncionario.inc.php @@ -44,7 +44,7 @@ class clsMenuFuncionario { var $ref_ref_cod_pessoa_fj = FALSE; var $cadastra = FALSE; - var $exclui = FALSE; + var $exclui = FALSE; var $ref_cod_menu_submenu = FALSE; /** @@ -257,4 +257,4 @@ function detalhe() return FALSE; } -} \ No newline at end of file +} diff --git a/ieducar/intranet/public_pais_lst.php b/ieducar/intranet/public_pais_lst.php index 2a572e1d62..8ce4373a04 100644 --- a/ieducar/intranet/public_pais_lst.php +++ b/ieducar/intranet/public_pais_lst.php @@ -99,7 +99,7 @@ function Gerar() // Paginador $this->__limite = 20; - $this->__offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->__limite-$this->__limite: 0; + $this->__offset = isset($_GET["pagina_{$this->nome}"]) ? $_GET["pagina_{$this->nome}"] * $this->__limite-$this->__limite : 0; $obj_pais = new clsPublicPais(); $obj_pais->setOrderby( "nome ASC" ); @@ -151,4 +151,4 @@ function Gerar() $pagina->addForm( $miolo ); // gera o html $pagina->MakeAll(); -?> \ No newline at end of file +?> From 833f45dc590166a6cbb6779686a0e91c85eabc83 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Thu, 9 Aug 2018 15:27:10 -0300 Subject: [PATCH 72/73] =?UTF-8?q?Corre=C3=A7=C3=B5es=20solicitadas=20no=20?= =?UTF-8?q?code=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ieducar/includes/bootstrap.php | 2 +- ieducar/intranet/include/clsListagem.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ieducar/includes/bootstrap.php b/ieducar/includes/bootstrap.php index b6bc575db8..3980425797 100644 --- a/ieducar/includes/bootstrap.php +++ b/ieducar/includes/bootstrap.php @@ -119,7 +119,7 @@ chdir($root . DS . 'intranet'); unset($root, $paths); -if (! function_exists('debug')) { +if (!function_exists('debug')) { function debug($var) { $backtrace = debug_backtrace(); diff --git a/ieducar/intranet/include/clsListagem.inc.php b/ieducar/intranet/include/clsListagem.inc.php index 46edf3d8bd..ee5a33ddaf 100644 --- a/ieducar/intranet/include/clsListagem.inc.php +++ b/ieducar/intranet/include/clsListagem.inc.php @@ -572,7 +572,7 @@ function RenderHTML() foreach ($linha as $i => $celula) { if (!empty( $this->colunas)) { - list($fmt) = current($this->colunas); + $fmt = current($this->colunas); } else { $fmt = alTopLeft; From 09458904fec238f24d5ec0fb83b64877da3e6413 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Fri, 10 Aug 2018 15:28:33 -0300 Subject: [PATCH 73/73] =?UTF-8?q?Atualiza=20depend=C3=AAncias=20do=20compo?= =?UTF-8?q?ser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.lock | 326 +++++++++++++++++++++++++------------------------- 1 file changed, 165 insertions(+), 161 deletions(-) diff --git a/composer.lock b/composer.lock index 4d6b91ec41..070325f068 100644 --- a/composer.lock +++ b/composer.lock @@ -226,28 +226,30 @@ }, { "name": "google/recaptcha", - "version": "1.1.3", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/google/recaptcha.git", - "reference": "5a56d15ca10a7b75158178752b2ad8f755eb4f78" + "reference": "e7add3be59211482ecdb942288f52da64a35f61a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/recaptcha/zipball/5a56d15ca10a7b75158178752b2ad8f755eb4f78", - "reference": "5a56d15ca10a7b75158178752b2ad8f755eb4f78", + "url": "https://api.github.com/repos/google/recaptcha/zipball/e7add3be59211482ecdb942288f52da64a35f61a", + "reference": "e7add3be59211482ecdb942288f52da64a35f61a", "shasum": "" }, "require": { "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.8" + "friendsofphp/php-cs-fixer": "^2.2.20|^2.12", + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -259,15 +261,15 @@ "license": [ "BSD-3-Clause" ], - "description": "Client library for reCAPTCHA, a free service that protect websites from spam and abuse.", - "homepage": "http://www.google.com/recaptcha/", + "description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.", + "homepage": "https://www.google.com/recaptcha/", "keywords": [ "Abuse", "captcha", "recaptcha", "spam" ], - "time": "2017-03-09T18:44:34+00:00" + "time": "2018-08-05T09:31:53+00:00" }, { "name": "portabilis/jasperphp", @@ -484,16 +486,16 @@ }, { "name": "symfony/config", - "version": "v3.4.12", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "1fffdeb349ff36a25184e5564c25289b1dbfc402" + "reference": "7b08223b7f6abd859651c56bcabf900d1627d085" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/1fffdeb349ff36a25184e5564c25289b1dbfc402", - "reference": "1fffdeb349ff36a25184e5564c25289b1dbfc402", + "url": "https://api.github.com/repos/symfony/config/zipball/7b08223b7f6abd859651c56bcabf900d1627d085", + "reference": "7b08223b7f6abd859651c56bcabf900d1627d085", "shasum": "" }, "require": { @@ -544,20 +546,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-06-19T14:02:58+00:00" + "time": "2018-07-26T11:19:56+00:00" }, { "name": "symfony/console", - "version": "v3.4.12", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "1b97071a26d028c9bd4588264e101e14f6e7cd00" + "reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/1b97071a26d028c9bd4588264e101e14f6e7cd00", - "reference": "1b97071a26d028c9bd4588264e101e14f6e7cd00", + "url": "https://api.github.com/repos/symfony/console/zipball/6b217594552b9323bcdcfc14f8a0ce126e84cd73", + "reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73", "shasum": "" }, "require": { @@ -613,36 +615,36 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-05-23T05:02:55+00:00" + "time": "2018-07-26T11:19:56+00:00" }, { "name": "symfony/debug", - "version": "v3.4.12", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "47e6788c5b151cf0cfdf3329116bf33800632d75" + "reference": "9316545571f079c4dd183e674721d9dc783ce196" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/47e6788c5b151cf0cfdf3329116bf33800632d75", - "reference": "47e6788c5b151cf0cfdf3329116bf33800632d75", + "url": "https://api.github.com/repos/symfony/debug/zipball/9316545571f079c4dd183e674721d9dc783ce196", + "reference": "9316545571f079c4dd183e674721d9dc783ce196", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": "^7.1.3", "psr/log": "~1.0" }, "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "symfony/http-kernel": "<3.4" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "symfony/http-kernel": "~3.4|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -669,30 +671,30 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-06-25T11:10:40+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.12", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "8a721a5f2553c6c3482b1c5b22ed60fe94dd63ed" + "reference": "2e30335e0aafeaa86645555959572fe7cea22b43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/8a721a5f2553c6c3482b1c5b22ed60fe94dd63ed", - "reference": "8a721a5f2553c6c3482b1c5b22ed60fe94dd63ed", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/2e30335e0aafeaa86645555959572fe7cea22b43", + "reference": "2e30335e0aafeaa86645555959572fe7cea22b43", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": "^7.1.3", "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -719,29 +721,32 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-06-21T11:10:19+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "suggest": { + "ext-ctype": "For best performance" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -774,20 +779,20 @@ "polyfill", "portable" ], - "time": "2018-04-30T19:57:29+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", "shasum": "" }, "require": { @@ -799,7 +804,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -833,20 +838,20 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.12", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0" + "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c5010cc1692ce1fa328b1fb666961eb3d4a85bb0", - "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0", + "url": "https://api.github.com/repos/symfony/yaml/zipball/810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", + "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", "shasum": "" }, "require": { @@ -892,7 +897,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-05-03T23:18:14+00:00" + "time": "2018-07-26T11:19:56+00:00" } ], "packages-dev": [ @@ -1004,30 +1009,30 @@ }, { "name": "doctrine/annotations", - "version": "v1.4.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": "^5.6 || ^7.0" + "php": "^7.1" }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -1068,36 +1073,36 @@ "docblock", "parser" ], - "time": "2017-02-24T16:22:25+00:00" + "time": "2017-12-06T07:11:42+00:00" }, { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1122,7 +1127,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2017-07-22T11:58:36+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -1217,25 +1222,28 @@ }, { "name": "myclabs/deep-copy", - "version": "1.7.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { @@ -1258,37 +1266,33 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "time": "2018-06-11T23:09:50+00:00" }, { "name": "paragonie/random_compat", - "version": "v2.0.17", + "version": "v9.99.99", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d" + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d", - "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", "shasum": "" }, "require": { - "php": ">=5.2.0" + "php": "^7" }, "require-dev": { - "phpunit/phpunit": "4.*|5.*" + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" }, "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, "type": "library", - "autoload": { - "files": [ - "lib/random.php" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -1307,7 +1311,7 @@ "pseudorandom", "random" ], - "time": "2018-07-04T16:31:37+00:00" + "time": "2018-07-02T15:55:56+00:00" }, { "name": "phar-io/manifest", @@ -1616,16 +1620,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.7.6", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { @@ -1637,12 +1641,12 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -1675,7 +1679,7 @@ "spy", "stub" ], - "time": "2018-04-18T13:57:24+00:00" + "time": "2018-08-05T17:53:17+00:00" }, { "name": "phpunit/dbunit", @@ -1980,16 +1984,16 @@ }, { "name": "phpunit/phpunit", - "version": "6.5.9", + "version": "6.5.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "093ca5508174cd8ab8efe44fd1dde447adfdec8f" + "reference": "7bab54cb366076023bbf457a2a0d513332cd40f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/093ca5508174cd8ab8efe44fd1dde447adfdec8f", - "reference": "093ca5508174cd8ab8efe44fd1dde447adfdec8f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7bab54cb366076023bbf457a2a0d513332cd40f2", + "reference": "7bab54cb366076023bbf457a2a0d513332cd40f2", "shasum": "" }, "require": { @@ -2007,7 +2011,7 @@ "phpunit/php-file-iterator": "^1.4.3", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.5", + "phpunit/phpunit-mock-objects": "^5.0.9", "sebastian/comparator": "^2.1", "sebastian/diff": "^2.0", "sebastian/environment": "^3.1", @@ -2060,20 +2064,20 @@ "testing", "xunit" ], - "time": "2018-07-03T06:40:40+00:00" + "time": "2018-08-07T07:05:35+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "5.0.8", + "version": "5.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f" + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f", - "reference": "6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", "shasum": "" }, "require": { @@ -2086,7 +2090,7 @@ "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^6.5" + "phpunit/phpunit": "^6.5.11" }, "suggest": { "ext-soap": "*" @@ -2119,7 +2123,7 @@ "mock", "xunit" ], - "time": "2018-07-13T03:27:23+00:00" + "time": "2018-08-09T05:50:03+00:00" }, { "name": "phpunit/phpunit-selenium", @@ -2756,30 +2760,30 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.4.12", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8" + "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fdd5abcebd1061ec647089c6c41a07ed60af09f8", - "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bfb30c2ad377615a463ebbc875eba64a99f6aa3e", + "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.4" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0" }, "suggest": { "symfony/dependency-injection": "", @@ -2788,7 +2792,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2815,29 +2819,29 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-04-06T07:35:25+00:00" + "time": "2018-07-26T09:10:45+00:00" }, { "name": "symfony/finder", - "version": "v3.4.12", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394" + "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394", - "reference": "3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394", + "url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068", + "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2864,29 +2868,29 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-06-19T20:52:10+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/options-resolver", - "version": "v3.4.12", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "cc5e98ed91688a22a7162a8800096356f9076b1d" + "reference": "1913f1962477cdbb13df951f8147d5da1fe2412c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc5e98ed91688a22a7162a8800096356f9076b1d", - "reference": "cc5e98ed91688a22a7162a8800096356f9076b1d", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/1913f1962477cdbb13df951f8147d5da1fe2412c", + "reference": "1913f1962477cdbb13df951f8147d5da1fe2412c", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2918,30 +2922,30 @@ "configuration", "options" ], - "time": "2018-05-30T04:26:49+00:00" + "time": "2018-07-26T08:55:25+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6" + "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934", + "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0", + "paragonie/random_compat": "~1.0|~2.0|~9.99", "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2977,20 +2981,20 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46" + "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/a4576e282d782ad82397f3e4ec1df8e0f0cafb46", - "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae", + "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae", "shasum": "" }, "require": { @@ -2999,7 +3003,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -3032,29 +3036,29 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/process", - "version": "v3.4.12", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "acc5a37c706ace827962851b69705b24e71ca17c" + "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/acc5a37c706ace827962851b69705b24e71ca17c", - "reference": "acc5a37c706ace827962851b69705b24e71ca17c", + "url": "https://api.github.com/repos/symfony/process/zipball/f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", + "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -3081,29 +3085,29 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-05-30T04:24:30+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.4.12", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af" + "reference": "966c982df3cca41324253dc0c7ffe76b6076b705" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/eb17cfa072cab26537ac37e9c4ece6c0361369af", - "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/966c982df3cca41324253dc0c7ffe76b6076b705", + "reference": "966c982df3cca41324253dc0c7ffe76b6076b705", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -3130,7 +3134,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2018-02-17T14:55:25+00:00" + "time": "2018-07-26T11:00:49+00:00" }, { "name": "theseer/tokenizer", @@ -3232,4 +3236,4 @@ "php": "~7.0" }, "platform-dev": [] -} \ No newline at end of file +}