Example #1
0
 function Gerar()
 {
     $obj_permissoes = new clsPermissoes();
     //		echo "<pre>";print_r($_POST);die;
     if (!$this->sem_cnpj && !$this->com_cnpj) {
         $parametros = new clsParametrosPesquisas();
         $parametros->setSubmit(1);
         $parametros->setPessoa('J');
         $parametros->setPessoaCampo('sem_cnpj');
         $parametros->setPessoaNovo("S");
         $parametros->setPessoaCPF("N");
         $parametros->setPessoaTela('window');
         $this->campoOculto("sem_cnpj", "");
         $parametros->setCodSistema(13);
         $parametros->adicionaCampoTexto("cnpj", "cnpj");
         $this->campoCnpjPesq("cnpj", "CNPJ", $this->cnpj, "pesquisa_pessoa_lst.php", $parametros->serializaCampos(), true);
         //			$this->acao_enviar = "obj = document.getElementById(\"cnpj\");if(obj.value != \"\" ) {document.getElementById(\"formcadastro\").submit(); } else { acao(); }";
         $this->acao_enviar = false;
         $this->url_cancelar = false;
         $this->array_botao = array("Continuar", "Cancelar");
         $this->array_botao_url_script = array("obj = document.getElementById('cnpj');if(obj.value != '' ) { acao(); } else { acao(); }", "go('educar_escola_lst.php');");
     } else {
         if ($_POST) {
             foreach ($_POST as $campo => $val) {
                 if ($campo != 'tipoacao' && $campo != 'sem_cnpj') {
                     $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val;
                 }
             }
         }
         if ($this->sem_cnpj) {
             $this->campoOculto("sem_cnpj", $this->sem_cnpj);
             // cadastro novo sem CNPJ
             $this->p_ddd_telefone_1 = $this->p_ddd_telefone_1 == null ? "" : $this->p_ddd_telefone_1;
             $this->p_ddd_telefone_fax = $this->p_ddd_telefone_fax == null ? "" : $this->p_ddd_telefone_fax;
             if ($this->ref_idpes) {
                 $objTemp = new clsPessoaJuridica($this->ref_idpes);
                 $detalhe = $objTemp->detalhe();
             }
             //				$this->campoOculto( "passo", 4 );
             //				$this->campoOculto( "sem_cnpj", 0 );
             $this->campoOculto("cod_escola", $this->cod_escola);
             // text
             $this->campoTexto("fantasia", "Escola", $this->fantasia, 30, 255, true);
             $this->campoTexto("sigla", "Sigla", $this->sigla, 30, 255, true);
             // foreign keys
             $nivel = $obj_permissoes->nivel_acesso($this->pessoa_logada);
             if ($nivel == 1) {
                 $cabecalhos[] = "Instituicao";
                 $objInstituicao = new clsPmieducarInstituicao();
                 $opcoes = array("" => "Selecione");
                 $objInstituicao->setOrderby("nm_instituicao ASC");
                 $lista = $objInstituicao->lista();
                 if (is_array($lista)) {
                     foreach ($lista as $linha) {
                         $opcoes[$linha["cod_instituicao"]] = $linha["nm_instituicao"];
                     }
                 }
                 $this->campoLista("ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao);
             } else {
                 $this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada);
                 if ($this->ref_cod_instituicao) {
                     $this->campoOculto("ref_cod_instituicao", $this->ref_cod_instituicao);
                 } else {
                     die("Usu�rio n�o � do nivel poli-institucional e n�o possui uma institui��o");
                 }
             }
             $opcoes = array("" => "Selecione");
             if (class_exists("clsPmieducarEscolaRedeEnsino")) {
                 /*$todas_redes_ensino = "rede_ensino = new Array();\n";
                 		$objTemp = new clsPmieducarEscolaRedeEnsino();
                 		$lista = $objTemp->lista();
                 		if ( is_array( $lista ) && count( $lista ) )
                 		{
                 			foreach ( $lista as $registro )
                 			{
                 				$todas_redes_ensino .= "rede_ensino[rede_ensino.length] = new Array( {$registro["cod_escola_rede_ensino"]}, '{$registro['nm_rede']}', {$registro["ref_cod_instituicao"]} );\n";
                 			}
                 		}
                 		echo "<script>{$todas_redes_ensino}</script>";*/
                 // EDITAR
                 $script = "javascript:showExpansivelIframe(520, 120, 'educar_escola_rede_ensino_cad_pop.php');";
                 if ($this->ref_cod_instituicao) {
                     $objTemp = new clsPmieducarEscolaRedeEnsino();
                     $lista = $objTemp->lista(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_escola_rede_ensino']}"] = "{$registro['nm_rede']}";
                         }
                     }
                     $script = "<img id='img_rede_ensino' style='display: \\'\\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
                 } else {
                     $script = "<img id='img_rede_ensino' style='display: none;'  src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
                 }
             } else {
                 echo "<!--\nErro\nClasse clsPmieducarEscolaRedeEnsino nao encontrada\n-->";
                 $opcoes = array("" => "Erro na geracao");
             }
             $this->campoLista("ref_cod_escola_rede_ensino", "Rede Ensino", $opcoes, $this->ref_cod_escola_rede_ensino, "", false, "", $script);
             $opcoes = array("" => "Selecione");
             if (class_exists("clsPmieducarEscolaLocalizacao")) {
                 /*$todas_escolas_localizacao = "escola_localizacao = new Array();\n";
                 		$objTemp = new clsPmieducarEscolaLocalizacao();
                 		$lista = $objTemp->lista();
                 		if ( is_array( $lista ) && count( $lista ) )
                 		{
                 			foreach ( $lista as $registro )
                 			{
                 				$todas_escolas_localizacao .= "escola_localizacao[escola_localizacao.length] = new Array( {$registro["cod_escola_localizacao"]}, '{$registro['nm_localizacao']}', {$registro["ref_cod_instituicao"]} );\n";
                 			}
                 		}
                 		echo "<script>{$todas_escolas_localizacao}</script>";*/
                 // EDITAR
                 $script = "javascript:showExpansivelIframe(520, 120, 'educar_escola_localizacao_cad_pop.php');";
                 if ($this->ref_cod_instituicao) {
                     $objTemp = new clsPmieducarEscolaLocalizacao();
                     $lista = $objTemp->lista(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_escola_localizacao']}"] = "{$registro['nm_localizacao']}";
                         }
                     }
                     $script = "<img id='img_localizacao' style='display: \\'\\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
                 } else {
                     $script = "<img id='img_localizacao' style='display: none;'  src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
                 }
             } else {
                 echo "<!--\nErro\nClasse clsPmieducarEscolaLocalizacao nao encontrada\n-->";
                 $opcoes = array("" => "Erro na geracao");
             }
             $this->campoLista("ref_cod_escola_localizacao", "Escola Localiza&ccedil;&atilde;o", $opcoes, $this->ref_cod_escola_localizacao, "", false, "", $script);
             if (is_numeric($this->cep)) {
                 $this->cep = int2CEP($this->cep);
             }
             //				$this->campoCep( "cep","CEP", $this->cep,true,"-",false,false );
             $this->campoCep("cep", "CEP", $this->cep, true, "-", false, false);
             $this->campoTexto("cidade", "Cidade", $this->cidade, "50", "255", true);
             $this->campoTexto("bairro", "Bairro", $this->bairro, "50", "20", true);
             $this->campoTexto("logradouro", "Logradouro", $this->logradouro, "50", "255", true);
             $this->campoTexto("complemento", "Complemento", $this->complemento, "22", "20", false);
             $this->campoNumero("numero", "Número", $this->numero, "6", "6", true);
             $this->campoTexto("p_ddd_telefone_1", "DDD Telefone 1", $this->p_ddd_telefone_1, "2", "2", false);
             $this->campoTexto("p_telefone_1", "Telefone 1", $this->p_telefone_1, "10", "15", false);
             $this->campoTexto("p_ddd_telefone_fax", "DDD Fax", $this->p_ddd_telefone_fax, "2", "2", false);
             $this->campoTexto("p_telefone_fax", "Fax", $this->p_telefone_fax, "10", "15", false);
             $this->campoTexto("p_email", "E-mail", $this->p_email, "50", "255", false);
         }
         if ($this->com_cnpj) {
             $this->campoOculto("com_cnpj", $this->com_cnpj);
             //				die("com CNPJ");
             //				echo "<br>cep: ".$this->cep;
             //				echo "<br>cep_: ".$this->cep_;
             if (!$this->cod_escola) {
                 $this->cnpj = urldecode($_POST['cnpj']);
                 $this->cnpj = idFederal2int($this->cnpj);
                 //					echo int2IdFederal($this->cnpj);
                 $this->cnpj = int2IdFederal($this->cnpj);
             }
             //				echo "sakdmk: ".$this->cnpj;die;
             // cadastro novo com CNPJ
             //echo "hehehe".idFederal2int($this->cnpj);echo "kiki".int2IdFederal($this->cnpj);die;
             $objJuridica = new clsPessoaJuridica(false, idFederal2int($this->cnpj));
             $det = $objJuridica->detalhe();
             $this->ref_idpes = $det["idpes"];
             //				if( $this->ref_idpes )
             //				{
             //					$this->p_ddd_telefone_1 = ( $this->p_ddd_telefone_1 == null ) ? "": is_numeric( $this->p_ddd_telefone_1 );
             //					$this->p_ddd_telefone_2 = ( $this->p_ddd_telefone_2 == null ) ? "": is_numeric( $this->p_ddd_telefone_2 );
             //					$this->p_ddd_telefone_3 = ( $this->p_ddd_telefone_3 == null ) ? "": is_numeric( $this->p_ddd_telefone_3 );
             //					$obj_pessoa = new clsPessoa_( $this->ref_idpes );
             //					$det_pessoa = $obj_pessoa->detalhe();
             //$this->fantasia = $det_pessoa["nome"];
             //					$this->nm_escola = $det["nome"];
             if (!$this->fantasia) {
                 $this->fantasia = $det["fantasia"];
             }
             if ($this->passou) {
                 $this->cnpj = is_numeric($this->cnpj) ? $this->cnpj : idFederal2int($this->cnpj);
                 $this->cnpj = int2IdFederal($this->cnpj);
             }
             //
             $this->campoRotulo("cnpj_", "CNPJ", $this->cnpj);
             $this->campoOculto("cnpj", idFederal2int($this->cnpj));
             $this->campoOculto("ref_idpes", $this->ref_idpes);
             //					$this->campoOculto( "passo", 3 );
             $this->campoOculto("cod_escola", $this->cod_escola);
             // text
             $this->campoTexto("fantasia", "Escola", $this->fantasia, 30, 255, true);
             $this->campoTexto("sigla", "Sigla", $this->sigla, 30, 255, true);
             // foreign keys
             $nivel = $obj_permissoes->nivel_acesso($this->pessoa_logada);
             if ($nivel == 1) {
                 $cabecalhos[] = "Instituicao";
                 $objInstituicao = new clsPmieducarInstituicao();
                 $opcoes = array("" => "Selecione");
                 $objInstituicao->setOrderby("nm_instituicao ASC");
                 $lista = $objInstituicao->lista();
                 if (is_array($lista)) {
                     foreach ($lista as $linha) {
                         $opcoes[$linha["cod_instituicao"]] = $linha["nm_instituicao"];
                     }
                 }
                 $this->campoLista("ref_cod_instituicao", "Instituicao", $opcoes, $this->ref_cod_instituicao);
             } else {
                 $this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada);
                 if ($this->ref_cod_instituicao) {
                     $this->campoOculto("ref_cod_instituicao", $this->ref_cod_instituicao);
                 } else {
                     die("Usu�rio n�o � do nivel poli-institucional e n�o possui uma institui��o");
                 }
             }
             $opcoes = array("" => "Selecione");
             if (class_exists("clsPmieducarEscolaRedeEnsino")) {
                 /*$todas_redes_ensino = "rede_ensino = new Array();\n";
                 		$objTemp = new clsPmieducarEscolaRedeEnsino();
                 		$lista = $objTemp->lista( null,null,null,null,null,null,null,null,1 );
                 		if ( is_array( $lista ) && count( $lista ) )
                 		{
                 			foreach ( $lista as $registro )
                 			{
                 				$todas_redes_ensino .= "rede_ensino[rede_ensino.length] = new Array( {$registro["cod_escola_rede_ensino"]}, '{$registro['nm_rede']}', {$registro["ref_cod_instituicao"]} );\n";
                 			}
                 		}
                 		echo "<script>{$todas_redes_ensino}</script>";*/
                 // EDITAR
                 $script = "javascript:showExpansivelIframe(520, 120, 'educar_escola_rede_ensino_cad_pop.php');";
                 if ($this->ref_cod_instituicao) {
                     $objTemp = new clsPmieducarEscolaRedeEnsino();
                     $lista = $objTemp->lista(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_escola_rede_ensino']}"] = "{$registro['nm_rede']}";
                         }
                     }
                     $script = "<img id='img_rede_ensino' style='display:\\'\\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
                 } else {
                     $script = "<img id='img_rede_ensino' style='display: none;'  src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
                 }
             } else {
                 echo "<!--\nErro\nClasse clsPmieducarEscolaRedeEnsino nao encontrada\n-->";
                 $opcoes = array("" => "Erro na geracao");
             }
             $this->campoLista("ref_cod_escola_rede_ensino", "Rede Ensino", $opcoes, $this->ref_cod_escola_rede_ensino, "", false, "", $script);
             $opcoes = array("" => "Selecione");
             if (class_exists("clsPmieducarEscolaLocalizacao")) {
                 /*$todas_escolas_localizacao = "escola_localizacao = new Array();\n";
                 		$objTemp = new clsPmieducarEscolaLocalizacao();
                 		$lista = $objTemp->lista( null,null,null,null,null,null,null,null,1 );
                 		if ( is_array( $lista ) && count( $lista ) )
                 		{
                 			foreach ( $lista as $registro )
                 			{
                 				$todas_escolas_localizacao .= "escola_localizacao[escola_localizacao.length] = new Array( {$registro["cod_escola_localizacao"]}, '{$registro['nm_localizacao']}', {$registro["ref_cod_instituicao"]} );\n";
                 			}
                 		}
                 		echo "<script>{$todas_escolas_localizacao}</script>";*/
                 // EDITAR
                 $script = "javascript:showExpansivelIframe(520, 120, 'educar_escola_localizacao_cad_pop.php');";
                 if ($this->ref_cod_instituicao) {
                     $objTemp = new clsPmieducarEscolaLocalizacao();
                     $lista = $objTemp->lista(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_escola_localizacao']}"] = "{$registro['nm_localizacao']}";
                         }
                     }
                     $script = "<img id='img_localizacao' style='display:\\'\\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
                 } else {
                     $script = "<img id='img_localizacao' style='display: none;' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
                 }
             } else {
                 echo "<!--\nErro\nClasse clsPmieducarEscolaLocalizacao nao encontrada\n-->";
                 $opcoes = array("" => "Erro na geracao");
             }
             $this->campoLista("ref_cod_escola_localizacao", "Escola Localiza&ccedil;&atilde;o", $opcoes, $this->ref_cod_escola_localizacao, "", false, "", $script);
             // Detalhes do Endereco
             $objUf = new clsUf();
             $listauf = $objUf->lista();
             $listaEstado = array("" => "Selecione");
             if ($listauf) {
                 foreach ($listauf as $uf) {
                     $listaEstado[$uf['sigla_uf']] = $uf['sigla_uf'];
                 }
             }
             $objTipoLog = new clsTipoLogradouro();
             $listaTipoLog = $objTipoLog->lista();
             $listaTLog = array("" => "Selecione");
             if ($listaTipoLog) {
                 foreach ($listaTipoLog as $tipoLog) {
                     $listaTLog[urldecode($tipoLog['idtlog'])] = $tipoLog['descricao'];
                 }
             }
             $this->campoOculto("isEnderecoExterno", $this->isEnderecoExterno);
             //	echo "$this->cep ,$this->sigla_uf ";
             $this->campoOculto("cep_", $this->cep_);
             $this->campoOculto("sigla_uf_", $this->sigla_uf_);
             $this->campoOculto("cidade_", $this->cidade_);
             $this->campoOculto("bairro_", $this->bairro_);
             $this->campoOculto("idbai", $this->idbai);
             $this->campoOculto("logradouro_", $this->logradouro_);
             $this->campoOculto("idlog", $this->idlog);
             $this->campoOculto("idtlog_", $this->idtlog_);
             $disabled = $this->isEnderecoExterno ? false : true;
             if ($this->idlog && $this->idbai && $this->cep && $this->ref_idpes) {
                 $this->campoOculto("cep_", $this->cep);
                 $this->cep_ = int2CEP($this->cep);
                 //$this->campoLista( "ref_cod_escola_localizacao", "Escola Localizac&atilde;o", $opcoes, $this->ref_cod_escola_localizacao );
                 //						$this->campoCep("cep_","CEP", int2CEP($this->cep),true,"-","&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f('pesquisa_cep3.php', 'enderecos')\" style=\"cursor: hand;\">",true);
                 //						$this->campoCep( "cep_", "CEP", int2CEP( $this->cep ), true, "-", "&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f( 'pesquisa_cep_lst.php', 'enderecos' )\" style=\"cursor: hand;\">", false );
                 //$this->campoCep( "cep", "CEP", int2CEP( $this->cep ), true, "-", "&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_popless('pesquisa_cep_lst.php', 'enderecos')\" style=\"cursor: hand;\">", true );
                 $this->campoCep("cep", "CEP", $this->cep_, true, "-", "<img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel( 500,500, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep_&campo4=logradouro&campo5=idlog&campo6=sigla_uf_&campo7=cidade&campo8=idtlog_&campo9=isEnderecoExterno&campo10=cep&campo11=sigla_uf&campo12=idtlog&campo13=cidade_\\'></iframe>');\">", $disabled);
                 $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf, false, false, false, false, true, true);
                 $this->campoTexto("cidade", "Cidade", $this->cidade, "50", "255", true, false, false, "", "", "", "onKeyUp", true);
                 $this->campoTexto("bairro", "Bairro", $this->bairro, "50", "255", true, false, false, "", "", "", "onKeyUp", true);
                 $this->campoLista("idtlog", "Tipo Logradouro", $listaTLog, $this->idtlog, false, false, false, false, true, true);
                 $this->campoTexto("logradouro", "Logradouro", $this->logradouro, "50", "255", true, false, false, "", "", "", "onKeyUp", true);
                 $this->campoTexto("complemento", "Complemento", $this->complemento, "22", "20", false, false);
                 $this->campoNumero("numero", "Número", $this->numero, "6", "6", false);
                 $this->campoNumero("andar", "Andar", $this->andar, "2", "2", false);
             } elseif ($this->ref_idpes && $this->cep) {
                 $this->cep = is_numeric($this->cep) ? int2CEP($this->cep) : $this->cep;
                 //						$this->campoCep("cep_","CEP", int2CEP($this->cep),true,"-","&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f('pesquisa_cep3.php', 'enderecos')\" style=\"cursor: hand;\">",false);
                 //						$this->campoCep( "cep_", "CEP", int2CEP( $this->cep ), true, "-", "&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f( 'pesquisa_cep_lst.php', 'enderecos' )\" style=\"cursor: hand;\">", false );
                 //$this->campoCep( "cep", "CEP", int2CEP( $this->cep ), true, "-", "&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_popless('pesquisa_cep_lst.php', 'enderecos')\" style=\"cursor: hand;\">", false );
                 $this->campoCep("cep", "CEP", $this->cep, true, "-", "<img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel( 500,500, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep_&campo4=logradouro&campo5=idlog&campo6=sigla_uf_&campo7=cidade&campo8=idtlog_&campo9=isEnderecoExterno&campo10=cep&campo11=sigla_uf&campo12=idtlog&campo13=cidade_\\'></iframe>');\">");
                 $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf, "", false, "", "", false, true);
                 $this->campoTexto("cidade", "Cidade", $this->cidade, "50", "255", true, false, false, "", "", "", "onKeyUp", false);
                 $this->campoTexto("bairro", "Bairro", $this->bairro, "50", "255", true, false, false, "", "", "", "onKeyUp", false);
                 $this->campoLista("idtlog", "Tipo Logradouro", $listaTLog, $this->idtlog, "", false, "", "", false, true);
                 $this->campoTexto("logradouro", "Logradouro", $this->logradouro, "50", "255", true, false, false, "", "", "", "onKeyUp", false);
                 $this->campoTexto("complemento", "Complemento", $this->complemento, "22", "20", false, false, false, "", "", "", "onKeyUp", false);
                 $this->campoNumero("numero", "Número", $this->numero, 6, 6, false, "", "");
                 $this->campoNumero("andar", "Andar", $this->andar, "2", "2", false);
             } else {
                 if (!$this->isEnderecoExterno) {
                     $obj_bairro = new clsBairro($this->idbai);
                     $this->cep_ = int2CEP($this->cep_);
                     $obj_bairro_det = $obj_bairro->detalhe();
                     if ($obj_bairro_det) {
                         $this->bairro = $obj_bairro_det["nome"];
                     }
                     $obj_log = new clsLogradouro($this->idlog);
                     $obj_log_det = $obj_log->detalhe();
                     if ($obj_log_det) {
                         $this->logradouro = $obj_log_det["nome"];
                         $this->idtlog = $obj_log_det["idtlog"]->idtlog;
                         $obj_mun = new clsMunicipio($obj_log_det["idmun"]);
                         $det_mun = $obj_mun->detalhe();
                         if ($det_mun) {
                             $this->cidade = strtoupper(ucfirst(strtolower($det_mun["nome"])));
                         }
                         $this->sigla_uf = $this->sigla_uf_ = $det_mun['sigla_uf']->sigla_uf;
                     }
                 } else {
                     $this->cep_ = $this->cep;
                 }
                 /*$obj_bairro = new clsBairro($obj_endereco_det["ref_idbai"]);
                 					$obj_bairro_det = $obj_bairro->detalhe();
                 
                 					if($obj_bairro_det){
                 
                 						$this->bairro = $obj_bairro_det["nome"];
                 					}*/
                 //						$this->campoCep("cep_","CEP", int2CEP($this->cep),true,"-","&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f('pesquisa_cep3.php', 'enderecos')\" style=\"cursor: hand;\">",true);
                 //						$this->campoCep( "cep_", "CEP", int2CEP( $this->cep ), true, "-", "&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f( 'pesquisa_cep_lst.php', 'enderecos' )\" style=\"cursor: hand;\">", false );
                 //						$this->campoCep( "cep_", "CEP", int2CEP( $this->cep ), true, "-", "&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_popless('pesquisa_cep_lst.php', 'enderecos')\" style=\"cursor: hand;\">", false );
                 $this->campoCep("cep", "CEP", $this->cep_, true, "-", "<img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel( 500,500, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep_&campo4=logradouro&campo5=idlog&campo6=sigla_uf_&campo7=cidade&campo8=idtlog_&campo9=isEnderecoExterno&campo10=cep&campo11=sigla_uf&campo12=idtlog&campo13=cidade_\\'></iframe>');\">", $disabled);
                 //	$this->campoCep("cep_", "CEP", $this->cep_, true, "-", "<img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel( 500,500, '<iframe name=\'miolo\' id=\'miolo\' frameborder=\'0\' height=\'100%\' width=\'500\' marginheight=\'0\' marginwidth=\'0\' src=\'educar_pesquisa_cep_log_bairro.php?campo1=nm_bairro&campo2=id_bairro&campo3=id_cep&campo4=nm_logradouro&campo5=id_logradouro&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog_&campo9=isEnderecoExterno&campo10=cep_&campo11=ref_sigla_uf_&campo12=ref_idtlog&campo13=id_cidade\'></iframe>');\">", $disabled);
                 $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf, false, false, false, false, $disabled, true);
                 $this->campoTexto("cidade", "Cidade", $this->cidade, "50", "255", true, false, false, "", "", "", "", $disabled, true);
                 $this->campoTexto("bairro", "Bairro", $this->bairro, "50", "20", true, false, false, "", "", "", "", $disabled, true);
                 $this->campoLista("idtlog", "Tipo Logradouro", $listaTLog, $this->idtlog, false, false, false, false, $disabled, true);
                 $this->campoTexto("logradouro", "Logradouro", $this->logradouro, "50", "255", true, false, false, "", "", "", "", $disabled, true);
                 $this->campoTexto("complemento", "Complemento", $this->complemento, "22", "20", false, false, false);
                 $this->campoNumero("numero", "N&uacute;mero", $this->numero, "6", "6", false);
                 $this->campoNumero("andar", "Andar", $this->andar, "2", "2", false);
             }
             $this->campoNumero("p_ddd_telefone_1", "DDD Telefone 1", $this->p_ddd_telefone_1, 2, 2, false);
             $this->campoNumero("p_telefone_1", "Telefone 1", $this->p_telefone_1, 10, 15, false);
             $this->campoNumero("p_ddd_telefone_2", "DDD Telefone 2", $this->p_ddd_telefone_2, 2, 2, false);
             $this->campoNumero("p_telefone_2", "Telefone", $this->p_telefone_2, 10, 15, false);
             $this->campoNumero("p_ddd_telefone_fax", "DDD Fax", $this->p_ddd_telefone_fax, 2, 2, false);
             $this->campoNumero("p_telefone_fax", "Fax", $this->p_telefone_fax, 10, 15, false);
             $this->campoTexto("p_http", "Site", $this->p_http, "50", "255", false);
             $this->campoTexto("p_email", "E-mail", $this->p_email, "50", "255", false);
             //				}
             //				else
             //				{
             //					$this->mensagem = "nop";
             //				}
             $this->passou = true;
             $this->campoOculto("passou", $this->passou);
         }
         //			else if ( $this->passo == 3 )
         //			{
         //
         //
         //
         //			}
         if ($_POST["escola_curso"]) {
             $this->escola_curso = unserialize(urldecode($_POST["escola_curso"]));
         }
         if (is_numeric($this->cod_escola) && !$_POST) {
             $obj = new clsPmieducarEscolaCurso($this->cod_escola);
             $registros = $obj->lista($this->cod_escola);
             if ($registros) {
                 foreach ($registros as $campo) {
                     $this->escola_curso[$campo["ref_cod_curso"]] = $campo["ref_cod_curso"];
                 }
             }
         }
         if ($_POST["ref_cod_curso"]) {
             $this->escola_curso[$_POST["ref_cod_curso"]] = $_POST["ref_cod_curso"];
             unset($this->ref_cod_curso);
         }
         $this->campoQuebra();
         $this->campoOculto("excluir_curso", "");
         unset($aux);
         if ($this->escola_curso) {
             //				echo "<pre>";print_r($this->escola_curso);
             foreach ($this->escola_curso as $curso) {
                 if ($this->excluir_curso == $curso) {
                     unset($this->escola_curso[$curso]);
                     // = null;
                     $this->excluir_curso = null;
                 } else {
                     $obj_curso = new clsPmieducarCurso($curso);
                     $obj_curso_det = $obj_curso->detalhe();
                     $nm_curso = $obj_curso_det["nm_curso"];
                     $this->campoTextoInv("ref_cod_curso_{$curso}", "", $nm_curso, 30, 255, false, false, false, "", "<a href='#' onclick=\"getElementById('excluir_curso').value = '{$curso}'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>");
                     $aux[$curso] = $curso;
                 }
             }
             unset($this->escola_curso);
             $this->escola_curso = $aux;
         }
         $this->campoOculto("escola_curso", serialize($this->escola_curso));
         $opcoes = array("" => "Selecione");
         if (class_exists("clsPmieducarCurso")) {
             /*$todos_cursos = "curso = new Array();\n";
             		$objTemp = new clsPmieducarCurso();
             		$objTemp->setOrderby("nm_curso");
             		$lista = $objTemp->lista( null,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 )
             			{
             				$todos_cursos .= "curso[curso.length] = new Array({$registro["cod_curso"]},'{$registro["nm_curso"]}', {$registro["ref_cod_instituicao"]});\n";
             			}
             		}
             		echo "<script>{$todos_cursos}</script>";*/
             // EDITAR
             if ($this->cod_escola || $this->ref_cod_instituicao) {
                 $objTemp = new clsPmieducarCurso();
                 $objTemp->setOrderby("nm_curso");
                 $lista = $objTemp->lista(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1, null, $this->ref_cod_instituicao);
                 if (is_array($lista) && count($lista)) {
                     foreach ($lista as $registro) {
                         $opcoes["{$registro['cod_curso']}"] = "{$registro['nm_curso']}";
                     }
                 }
             }
         } else {
             echo "<!--\nErro\nClasse clsPmieducarCurso n&atilde;o encontrada\n-->";
             $opcoes = array("" => "Erro na gera&ccedil;&atilde;o");
         }
         if ($aux) {
             $this->campoLista("ref_cod_curso", "Curso", $opcoes, $this->ref_cod_curso, "", false, "", "<a href='#' onclick=\"getElementById('incluir_curso').value = 'S'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bot_adiciona.gif' title='Incluir' border=0></a>", false, false);
         } else {
             $this->campoLista("ref_cod_curso", "Curso", $opcoes, $this->ref_cod_curso, "", false, "", "<a href='#' onclick=\"getElementById('incluir_curso').value = 'S'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bot_adiciona.gif' title='Incluir' border=0></a>");
         }
         $this->campoOculto("incluir_curso", "");
         $this->campoQuebra();
     }
 }
 function Gerar()
 {
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet", false);
     if (!$this->busca_pessoa) {
         $parametros = new clsParametrosPesquisas();
         $parametros->setSubmit(1);
         $parametros->setPessoa('F');
         $parametros->setPessoaCampo("cod_pessoa_fj");
         $parametros->setPessoaNovo('S');
         $parametros->setPessoaTela("window");
         $parametros->setCodSistema(8);
         $parametros->adicionaCampoTexto("busca_pessoa", "cpf");
         $this->campoCpf("busca_pessoa", "CPF", $this->busca_pessoa, true, "<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_popless( 'pesquisa_pessoa_lst.php?campos=" . $parametros->serializaCampos() . "', 'busca_pessoa' )\">");
         $this->campoOculto("cod_grupo", $this->cod_grupo);
         $this->campoOculto("cod_pessoa_fj", "");
     } else {
         $this->nome_url_cancelar = "Cancelar";
         $this->url_cancelar = "otopic_meus_grupos_det.php?cod_grupo={$this->cod_grupo}";
         $this->campoOculto("cod_grupo", $this->cod_grupo);
         $this->campoOculto("cod_pessoa_fj", $this->cod_pessoa_fj);
         $this->campoTexto("nm_pessoa", "Nome", $this->nm_pessoa, "50", "255", true);
         if ($this->id_federal) {
             $this->campoCpf("id_federal", "CPF", int2CPF($this->id_federal), "50", "", true);
         }
         $lista_sexos = array();
         $lista_sexos[""] = "Escolha uma op&ccedil;&atilde;o...";
         $lista_sexos["M"] = "Masculino";
         $lista_sexos["F"] = "Feminino";
         $this->campoLista("sexo", "Sexo", $lista_sexos, $this->sexo);
         // Detalhes do Endereço
         $objTipoLog = new clsTipoLogradouro();
         $listaTipoLog = $objTipoLog->lista();
         $listaTLog = array("0" => "Selecione");
         if ($listaTipoLog) {
             foreach ($listaTipoLog as $tipoLog) {
                 $listaTLog[$tipoLog['idtlog']] = $tipoLog['descricao'];
             }
         }
         $objUf = new clsUf();
         $listauf = $objUf->lista();
         $listaEstado = array("0" => "Selecione");
         if ($listauf) {
             foreach ($listauf as $uf) {
                 $listaEstado[$uf['sigla_uf']] = $uf['sigla_uf'];
             }
         }
         $this->campoOculto("idbai", $this->idbai);
         $this->campoOculto("idlog", $this->idlog);
         $this->campoOculto("cep", $this->cep);
         if ($this->idlog && $this->idbai && $this->cep && $this->cod_pessoa_fj) {
             $this->campoCep("cep_", "CEP", $this->cep, false, "-", "&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f('pesquisa_cep.php', 'enderecos')\" style=\"cursor: hand;\">", true);
             $this->campoLista("idtlog", "Tipo Logradouro", $listaTLog, $this->idtlog, false, false, false, false, true);
             $this->campoTextoInv("logradouro", "Logradouro", $this->logradouro, "50", "255", false);
             $this->campoTextoInv("cidade", "Cidade", $this->cidade, "50", "255", false);
             $this->campoTextoInv("bairro", "Bairro", $this->bairro, "50", "255", false);
             $this->campoTexto("complemento", "Complemento", $this->complemento, "50", "255", false);
             $this->campoTexto("numero", "Número", $this->numero, "10", "10", false);
             $this->campoTexto("letra", "Letra", $this->letra, "1", "1", false);
             $this->campoTexto("apartamento", "Número Apartametno", $this->apartamento, "6", "6", false);
             $this->campoTexto("bloco", "Bloco", $this->bloco, "20", "20", false);
             $this->campoTexto("andar", "Andar", $this->andar, "2", "2", false);
             $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf, false, false, false, false, true);
         } elseif ($this->cod_pessoa_fj) {
             $this->campoCep("cep_", "CEP", $this->cep, false, "-", "&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f('pesquisa_cep.php', 'enderecos')\" style=\"cursor: hand;\">", false);
             $this->campoLista("idtlog", "Tipo Logradouro", $listaTLog, $this->idtlog);
             $this->campoTexto("logradouro", "Logradouro", $this->logradouro, "50", "255", false);
             $this->campoTexto("cidade", "Cidade", $this->cidade, "50", "255", false);
             $this->campoTexto("bairro", "Bairro", $this->bairro, "50", "255", false);
             $this->campoTexto("complemento", "Complemento", $this->complemento, "50", "255", false);
             $this->campoTexto("numero", "Número", $this->numero, "10", "10", false);
             $this->campoTexto("letra", "Letra", $this->letra, "1", "1", false);
             $this->campoTexto("apartamento", "Número Apartametno", $this->apartamento, "6", "6", false);
             $this->campoTexto("bloco", "Bloco", $this->bloco, "20", "20", false);
             $this->campoTexto("andar", "Andar", $this->andar, "2", "2", false);
             $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf);
         } else {
             $this->campoCep("cep_", "CEP", $this->cep, false, "-", "&nbsp;<img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f('pesquisa_cep.php', 'enderecos')\" style=\"cursor: hand;\">", true);
             $this->campoLista("idtlog", "Tipo Logradouro", $listaTLog, $this->idtlog, false, false, false, false, true);
             $this->campoTextoInv("logradouro", "Logradouro", $this->logradouro, "50", "255", true);
             $this->campoTextoInv("cidade", "Cidade", $this->cidade, "50", "255", true);
             $this->campoTextoInv("bairro", "Bairro", $this->bairro, "50", "255", true);
             $this->campoTextoInv("complemento", "Complemento", $this->complemento, "50", "255", false);
             $this->campoTextoInv("numero", "Número", $this->numero, "10", "10", false);
             $this->campoTextoInv("letra", "Letra", $this->letra, "1", "1", false);
             $this->campoTexto("apartamento", "Número Apartametno", $this->apartamento, "6", "6", false);
             $this->campoTexto("bloco", "Bloco", $this->bloco, "20", "20", false);
             $this->campoTexto("andar", "Andar", $this->andar, "2", "2", false);
             $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf, false, false, false, false, true);
         }
         $this->campoTexto("ddd_telefone_1", "DDD Telefone 1", $this->ddd_telefone_1, "3", "2", false);
         $this->campoTexto("telefone_1", "Telefone 1", $this->telefone_1, "10", "15", false);
         $this->campoTexto("ddd_telefone_2", "DDD Telefone 2", $this->ddd_telefone_2, "3", "2", false);
         $this->campoTexto("telefone_2", "Telefone", $this->telefone_2, "10", "15", false);
         $this->campoTexto("ddd_telefone_mov", "DDD Celular", $this->ddd_telefone_mov, "3", "2", false);
         $this->campoTexto("telefone_mov", "Celular", $this->telefone_mov, "10", "15", false);
         $this->campoTexto("ddd_telefone_fax", "DDD Fax", $this->ddd_telefone_fax, "3", "2", false);
         $this->campoTexto("telefone_fax", "Fax", $this->telefone_fax, "10", "15", false);
         $this->campoTexto("http", "Site", $this->http, "50", "255", false);
         $this->campoTexto("email", "E-mail", $this->email, "50", "255", false);
         /***********************
         			Documentos
         			***********************/
         if ($this->cod_pessoa_fj) {
             $this->campoRotulo("documentos", "<b><i>Documentos</i></b>", "<a href='#' onclick=\" openPage('adicionar_documentos_cad.php?id_pessoa={$this->cod_pessoa_fj}','400','400','yes', '10','10'); \"><img src='imagens/nvp_bot_ad_doc.png' border='0'></a>");
         }
     }
 }
 function Gerar()
 {
     $this->campoOculto("ref_pessoa", $this->ref_pessoa);
     if (is_numeric($this->ref_pessoa)) {
         $this->campoOculto("confere_senha", $this->confere_senha);
     }
     //--------------------------------------------------------------------
     if ($_POST) {
         foreach ($_POST as $campo => $val) {
             $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val;
         }
     }
     //--------------------------------------------------------------------
     $this->ref_cod_setor_new = 0;
     if (!$this->ref_cod_setor_new && is_numeric($this->ref_pessoa)) {
         $objFuncionario = new clsPortalFuncionario($this->ref_pessoa);
         $detFunc = $objFuncionario->detalhe();
         $this->ref_cod_setor_new = $detFunc["ref_cod_setor_new"];
     }
     if ($this->ref_cod_setor_new) {
         $objSetor = new clsSetor();
         $parentes = $objSetor->getNiveis($this->ref_cod_setor_new);
         for ($i = 0; $i < 5; $i++) {
             if (isset($parentes[$i]) && $parentes[$i]) {
                 $nmvar = "setor_{$i}";
                 $this->{$nmvar} = $parentes[$i];
             }
         }
     }
     //--------------------------------------------------------------------
     if ($_GET["ref_pessoa"]) {
         $obj_funcionario = new clsPessoaFj($this->ref_pessoa);
         $det_funcionario = $obj_funcionario->detalhe();
         $this->nome = $det_funcionario["nome"];
         $this->campoRotulo("nome", "Nome", $this->nome);
     } else {
         $parametros = new clsParametrosPesquisas();
         $parametros->setSubmit(1);
         $parametros->setPessoa("F");
         $parametros->setPessoaNovo('S');
         $parametros->setPessoaEditar('N');
         $parametros->setPessoaTela("frame");
         $parametros->setPessoaCPF('N');
         $parametros->adicionaCampoTexto("nome", "nome");
         $parametros->adicionaCampoTexto("nome_busca", "nome");
         $parametros->adicionaCampoTexto("ref_pessoa", "idpes");
         $this->campoTextoPesquisa("nome_busca", "Nome", $this->nome, 30, 255, true, "pesquisa_pessoa_lst.php", false, false, "", "", $parametros->serializaCampos() . "&busca=S", true);
         $this->campoOculto("nome", $this->nome);
         $this->campoOculto("ref_pessoa", $this->ref_pessoa);
     }
     $this->campoTexto("matricula", "Matr&iacute;cula", $this->matricula, 12, 12, true);
     $this->campoSenha("_senha", "Senha", $this->_senha, true);
     $this->campoEmail("email", "E-mail usuário", $this->email, 50, 50, false, false, false, 'Utilizado para redefinir a senha, caso o usúario esqueça<br />Este campo pode ser gravado em branco, neste caso será solicitado um e-mail ao usuário, após entrar no sistema.');
     $obj_setor = new clsSetor();
     $lst_setor = $obj_setor->lista(null, null, null, null, null, null, null, null, null, 1, 0);
     $opcoes = array("" => "Selecione");
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     }
     $this->campoLista("setor_0", "Setor", $opcoes, $this->setor_0, "oproDocumentoNextLvl( this.value, '1' )", NULL, NULL, NULL, NULL, FALSE);
     $lst_setor = $obj_setor->lista($this->setor_0);
     $opcoes = array("" => "Selecione");
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     } else {
         $opcoes[""] = "---------";
     }
     $this->campoLista("setor_1", "Subsetor 1", $opcoes, $this->setor_1, "oproDocumentoNextLvl(this.value, '2')", false, "", "", $this->setor_0 == "" ? true : false, false);
     $opcoes = array("" => "Selecione");
     $lst_setor = $obj_setor->lista($this->setor_1);
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     } else {
         $opcoes[""] = "---------";
     }
     $this->campoLista("setor_2", "Subsetor 2", $opcoes, $this->setor_2, "oproDocumentoNextLvl(this.value, '3')", false, "", "", $this->setor_1 == "" ? true : false, false);
     $opcoes = array("" => "Selecione");
     $lst_setor = $obj_setor->lista($this->setor_2);
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     } else {
         $opcoes[""] = "---------";
     }
     $this->campoLista("setor_3", "Subsetor 3", $opcoes, $this->setor_3, "oproDocumentoNextLvl(this.value, '4')", false, "", "", $this->setor_2 == "" ? true : false, false);
     $opcoes = array("" => "Selecione");
     $lst_setor = $obj_setor->lista($this->setor_3);
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     } else {
         $opcoes[""] = "---------";
     }
     $this->campoLista("setor_4", "Subsetor 4", $opcoes, $this->setor_4, "oproDocumentoNextLvl(this.value, '5')", false, "", "", $this->setor_3 == "" ? true : false, false);
     $opcoes = array(0 => "Inativo", 1 => "Ativo");
     $this->campoLista("ativo", "Status", $opcoes, $this->ativo);
     $opcoes = array("" => "Selecione", 5 => "Comissionado", 4 => "Contratado", 3 => "Efetivo", 6 => "Estagi&aacute;rio");
     $this->campoLista("ref_cod_funcionario_vinculo", "V&iacute;nculo", $opcoes, $this->ref_cod_funcionario_vinculo);
     $opcoes = array("" => "Selecione", 5 => "5", 6 => "6", 7 => "7", 10 => "10", 14 => "14", 20 => "20", 21 => "21", 28 => "28", 30 => "30", 35 => "35", 60 => "60", 90 => "90", 120 => "120", 150 => "150", 180 => "180", 210 => "210", 240 => "240", 270 => "270", 300 => "300", 365 => "365");
     $this->campoLista("tempo_expira_conta", "Dias p/ expirar a conta", $opcoes, $this->tempo_expira_conta);
     $tempoExpiraSenha = $GLOBALS['coreExt']['Config']->app->user_accounts->default_password_expiration_period;
     if (is_numeric($tempoExpiraSenha)) {
         $this->campoOculto("tempo_expira_senha", $tempoExpiraSenha);
     } else {
         $opcoes = array('' => 'Selecione', 5 => '5', 30 => '30', 60 => '60', 90 => '90', 120 => '120', 180 => '180');
         $this->campoLista("tempo_expira_senha", "Dias p/ expirar a senha", $opcoes, $this->tempo_expira_senha);
     }
     $this->campoTexto("ramal", "Ramal", $this->ramal, 11, 30);
     $opcoes = array(null => "Não", 'S' => "Sim");
     $this->campoLista("super", "Super usu&aacute;rio", $opcoes, $this->super, '', false, '', '', false, false);
     $opcoes = array(null => "Não", 1 => "Sim");
     $this->campoLista("proibido", "Banido", $opcoes, $this->proibido, '', false, '', '', false, false);
     $opcoes = array(null => "Não", 1 => "Sim");
     $this->campoLista("matricula_permanente", "Matr&iacute;cula permanente", $opcoes, $this->matricula_permanente, '', false, '', '', false, false);
     //-----------------------------------------------------------------------------------------------
     $this->campoRotulo("rotulo_permissoes", "<b><i>Permiss&otilde;es</i></b>", "");
     $obj_menu = new clsPortalMenuMenu();
     $obj_menu->setOrderby("nm_menu ASC");
     $lst_menu = $obj_menu->lista();
     //busca todos os submenus liberado para o funcionario
     if (is_numeric($this->ref_pessoa)) {
         $obj_menu_funcionario = new clsPortalMenuFuncionario($this->ref_pessoa);
         $lst_menu_funcionario = $obj_menu_funcionario->lista(null, null, $this->ref_pessoa);
         if (is_array($lst_menu_funcionario) && count($lst_menu_funcionario)) {
             foreach ($lst_menu_funcionario as $id_submenu) {
                 $array_submenu[] = $id_submenu["ref_cod_menu_submenu"];
             }
         }
     }
     if (is_array($lst_menu) && count($lst_menu)) {
         foreach ($lst_menu as $key => $menu) {
             $array_valores = array();
             if ($menu["cod_menu_menu"] != 1) {
                 /*					if( $menu['nm_menu'] == "i-Frotas")
                 					{
                 						echo $menu["cod_menu_menu"];
                 					}*/
                 $obj_submenu = new clsPortalMenuSubmenu();
                 $obj_submenu->setOrderby("nm_submenu ASC");
                 $lst_submenu = $obj_submenu->lista($menu["cod_menu_menu"], 2);
                 $opcoes = array("" => "Selecione");
                 if (is_array($lst_submenu) && count($lst_submenu)) {
                     foreach ($lst_submenu as $submenu) {
                         $opcoes[$submenu["cod_menu_submenu"]] = $submenu["nm_submenu"];
                     }
                 }
                 if (is_numeric($this->ref_pessoa)) {
                     if (is_array($array_submenu) && count($array_submenu)) {
                         //faz a interseccao dos submenus do funcionario e os submenus do menu atual (do foreach)
                         $array_menu_submenu = array_intersect(array_flip($opcoes), $array_submenu);
                     }
                     $contador = 0;
                     if (is_array($array_menu_submenu) && count($array_menu_submenu)) {
                         //monta a matriz que conterao os valores da tabela (do BD)
                         foreach ($array_menu_submenu as $id_submenu) {
                             $obj_menu_funcionario = new clsPortalMenuFuncionario($this->ref_pessoa, null, null, $id_submenu);
                             $det_menu_funcionario = $obj_menu_funcionario->detalhe();
                             $array_valores[$contador][] = $det_menu_funcionario["ref_cod_menu_submenu"];
                             $array_valores[$contador][] = $det_menu_funcionario["cadastra"];
                             $array_valores[$contador++][] = $det_menu_funcionario["exclui"];
                         }
                     }
                 }
                 $this->campoTabelaInicio(str_replace(" ", "_", limpa_acentos(strtolower($menu["nm_menu"]))), $menu["nm_menu"], array("Submenu", "Cadastrar", "Excluir"), $array_valores, "500");
                 $this->campoLista(str_replace(" ", "_", limpa_acentos(strtolower($menu["nm_menu"]))) . "_", "", $opcoes, "", "", false, "", "", false, false);
                 $this->campoCheck("cad_" . str_replace(" ", "_", limpa_acentos(strtolower($menu["nm_menu"]))), "", "");
                 $this->campoCheck("exc_" . str_replace(" ", "_", limpa_acentos(strtolower($menu["nm_menu"]))), "", "");
                 $this->campoTabelaFim();
             }
         }
     }
 }
