protected function loadDadosForMatricula($matriculaId) { $sql = "select cod_matricula as id, ref_cod_aluno as aluno_id, matricula.ano,\n escola.ref_cod_instituicao as instituicao_id, matricula.ref_ref_cod_escola\n as escola_id, matricula.ref_cod_curso as curso_id, matricula.ref_ref_cod_serie\n as serie_id, matricula_turma.ref_cod_turma as turma_id from\n pmieducar.matricula_turma, pmieducar.matricula, pmieducar.escola where escola.cod_escola =\n matricula.ref_ref_cod_escola and ref_cod_matricula = cod_matricula and ref_cod_matricula =\n \$1 and matricula.ativo = matricula_turma.ativo and matricula_turma.ativo = 1 order by\n matricula_turma.sequencial limit 1"; $dadosMatricula = $this->fetchPreparedQuery($sql, $matriculaId, false, 'first-row'); $attrs = array('id', 'aluno_id', 'ano', 'instituicao_id', 'escola_id', 'curso_id', 'serie_id', 'turma_id'); return Portabilis_Array_Utils::filter($dadosMatricula, $attrs); }
protected function inputOptions($options) { $resources = $options['resources']; $instituicaoId = $this->getInstituicaoId($options['instituicaoId']); $escolaId = $this->getEscolaId($options['escolaId']); $serieId = $this->getSerieId($options['serieId']); $ano = $this->viewInstance->ano; $userId = $this->getCurrentUserId(); $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); if ($escolaId and $serieId and empty($resources) and $isProfessor) { $turmas = Portabilis_Business_Professor::turmasAlocado($escolaId, $serieId, $userId); $resources = Portabilis_Array_Utils::setAsIdValue($turmas, 'id', 'nome'); } elseif ($escolaId && $serieId && empty($resources)) { $resources = App_Model_IedFinder::getTurmas($escolaId, $serieId); } // caso no letivo esteja definido para filtrar turmas por ano, // somente exibe as turmas do ano letivo. if ($escolaId && $ano && $this->turmasPorAno($escolaId, $ano)) { foreach ($resources as $id => $nome) { $turma = new clsPmieducarTurma(); $turma->cod_turma = $id; $turma = $turma->detalhe(); if ($turma['ano'] != $ano) { unset($resources[$id]); } } } return $this->insertOption(null, "Selecione uma turma", $resources); }
protected function getOptions($resources) { if (empty($resources)) { $resources = new clsPmieducarAcervoAssunto(); $resources = $resources->lista(); $resources = Portabilis_Array_Utils::setAsIdValue($resources, 'cod_acervo_assunto', 'nm_assunto'); } return $this->insertOption(null, '', $resources); }
protected function getOptions($resources) { if (empty($resources)) { $resources = new clsCadastroDeficiencia(); $resources = $resources->lista(); $resources = Portabilis_Array_Utils::setAsIdValue($resources, 'cod_deficiencia', 'nm_deficiencia'); } return $this->insertOption(null, '', $resources); }
protected function inputOptions($options) { $resources = $options['resources']; if (empty($resources)) { $resources = new clsPmieducarAlunoBeneficio(); $resources = $resources->lista(null, null, null, null, null, null, null, null, null, 1); $resources = Portabilis_Array_Utils::setAsIdValue($resources, 'cod_aluno_beneficio', 'nm_beneficio'); } return $this->insertOption(null, "Beneficio", $resources); }
protected function inputOptions($options) { $resources = $options['resources']; if (empty($options['resources'])) { $resources = new clsPmieducarReligiao(); $resources = $resources->lista(null, null, null, null, null, null, null, null, 1); $resources = Portabilis_Array_Utils::setAsIdValue($resources, 'cod_religiao', 'nm_religiao'); } return $this->insertOption(null, Portabilis_String_Utils::toLatin1("Religião"), $resources); }
protected function inputOptions($options) { $resources = $options['resources']; if (empty($options['resources'])) { $resources = new clsTipoLogradouro(); $resources = $resources->lista(); $resources = Portabilis_Array_Utils::setAsIdValue($resources, 'idtlog', 'descricao'); } return $this->insertOption(null, "Tipo logradouro", $resources); }
protected function inputOptions($options) { $resources = $options['resources']; if (empty($options['resources'])) { $sql = "select id, nome from pmieducar.turma_turno where ativo = 1 order by id DESC"; $resources = Portabilis_Utils_Database::fetchPreparedQuery($sql); $resources = Portabilis_Array_Utils::setAsIdValue($resources, 'id', 'nome'); } return $this->insertOption(null, "Selecione", $resources); }
protected function inputOptions($options) { $resources = $options['resources']; if (empty($resources)) { $resources = new clsEstadoCivil(); $resources = $resources->lista(); $resources = Portabilis_Array_Utils::setAsIdValue($resources, 'ideciv', 'descricao'); } return $this->insertOption(null, "Estado civil", $resources); }
protected function inputOptions($options) { $resources = $options['resources']; if (empty($options['resources'])) { $resources = new clsUf(); $resources = $resources->lista(); $resources = Portabilis_Array_Utils::setAsIdValue($resources, 'sigla_uf', 'sigla_uf'); } return $this->insertOption(null, "Estado", $resources); }
protected function get() { $id = $this->getRequest()->id; $ponto = new clsModulesPontoTransporteEscolar(); $ponto->cod_ponto_transporte_escolar = $id; $ponto = $ponto->detalhe(); $attrs = array('cod_ponto_transporte_escolar' => 'id'); $pt = Portabilis_Array_Utils::filter($ponto, $attrs); $pt['desc'] = Portabilis_String_Utils::toUtf8($ponto['descricao']); return $pt; }
protected function inputOptions($options) { $resources = $options['resources']; $escolaId = $this->getEscolaId($options['escolaId']); if ($escolaId && empty($resources)) { $sql = "select ano from pmieducar.escola_ano_letivo as al where ref_cod_escola = \$1\n and ativo = 1 {$this->filtroSituacao()} order by ano desc"; $resources = Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => $escolaId)); $resources = Portabilis_Array_Utils::setAsIdValue($resources, 'ano', 'ano'); } return $this->insertOption(null, "Selecione um ano letivo", $resources); }
protected function get() { $id = $this->getRequest()->id; $pt = new clsModulesPessoaTransporte(); $pt->cod_pessoa_transporte = $id; $pt = $pt->detalhe(); $attrs = array('cod_pessoa_transporte' => 'id', 'ref_cod_rota_transporte_escolar' => 'rota', 'ref_cod_ponto_transporte_escolar' => 'ponto', 'ref_idpes_destino' => 'pessoaj', 'ref_idpes' => 'pessoa', 'observacao' => 'observacao'); $pt = Portabilis_Array_Utils::filter($pt, $attrs); $pt['pessoaj_nome'] = $this->loadNomePessoaj($id); $pt['pessoa_nome'] = $this->loadNomePessoa($id); return $pt; }
protected function inputOptions($options) { $resources = $options['resources']; $instituicaoId = $this->getInstituicaoId($options['instituicaoId']); $userId = $this->getCurrentUserId(); $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); if ($instituicaoId and empty($resources) and $isProfessor) { $escolas = Portabilis_Business_Professor::escolasAlocado($instituicaoId, $userId); $resources = Portabilis_Array_Utils::setAsIdValue($escolas, 'id', 'nome'); } elseif ($instituicaoId and empty($resources)) { $resources = App_Model_IedFinder::getEscolas($instituicaoId); } return $this->insertOption(null, "Selecione uma escola", $resources); }
protected function get() { if ($this->canGet()) { $id = $this->getRequest()->id; $empresa = new clsModulesEmpresaTransporteEscolar(); $empresa->cod_empresa_transporte_escolar = $id; $empresa = $empresa->detalhe(); $attrs = array('cod_empresa_transporte_escolar' => 'id', 'ref_idpes' => 'pessoaj', 'observacao' => 'observacao', 'ref_resp_idpes' => 'pessoa'); $empresa = Portabilis_Array_Utils::filter($empresa, $attrs); $empresa['nome'] = $this->loadNomePessoa($id); $empresa['pessoajnome'] = $this->loadNomePessoaj($id); $empresa['observacao'] = Portabilis_String_Utils::toUtf8($empresa['observacao']); return $empresa; } }
public static function split($divisors, $string, $options = array()) { $result = array($string); $defaultOptions = array('limit' => -1, 'trim' => true); $options = self::mergeOptions($options, $defaultOptions); if (!is_array($divisors)) { $divisors = array($divisors); } foreach ($divisors as $divisor) { if (is_numeric(strpos($string, $divisor))) { $result = split($divisor, $string, $options['limit']); break; } } if ($options['trim']) { $result = Portabilis_Array_Utils::trim($result); } return $result; }
protected function loadSituacaoExemplar($permiteEmprestimo = true, $padrao = true, $emprestada = false) { $permiteEmprestimo = $permiteEmprestimo == true ? 2 : 1; $emprestada = $emprestada == true ? 1 : 0; if (!is_null($padrao)) { $padrao = $padrao == true ? 1 : 0; } $situacao = new clsPmieducarSituacao(); $situacao = $situacao->lista(null, null, null, null, $permiteEmprestimo, null, $padrao, $emprestada, null, null, null, null, 1, $this->getRequest()->biblioteca_id, $this->getRequest()->instituicao_id, $this->getRequest()->escola_id); if ($situacao) { $situacao = Portabilis_Array_Utils::filter($situacao[0], array('cod_situacao' => 'id', 'ref_cod_biblioteca' => 'biblioteca_id', 'nm_situacao' => 'label', 'situacao_padrao' => 'padrao', 'situacao_emprestada' => 'emprestada', 'permite_emprestimo', 'descricao')); } return $situacao; }
protected function get() { $id = $this->getRequest()->id; $motorista = new clsModulesMotorista(); $motorista->cod_motorista = $id; $motorista = $motorista->detalhe(); $attrs = array('cod_motorista' => 'id', 'ref_idpes' => 'pessoa', 'tipo_cnh' => 'tipo_cnh', 'ref_cod_empresa_transporte_escolar' => 'ref_cod_empresa_transporte_escolar', 'cnh' => 'cnh', 'observacao' => 'observacao', 'dt_habilitacao' => 'dt_habilitacao', 'vencimento_cnh' => 'vencimento_cnh'); $motorista = Portabilis_Array_Utils::filter($motorista, $attrs); $motorista['nome'] = Portabilis_String_Utils::toUtf8($this->loadNomePessoa($id)); $motorista['empresa'] = Portabilis_String_Utils::toUtf8($this->loadNomeEmpresa($id)); $motorista['dt_habilitacao'] = Portabilis_Date_Utils::pgSQLToBr($motorista['dt_habilitacao']); $motorista['vencimento_cnh'] = Portabilis_Date_Utils::pgSQLToBr($motorista['vencimento_cnh']); $motorista['cnh'] = Portabilis_String_Utils::toUtf8($motorista['cnh']); $motorista['observacao'] = Portabilis_String_Utils::toUtf8($motorista['observacao']); return $motorista; }
function Gerar() { if ($_POST) { foreach ($_POST as $campo => $val) { $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val; } } $this->campoOculto('cod_turma', $this->cod_turma); // foreign keys $obrigatorio = FALSE; $instituicao_obrigatorio = TRUE; $escola_curso_obrigatorio = TRUE; $curso_obrigatorio = TRUE; $get_escola = TRUE; $get_escola_curso_serie = FALSE; $sem_padrao = TRUE; $get_curso = TRUE; $bloqueia = false; $anoVisivel = false; if (isset($this->ano) || !is_numeric($this->cod_turma)) { $anoVisivel = true; } if (!isset($this->cod_turma)) { $bloqueia = false; } else { if (is_numeric($this->cod_turma)) { $obj_matriculas_turma = new clsPmieducarMatriculaTurma(); $obj_matriculas_turma->setOrderby('nome_aluno'); $lst_matriculas_turma = $obj_matriculas_turma->lista(NULL, $this->cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, array(1, 2, 3), NULL, NULL, NULL, NULL, TRUE, NULL, 1, TRUE); if (is_array($lst_matriculas_turma) && count($lst_matriculas_turma) > 0) { $bloqueia = true; } } } $desabilitado = $bloqueia; include 'include/pmieducar/educar_campo_lista.php'; if ($this->ref_cod_escola) { $this->ref_ref_cod_escola = $this->ref_cod_escola; } $opcoes_serie = array('' => 'Selecione'); // Editar if ($this->ref_cod_curso) { $obj_serie = new clsPmieducarSerie(); $obj_serie->setOrderby('nm_serie ASC'); $lst_serie = $obj_serie->lista(NULL, NULL, NULL, $this->ref_cod_curso, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if (is_array($lst_serie) && count($lst_serie)) { foreach ($lst_serie as $serie) { $opcoes_serie[$serie['cod_serie']] = $serie['nm_serie']; } } } if ($bloqueia) { $this->campoOculto('serie_param', $this->serie_param = $this->ref_ref_cod_serie); $this->campoOculto('escola_param', $this->escola_param = $this->ref_cod_escola); } $this->campoLista('ref_ref_cod_serie', 'Série', $opcoes_serie, $this->ref_ref_cod_serie, '', FALSE, '', NULL, $bloqueia); // o campo ano somente é exibido para turmas novas ou cadastradas após inclusão deste campo. if ($anoVisivel) { $this->inputsHelper()->dynamic('anoLetivo', array('disabled' => $bloqueia)); if ($bloqueia) { $this->inputsHelper()->hidden('ano_hidden', array('value' => $this->ano)); } } // Infra prédio cômodo $opcoes = array('' => 'Selecione'); // Editar if ($this->ref_ref_cod_escola) { $obj_infra_predio = new clsPmieducarInfraPredio(); $obj_infra_predio->setOrderby('nm_predio ASC'); $lst_infra_predio = $obj_infra_predio->lista(NULL, NULL, NULL, $this->ref_ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if (is_array($lst_infra_predio) && count($lst_infra_predio)) { foreach ($lst_infra_predio as $predio) { $obj_infra_predio_comodo = new clsPmieducarInfraPredioComodo(); $lst_infra_predio_comodo = $obj_infra_predio_comodo->lista(NULL, NULL, NULL, NULL, $predio['cod_infra_predio'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); if (is_array($lst_infra_predio_comodo) && count($lst_infra_predio_comodo)) { foreach ($lst_infra_predio_comodo as $comodo) { $opcoes[$comodo['cod_infra_predio_comodo']] = $comodo['nm_comodo']; } } } } } $this->campoLista('ref_cod_infra_predio_comodo', 'Sala', $opcoes, $this->ref_cod_infra_predio_comodo, NULL, NULL, NULL, NULL, NULL, FALSE); $array_servidor = array('' => 'Selecione um servidor'); if ($this->ref_cod_regente) { $obj_pessoa = new clsPessoa_($this->ref_cod_regente); $det = $obj_pessoa->detalhe(); $array_servidor[$this->ref_cod_regente] = $det['nome']; } $this->campoListaPesq('ref_cod_regente', 'Professor/Regente', $array_servidor, $this->ref_cod_regente, '', '', FALSE, '', '', NULL, NULL, '', TRUE, FALSE, FALSE); // Turma tipo $opcoes = array('' => 'Selecione'); // Editar if ($this->ref_cod_instituicao) { $objTemp = new clsPmieducarTurmaTipo(); $objTemp->setOrderby('nm_tipo ASC'); $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { $opcoes[$registro['cod_turma_tipo']] = $registro['nm_tipo']; } } } $this->campoLista('ref_cod_turma_tipo', 'Tipo de Turma', $opcoes, $this->ref_cod_turma_tipo, '', FALSE, '', NULL); $this->campoTexto('nm_turma', 'Turma', $this->nm_turma, 30, 255, TRUE); $this->campoTexto('sgl_turma', 'Sigla', $this->sgl_turma, 15, 15, FALSE); $this->campoNumero('max_aluno', 'Máximo de Alunos', $this->max_aluno, 3, 3, TRUE); $this->inputsHelper()->date('data_fechamento', array('required' => false, 'label' => 'Data de fechamento', 'value' => Portabilis_Date_Utils::pgSQLToBr($this->data_fechamento))); $ativo = isset($this->cod_turma) ? dbBool($this->visivel) : true; $this->campoCheck('visivel', 'Ativo', $ativo); $this->campoCheck('multiseriada', 'Multi-Seriada', $this->multiseriada, '', FALSE, FALSE); $this->campoLista('ref_ref_cod_serie_mult', 'Série', array('' => 'Selecione'), '', '', FALSE, '', '', '', FALSE); $this->campoOculto('ref_ref_cod_serie_mult_', $this->ref_ref_cod_serie_mult); $this->campoQuebra2(); // hora $this->campoHora('hora_inicial', 'Hora Inicial', $this->hora_inicial, FALSE); $this->campoHora('hora_final', 'Hora Final', $this->hora_final, FALSE); $this->campoHora('hora_inicio_intervalo', Portabilis_String_Utils::toLatin1('Hora Início Intervalo'), $this->hora_inicio_intervalo, FALSE); $this->campoHora('hora_fim_intervalo', 'Hora Fim Intervalo', $this->hora_fim_intervalo, FALSE); $this->inputsHelper()->turmaTurno(); // modelos boletim require_once 'Portabilis/Model/Report/TipoBoletim.php'; require_once 'Portabilis/Array/Utils.php'; $tiposBoletim = Portabilis_Model_Report_TipoBoletim::getInstance()->getEnums(); $tiposBoletim = Portabilis_Array_Utils::insertIn(null, "Selecione um modelo", $tiposBoletim); $this->campoLista('tipo_boletim', Portabilis_String_Utils::toLatin1('Modelo relatório boletim'), $tiposBoletim, $this->tipo_boletim); $this->campoQuebra2(); if ($this->ref_ref_cod_serie) { require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php'; require_once 'ComponenteCurricular/Model/AnoEscolarDataMapper.php'; require_once 'ComponenteCurricular/Model/TurmaDataMapper.php'; $disciplinas = ''; $conteudo = ''; // Instancia o mapper de componente curricular $mapper = new ComponenteCurricular_Model_ComponenteDataMapper(); // Instancia o mapper de ano escolar $anoEscolar = new ComponenteCurricular_Model_AnoEscolarDataMapper(); $lista = $anoEscolar->findComponentePorSerie($this->ref_ref_cod_serie); // Instancia o mapper de turma $componenteTurmaMapper = new ComponenteCurricular_Model_TurmaDataMapper(); $componentesTurma = array(); if (isset($this->cod_turma) && is_numeric($this->cod_turma)) { $componentesTurma = $componenteTurmaMapper->findAll(array(), array('turma' => $this->cod_turma)); } $componentes = array(); foreach ($componentesTurma as $componenteTurma) { $componentes[$componenteTurma->get('componenteCurricular')] = $componenteTurma; } unset($componentesTurma); $this->escola_serie_disciplina = array(); if (is_array($lista) && count($lista)) { $conteudo .= '<div style="margin-bottom: 10px;">'; $conteudo .= ' <span style="display: block; float: left; width: 250px;">Nome</span>'; $conteudo .= ' <span style="display: block; float: left; width: 100px;">' . Portabilis_String_Utils::toLatin1('Carga horária') . '</span>'; $conteudo .= ' <span style="display: block; float: left">' . Portabilis_String_Utils::toLatin1('Usar padrão do componente?') . '</span>'; $conteudo .= '</div>'; $conteudo .= '<br style="clear: left" />'; foreach ($lista as $registro) { $checked = ''; $usarComponente = FALSE; if (isset($componentes[$registro->id])) { $checked = 'checked="checked"'; } if (is_null($componentes[$registro->id]->cargaHoraria) || 0 == $componentes[$registro->id]->cargaHoraria) { $usarComponente = TRUE; } else { $cargaHoraria = $componentes[$registro->id]->cargaHoraria; } $cargaComponente = $registro->cargaHoraria; $conteudo .= '<div style="margin-bottom: 10px; float: left">'; $conteudo .= " <label style='display: block; float: left; width: 250px'><input type=\"checkbox\" {$checked} name=\"disciplinas[{$registro->id}]\" id=\"disciplinas[]\" value=\"{$registro->id}\">{$registro}</label>"; $conteudo .= " <label style='display: block; float: left; width: 100px;'><input type='text' name='carga_horaria[{$registro->id}]' value='{$cargaHoraria}' size='5' maxlength='7'></label>"; $conteudo .= " <label style='display: block; float: left'><input type='checkbox' name='usar_componente[{$registro->id}]' value='1' " . ($usarComponente == TRUE ? $checked : '') . ">({$cargaComponente} h)</label>"; $conteudo .= '</div>'; $conteudo .= '<br style="clear: left" />'; $cargaHoraria = ''; } $disciplinas = '<table cellspacing="0" cellpadding="0" border="0">'; $disciplinas .= sprintf('<tr align="left"><td>%s</td></tr>', $conteudo); $disciplinas .= '</table>'; } else { $disciplinas = Portabilis_String_Utils::toLatin1('A série/ano escolar não possui componentes curriculares cadastrados.'); } } $componentes = $help = array(); try { $componentes = App_Model_IedFinder::getEscolaSerieDisciplina($this->ref_ref_cod_serie, $this->ref_cod_escola); } catch (Exception $e) { } foreach ($componentes as $componente) { $help[] = sprintf('%s (%.0f h)', $componente->nome, $componente->cargaHoraria); } if (count($componentes)) { $help = '<ul><li>' . implode('</li><li>', $help) . '</li></ul>'; } else { $help = ''; } $label = 'Componentes curriculares:<br />' . '<strong>Observação:</strong> caso não defina os componentes<br />' . 'curriculares para a turma, esta usará a definição<br />' . 'da série/ano escolar da escola:' . '<span id="_escola_serie_componentes">%s</span>'; $label = sprintf($label, $help); $this->campoRotulo('disciplinas_', $label, "<div id='disciplinas'>{$disciplinas}</div>"); $this->campoQuebra2(); if ($_POST['turma_modulo']) { $this->turma_modulo = unserialize(urldecode($_POST['turma_modulo'])); } $qtd_modulo = count($this->turma_modulo) == 0 ? 1 : count($this->turma_modulo) + 1; if (is_numeric($this->cod_turma) && !$_POST) { $obj = new clsPmieducarTurmaModulo(); $registros = $obj->lista($this->cod_turma); if ($registros) { foreach ($registros as $campo) { $this->turma_modulo[$campo[$qtd_modulo]]['sequencial_'] = $campo['sequencial']; $this->turma_modulo[$campo[$qtd_modulo]]['ref_cod_modulo_'] = $campo['ref_cod_modulo']; $this->turma_modulo[$campo[$qtd_modulo]]['data_inicio_'] = dataFromPgToBr($campo['data_inicio']); $this->turma_modulo[$campo[$qtd_modulo]]['data_fim_'] = dataFromPgToBr($campo['data_fim']); $qtd_modulo++; } } } if ($_POST["ref_cod_modulo"] && $_POST["data_inicio"] && $_POST["data_fim"]) { $this->turma_modulo[$qtd_modulo]["sequencial_"] = $qtd_modulo; $this->turma_modulo[$qtd_modulo]["ref_cod_modulo_"] = $_POST["ref_cod_modulo"]; $this->turma_modulo[$qtd_modulo]["data_inicio_"] = $_POST["data_inicio"]; $this->turma_modulo[$qtd_modulo]["data_fim_"] = $_POST["data_fim"]; $qtd_modulo++; unset($this->ref_cod_modulo); unset($this->data_inicio); unset($this->data_fim); } $this->campoOculto("excluir_modulo", ""); $qtd_modulo = 1; unset($aux); if ($this->turma_modulo) { foreach ($this->turma_modulo as $campo) { if ($this->excluir_modulo == $campo['sequencial_']) { $this->turma_modulo[$campo['sequencial']] = NULL; $this->excluir_modulo = NULL; } else { $obj_modulo = new clsPmieducarModulo($campo['ref_cod_modulo_']); $det_modulo = $obj_modulo->detalhe(); $nm_tipo_modulo = $det_modulo['nm_tipo']; $this->campoTextoInv('ref_cod_modulo_' . $campo['sequencial_'], '', $nm_tipo_modulo, 30, 255, FALSE, FALSE, TRUE, '', '', '', '', 'ref_cod_modulo'); $this->campoTextoInv('data_inicio_' . $campo['sequencial_'], '', $campo['data_inicio_'], 10, 10, FALSE, FALSE, TRUE, '', '', '', '', ''); $this->campoTextoInv('data_fim_' . $campo['sequencial_'], '', $campo['data_fim_'], 10, 10, FALSE, FALSE, FALSE, '', "<a href='#' onclick=\"document.getElementById('excluir_modulo').value = '{$campo["sequencial_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", '', '', ''); $aux[$qtd_modulo]['sequencial_'] = $qtd_modulo; $aux[$qtd_modulo]['ref_cod_modulo_'] = $campo['ref_cod_modulo_']; $aux[$qtd_modulo]['data_inicio_'] = $campo['data_inicio_']; $aux[$qtd_modulo]['data_fim_'] = $campo['data_fim_']; $qtd_modulo++; } } unset($this->turma_modulo); $this->turma_modulo = $aux; } $this->campoOculto('turma_modulo', serialize($this->turma_modulo)); // Módulo // foreign keys $opcoes = array('' => 'Selecione'); // Editar if ($this->ref_cod_instituicao) { $objTemp = new clsPmieducarModulo(); $objTemp->setOrderby('nm_tipo ASC'); $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { $opcoes[$registro['cod_modulo']] = $registro['nm_tipo']; } } } $this->campoLista('ref_cod_modulo', Portabilis_String_utils::toLatin1('Módulo'), $opcoes, $this->ref_cod_modulo, NULL, NULL, NULL, NULL, NULL, FALSE); $this->campoData('data_inicio', Portabilis_String_utils::toLatin1('Data Início'), $this->data_inicio, FALSE); $this->campoData('data_fim', 'Data Fim', $this->data_fim, FALSE); $this->campoOculto('incluir_modulo', ''); $this->campoRotulo('bt_incluir_modulo', Portabilis_String_utils::toLatin1('Módulo'), "<a href='#' onclick=\"document.getElementById('incluir_modulo').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>"); $this->campoQuebra2(); if ($_POST['turma_dia_semana']) { $this->turma_dia_semana = unserialize(urldecode($_POST['turma_dia_semana'])); } if (is_numeric($this->cod_turma) && !$_POST) { $obj = new clsPmieducarTurmaDiaSemana(); $registros = $obj->lista(NULL, $this->cod_turma); if ($registros) { foreach ($registros as $campo) { $aux['dia_semana_'] = $campo['dia_semana']; $aux['hora_inicial_'] = $campo['hora_inicial']; $aux['hora_final_'] = $campo['hora_final']; $this->turma_dia_semana[] = $aux; } } } unset($aux); if ($_POST['dia_semana'] && $_POST['ds_hora_inicial'] && $_POST['ds_hora_final']) { $aux['dia_semana_'] = $_POST['dia_semana']; $aux['hora_inicial_'] = $_POST['ds_hora_inicial']; $aux['hora_final_'] = $_POST['ds_hora_final']; $this->turma_dia_semana[] = $aux; unset($this->dia_semana); unset($this->ds_hora_inicial); unset($this->ds_hora_final); } $this->campoOculto('excluir_dia_semana', ''); unset($aux); if ($this->turma_dia_semana) { foreach ($this->turma_dia_semana as $key => $dias_semana) { if ($this->excluir_dia_semana == $dias_semana['dia_semana_']) { unset($this->turma_dia_semana[$key]); unset($this->excluir_dia_semana); } else { $nm_dia_semana = $this->dias_da_semana[$dias_semana['dia_semana_']]; $this->campoTextoInv('dia_semana_' . $dias_semana['dia_semana_'], '', $nm_dia_semana, 8, 8, FALSE, FALSE, TRUE, '', '', '', '', 'dia_semana'); $this->campoTextoInv('hora_inicial_' . $dias_semana['dia_semana_'], '', $dias_semana['hora_inicial_'], 5, 5, FALSE, FALSE, TRUE, '', '', '', '', 'ds_hora_inicial_'); $this->campoTextoInv('hora_final_' . $dias_semana['dia_semana_'], '', $dias_semana['hora_final_'], 5, 5, FALSE, FALSE, FALSE, '', "<a href='#' onclick=\"document.getElementById('excluir_dia_semana').value = '{$dias_semana["dia_semana_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", '', '', 'ds_hora_final_'); $aux['dia_semana_'] = $dias_semana['dia_semana_']; $aux['hora_inicial_'] = $dias_semana['hora_inicial_']; $aux['hora_final_'] = $dias_semana['hora_final_']; } } } $this->campoOculto('turma_dia_semana', serialize($this->turma_dia_semana)); if (class_exists('clsPmieducarTurmaDiaSemana')) { $opcoes = $this->dias_da_semana; } else { echo '<!--\\nErro\\nClasse clsPmieducarTurmaDiaSemana não encontrada\\n-->'; $opcoes = array('' => Portabilis_String_utils::toLatin1('Erro na geração')); } $this->campoLista('dia_semana', 'Dia Semana', $opcoes, $this->dia_semana, NULL, false, '', '', false, false); $this->campoHora('ds_hora_inicial', 'Hora Inicial', $this->ds_hora_inicial, FALSE); $this->campoHora('ds_hora_final', 'Hora Final', $this->ds_hora_final, FALSE); $this->campoOculto('incluir_dia_semana', ''); $this->campoRotulo('bt_incluir_dia_semana', 'Dia Semana', "<a href='#' onclick=\"document.getElementById('incluir_dia_semana').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>"); $this->campoOculto('padrao_ano_escolar', $this->padrao_ano_escolar); $this->acao_enviar = 'valida()'; }
protected function getMatriculas() { if ($this->canGetMatriculas()) { $matriculas = new clsPmieducarMatricula(); $matriculas->setOrderby('ano DESC, ref_ref_cod_serie DESC, cod_matricula DESC, aprovado'); $matriculas = $matriculas->lista(null, null, null, null, null, null, $this->getRequest()->aluno_id, null, null, null, null, null, 1); $attrs = array('cod_matricula' => 'id', 'ref_cod_instituicao' => 'instituicao_id', 'ref_ref_cod_escola' => 'escola_id', 'ref_cod_curso' => 'curso_id', 'ref_ref_cod_serie' => 'serie_id', 'ref_cod_aluno' => 'aluno_id', 'nome' => 'aluno_nome', 'aprovado' => 'situacao', 'ano'); $matriculas = Portabilis_Array_Utils::filterSet($matriculas, $attrs); foreach ($matriculas as $index => $matricula) { $turma = $this->loadTurmaByMatriculaId($matricula['id']); $matriculas[$index]['aluno_nome'] = $this->toUtf8($matricula['aluno_nome'], array('transform' => true)); $matriculas[$index]['turma_id'] = $turma['id']; $matriculas[$index]['turma_nome'] = $turma['nome']; $matriculas[$index]['escola_nome'] = $this->loadEscolaNome($matricula['escola_id']); $matriculas[$index]['curso_nome'] = $this->loadCursoNome($matricula['curso_id']); $matriculas[$index]['serie_nome'] = $this->loadSerieNome($matricula['serie_id']); $matriculas[$index]['ultima_enturmacao'] = $this->loadNomeTurmaOrigem($matricula['id']); $matriculas[$index]['data_entrada'] = $this->loadTransferenciaDataEntrada($matricula['id']); $matriculas[$index]['data_saida'] = $this->loadTransferenciaDataSaida($matricula['id']); $matriculas[$index]['situacao'] = App_Model_MatriculaSituacao::getInstance()->getValue($matricula['situacao']); $matriculas[$index]['user_can_access'] = Portabilis_Utils_User::canAccessEscola($matricula['escola_id']); $matriculas[$index]['transferencia_em_aberto'] = $this->possuiTransferenciaEmAberto($matricula['id']); } return array('matriculas' => $matriculas); } }
public static function sortByValue($array) { uasort($array, function ($a, $b) { return Portabilis_Array_Utils::_valueSorter($a, $b); }); return $array; }
protected function get() { $pessoa = array(); if ($this->canGet()) { if ($this->getRequest()->id) { $pessoa = $this->loadPessoa($this->getRequest()->id); } else { $pessoa = $this->loadPessoaByCpf($this->getRequest()->cpf); } $attrs = array('id', 'nome'); $pessoa = Portabilis_Array_Utils::filter($pessoa, $attrs); $details = $this->loadDetails($this->getRequest()->id); $pessoa = Portabilis_Array_Utils::merge($pessoa, $details); $pessoa['deficiencias'] = $this->loadDeficiencias($this->getRequest()->id); } return $pessoa; }
protected function get() { $id = $this->getRequest()->id; $veiculo = new clsModulesVeiculo(); $veiculo->cod_veiculo = $id; $veiculo = $veiculo->detalhe(); $attrs = array('cod_veiculo' => 'id', 'descricao' => 'descricao', 'placa' => 'placa', 'renavam' => 'renavam', 'chassi' => 'chassi', 'marca' => 'marca', 'ano_fabricacao' => 'ano_fabricacao', 'ano_modelo' => 'ano_modelo', 'passageiros' => 'passageiros', 'malha' => 'malha', 'ref_cod_tipo_veiculo' => 'tipo', 'exclusivo_transporte_escolar' => 'exclusivo_transporte_escolar', 'adaptado_necessidades_especiais' => 'adaptado_necessidades_especiais', 'ativo' => 'ativo', 'descricao_inativo' => 'descricao_inativo', 'ref_cod_empresa_transporte_escolar' => 'empresa', 'ref_cod_motorista' => 'motorista', 'observacao' => 'observacao'); $veiculo = Portabilis_Array_Utils::filter($veiculo, $attrs); $veiculo['empresaNome'] = Portabilis_String_Utils::toUtf8($this->loadNomeEmpresa($veiculo['empresa'])); $veiculo['motoristaNome'] = Portabilis_String_Utils::toUtf8($this->loadNomeMotorista($veiculo['motorista'])); $veiculo['descricao'] = Portabilis_String_Utils::toUtf8($veiculo['descricao']); $veiculo['marca'] = Portabilis_String_Utils::toUtf8($veiculo['marca']); $veiculo['placa'] = Portabilis_String_Utils::toUtf8($veiculo['placa']); $veiculo['chassi'] = Portabilis_String_Utils::toUtf8($veiculo['chassi']); $veiculo['descricao_inativo'] = Portabilis_String_Utils::toUtf8($veiculo['descricao_inativo']); $veiculo['observacao'] = Portabilis_String_Utils::toUtf8($veiculo['observacao']); return $veiculo; }
protected static function mergeOptions($options, $defaultOptions) { return Portabilis_Array_Utils::merge($options, $defaultOptions); }
protected function get() { $id = $this->getRequest()->id; $rota = new clsModulesRotaTransporteEscolar(); $rota->cod_rota_transporte_escolar = $id; $rota = $rota->detalhe(); $attrs = array('cod_rota_transporte_escolar' => 'id', 'descricao' => 'desc', 'ref_idpes_destino' => 'ref_idpes_destino', 'ano' => 'ano', 'tipo_rota' => 'tipo_rota', 'km_pav' => 'km_pav', 'km_npav' => 'km_npav', 'ref_cod_empresa_transporte_escolar' => 'ref_cod_empresa_transporte_escolar', 'tercerizado' => 'tercerizado'); $rota = Portabilis_Array_Utils::filter($rota, $attrs); $rota['nomeEmpresa'] = Portabilis_String_Utils::toUtf8($this->loadNomeEmpresa($id)); $rota['nomeDestino'] = Portabilis_String_Utils::toUtf8($this->loadNomePessoaj($id)); $rota['desc'] = Portabilis_String_Utils::toUtf8($rota['desc']); return $rota; }
protected function loadMatriculasAluno($alunoId, $escolaId) { // #TODO mostrar o nome da situação da matricula // seleciona somente matriculas em andamento, aprovado, reprovado, em exame, aprovado apos exame e retido faltas $sql = "select cod_matricula as id, ano, ref_cod_instituicao as instituicao_id, ref_ref_cod_escola as\n escola_id, ref_cod_curso as curso_id, ref_ref_cod_serie as serie_id from pmieducar.matricula,\n pmieducar.escola where cod_escola = ref_ref_cod_escola and ref_cod_aluno = \$1 and ref_ref_cod_escola =\n \$2 and matricula.ativo = 1 and matricula.aprovado in (1, 2, 3, 7, 8, 9) order by ano desc, id"; $params = array($alunoId, $escolaId); $matriculas = $this->fetchPreparedQuery($sql, $params, false); if (is_array($matriculas) && count($matriculas) > 0) { $attrs = array('id', 'ano', 'instituicao_id', 'escola_id', 'curso_id', 'serie_id'); $matriculas = Portabilis_Array_Utils::filterSet($matriculas, $attrs); foreach ($matriculas as $key => $matricula) { $matriculas[$key]['nome_curso'] = $this->loadNameFor('curso', $matricula['curso_id']); $matriculas[$key]['nome_escola'] = $this->loadNomeEscola($this->getRequest()->escola_id); $matriculas[$key]['nome_serie'] = $this->loadNameFor('serie', $matricula['serie_id']); $matriculas[$key]['situacao'] = '#TODO'; $turma = $this->tryLoadMatriculaTurma($matricula['id']); if (is_array($turma) and count($turma) > 0) { $matriculas[$key]['turma_id'] = $turma['turma_id']; $matriculas[$key]['nome_turma'] = $turma['nome_turma']; $matriculas[$key]['report_boletim_template'] = $turma['report_boletim_template']; } } } return $matriculas; }
function Gerar() { $this->url_cancelar = $this->retorno == 'Editar' ? 'atendidos_det.php?cod_pessoa=' . $this->cod_pessoa_fj : 'atendidos_lst.php'; $this->campoCpf('id_federal', 'CPF', $this->id_federal, FALSE); $this->campoOculto('cod_pessoa_fj', $this->cod_pessoa_fj); $this->campoTexto('nm_pessoa', 'Nome', $this->nm_pessoa, '50', '255', TRUE); $foto = false; if (is_numeric($this->cod_pessoa_fj)) { $objFoto = new ClsCadastroFisicaFoto($this->cod_pessoa_fj); $detalheFoto = $objFoto->detalhe(); if (count($detalheFoto)) { $foto = $detalheFoto['caminho']; } } else { $foto = false; } if ($foto != false) { $this->campoRotulo('fotoAtual_', 'Foto atual', '<img height="117" src="' . $foto . '"/>'); $this->campoArquivo('file', 'Trocar foto', $this->arquivoFoto, 40, '<br/> <span style="font-style: italic; font-size= 10px;">* Recomenda-se imagens nos formatos jpeg, jpg, png e gif. Tamanho máximo: 150KB</span>'); } else { $this->campoArquivo('file', 'Foto', $this->arquivoFoto, 40, '<br/> <span style="font-style: italic; font-size= 10px;">* Recomenda-se imagens nos formatos jpeg, jpg, png e gif. Tamanho máximo: 150KB</span>'); } // ao cadastrar pessoa do pai ou mãe apartir do cadastro de outra pessoa, // é enviado o tipo de cadastro (pai ou mae). $parentType = isset($_REQUEST['parent_type']) ? $_REQUEST['parent_type'] : ''; $naturalidadeObrigatoria = $parentType == '' ? true : false; // sexo $sexo = $this->sexo; // sugere sexo quando cadastrando o pai ou mãe if (!$sexo && $parentType == 'pai') { $sexo = 'M'; } elseif (!$sexo && $parentType == 'mae') { $sexo = 'F'; } $options = array('label' => 'Sexo / Estado civil', 'value' => $sexo, 'resources' => array('' => 'Sexo', 'M' => 'Masculino', 'F' => 'Feminino'), 'inline' => true); $this->inputsHelper()->select('sexo', $options); // estado civil $this->inputsHelper()->estadoCivil(array('label' => '', 'required' => empty($parentType))); // data nascimento $options = array('label' => 'Data nascimento', 'value' => $this->data_nasc, 'required' => empty($parentType)); $this->inputsHelper()->date('data_nasc', $options); // pai, mãe $this->inputPai(); $this->inputMae(); // documentos $documentos = new clsDocumento(); $documentos->idpes = $this->cod_pessoa_fj; $documentos = $documentos->detalhe(); // rg // o rg é obrigatorio ao cadastrar pai ou mãe, exceto se configurado como opcional. $required = !empty($parentType); if ($required && $GLOBALS['coreExt']['Config']->app->rg_pessoa_fisica_pais_opcional) { $required = false; } $options = array('required' => $required, 'label' => 'RG / Data emissão', 'placeholder' => 'Documento identidade', 'value' => $documentos['rg'], 'max_length' => 20, 'size' => 27, 'inline' => true); $this->inputsHelper()->integer('rg', $options); // data emissão rg $options = array('required' => false, 'label' => '', 'placeholder' => 'Data emissão', 'value' => $documentos['data_exp_rg'], 'size' => 19); $this->inputsHelper()->date('data_emissao_rg', $options); // orgão emissão rg $selectOptions = array(null => 'Orgão emissor'); $orgaos = new clsOrgaoEmissorRg(); $orgaos = $orgaos->lista(); foreach ($orgaos as $orgao) { $selectOptions[$orgao['idorg_rg']] = $orgao['sigla']; } $selectOptions = Portabilis_Array_Utils::sortByValue($selectOptions); $options = array('required' => false, 'label' => '', 'value' => $documentos['idorg_exp_rg'], 'resources' => $selectOptions, 'inline' => true); $this->inputsHelper()->select('orgao_emissao_rg', $options); // uf emissão rg $options = array('required' => false, 'label' => '', 'value' => $documentos['sigla_uf_exp_rg']); $helperOptions = array('attrName' => 'uf_emissao_rg'); $this->inputsHelper()->uf($options, $helperOptions); // Código NIS (PIS/PASEP) $options = array('required' => false, 'label' => 'NIS (PIS/PASEP)', 'placeholder' => '', 'value' => $this->nis_pis_pasep, 'max_length' => 11, 'size' => 20); $this->inputsHelper()->integer('nis_pis_pasep', $options); // Carteira do SUS $options = array('required' => false, 'label' => 'Número da carteira do SUS', 'placeholder' => '', 'value' => $this->sus, 'max_length' => 20, 'size' => 20); $this->inputsHelper()->text('sus', $options); // tipo de certidao civil $selectOptions = array(null => 'Tipo certidão civil', 'certidao_nascimento_novo_formato' => 'Nascimento (novo formato)', 91 => 'Nascimento (antigo formato)', 92 => 'Casamento'); // caso certidao nascimento novo formato tenha sido informado, // considera este o tipo da certidão if (!empty($documentos['certidao_nascimento'])) { $tipoCertidaoCivil = 'certidao_nascimento_novo_formato'; } else { $tipoCertidaoCivil = $documentos['tipo_cert_civil']; } $options = array('required' => false, 'label' => 'Tipo certidão civil', 'value' => $tipoCertidaoCivil, 'resources' => $selectOptions, 'inline' => true); $this->inputsHelper()->select('tipo_certidao_civil', $options); // termo certidao civil $options = array('required' => false, 'label' => '', 'placeholder' => 'Termo', 'value' => $documentos['num_termo'], 'max_length' => 8, 'inline' => true); $this->inputsHelper()->integer('termo_certidao_civil', $options); // livro certidao civil $options = array('required' => false, 'label' => '', 'placeholder' => 'Livro', 'value' => $documentos['num_livro'], 'max_length' => 8, 'size' => 15, 'inline' => true); $this->inputsHelper()->text('livro_certidao_civil', $options); // folha certidao civil $options = array('required' => false, 'label' => '', 'placeholder' => 'Folha', 'value' => $documentos['num_folha'], 'max_length' => 4, 'inline' => true); $this->inputsHelper()->integer('folha_certidao_civil', $options); // certidao nascimento (novo padrão) $options = array('required' => false, 'label' => '', 'placeholder' => 'Certidão nascimento', 'value' => $documentos['certidao_nascimento'], 'max_length' => 50, 'size' => 50); $this->inputsHelper()->text('certidao_nascimento', $options); // uf emissão certidão civil $options = array('required' => false, 'label' => 'Estado emissão / Data emissão', 'value' => $documentos['sigla_uf_cert_civil'], 'inline' => true); $helperOptions = array('attrName' => 'uf_emissao_certidao_civil'); $this->inputsHelper()->uf($options, $helperOptions); // data emissão certidão civil $options = array('required' => false, 'label' => '', 'placeholder' => 'Data emissão', 'value' => $documentos['data_emissao_cert_civil']); $this->inputsHelper()->date('data_emissao_certidao_civil', $options); // cartório emissão certidão civil $options = array('required' => false, 'label' => 'Cartório emissão', 'value' => $documentos['cartorio_cert_civil'], 'cols' => 45, 'max_length' => 150); $this->inputsHelper()->textArea('cartorio_emissao_certidao_civil', $options); // carteira de trabalho $options = array('required' => false, 'label' => 'Carteira de trabalho / Série', 'placeholder' => 'Carteira de trabalho', 'value' => $documentos['num_cart_trabalho'], 'max_length' => 7, 'inline' => true); $this->inputsHelper()->integer('carteira_trabalho', $options); // serie carteira de trabalho $options = array('required' => false, 'label' => '', 'placeholder' => 'Série', 'value' => $documentos['serie_cart_trabalho'], 'max_length' => 5); $this->inputsHelper()->integer('serie_carteira_trabalho', $options); // uf emissão carteira de trabalho $options = array('required' => false, 'label' => 'Estado emissão / Data emissão', 'value' => $documentos['sigla_uf_cart_trabalho'], 'inline' => true); $helperOptions = array('attrName' => 'uf_emissao_carteira_trabalho'); $this->inputsHelper()->uf($options, $helperOptions); // data emissão carteira de trabalho $options = array('required' => false, 'label' => '', 'placeholder' => 'Data emissão', 'value' => $documentos['data_emissao_cart_trabalho']); $this->inputsHelper()->date('data_emissao_carteira_trabalho', $options); // titulo eleitor $options = array('required' => false, 'label' => 'Titulo eleitor / Zona / Seção', 'placeholder' => 'Titulo eleitor', 'value' => $documentos['num_tit_eleitor'], 'max_length' => 13, 'inline' => true); $this->inputsHelper()->integer('titulo_eleitor', $options); // zona titulo eleitor $options = array('required' => false, 'label' => '', 'placeholder' => 'Zona', 'value' => $documentos['zona_tit_eleitor'], 'max_length' => 4, 'inline' => true); $this->inputsHelper()->integer('zona_titulo_eleitor', $options); // seção titulo eleitor $options = array('required' => false, 'label' => '', 'placeholder' => 'Seção', 'value' => $documentos['secao_tit_eleitor'], 'max_length' => 4); $this->inputsHelper()->integer('secao_titulo_eleitor', $options); // Cor/raça. $racas = new clsCadastroRaca(); $racas = $racas->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, TRUE); $selectOptions = array('' => 'Raça'); foreach ($racas as $raca) { $selectOptions[$raca['cod_raca']] = $raca['nm_raca']; } $selectOptions = Portabilis_Array_Utils::sortByValue($selectOptions); $this->campoLista('cor_raca', 'Raça', $selectOptions, $this->cod_raca, '', FALSE, '', '', '', FALSE); // nacionalidade // tipos $tiposNacionalidade = array(null => 'Selecione', '1' => 'Brasileiro', '2' => 'Naturalizado brasileiro', '3' => 'Estrangeiro'); $options = array('label' => 'Nacionalidade', 'resources' => $tiposNacionalidade, 'required' => false, 'inline' => true, 'value' => $this->tipo_nacionalidade); $this->inputsHelper()->select('tipo_nacionalidade', $options); // pais origem $options = array('label' => '', 'placeholder' => 'Informe o nome do pais', 'required' => true); $hiddenInputOptions = array('options' => array('value' => $this->pais_origem_id)); $helperOptions = array('objectName' => 'pais_origem', 'hiddenInputOptions' => $hiddenInputOptions); $this->inputsHelper()->simpleSearchPais('nome', $options, $helperOptions); // naturalidade //$options = array('label' => 'Naturalidade', 'required' => true); $options = array('label' => 'Naturalidade', 'required' => $naturalidadeObrigatoria); $helperOptions = array('objectName' => 'naturalidade', 'hiddenInputOptions' => array('options' => array('value' => $this->naturalidade_id))); $this->inputsHelper()->simpleSearchMunicipio('nome', $options, $helperOptions); // Detalhes do Endereço if ($this->idlog) { $objLogradouro = new clsLogradouro($this->idlog); $detalheLogradouro = $objLogradouro->detalhe(); if ($detalheLogradouro) { $this->municipio_id = $detalheLogradouro['idmun']; } // Caso seja um endereço externo, tentamos então recuperar a cidade pelo cep } elseif ($this->cep) { $numCep = idFederal2int($this->cep); $sql = "SELECT idmun, count(idmun) as count_mun FROM public.logradouro l, urbano.cep_logradouro cl \n WHERE cl.idlog = l.idlog AND cl.cep = '{$numCep}' group by idmun order by count_mun desc limit 1"; $options = array('return_only' => 'first-field'); $result = Portabilis_Utils_Database::fetchPreparedQuery($sql, $options); if ($result) { $this->municipio_id = $result; } } if ($this->cod_pessoa_fj) { $objPE = new clsPessoaEndereco($this->cod_pessoa_fj); $det = $objPE->detalhe(); if ($det) { $this->bairro_id = $det['idbai']; $this->logradouro_id = $det['idlog']; } } if (!($this->bairro_id && $this->municipio_id && $this->logradouro_id)) { $this->bairro_id = null; $this->municipio_id = null; $this->logradouro_id = null; } $this->campoOculto('idbai', $this->idbai); $this->campoOculto('idlog', $this->idlog); $this->campoOculto('cep', $this->cep); $this->campoOculto('ref_sigla_uf', $this->sigla_uf); $this->campoOculto('ref_idtlog', $this->idtlog); $this->campoOculto('id_cidade', $this->cidade); // o endereçamento é opcional $enderecamentoObrigatorio = false; // Caso o cep já esteja definido, os campos já vem desbloqueados inicialmente $desativarCamposDefinidosViaCep = empty($this->cep); $this->campoRotulo('', '<b> Endereçamento</b>', '', '', 'Digite um CEP ou clique na lupa para<br/> busca avançada para começar'); $this->campoCep('cep_', 'CEP', $this->cep, $enderecamentoObrigatorio, '-', " <img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel(500, 550, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'educar_pesquisa_cep_log_bairro2.php?campo1=bairro&campo2=idbai&campo3=cep&campo4=logradouro&campo5=idlog&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog&campo9=isEnderecoExterno&campo10=cep_&campo11=municipio_municipio&campo12=idtlog&campo13=municipio_id&campo14=zona_localizacao\\'></iframe>');\">", false); $options = array('label' => Portabilis_String_Utils::toLatin1('Município'), 'required' => $enderecamentoObrigatorio, 'disabled' => $desativarCamposDefinidosViaCep); $helperOptions = array('objectName' => 'municipio', 'hiddenInputOptions' => array('options' => array('value' => $this->municipio_id))); $this->inputsHelper()->simpleSearchMunicipio('municipio', $options, $helperOptions); $helperOptions = array('hiddenInputOptions' => array('options' => array('value' => $this->bairro_id))); $options = array('label' => Portabilis_String_Utils::toLatin1('Bairro / Zona de Localização - <b>Buscar</b>'), 'required' => $enderecamentoObrigatorio, 'disabled' => $desativarCamposDefinidosViaCep); $this->inputsHelper()->simpleSearchBairro('bairro', $options, $helperOptions); $options = array('label' => 'Bairro / Zona de Localização - <b>Cadastrar</b>', 'placeholder' => 'Bairro', 'value' => $this->bairro, 'max_length' => 40, 'disabled' => $desativarCamposDefinidosViaCep, 'inline' => true, 'required' => $enderecamentoObrigatorio); $this->inputsHelper()->text('bairro', $options); // zona localização $zonas = App_Model_ZonaLocalizacao::getInstance(); $zonas = $zonas->getEnums(); $zonas = Portabilis_Array_Utils::insertIn(null, 'Zona localização', $zonas); $options = array('label' => '', 'placeholder' => 'Zona localização ', 'value' => $this->zona_localizacao, 'disabled' => $desativarCamposDefinidosViaCep, 'resources' => $zonas, 'required' => $enderecamentoObrigatorio); $this->inputsHelper()->select('zona_localizacao', $options); $helperOptions = array('hiddenInputOptions' => array('options' => array('value' => $this->logradouro_id))); $options = array('label' => 'Tipo / Logradouro - <b>Buscar</b>', 'required' => $enderecamentoObrigatorio, 'disabled' => $desativarCamposDefinidosViaCep); $this->inputsHelper()->simpleSearchLogradouro('logradouro', $options, $helperOptions); // tipo logradouro $options = array('label' => 'Tipo / Logradouro - <b>Cadastrar</b>', 'value' => $this->idtlog, 'disabled' => $desativarCamposDefinidosViaCep, 'inline' => true, 'required' => $enderecamentoObrigatorio); $helperOptions = array('attrName' => 'idtlog'); $this->inputsHelper()->tipoLogradouro($options, $helperOptions); // logradouro $options = array('label' => '', 'placeholder' => 'Logradouro', 'value' => $this->logradouro, 'max_length' => 150, 'disabled' => $desativarCamposDefinidosViaCep, 'required' => $enderecamentoObrigatorio); $this->inputsHelper()->text('logradouro', $options); // complemento $options = array('required' => false, 'value' => $this->complemento, 'max_length' => 20); $this->inputsHelper()->text('complemento', $options); // numero $options = array('required' => false, 'label' => 'Número / Letra', 'placeholder' => 'Número', 'value' => $this->numero, 'max_length' => 6, 'inline' => true); $this->inputsHelper()->integer('numero', $options); // letra $options = array('required' => false, 'label' => '', 'placeholder' => 'Letra', 'value' => $this->letra, 'max_length' => 1, 'size' => 15); $this->inputsHelper()->text('letra', $options); // apartamento $options = array('required' => false, 'label' => 'Nº apartamento / Bloco / Andar', 'placeholder' => 'Nº apartamento', 'value' => $this->apartamento, 'max_length' => 6, 'inline' => true); $this->inputsHelper()->integer('apartamento', $options); // bloco $options = array('required' => false, 'label' => '', 'placeholder' => 'Bloco', 'value' => $this->bloco, 'max_length' => 20, 'size' => 15, 'inline' => true); $this->inputsHelper()->text('bloco', $options); // andar $options = array('required' => false, 'label' => '', 'placeholder' => 'Andar', 'value' => $this->andar, 'max_length' => 2); $this->inputsHelper()->integer('andar', $options); // contato $this->inputTelefone('1', 'Telefone residencial'); $this->inputTelefone('mov', 'Celular'); $this->inputTelefone('2', 'Telefone adicional'); $this->inputTelefone('fax', 'Fax'); $this->campoTexto('email', 'E-mail', $this->email, '50', '255', FALSE); // after change pessoa pai / mae if ($parentType) { $this->inputsHelper()->hidden('parent_type', array('value' => $parentType)); } $styles = array('/modules/Portabilis/Assets/Stylesheets/Frontend.css', '/modules/Portabilis/Assets/Stylesheets/Frontend/Resource.css', '/modules/Cadastro/Assets/Stylesheets/PessoaFisica.css'); Portabilis_View_Helper_Application::loadStylesheet($this, $styles); $script = array('/modules/Cadastro/Assets/Javascripts/PessoaFisica.js', '/modules/Cadastro/Assets/Javascripts/Endereco.js'); Portabilis_View_Helper_Application::loadJavascript($this, $script); $this->campoCep('cep_', 'CEP', $this->cep, $enderecamentoObrigatorio, '-', " <img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel(500, 550, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'educar_pesquisa_cep_log_bairro2.php?campo1=bairro_bairro&campo2=bairro_id&campo3=cep&campo4=logradouro_logradouro&campo5=logradouro_id&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog&campo9=isEnderecoExterno&campo10=cep_&campo11=municipio_municipio&campo12=idtlog&campo13=municipio_id&campo14=zona_localizacao\\'></iframe>');\">", false); }
protected function mergeInputOptions($inputOptions = array(), $helperOptions = array()) { if (!empty($inputOptions) && isset($helperOptions['options'])) { throw new Exception("Don't send \$inputOptions and \$helperOptions['options'] at the same time!"); } $defaultOptions = array('options' => $inputOptions); $options = Portabilis_Array_Utils::merge($helperOptions, $defaultOptions); //foreach($helperOptions as $k => $v) { // $options[$k] = $v; //} return $options; }
protected static function insertOption($key, $value, $array) { return Portabilis_Array_Utils::insertIn($key, $value, $array); }
protected function loadComponentesCurricularesForMatricula($matriculaId) { $componentesCurriculares = array(); $componenteCurricularId = $this->getRequest()->componente_curricular_id; $_componentesCurriculares = App_Model_IedFinder::getComponentesPorMatricula($matriculaId, null, null, $componenteCurricularId); foreach ($_componentesCurriculares as $_componente) { $componente = array(); $componente['id'] = $_componente->get('id'); $componente['nome'] = $this->safeString(strtoupper($_componente->get('nome')), false); $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->getSituacaoMatricula($componente['id']); $componente['nota_necessaria_exame'] = $componente['situacao'] == 'Em Exame' ? $this->getNotaNecessariaExame($componente['id']) : null; 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['area_id'] = $area->id; $componente['area_nome'] = $this->safeString(strtoupper($nomeArea), false); //criando chave para ordenamento temporário //área de conhecimento + componente curricular $componente['my_order'] = Portabilis_String_Utils::unaccent(strtoupper($nomeArea)) . Portabilis_String_Utils::unaccent(strtoupper($_componente->get('nome'))); $componentesCurriculares[] = $componente; } //ordenando pela chave temporária criada $componentesCurriculares = Portabilis_Array_Utils::sortByKey('my_order', $componentesCurriculares); //removendo chave temporária $len = count($componentesCurriculares); for ($i = 0; $i < $len; $i++) { unset($componentesCurriculares[$i]['my_order']); } return $componentesCurriculares; }