function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Escola Localização - Detalhe";
     $this->cod_escola_localizacao = $_GET["cod_escola_localizacao"];
     $tmp_obj = new clsPmieducarEscolaLocalizacao($this->cod_escola_localizacao);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: educar_escola_localizacao_lst.php");
         die;
     }
     if (class_exists("clsPmieducarInstituicao")) {
         $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro["ref_cod_instituicao"]);
         $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
         $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"];
     } else {
         $registro["ref_cod_instituicao"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarInstituicao\n-->";
     }
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         if ($registro["ref_cod_instituicao"]) {
             $this->addDetalhe(array("Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}"));
         }
     }
     if ($registro["nm_localizacao"]) {
         $this->addDetalhe(array("Localiza&ccedil;&atilde;o", "{$registro["nm_localizacao"]}"));
     }
     if ($obj_permissoes->permissao_cadastra(562, $this->pessoa_logada, 3)) {
         $this->url_novo = "educar_escola_localizacao_cad.php";
         $this->url_editar = "educar_escola_localizacao_cad.php?cod_escola_localizacao={$registro["cod_escola_localizacao"]}";
     }
     $this->url_cancelar = "educar_escola_localizacao_lst.php";
     $this->largura = "100%";
     $localizacao = new LocalizacaoSistema();
     $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "In&iacute;cio", "educar_index.php" => "i-Educar - Escola", "" => "Detalhe da localiza&ccedil;&atilde;o"));
     $this->enviaLocalizacao($localizacao->montar());
 }
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Escola Localiza&ccedil;&atilde;o - Detalhe";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->cod_escola_localizacao = $_GET["cod_escola_localizacao"];
     $tmp_obj = new clsPmieducarEscolaLocalizacao($this->cod_escola_localizacao);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: educar_escola_localizacao_lst.php");
         die;
     }
     if (class_exists("clsPmieducarInstituicao")) {
         $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro["ref_cod_instituicao"]);
         $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
         $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"];
     } else {
         $registro["ref_cod_instituicao"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarInstituicao\n-->";
     }
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         if ($registro["ref_cod_instituicao"]) {
             $this->addDetalhe(array("Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}"));
         }
     }
     if ($registro["nm_localizacao"]) {
         $this->addDetalhe(array("Localiza&ccedil;&atilde;o", "{$registro["nm_localizacao"]}"));
     }
     if ($obj_permissoes->permissao_cadastra(562, $this->pessoa_logada, 3)) {
         $this->url_novo = "educar_escola_localizacao_cad.php";
         $this->url_editar = "educar_escola_localizacao_cad.php?cod_escola_localizacao={$registro["cod_escola_localizacao"]}";
     }
     $this->url_cancelar = "educar_escola_localizacao_lst.php";
     $this->largura = "100%";
 }