Example #4
0
 function Gerar()
 {
     $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet', FALSE);
     if (!$this->busca_pessoa) {
         $this->campoOculto('cod_pessoa_fj', '');
         $parametros = new clsParametrosPesquisas();
         $parametros->setSubmit(1);
         $parametros->adicionaCampoTexto('busca_pessoa', 'id_federal');
         $parametros->adicionaCampoTexto('cod_pessoa_fj', 'idpes');
         $parametros->setPessoa('F');
         $parametros->setPessoaCampo('cod_pessoa_fj');
         $parametros->setPessoaNovo('S');
         $parametros->setPessoaTela('window');
         $html = sprintf('<img id="lupa" src="imagens/lupa.png" border="0" ' . "onclick=\"showExpansivel(500, 500, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'pesquisa_pessoa_lst.php?campos=%s\\'></iframe>');\"" . '>', $parametros->serializaCampos());
         $this->campoCpf('busca_pessoa', 'CPF', $this->ref_cod_pessoa_fj, TRUE, $html, FALSE, TRUE);
     } else {
         $this->campoOculto('busca_pessoa', $this->busca_pessoa);
         $this->url_cancelar = $this->retorno == 'Editar' ? 'atendidos_det.php?cod_pessoa=' . $this->cod_pessoa_fj : 'atendidos_lst.php';
         $this->campoOculto('cod_pessoa_fj', $this->cod_pessoa_fj);
         $this->campoTexto('nm_pessoa', 'Nome', $this->nm_pessoa, '50', '255', TRUE);
         if ($this->id_federal) {
             $this->campoRotulo('id_federal', 'CPF', int2CPF($this->id_federal));
         } else {
             $this->campoCpf('id_federal', 'CPF', '', FALSE);
         }
         if ($this->data_nasc) {
             $this->data_nasc = dataFromPgToBr($this->data_nasc);
         }
         $this->campoData('data_nasc', 'Data de Nascimento', $this->data_nasc);
         $lista_sexos = array();
         $lista_sexos[''] = 'Escolha uma opção...';
         $lista_sexos['M'] = 'Masculino';
         $lista_sexos['F'] = 'Feminino';
         $this->campoLista('sexo', 'Sexo', $lista_sexos, $this->sexo);
         // Cor/raça.
         $opcoes_raca = array('' => 'Selecione');
         $obj_raca = new clsCadastroRaca();
         $lst_raca = $obj_raca->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, TRUE);
         if ($lst_raca) {
             foreach ($lst_raca as $raca) {
                 $opcoes_raca[$raca['cod_raca']] = $raca['nm_raca'];
             }
         }
         $this->campoLista('cor_raca', 'Raça', $opcoes_raca, $this->cod_raca, '', FALSE, '', '', '', FALSE);
         // Detalhes do Endereço
         $objTipoLog = new clsTipoLogradouro();
         $listaTipoLog = $objTipoLog->lista();
         $listaTLog = array('0' => 'Selecione');
         if ($listaTipoLog) {
             foreach ($listaTipoLog as $tipoLog) {
                 $listaTLog[$tipoLog['idtlog']] = $tipoLog['descricao'];
             }
         }
         $objUf = new clsUf();
         $listauf = $objUf->lista();
         $listaEstado = array('0' => 'Selecione');
         if ($listauf) {
             foreach ($listauf as $uf) {
                 $listaEstado[$uf['sigla_uf']] = $uf['sigla_uf'];
             }
         }
         $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);
         $zona = App_Model_ZonaLocalizacao::getInstance();
         if ($this->idlog && $this->idbai && $this->cep && $this->cod_pessoa_fj) {
             $this->campoCep('cep_', 'CEP', $this->cep, true, '-', "&nbsp;<img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel( 500,500, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'educar_pesquisa_cep_log_bairro.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=sigla_uf&campo12=idtlog&campo13=id_cidade\\'></iframe>');\">", TRUE);
             $this->campoLista('idtlog', 'Tipo Logradouro', $listaTLog, $this->idtlog, FALSE, FALSE, FALSE, FALSE, TRUE);
             $this->campoTextoInv('logradouro', 'Logradouro', $this->logradouro, '50', '255', FALSE);
             $this->campoTextoInv('cidade', 'Cidade', $this->cidade, '50', '255', FALSE);
             $this->campoTextoInv('bairro', 'Bairro', $this->bairro, '50', '255', FALSE);
             $this->campoTexto('complemento', 'Complemento', $this->complemento, '50', '255', FALSE);
             $this->campoTexto('numero', 'Número', $this->numero, '10', '10');
             $this->campoTexto('letra', 'Letra', $this->letra, '1', '1', FALSE);
             $this->campoTexto('apartamento', 'Número Apartamento', $this->apartamento, '6', '6', FALSE);
             $this->campoTexto('bloco', 'Bloco', $this->bloco, '20', '20', FALSE);
             $this->campoTexto('andar', 'Andar', $this->andar, '2', '2', FALSE);
             $this->campoLista('sigla_uf', 'Estado', $listaEstado, $this->sigla_uf, FALSE, FALSE, FALSE, FALSE, TRUE);
         } elseif ($this->cod_pessoa_fj && $this->cep) {
             $this->campoCep('cep_', 'CEP', $this->cep, true, '-', "&nbsp;<img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel( 500,500, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'educar_pesquisa_cep_log_bairro.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=sigla_uf&campo12=idtlog&campo13=id_cidade\\'></iframe>');\">", $disabled);
             $this->campoLista('idtlog', 'Tipo Logradouro', $listaTLog, $this->idtlog);
             $this->campoTexto('logradouro', 'Logradouro', $this->logradouro, '50', '255', FALSE);
             $this->campoTexto('cidade', 'Cidade', $this->cidade, '50', '255', FALSE);
             $this->campoTexto('bairro', 'Bairro', $this->bairro, '50', '255', FALSE);
             $this->campoTexto('complemento', 'Complemento', $this->complemento, '50', '255', FALSE);
             $this->campoTexto('numero', 'Número', $this->numero, '10', '10');
             $this->campoTexto('letra', 'Letra', $this->letra, '1', '1', FALSE);
             $this->campoTexto('apartamento', 'Número Apartamento', $this->apartamento, '6', '6', FALSE);
             $this->campoTexto('bloco', 'Bloco', $this->bloco, '20', '20', FALSE);
             $this->campoTexto('andar', 'Andar', $this->andar, '2', '2', FALSE);
             $this->campoLista('sigla_uf', 'Estado', $listaEstado, $this->sigla_uf);
         } else {
             $this->campoCep('cep_', 'CEP', $this->cep, TRUE, '-', "&nbsp;<img id='lupa' src=\"imagens/lupa.png\" border=\"0\"\n          onclick=\"showExpansivel(500, 500, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'educar_pesquisa_cep_log_bairro.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=sigla_uf&campo12=idtlog&campo13=id_cidade&campo14=zona_localizacao\\'></iframe>');\">", false);
             $this->campoLista('idtlog', 'Tipo Logradouro', $listaTLog, $this->idtlog, FALSE, FALSE, FALSE, FALSE, FALSE);
             $this->campoTexto('logradouro', 'Logradouro', $this->logradouro, '50', '255');
             $this->campoTexto('cidade', 'Cidade', $this->cidade, '50', '255');
             $this->campoTexto('bairro', 'Bairro', $this->bairro, '50', '255');
             $this->campoTexto('complemento', 'Complemento', $this->complemento, '50', '255', FALSE);
             $this->campoTexto('numero', 'Número', $this->numero, '10', '10');
             $this->campoTexto('letra', 'Letra', $this->letra, '1', '1', FALSE);
             $this->campoTexto('apartamento', 'Número Apartamento', $this->apartamento, '6', '6', FALSE);
             $this->campoTexto('bloco', 'Bloco', $this->bloco, '20', '20', FALSE);
             $this->campoTexto('andar', 'Andar', $this->andar, '2', '2', FALSE);
             $this->campoLista('sigla_uf', 'Estado', $listaEstado, $this->sigla_uf, FALSE, FALSE, FALSE, FALSE, FALSE);
         }
         $this->campoLista('zona_localizacao', 'Zona Localização', $zona->getEnums(), $this->zona_localizacao, FALSE, FALSE, FALSE, FALSE, $this->idbai ? TRUE : FALSE);
         $this->campoTexto('ddd_telefone_1', 'DDD Telefone 1', $this->ddd_telefone_1, '3', '2', FALSE);
         $this->campoTexto('telefone_1', 'Telefone 1', $this->telefone_1, '10', '15', FALSE);
         $this->campoTexto('ddd_telefone_2', 'DDD Telefone 2', $this->ddd_telefone_2, '3', '2', FALSE);
         $this->campoTexto('telefone_2', 'Telefone 2', $this->telefone_2, '10', '15', FALSE);
         $this->campoTexto('ddd_telefone_mov', 'DDD Celular', $this->ddd_telefone_mov, '3', '2', FALSE);
         $this->campoTexto('telefone_mov', 'Celular', $this->telefone_mov, '10', '15', FALSE);
         $this->campoTexto('ddd_telefone_fax', 'DDD Fax', $this->ddd_telefone_fax, '3', '2', FALSE);
         $this->campoTexto('telefone_fax', 'Fax', $this->telefone_fax, '10', '15', FALSE);
         $this->campoTexto('http', 'Site', $this->http, '50', '255', FALSE);
         $this->campoTexto('email', 'E-mail', $this->email, '50', '255', FALSE);
         if ($this->cod_pessoa_fj) {
             $this->campoRotulo('documentos', '<b><i>Documentos</i></b>', "<a href='#' onclick=\"openPage('adicionar_documentos_cad.php?id_pessoa={$this->cod_pessoa_fj}', '400', '400', 'yes', '10', '10'); \"><img src='imagens/nvp_bot_ad_doc.png' border='0'></a>");
             $this->campoCheck('alterado', 'Alterado', $this->alterado);
         }
     }
 }