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); }
public static function setAsIdValue($arrays, $keyAttr, $valueAtt) { if (empty($arrays)) { return array(); } if (!is_array($arrays)) { $arrays = array($arrays); } $idValueArray = array(); foreach ($arrays as $array) { $idValueArray = self::merge($idValueArray, self::asIdValue($array, $keyAttr, $valueAtt)); } return Portabilis_Array_Utils::sortByValue($idValueArray); }