Пример #3
0
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Escola - Detalhe";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->cod_escola = $_GET["cod_escola"];
     $tmp_obj = new clsPmieducarEscola($this->cod_escola);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: educar_escola_lst.php");
         die;
     }
     if (class_exists("clsPmieducarInstituicao")) {
         $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro["ref_cod_instituicao"]);
         $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
         $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"];
     } else {
         $registro["ref_cod_instituicao"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarInstituicao\n-->";
     }
     if ($registro["ref_idpes"]) {
         $obj_escola = new clsPessoa_($registro["ref_idpes"]);
         $obj_escola_det = $obj_escola->detalhe();
         $url = $obj_escola_det["url"];
         $email = $obj_escola_det["email"];
         $obj_escola1 = new clsPessoaJuridica($registro["ref_idpes"]);
         $obj_escola_det1 = $obj_escola1->detalhe();
         $nm_escola = $obj_escola_det1["fantasia"];
         $obj_endereco = new clsPessoaEndereco($registro["ref_idpes"]);
         if (class_exists("clsPessoaEndereco")) {
             $tipo = 1;
             $endereco_lst = $obj_endereco->lista($registro["ref_idpes"]);
             if ($endereco_lst) {
                 foreach ($endereco_lst as $endereco) {
                     $cep = $endereco["cep"]->cep;
                     $idlog = $endereco["idlog"]->idlog;
                     $obj = new clsLogradouro($idlog);
                     $obj_det = $obj->detalhe();
                     $logradouro = $obj_det["nome"];
                     $idtlog = $obj_det["idtlog"]->detalhe();
                     $tipo_logradouro = $idtlog["descricao"];
                     $idbai = $endereco["idbai"]->detalhe();
                     $idbai = $idbai['nome'];
                     $numero = $endereco["numero"];
                     $complemento = $endereco["complemento"];
                     $andar = $endereco["andar"];
                 }
             } else {
                 if (class_exists("clsEnderecoExterno")) {
                     $tipo = 2;
                     $obj_endereco = new clsEnderecoExterno();
                     $endereco_lst = $obj_endereco->lista(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, $registro["ref_idpes"]);
                     if ($endereco_lst) {
                         foreach ($endereco_lst as $endereco) {
                             $cep = $endereco["cep"];
                             $sigla_uf = $endereco["sigla_uf"]->detalhe();
                             $sigla_uf = $sigla_uf["nome"];
                             $cidade = $endereco["cidade"];
                             $idtlog = $endereco["idtlog"]->detalhe();
                             $tipo_logradouro = $idtlog["descricao"];
                             $logradouro = $endereco["logradouro"];
                             $bairro = $endereco["bairro"];
                             $numero = $endereco["numero"];
                             $complemento = $endereco["complemento"];
                             $andar = $endereco["andar"];
                         }
                     }
                 }
             }
         }
         if (class_exists("clsPessoaTelefone")) {
             $obj_telefone = new clsPessoaTelefone();
             $telefone_lst = $obj_telefone->lista($registro["ref_idpes"], "tipo");
             if ($telefone_lst) {
                 foreach ($telefone_lst as $telefone) {
                     if ($telefone["tipo"] == 1) {
                         $ddd_telefone_1 = $telefone["ddd"];
                         $telefone_1 = $telefone["fone"];
                     } else {
                         if ($telefone["tipo"] == 2) {
                             $ddd_telefone_2 = $telefone["ddd"];
                             $telefone_2 = $telefone["fone"];
                         } else {
                             if ($telefone["tipo"] == 4) {
                                 $ddd_telefone_fax = $telefone["ddd"];
                                 $telefone_fax = $telefone["fone"];
                             }
                         }
                     }
                 }
             }
         }
     } else {
         if (class_exists("clsPmieducarEscolaComplemento")) {
             $tipo = 3;
             $obj_escola = new clsPmieducarEscolaComplemento($this->cod_escola);
             $obj_escola_det = $obj_escola->detalhe();
             $nm_escola = $obj_escola_det["nm_escola"];
             $cep = $obj_escola_det["cep"];
             $numero = $obj_escola_det["numero"];
             $complemento = $obj_escola_det["complemento"];
             $email = $obj_escola_det["email"];
             $cidade = $obj_escola_det["municipio"];
             $bairro = $obj_escola_det["bairro"];
             $logradouro = $obj_escola_det["logradouro"];
             $ddd_telefone = $obj_escola_det["ddd_telefone"];
             $telefone = $obj_escola_det["telefone"];
             $ddd_telefone_fax = $obj_escola_det["ddd_fax"];
             $telefone_fax = $obj_escola_det["fax"];
         }
     }
     if (class_exists("clsPmieducarEscolaLocalizacao")) {
         $obj_ref_cod_escola_localizacao = new clsPmieducarEscolaLocalizacao($registro["ref_cod_escola_localizacao"]);
         $det_ref_cod_escola_localizacao = $obj_ref_cod_escola_localizacao->detalhe();
         $registro["ref_cod_escola_localizacao"] = $det_ref_cod_escola_localizacao["nm_localizacao"];
     } else {
         $registro["ref_cod_escola_localizacao"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarEscolaLocalizacao\n-->";
     }
     if (class_exists("clsPmieducarEscolaRedeEnsino")) {
         $obj_ref_cod_escola_rede_ensino = new clsPmieducarEscolaRedeEnsino($registro["ref_cod_escola_rede_ensino"]);
         $det_ref_cod_escola_rede_ensino = $obj_ref_cod_escola_rede_ensino->detalhe();
         $registro["ref_cod_escola_rede_ensino"] = $det_ref_cod_escola_rede_ensino["nm_rede"];
     } else {
         $registro["ref_cod_escola_rede_ensino"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarEscolaRedeEnsino\n-->";
     }
     if (class_exists("clsPessoaJuridica")) {
         $obj_ref_idpes = new clsPessoaJuridica($registro["ref_idpes"]);
         $det_ref_idpes = $obj_ref_idpes->detalhe();
         $registro["ref_idpes"] = $det_ref_idpes["nome"];
     } else {
         $registro["ref_idpes"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsCadastroJuridica\n-->";
     }
     if ($registro["ref_cod_instituicao"]) {
         $this->addDetalhe(array("Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}"));
     }
     if ($nm_escola) {
         $this->addDetalhe(array("Escola", "{$nm_escola}"));
     }
     if ($registro["sigla"]) {
         $this->addDetalhe(array("Sigla", "{$registro["sigla"]}"));
     }
     if ($registro["ref_cod_escola_localizacao"]) {
         $this->addDetalhe(array("Localiza&ccedil;&atilde;o", "{$registro["ref_cod_escola_localizacao"]}"));
     }
     if ($registro["ref_cod_escola_rede_ensino"]) {
         $this->addDetalhe(array("Rede Ensino", "{$registro["ref_cod_escola_rede_ensino"]}"));
     }
     if ($registro["ref_idpes"]) {
         $this->addDetalhe(array("Raz&atilde;o Social", "{$registro["ref_idpes"]}"));
     }
     if ($tipo == 1) {
         if ($cep) {
             $cep = int2CEP($cep);
             $this->addDetalhe(array("CEP", "{$cep}"));
         }
         if ($idbai) {
             $this->addDetalhe(array("Bairro", "{$idbai}"));
         }
         if ($tipo_logradouro) {
             $this->addDetalhe(array("Tipo Logradouro", "{$tipo_logradouro}"));
         }
         if ($logradouro) {
             $this->addDetalhe(array("Logradouro", "{$logradouro}"));
         }
         if ($complemento) {
             $this->addDetalhe(array("Complemento", "{$complemento}"));
         }
         if ($numero) {
             $this->addDetalhe(array("N&uacute;mero", "{$numero}"));
         }
         if ($andar) {
             $this->addDetalhe(array("Andar", "{$andar}"));
         }
         if ($url) {
             $this->addDetalhe(array("Site", "{$url}"));
         }
         if ($email) {
             $this->addDetalhe(array("E-mail", "{$email}"));
         }
         if ($ddd_telefone_1) {
             $this->addDetalhe(array("DDD Telefone 1", "{$ddd_telefone_1}"));
         }
         if ($telefone_1) {
             $this->addDetalhe(array("Telefone 1", "{$telefone_1}"));
         }
         if ($ddd_telefone_2) {
             $this->addDetalhe(array("DDD Telefone 2", "{$ddd_telefone_2}"));
         }
         if ($telefone_2) {
             $this->addDetalhe(array("Telefone 2", "{$telefone_2}"));
         }
         if ($ddd_telefone_fax) {
             $this->addDetalhe(array("DDD Fax", "{$ddd_telefone_fax}"));
         }
         if ($telefone_fax) {
             $this->addDetalhe(array("Fax", "{$telefone_fax}"));
         }
     } else {
         if ($tipo == 2) {
             if ($cep) {
                 $cep = int2CEP($cep);
                 $this->addDetalhe(array("CEP", "{$cep}"));
             }
             if ($sigla_uf) {
                 $this->addDetalhe(array("Estado", "{$sigla_uf}"));
             }
             if ($cidade) {
                 $this->addDetalhe(array("Cidade", "{$cidade}"));
             }
             if ($bairro) {
                 $this->addDetalhe(array("Bairro", "{$bairro}"));
             }
             if ($tipo_logradouro) {
                 $this->addDetalhe(array("Tipo Logradouro", "{$tipo_logradouro}"));
             }
             if ($logradouro) {
                 $this->addDetalhe(array("Logradouro", "{$logradouro}"));
             }
             if ($complemento) {
                 $this->addDetalhe(array("Complemento", "{$complemento}"));
             }
             if ($numero) {
                 $this->addDetalhe(array("N&uacute;mero", "{$numero}"));
             }
             if ($andar) {
                 $this->addDetalhe(array("Andar", "{$andar}"));
             }
             if ($url) {
                 $this->addDetalhe(array("Site", "{$url}"));
             }
             if ($email) {
                 $this->addDetalhe(array("E-mail", "{$email}"));
             }
             if ($ddd_telefone_1) {
                 $this->addDetalhe(array("DDD Telefone 1", "{$ddd_telefone_1}"));
             }
             if ($telefone_1) {
                 $this->addDetalhe(array("Telefone 1", "{$telefone_1}"));
             }
             if ($ddd_telefone_2) {
                 $this->addDetalhe(array("DDD Telefone 2", "{$ddd_telefone_2}"));
             }
             if ($telefone_2) {
                 $this->addDetalhe(array("Telefone 2", "{$telefone_2}"));
             }
             if ($ddd_telefone_fax) {
                 $this->addDetalhe(array("DDD Fax", "{$ddd_telefone_fax}"));
             }
             if ($telefone_fax) {
                 $this->addDetalhe(array("Fax", "{$telefone_fax}"));
             }
         } else {
             if ($tipo == 3) {
                 if ($cep) {
                     $cep = int2CEP($cep);
                     $this->addDetalhe(array("CEP", "{$cep}"));
                 }
                 if ($cidade) {
                     $this->addDetalhe(array("Cidade", "{$cidade}"));
                 }
                 if ($bairro) {
                     $this->addDetalhe(array("Bairro", "{$bairro}"));
                 }
                 if ($logradouro) {
                     $this->addDetalhe(array("Logradouro", "{$logradouro}"));
                 }
                 if ($complemento) {
                     $this->addDetalhe(array("Complemento", "{$complemento}"));
                 }
                 if ($numero) {
                     $this->addDetalhe(array("N&uacute;mero", "{$numero}"));
                 }
                 if ($email) {
                     $this->addDetalhe(array("E-mail", "{$email}"));
                 }
                 if ($ddd_telefone) {
                     $this->addDetalhe(array("DDD Telefone", "{$ddd_telefone}"));
                 }
                 if ($telefone) {
                     $this->addDetalhe(array("Telefone", "{$telefone}"));
                 }
                 if ($ddd_telefone_fax) {
                     $this->addDetalhe(array("DDD Fax", "{$ddd_telefone_fax}"));
                 }
                 if ($telefone_fax) {
                     $this->addDetalhe(array("Fax", "{$telefone_fax}"));
                 }
             }
         }
     }
     $obj = new clspmieducarescolacurso();
     $lst = $obj->lista($this->cod_escola);
     if ($lst) {
         $tabela = "<table>\n\t\t\t\t\t       <tr align='center'>\n\t\t\t\t\t           <td bgcolor='#a1b3bd'><b>nome</b></td>\n\t\t\t\t\t       </tr>";
         $cont = 0;
         foreach ($lst as $valor) {
             if ($cont % 2 == 0) {
                 $color = " bgcolor='#e4e9ed' ";
             } else {
                 $color = " bgcolor='#ffffff' ";
             }
             $obj_curso = new clspmieducarcurso($valor["ref_cod_curso"]);
             $obj_curso->setorderby("nm_curso asc");
             $obj_curso_det = $obj_curso->detalhe();
             $nm_curso = $obj_curso_det["nm_curso"];
             $tabela .= "<tr>\n\t\t\t\t\t\t\t    <td {$color} align=left>{$nm_curso}</td>\n\t\t\t\t\t\t\t</tr>";
             $cont++;
         }
         $tabela .= "</table>";
     }
     if ($nm_curso) {
         $this->addDetalhe(array("Curso", "{$tabela}"));
     }
     if ($tabela = $this->listaAnos()) {
         $this->addDetalhe(array("-", "{$tabela}"));
     }
     $obj_permissoes = new clsPermissoes();
     $canCreate = $obj_permissoes->permissao_cadastra(561, $this->pessoa_logada, 3);
     $canEdit = $obj_permissoes->permissao_cadastra(561, $this->pessoa_logada, 7);
     if ($canCreate) {
         $this->url_novo = "educar_escola_cad.php";
     }
     if ($canEdit) {
         $this->url_editar = "educar_escola_cad.php?cod_escola={$registro["cod_escola"]}";
         $this->array_botao = array("Definir Ano Letivo");
         $this->array_botao_url = array("educar_escola_ano_letivo_cad.php?cod_escola={$registro["cod_escola"]}");
     }
     $this->url_cancelar = "educar_escola_lst.php";
     $this->largura = "100%";
 }
Пример #4
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()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Escola Localiza&ccedil;&atilde;o - Listagem";
     foreach ($_GET as $var => $val) {
         // passa todos os valores obtidos no GET para atributos do objeto
         $this->{$var} = $val === "" ? null : $val;
     }
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $lista_busca = array("Localiza&ccedil;&atilde;o");
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         $lista_busca[] = "Institui&ccedil;&atilde;o";
     }
     $this->addCabecalhos($lista_busca);
     // Filtros de Foreign Keys
     include "include/pmieducar/educar_campo_lista.php";
     // outros Filtros
     $this->campoTexto("nm_localizacao", "Localiza&ccedil;&atilde;o", $this->nm_localizacao, 30, 255, false);
     // Paginador
     $this->limite = 20;
     $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0;
     $obj_escola_localizacao = new clsPmieducarEscolaLocalizacao();
     $obj_escola_localizacao->setOrderby("nm_localizacao ASC");
     $obj_escola_localizacao->setLimite($this->limite, $this->offset);
     $lista = $obj_escola_localizacao->lista(null, null, null, $this->nm_localizacao, null, null, null, null, 1, $this->ref_cod_instituicao);
     $total = $obj_escola_localizacao->_total;
     // monta a lista
     if (is_array($lista) && count($lista)) {
         foreach ($lista as $registro) {
             // pega detalhes de foreign_keys
             if (class_exists("clsPmieducarInstituicao")) {
                 $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro["ref_cod_instituicao"]);
                 $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
                 $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"];
             } else {
                 $registro["ref_cod_instituicao"] = "Erro na geracao";
                 echo "<!--\nErro\nClasse nao existente: clsPmieducarInstituicao\n-->";
             }
             $lista_busca = array("<a href=\"educar_escola_localizacao_det.php?cod_escola_localizacao={$registro["cod_escola_localizacao"]}\">{$registro["nm_localizacao"]}</a>");
             if ($nivel_usuario == 1) {
                 $lista_busca[] = "<a href=\"educar_escola_localizacao_det.php?cod_escola_localizacao={$registro["cod_escola_localizacao"]}\">{$registro["ref_cod_instituicao"]}</a>";
             }
             $this->addLinhas($lista_busca);
         }
     }
     $this->addPaginador2("educar_escola_localizacao_lst.php", $total, $_GET, $this->nome, $this->limite);
     if ($obj_permissoes->permissao_cadastra(562, $this->pessoa_logada, 3)) {
         $this->acao = "go(\"educar_escola_localizacao_cad.php\")";
         $this->nome_acao = "Novo";
     }
     $this->largura = "100%";
 }
 function Excluir()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     $obj_permissoes = new clsPermissoes();
     $obj_permissoes->permissao_cadastra(562, $this->pessoa_logada, 3, "educar_escola_localizacao_lst.php");
     $obj = new clsPmieducarEscolaLocalizacao($this->cod_escola_localizacao, $this->pessoa_logada, null, null, null, null, 0);
     $excluiu = $obj->excluir();
     if ($excluiu) {
         $this->mensagem .= "Exclus&atilde;o efetuada com sucesso.<br>";
         header("Location: educar_escola_localizacao_lst.php");
         die;
         return true;
     }
     $this->mensagem = "Exclus&atilde;o n&atilde;o realizada.<br>";
     echo "<!--\nErro ao excluir clsPmieducarEscolaLocalizacao\nvalores obrigatorios\nif( is_numeric( {$this->cod_escola_localizacao} ) && is_numeric( {$this->pessoa_logada} ) )\n-->";
     return false;
 }
 function escreveTotal(&$totais, &$total_geral_curso, $ref_cod_localizacao)
 {
     $obj_localizacao = new clsPmieducarEscolaLocalizacao($ref_cod_localizacao);
     $det_localizacao = $obj_localizacao->detalhe();
     $fonte = 'arial';
     $corTexto = '#000000';
     $esquerda = 30;
     $direita = 782;
     $altura = 20;
     $espaco = 150.4;
     $qtd_series = 0;
     $qtd_series_relatorio = 4;
     $esquerda_aux = 0;
     $this->pdf->quadrado_relativo($esquerda, $this->page_y, $direita, $altura);
     $this->pdf->escreve_relativo("Total - {$det_localizacao["nm_localizacao"]}", $esquerda + $esquerda_aux + $aux, $this->page_y + 5, 150, 100, $fonte, 8, $corTexto);
     $esquerda = $espaco;
     $this->pdf->linha_relativa($esquerda, $this->page_y, 0, $altura);
     $tam_totais = count($totais);
     for ($i = 0; $i < $tam_totais - 1; $i++) {
         $this->total_geral_localizacao[$i] += $totais[$i];
         $this->pdf->escreve_relativo($totais[$i], $esquerda + $esquerda_aux, $this->page_y + 4, $espaco / $qtd_series_relatorio / 2, 100, $fonte, 8, $corTexto, 'center');
         $this->pdf->linha_relativa($esquerda + $esquerda_aux + $espaco / $qtd_series_relatorio / 2, $this->page_y, 0, $altura);
         $this->total_geral_localizacao[++$i] += $totais[$i];
         $this->pdf->escreve_relativo($totais[$i], $esquerda + $esquerda_aux + $espaco / $qtd_series_relatorio / 2, $this->page_y + 4, $espaco / $qtd_series_relatorio / 2, 100, $fonte, 8, $corTexto, 'center');
         $this->pdf->linha_relativa($esquerda + $esquerda_aux + $espaco / $qtd_series_relatorio, $this->page_y, 0, $altura);
         $esquerda_aux += $espaco / $qtd_series_relatorio;
     }
     $esquerda = $esquerda_aux + $espaco;
     $aux = 91;
     $this->total_geral_localizacao[$i++] += $total_geral_curso["turma"];
     $this->total_geral_localizacao[$i] += $total_geral_curso["aluno"];
     $this->pdf->escreve_relativo($total_geral_curso["turma"], $esquerda, $this->page_y + 4, ($espaco + $aux) / $qtd_series_relatorio / 2, 100, $fonte, 8, $corTexto, 'center');
     $this->pdf->linha_relativa($esquerda + ($espaco - $aux) / 2, $this->page_y, 0, $altura);
     $this->pdf->escreve_relativo($total_geral_curso["aluno"], $esquerda + ($espaco - $aux) / 2, $this->page_y + 4, ($espaco + $aux) / $qtd_series_relatorio / 2, 100, $fonte, 8, $corTexto, 'center');
     $this->pdf->linha_relativa($esquerda + $espaco - $aux, $this->page_y, 0, $altura);
     $totais = array();
     $total_geral_curso = array();
     $this->page_y += 20;
 }
 function Novo()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     $obj_permissoes = new clsPermissoes();
     $obj_permissoes->permissao_cadastra(562, $this->pessoa_logada, 3, "educar_escola_localizacao_lst.php");
     $obj = new clsPmieducarEscolaLocalizacao(null, null, $this->pessoa_logada, $this->nm_localizacao, null, null, 1, $this->ref_cod_instituicao);
     $cadastrou = $obj->cadastra();
     if ($cadastrou) {
         echo "<script>\n\t\t\t\t\t\tparent.document.getElementById('ref_cod_escola_localizacao').options[parent.document.getElementById('ref_cod_escola_localizacao').options.length] = new Option('{$this->nm_localizacao}', '{$cadastrou}', false, false);\n\t\t\t\t\t\tparent.document.getElementById('ref_cod_escola_localizacao').value = '{$cadastrou}';\n\t\t\t\t\t\tparent.document.getElementById('ref_cod_escola_localizacao').disabled = false;\n\t\t\t\t\t\twindow.parent.fechaExpansivel('div_dinamico_'+(parent.DOM_divs.length-1));\n\t\t\t     \t</script>";
         die;
         return true;
     }
     $this->mensagem = "Cadastro n&atilde;o realizado.<br>";
     echo "<!--\nErro ao cadastrar clsPmieducarEscolaLocalizacao\nvalores obrigatorios\nis_numeric( {$this->pessoa_logada} ) && is_numeric( {$this->ref_cod_instituicao} ) && is_string( {$this->nm_localizacao} )\n-->";
     return false;
 }