SetTitulo( "{$this->_instituicao} i-Educar - Escola" ); $this->processoAp = "561"; $this->addEstilo("localizacaoSistema"); } } class indice extends clsCadastro { /** * Referencia pega da session para o idpes do usuario atual * * @var int */ var $pessoa_logada; var $cod_escola; var $ref_usuario_cad; var $ref_usuario_exc; var $ref_cod_instituicao; var $ref_cod_escola_localizacao; var $ref_cod_escola_rede_ensino; var $ref_idpes; var $cnpj; var $sigla; var $data_cadastro; var $data_exclusao; var $ativo; var $nm_escola; var $passou; var $escola_curso; var $ref_cod_curso; var $fantasia; var $sigla_uf_; var $cidade_; var $cep_; var $idtlog_; var $idbai_; var $endereco; var $cep; var $ref_bairro; var $p_ddd_telefone_1; var $p_telefone_1; var $p_ddd_telefone_2; var $p_telefone_2; var $p_ddd_telefone_mov; var $p_telefone_mov; var $p_ddd_telefone_fax; var $p_telefone_fax; var $p_email; var $p_http; var $tipo_pessoa; var $cidade; var $bairro; var $logradouro; var $idlog; var $idbai; var $idtlog; var $sigla_uf; var $complemento; var $numero; var $andar; var $incluir_curso; var $excluir_curso; var $sem_cnpj; var $com_cnpj; var $isEnderecoExterno = 0; function Inicializar() { $retorno = ""; @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 7, "educar_escola_lst.php" ); $this->cod_escola = $_GET["cod_escola"]; $this->sem_cnpj = false; // verifica se eh cadastro ou edicao de uma escola sem CNPJ // if (is_numeric( $_POST["sem_cnpj"] ) && !$this->ref_idpes) // { // $this->passo = 3; //// $retorno = "Novo"; // } // else if ($_POST['cnpj']) // { // $retorno = "Editar"; // }// verifica se eh um novo cadastro // elseif ($_POST['cnpj'] == "" && empty($_POST)) // { // $this->passo = 1; // }// verifica se eh uma cadastro ou edicao de uma escola com CNPJ // else // { // $this->passo = 2; // } // cadastro Novo sem CNPJ if (is_numeric( $_POST["sem_cnpj"] ) && !$this->cod_escola) { // $this->passo = 3; // vai para Novo, + o cadastro sera sem CNPJ // die("Sem CNPJ"); $this->sem_cnpj = true; $retorno = "Novo"; }// cadastro Novo com CNPJ else if ($_POST["cnpj"]) { $this->com_cnpj = true; // echo "
";print_r($_POST["cnpj"]);
// echo idFederal2int($_POST["cnpj"]);
$obj_juridica = new clsPessoaJuridica();
$lst_juridica = $obj_juridica->lista( idFederal2int($_POST["cnpj"]) );
// caso exista o CNPJ na BD
if (is_array($lst_juridica))
{
// die("juridica");
$retorno = "Editar";
$det_juridica = array_shift($lst_juridica);
$this->ref_idpes = $det_juridica["idpes"];
$obj = new clsPmieducarEscola();
$lst_escola = $obj->lista( null,null,null,null,null,null,$this->ref_idpes,null,null,null,1 );
if (is_array($lst_escola))
{
$registro = array_shift($lst_escola);
$this->cod_escola = $registro["cod_escola"];
}
// echo "idpes: ".$this->ref_idpes;
}// caso nao exista o CNPJ
else
{
// die("novo");
$retorno = "Novo";
}
}// cadastro Editar
if (is_numeric( $this->cod_escola ) && !$_POST["passou"])
{
$obj = new clsPmieducarEscola( $this->cod_escola );
$registro = $obj->detalhe();
if( $registro["ref_idpes"] )
{
$this->com_cnpj = true;
}
else
{
$this->sem_cnpj = true;
}
if( $registro)
{
foreach( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto
$this->$campo = $val;
$objEndereco = new clsPessoaEndereco( $this->ref_idpes );
$detEndereco = $objEndereco->detalhe();
if ($detEndereco) {
$this->isEnderecoExterno = 0;
}else
{
$this->isEnderecoExterno = 1;
}
$this->fantasia = $registro['nome'];
$objJuridica = new clsPessoaJuridica( $this->ref_idpes );
$det = $objJuridica->detalhe();
$this->cnpj = int2CNPJ($det["cnpj"]);
$this->fexcluir = $obj_permissoes->permissao_excluir( 561, $this->pessoa_logada, 3 );
$retorno = "Editar";
if( $registro["tipo_cadastro"] == 1 )
{
$objJuridica = new clsPessoaJuridica( false, idFederal2int( $this->cnpj ) );
$det = $objJuridica->detalhe();
$objPessoa = new clsPessoaFj( $det["idpes"] );
list( $this->endereco,
$this->cep,
$this->ref_bairro,
$this->p_ddd_telefone_1,
$this->p_telefone_1,
$this->p_ddd_telefone_2,
$this->p_telefone_2,
$this->p_ddd_telefone_mov,
$this->p_telefone_mov,
$this->p_ddd_telefone_fax,
$this->p_telefone_fax,
$this->p_email,
$this->p_http,
$this->tipo_pessoa,
$this->cidade,
$this->bairro,
$this->logradouro,
$this->idlog,
$this->idbai,
$this->idtlog,
$this->sigla_uf,
$this->complemento,
$this->numero,
$this->andar ) = $objPessoa->queryRapida( $det["idpes"],
"endereco",
"cep",
"bairro",
"ddd_1",
"fone_1",
"ddd_2",
"fone_2",
"ddd_mov",
"fone_mov",
"ddd_fax",
"fone_fax",
"email",
"url",
"tipo",
"cidade",
"bairro",
"logradouro",
"idlog",
"idbai",
"idtlog",
"sigla_uf",
"complemento",
"numero",
"andar" );
}
else
{
$objEscolaComplemento = new clsPmieducarEscolaComplemento( $this->cod_escola );
$detComplemento = $objEscolaComplemento->detalhe();
foreach ( $detComplemento AS $campo => $val )
$this->$campo = $val;
$this->cep_ = $this->cep;
$this->p_email = $this->email;
$this->cidade = $this->municipio;
$this->p_ddd_telefone_1 = $this->ddd_telefone;
$this->p_telefone_1 = $this->telefone;
$this->p_ddd_telefone_fax = $this->ddd_fax;
$this->p_telefone_fax = $this->fax;
}
}
}
elseif($_POST['cnpj'] && !$_POST["passou"])
{
// echo idFederal2int( $_POST['cnpj'] );
$objJuridica = new clsPessoaJuridica( false, idFederal2int( $_POST['cnpj'] ) );
$det = $objJuridica->detalhe();
$objPessoa = new clsPessoaFj( $det["idpes"] );
list( $this->endereco,
$this->cep,
$this->ref_bairro,
$this->p_ddd_telefone_1,
$this->p_telefone_1,
$this->p_ddd_telefone_2,
$this->p_telefone_2,
$this->p_ddd_telefone_mov,
$this->p_telefone_mov,
$this->p_ddd_telefone_fax,
$this->p_telefone_fax,
$this->p_email,
$this->p_http,
$this->tipo_pessoa,
$this->cidade,
$this->bairro,
$this->logradouro,
$this->idlog,
$this->idbai,
$this->idtlog,
$this->sigla_uf,
$this->complemento,
$this->numero,
$this->andar ) = $objPessoa->queryRapida( $det["idpes"],
"endereco",
"cep",
"bairro",
"ddd_1",
"fone_1",
"ddd_2",
"fone_2",
"ddd_mov",
"fone_mov",
"ddd_fax",
"fone_fax",
"email",
"url",
"tipo",
"cidade",
"bairro",
"logradouro",
"idlog",
"idbai",
"idtlog",
"sigla_uf",
"complemento",
"numero",
"andar" );
}
$this->url_cancelar = ($retorno == "Editar") ? "educar_escola_det.php?cod_escola={$registro["cod_escola"]}" : "educar_escola_lst.php";
$nomeMenu = $retorno == "Editar" ? $retorno : "Cadastrar";
$localizacao = new LocalizacaoSistema();
$localizacao->entradaCaminhos( array(
$_SERVER['SERVER_NAME']."/intranet" => "Início",
"educar_index.php" => "i-Educar - Escola",
"" => "{$nomeMenu} escola"
));
$this->enviaLocalizacao($localizacao->montar());
$this->nome_url_cancelar = "Cancelar";
return $retorno;
}
function Gerar()
{
// js
Portabilis_View_Helper_Application::loadJQueryLib($this);
$scripts = array(
'/modules/Portabilis/Assets/Javascripts/Utils.js',
'/modules/Portabilis/Assets/Javascripts/ClientApi.js',
'/modules/Cadastro/Assets/Javascripts/Escola.js'
);
Portabilis_View_Helper_Application::loadJavascript($this, $scripts);
$obj_permissoes = new clsPermissoes();
// echo "";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
{
$this->inputsHelper()->integer('escola_inep_id', array('label' => 'Código inep', 'required' => false, 'max_length' => 14));
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çã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 "";*/
// 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 = "
";
}
else
{
$script = "";
}
}
else
{
echo "";
$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 "";*/
// 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 = "
";
}
else
{
$script = "";
}
}
else
{
echo "";
$opcoes = array( "" => "Erro na geracao" );
}
$this->campoLista( "ref_cod_escola_localizacao", "Escola Localizaçã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 "
cep: ".$this->cep;
// echo "
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, 20, 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 "";*/
// 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 = "
";
}
else
{
$script = "";
}
}
else
{
echo "";
$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 "";*/
// 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 = "
";
}
else
{
$script = "";
}
}
else
{
echo "";
$opcoes = array( "" => "Erro na geracao" );
}
$this->campoLista( "ref_cod_escola_localizacao", "Escola Localizaçã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ão", $opcoes, $this->ref_cod_escola_localizacao );
// $this->campoCep("cep_","CEP", int2CEP($this->cep),true,"-","
",true);
// $this->campoCep( "cep_", "CEP", int2CEP( $this->cep ), true, "-", "
", false );
//$this->campoCep( "cep", "CEP", int2CEP( $this->cep ), true, "-", "
", true );
$this->campoCep("cep", "CEP", $this->cep_ , true, "-", "
');\">", $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,"-","
",false);
// $this->campoCep( "cep_", "CEP", int2CEP( $this->cep ), true, "-", "
", false );
//$this->campoCep( "cep", "CEP", int2CEP( $this->cep ), true, "-", "
", false );
$this->campoCep("cep", "CEP", $this->cep, true, "-", "
');\">");
$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,"-","
",true);
// $this->campoCep( "cep_", "CEP", int2CEP( $this->cep ), true, "-", "
", false );
// $this->campoCep( "cep_", "CEP", int2CEP( $this->cep ), true, "-", "
", false );
$this->campoCep("cep", "CEP", $this->cep_ , true, "-", "
');\">", $disabled);
// $this->campoCep("cep_", "CEP", $this->cep_, true, "-", "
');\">", $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ú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 )
// {
//
//
//
// }
$this->campoCheck("bloquear_lancamento_diario_anos_letivos_encerrados", "Bloquear lançamento no diário para anos letivos encerrados", $this->bloquear_lancamento_diario_anos_letivos_encerrados);
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 "";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, "", "__nome}.submit();\">
" );
$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 "";*/
// 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 "";
$opcoes = array( "" => "Erro na geração" );
}
if ( $aux )
$this->campoLista( "ref_cod_curso", "Curso", $opcoes, $this->ref_cod_curso,"",false,"","__nome}.submit();\">
",false,false);
else
$this->campoLista( "ref_cod_curso", "Curso", $opcoes, $this->ref_cod_curso,"",false,"","__nome}.submit();\">
");
$this->campoOculto( "incluir_curso", "" );
$this->campoQuebra();
}
}
function Novo()
{
@session_start();
$this->pessoa_logada = $_SESSION['id_pessoa'];
@session_write_close();
$obj_permissoes = new clsPermissoes();
$obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 3, "educar_escola_lst.php" );
$this->bloquear_lancamento_diario_anos_letivos_encerrados = is_null($this->bloquear_lancamento_diario_anos_letivos_encerrados) ? 0 : 1;
if ($this->com_cnpj)
{
// echo "clsPessoa_( false, $this->fantasia, $this->pessoa_logada, $this->p_http, "J", false, false, $this->p_email )";
$objPessoa = new clsPessoa_( false, $this->fantasia, $this->pessoa_logada, $this->p_http, "J", false, false, $this->p_email );
$this->ref_idpes = $objPessoa->cadastra();
if ($this->ref_idpes)
{
// echo "clsJuridica( $this->ref_idpes,$this->cnpj,$this->fantasia,false,false,$this->pessoa_logada )";
$obj_pes_juridica = new clsJuridica( $this->ref_idpes,$this->cnpj,$this->fantasia,false,false,$this->pessoa_logada );
$cadastrou = $obj_pes_juridica->cadastra();
if ($cadastrou)
{
$obj = new clsPmieducarEscola( null, $this->pessoa_logada, null, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, $this->ref_idpes, $this->sigla, null, null, 1, NULL, $this->bloquear_lancamento_diario_anos_letivos_encerrados);
$cadastrou1 = $obj->cadastra();
if( $cadastrou1 )
{
$objTelefone = new clsPessoaTelefone( $this->ref_idpes);
$objTelefone->excluiTodos();
$objTelefone = new clsPessoaTelefone( $this->ref_idpes, 1, str_replace( "-", "", $this->p_telefone_1 ), $this->p_ddd_telefone_1 );
$objTelefone->cadastra();
$objTelefone = new clsPessoaTelefone( $this->ref_idpes, 2, str_replace( "-", "", $this->p_telefone_2 ), $this->p_ddd_telefone_2 );
$objTelefone->cadastra();
$objTelefone = new clsPessoaTelefone( $this->ref_idpes, 3, str_replace( "-", "", $this->p_telefone_mov ), $this->p_ddd_telefone_mov );
$objTelefone->cadastra();
$objTelefone = new clsPessoaTelefone( $this->ref_idpes, 4, str_replace( "-", "", $this->p_telefone_fax ), $this->p_ddd_telefone_fax );
$objTelefone->cadastra();
if ( !$this->isEnderecoExterno )
{
// die("Interno");
// echo "
cep: ".$this->cep_;
// $this->cep = idFederal2Int( $this->cep );
$this->cep = $this->cep_;
// echo "
cep: ".$this->cep;
// echo "
clsPessoaEndereco( $this->ref_idpes, $this->cep, $this->idlog, $this->idbai, $this->numero, $this->complemento, false )";die;
$objEndereco = new clsPessoaEndereco( $this->ref_idpes, $this->cep, $this->idlog, $this->idbai, $this->numero, $this->complemento, false );
if( $objEndereco->detalhe() )
$objEndereco->edita();
else
$objEndereco->cadastra();
}
else
{
// echo "
Externo";
// echo "
cep_: ".$this->cep_;
$this->cep = idFederal2int( $this->cep );
// echo "
cep: ".$this->cep;
// echo "
clsEnderecoExterno( $this->ref_idpes, 1, $this->idtlog, $this->logradouro, $this->numero, $this->letra, $this->complemento, $this->bairro, $this->cep, $this->cidade, $this->sigla_uf, false )";
$objEnderecoExterno = new clsEnderecoExterno( $this->ref_idpes, "1", $this->idtlog, $this->logradouro, $this->numero, $this->letra, $this->complemento, $this->bairro, $this->cep, $this->cidade, $this->sigla_uf, false );
if ( $objEnderecoExterno->existe() )
{
// echo "
editar";
$objEnderecoExterno->edita();
}
else
{
// echo "
cadastra";
$objEnderecoExterno->cadastra();
}
}
//-----------------------CADASTRA CURSO------------------------//
$this->escola_curso = unserialize( urldecode( $this->escola_curso ) );
if ($this->escola_curso)
{
// echo "";print_r($this->escola_curso);die;
foreach ( $this->escola_curso AS $campo )
{
$curso_escola = new clsPmieducarEscolaCurso( $cadastrou1, $campo, null, $this->pessoa_logada, null, null, 1 );
$cadastrou_ = $curso_escola->cadastra();
if ( !$cadastrou_ )
{
$this->mensagem = "Cadastro não realizado.
";
echo "";
return false;
}
}
}
//-----------------------FIM CADASTRA CURSO------------------------//
}
else
{
$this->mensagem = "Cadastro não realizado (clsPmieducarEscola).
";
// echo "";
return false;
}
}
else
{
$this->mensagem = "Cadastro não realizado (clsJuridica).
";
// echo "";
return false;
}
$this->mensagem .= "Cadastro efetuado com sucesso.
";
header( "Location: educar_escola_lst.php" );
die();
return true;
}
else
{
$this->mensagem = "Cadastro não realizado (clsPessoa_).
";
return false;
}
}
else if( $this->sem_cnpj )
{
$obj = new clsPmieducarEscola( null, $this->pessoa_logada, null, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, null, $this->sigla, null, null, 1, null, $this->bloquear_lancamento_diario_anos_letivos_encerrados );
$cadastrou = $obj->cadastra();
if ($cadastrou)
{
$obj2 = new clsPmieducarEscolaComplemento( $cadastrou, null, $this->pessoa_logada, idFederal2int( $this->cep ),$this->numero,$this->complemento,$this->p_email,$this->fantasia,$this->cidade,$this->bairro,$this->logradouro,$this->p_ddd_telefone_1, $this->p_telefone_1,$this->p_ddd_telefone_fax, $this->p_telefone_fax,null,null,1);
$cadastrou2 = $obj2->cadastra();
if ($cadastrou2)
{
//-----------------------CADASTRA CURSO------------------------//
$this->escola_curso = unserialize( urldecode( $this->escola_curso ) );
if ($this->escola_curso)
{
foreach ( $this->escola_curso AS $campo )
{
$curso_escola = new clsPmieducarEscolaCurso( $cadastrou, $campo, null, $this->pessoa_logada, null, null, 1 );
$cadastrou_ = $curso_escola->cadastra();
if ( !$cadastrou_ )
{
$this->mensagem = "Cadastro não realizado.
";
echo "";
return false;
}
}
}
//-----------------------FIM CADASTRA CURSO------------------------//
$this->mensagem .= "Cadastro efetuado com sucesso.
";
header( "Location: educar_escola_lst.php" );
die();
return true;
}
else
{
$this->mensagem = "Cadastro não realizado.
";
echo "";
return false;
}
}
else
{
$this->mensagem = "Cadastro não realizado (clsPmieducarEscola).
";
// echo "";
return false;
}
}
}
function Editar()
{
@session_start();
$this->pessoa_logada = $_SESSION['id_pessoa'];
@session_write_close();
$obj_permissoes = new clsPermissoes();
$obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 7, "educar_escola_lst.php" );
$this->bloquear_lancamento_diario_anos_letivos_encerrados = is_null($this->bloquear_lancamento_diario_anos_letivos_encerrados) ? 0 : 1;
//
// echo "
cep: ".$this->cep;
// echo "
cep_: ".$this->cep_;die;
if ($this->cod_escola)
{
$obj = new clsPmieducarEscola($this->cod_escola, null, $this->pessoa_logada, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, $this->ref_idpes, $this->sigla, null, null, 1, $this->bloquear_lancamento_diario_anos_letivos_encerrados);
$editou = $obj->edita();
}
else
{
$obj = new clsPmieducarEscola(null, $this->pessoa_logada, null, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, $this->ref_idpes, $this->sigla, null, null, 1, $this->bloquear_lancamento_diario_anos_letivos_encerrados);
$editou = $obj->cadastra();
$this->cod_escola = $editou;
}
if( $editou )
{
if( $this->com_cnpj )
{
$objPessoa = new clsPessoa_( $this->ref_idpes, null, false, $this->p_http, false, $this->pessoa_logada, date( "Y-m-d H:i:s", time() ), $this->p_email );
$editou1 = $objPessoa->edita();
if ($editou1)
{
$obj_pes_juridica = new clsJuridica( $this->ref_idpes,$this->cnpj,$this->fantasia,false,false,false,$this->pessoa_logada );
$editou2 = $obj_pes_juridica->edita();
if ($editou2)
{
$objTelefone = new clsPessoaTelefone( $this->ref_idpes);
$objTelefone->excluiTodos();
$objTelefone = new clsPessoaTelefone( $this->ref_idpes, 1, str_replace( "-", "", $this->p_telefone_1 ), $this->p_ddd_telefone_1 );
$objTelefone->cadastra();
$objTelefone = new clsPessoaTelefone( $this->ref_idpes, 2, str_replace( "-", "", $this->p_telefone_2 ), $this->p_ddd_telefone_2 );
$objTelefone->cadastra();
$objTelefone = new clsPessoaTelefone( $this->ref_idpes, 3, str_replace( "-", "", $this->p_telefone_mov ), $this->p_ddd_telefone_mov );
$objTelefone->cadastra();
$objTelefone = new clsPessoaTelefone( $this->ref_idpes, 4, str_replace( "-", "", $this->p_telefone_fax ), $this->p_ddd_telefone_fax );
$objTelefone->cadastra();
$objEndereco = new clsPessoaEndereco( $this->ref_idpes );
$detEndereco = $objEndereco->detalhe();
if ($this->cep) {
$this->cep_ = idFederal2int($this->cep);
}
$this->cep = $this->cep;
//echo "$this->ref_idpes, $this->cep_, $this->idlog, $this->idbai, $this->numero, $this->complemento, false, false, false, false, $this->andar ";die;
//echo "";print_r($this);die;
/* $objEndereco2 = new clsPessoaEndereco( $this->ref_idpes, $this->cep_, $this->idlog, $this->idbai, $this->numero, $this->complemento, false, false, false, false, $this->andar );
if ( $detEndereco && $this->cep_ && $this->idlog && $this->idbai )
$objEndereco2->edita();
elseif ( $this->cep_ && $this->idlog && $this->idbai )
$objEndereco2->cadastra();
elseif ( $detEndereco )
{
$objEndereco2->exclui();
//$this->cep = $this->cep;
$objEnderecoExterno = new clsEnderecoExterno( $this->ref_idpes );
$detEnderecoExterno = $objEnderecoExterno->detalhe();
//$this->cep = idFederal2int($this->cep) ;
$objEnderecoExterno2 = new clsEnderecoExterno( $this->ref_idpes, "1", $this->idtlog, $this->logradouro, $this->numero, false, $this->complemento, $this->bairro, $this->cep_, $this->cidade, $this->sigla_uf, false, false, false, $this->andar );
if( $detEnderecoExterno )
{
$objEnderecoExterno2->edita();
if ( $detEndereco )
$objEndereco->exclui();
}
else
{
$objEnderecoExterno2->cadastra();
if ( $detEndereco )
$objEndereco->exclui();
}
}
else
{
$objEnderecoExterno = new clsEnderecoExterno( $this->ref_idpes );
$detEnderecoExterno = $objEnderecoExterno->detalhe();
$objEnderecoExterno2 = new clsEnderecoExterno( $this->ref_idpes, "1", $this->idtlog, $this->logradouro, $this->numero, false, $this->complemento, $this->bairro, $this->cep_, $this->cidade, $this->sigla_uf, false, false, false, $this->andar );
if( $detEnderecoExterno )
{
$objEnderecoExterno2->edita();
}
else
{
$objEnderecoExterno2->cadastra();
}
}*/
if ( !$this->isEnderecoExterno )
{
// die("Interno");
// echo "
cep: ".$this->cep_;
// $this->cep = idFederal2Int( $this->cep );
$this->cep = $this->cep_;
// echo "
cep: ".$this->cep;
// echo "
clsPessoaEndereco( $this->ref_idpes, $this->cep, $this->idlog, $this->idbai, $this->numero, $this->complemento, false )";die;
$objEndereco = new clsPessoaEndereco( $this->ref_idpes, $this->cep, $this->idlog, $this->idbai, $this->numero, $this->complemento, false );
if( $objEndereco->detalhe() )
$objEndereco->edita();
else
$objEndereco->cadastra();
}
else
{
// echo "
Externo";
// echo "
cep_: ".$this->cep_;
$this->cep = idFederal2int( $this->cep );
// echo "
cep: ".$this->cep;
// echo "
clsEnderecoExterno( $this->ref_idpes, 1, $this->idtlog, $this->logradouro, $this->numero, $this->letra, $this->complemento, $this->bairro, $this->cep, $this->cidade, $this->sigla_uf, false )";
$objEnderecoExterno = new clsEnderecoExterno( $this->ref_idpes, "1", $this->idtlog, $this->logradouro, $this->numero, $this->letra, $this->complemento, $this->bairro, $this->cep, $this->cidade, $this->sigla_uf, false );
if ( $objEnderecoExterno->existe() )
{
// echo "
editar";
$objEnderecoExterno->edita();
}
else
{
// echo "
cadastra";
$objEnderecoExterno->cadastra();
}
}
//-----------------------EDITA CURSO------------------------//
$this->escola_curso = unserialize( urldecode( $this->escola_curso ) );
$obj = new clsPmieducarEscolaCurso( $this->cod_escola );
$excluiu = $obj->excluirTodos();
if ( $excluiu )
{
if ($this->escola_curso)
{
// die("com cnpj");
foreach ( $this->escola_curso AS $campo )
{
$obj = new clsPmieducarEscolaCurso( $this->cod_escola, $campo, null, $this->pessoa_logada, null, null, 1 );
$cadastrou_ = $obj->cadastra();
if ( !$cadastrou_ )
{
$this->mensagem = "Edição não realizada.
";
echo "";
return false;
}
}
}
}
//-----------------------FIM EDITA CURSO------------------------//
$this->mensagem .= "Edição efetuada com sucesso.
";
header( "Location: educar_escola_lst.php" );
die();
return true;
}
/*if($this->cep && $this->idbai && $this->idlog)
{
$objEndereco = new clsPessoaEndereco( $this->ref_idpes );
$objEndereco2 = new clsPessoaEndereco($this->ref_idpes,$this->cep,$this->idlog,$this->idbai,$this->numero,$this->complemento, false,false, false, false, $this->andar);
if( $objEndereco->detalhe() )
{
$objEndereco2->edita();
}
else
{
$objEndereco2->cadastra();
}
$objPessoa = new clsPessoaFj();
list( $this->cidade, $this->bairro, $this->logradouro, $this->cep, $this->idtlog, $this->sigla_uf, $this->bloco, $this->apartamento, $this->andar ) = $objPessoa->queryRapida($this->ref_idpes, "cidade", "bairro", "logradouro", "cep", "idtlog", "sigla_uf", "bloco", "apartamento", "andar" );
}
else
{
$this->cep_ = idFederal2int($this->cep_);
$objEnderecoExterno = new clsEnderecoExterno( $this->ref_idpes );
$objEnderecoExterno2 = new clsEnderecoExterno( $this->ref_idpes,"1",$this->idtlog,$this->logradouro,$this->numero,false,$this->complemento,$this->bairro,$this->cep_,$this->cidade,$this->sigla_uf,false,false,false, $this->andar);
if( $objEnderecoExterno->detalhe() )
{
$objEnderecoExterno2->edita();
}
else
{
$objEnderecoExterno2->cadastra();
}
}*/
}
}
else if( $this->sem_cnpj )
{
$objComplemento = new clsPmieducarEscolaComplemento( $this->cod_escola, $this->pessoa_logada, null,idFederal2int( $this->cep_ ),$this->numero,$this->complemento,$this->p_email,$this->fantasia,$this->cidade,$this->bairro,$this->logradouro,$this->p_ddd_telefone_1, $this->p_telefone_1,$this->p_ddd_telefone_fax, $this->p_telefone_fax);
$editou1 = $objComplemento->edita();
if ($editou1)
{
//-----------------------EDITA CURSO------------------------//
$this->escola_curso = unserialize( urldecode( $this->escola_curso ) );
$obj = new clsPmieducarEscolaCurso( $this->cod_escola );
$excluiu = $obj->excluirTodos();
if ( $excluiu )
{
if ($this->escola_curso)
{
// die("sem cnpj");
foreach ( $this->escola_curso AS $campo )
{
$obj = new clsPmieducarEscolaCurso( $this->cod_escola, $campo, null, $this->pessoa_logada, null, null, 1 );
$cadastrou_ = $obj->cadastra();
if ( !$cadastrou_ )
{
$this->mensagem = "Edição não realizada.
";
echo "";
return false;
}
}
}
}
//-----------------------FIM EDITA CURSO------------------------//
$this->mensagem .= "Edição efetuada com sucesso.
";
header( "Location: educar_escola_lst.php" );
die();
return true;
}
else
{
$this->mensagem = "Edição não realizada (clsPmieducarEscolaComplemento).
";
// echo "";
return false;
}
}
}
$this->mensagem = "Edição não realizada.
";
echo "";
return false;
}
function Excluir()
{
@session_start();
$this->pessoa_logada = $_SESSION['id_pessoa'];
@session_write_close();
$obj_permissoes = new clsPermissoes();
$obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 3, "educar_escola_lst.php" );
$obj = new clsPmieducarEscola( $this->cod_escola,null,$this->pessoa_logada,null,null,null,null,null,null,null,0 );
$excluiu = $obj->excluir();
if( $excluiu )
{
$this->mensagem .= "Exclusão efetuada com sucesso.
";
header( "Location: educar_escola_lst.php" );
die();
return true;
}
$this->mensagem = "Exclusão não realizada.
";
echo "";
return false;
}
}
// cria uma extensao da classe base
$pagina = new clsIndexBase();
// cria o conteudo
$miolo = new indice();
// adiciona o conteudo na clsBase
$pagina->addForm( $miolo );
// gera o html
$pagina->MakeAll();
?>