function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Autor - Detalhe";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->cod_acervo_autor = $_GET["cod_acervo_autor"];
     $tmp_obj = new clsPmieducarAcervoAutor($this->cod_acervo_autor);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: educar_acervo_autor_lst.php");
         die;
     }
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     if (class_exists("clsPmieducarBiblioteca")) {
         $obj_ref_cod_biblioteca = new clsPmieducarBiblioteca($registro["ref_cod_biblioteca"]);
         $det_ref_cod_biblioteca = $obj_ref_cod_biblioteca->detalhe();
         $registro["ref_cod_biblioteca"] = $det_ref_cod_biblioteca["nm_biblioteca"];
         $registro["ref_cod_instituicao"] = $det_ref_cod_biblioteca["ref_cod_instituicao"];
         $registro["ref_cod_escola"] = $det_ref_cod_biblioteca["ref_cod_escola"];
         if ($registro["ref_cod_instituicao"]) {
             $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"];
         }
         if ($registro["ref_cod_escola"]) {
             $obj_ref_cod_escola = new clsPmieducarEscola();
             $det_ref_cod_escola = array_shift($obj_ref_cod_escola->lista($registro["ref_cod_escola"]));
             $registro["ref_cod_escola"] = $det_ref_cod_escola["nome"];
         }
     } else {
         $registro["ref_cod_biblioteca"] = "Erro na geração";
         echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarBiblioteca\n-->";
     }
     if ($registro["ref_cod_instituicao"] && $nivel_usuario == 1) {
         $this->addDetalhe(array("Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}"));
     }
     if ($registro["ref_cod_escola"] && ($nivel_usuario == 1 || $nivel_usuario == 2)) {
         $this->addDetalhe(array("Escola", "{$registro["ref_cod_escola"]}"));
     }
     if ($registro["ref_cod_biblioteca"]) {
         $this->addDetalhe(array("Biblioteca", "{$registro["ref_cod_biblioteca"]}"));
     }
     if ($registro["nm_autor"]) {
         $this->addDetalhe(array("Autor", "{$registro["nm_autor"]}"));
     }
     if ($registro["descricao"]) {
         $this->addDetalhe(array("Descri&ccedil;&atilde;o", "{$registro["descricao"]}"));
     }
     $obj_permissoes = new clsPermissoes();
     if ($obj_permissoes->permissao_cadastra(594, $this->pessoa_logada, 11)) {
         $this->url_novo = "educar_acervo_autor_cad.php";
         $this->url_editar = "educar_acervo_autor_cad.php?cod_acervo_autor={$registro["cod_acervo_autor"]}";
     }
     $this->url_cancelar = "educar_acervo_autor_lst.php";
     $this->largura = "100%";
 }
Esempio n. 2
0
 function Excluir()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     $obj_permissoes = new clsPermissoes();
     $obj_permissoes->permissao_excluir(594, $this->pessoa_logada, 11, "educar_acervo_autor_lst.php");
     $obj = new clsPmieducarAcervoAutor($this->cod_acervo_autor, $this->pessoa_logada, null, null, null, null, null, 0, $this->ref_cod_biblioteca);
     $excluiu = $obj->excluir();
     if ($excluiu) {
         $this->mensagem .= "Exclus&atilde;o efetuada com sucesso.<br>";
         header("Location: educar_acervo_autor_lst.php");
         die;
         return true;
     }
     $this->mensagem = "Exclus&atilde;o n&atilde;o realizada.<br>";
     echo "<!--\nErro ao excluir clsPmieducarAcervoAutor\nvalores obrigatorios\nif( is_numeric( {$this->cod_acervo_autor} ) && is_numeric( {$this->pessoa_logada} ) )\n-->";
     return false;
 }
Esempio n. 3
0
 function Gerar()
 {
     if ($_POST) {
         foreach ($_POST as $campo => $val) {
             $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val;
         }
     }
     if (is_numeric($this->colecao)) {
         $this->ref_cod_acervo_colecao = $this->colecao;
     }
     if (is_numeric($this->editora)) {
         $this->ref_cod_acervo_editora = $this->editora;
     }
     if (is_numeric($this->idioma)) {
         $this->ref_cod_acervo_idioma = $this->idioma;
     }
     if (is_numeric($this->autor)) {
         $this->ref_cod_acervo_autor = $this->autor;
     }
     // primary keys
     $this->campoOculto("cod_acervo", $this->cod_acervo);
     $this->campoOculto("colecao", "");
     $this->campoOculto("editora", "");
     $this->campoOculto("idioma", "");
     $this->campoOculto("autor", "");
     $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'biblioteca', 'bibliotecaTipoExemplar'));
     // Obra referência
     $opcoes = array("NULL" => "Selecione");
     if ($this->ref_cod_acervo && $this->ref_cod_acervo != "NULL") {
         $objTemp = new clsPmieducarAcervo($this->ref_cod_acervo);
         $detalhe = $objTemp->detalhe();
         if ($detalhe) {
             $opcoes["{$detalhe['cod_acervo']}"] = "{$detalhe['titulo']}";
         }
     }
     $this->campoLista("ref_cod_acervo", "Obra Refer&ecirc;ncia", $opcoes, $this->ref_cod_acervo, "", false, "", "<img border=\"0\" onclick=\"pesquisa();\" id=\"ref_cod_acervo_lupa\" name=\"ref_cod_acervo_lupa\" src=\"imagens/lupa.png\"\\/>", false, false);
     // Coleção
     $opcoes = array("" => "Selecione");
     if (class_exists("clsPmieducarAcervoColecao")) {
         $objTemp = new clsPmieducarAcervoColecao();
         $lista = $objTemp->lista();
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_acervo_colecao']}"] = "{$registro['nm_colecao']}";
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmieducarAcervoColecao nao encontrada\n-->";
         $opcoes = array("" => "Erro na geracao");
     }
     $this->campoLista("ref_cod_acervo_colecao", "Cole&ccedil;&atilde;o", $opcoes, $this->ref_cod_acervo_colecao, "", false, "", "<img id='img_colecao' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"showExpansivelImprimir(500, 200,'educar_acervo_colecao_cad_pop.php',[], 'Coleção')\" />", false, false);
     // Idioma
     $opcoes = array("" => "Selecione");
     if (class_exists("clsPmieducarAcervoIdioma")) {
         $objTemp = new clsPmieducarAcervoIdioma();
         $lista = $objTemp->lista();
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_acervo_idioma']}"] = "{$registro['nm_idioma']}";
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmieducarAcervoIdioma nao encontrada\n-->";
         $opcoes = array("" => "Erro na geracao");
     }
     $this->campoLista("ref_cod_acervo_idioma", "Idioma", $opcoes, $this->ref_cod_acervo_idioma, "", false, "", "<img id='img_idioma' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"showExpansivelImprimir(400, 150,'educar_acervo_idioma_cad_pop.php',[], 'Idioma')\" />");
     $opcoes = array("" => "Selecione");
     if (class_exists("clsPmieducarAcervoEditora")) {
         $objTemp = new clsPmieducarAcervoEditora();
         $lista = $objTemp->lista();
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_acervo_editora']}"] = "{$registro['nm_editora']}";
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmieducarAcervoEditora nao encontrada\n-->";
         $opcoes = array("" => "Erro na geracao");
     }
     $this->campoLista("ref_cod_acervo_editora", "Editora", $opcoes, $this->ref_cod_acervo_editora, "", false, "", "<img id='img_editora' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"showExpansivelImprimir(400, 320,'educar_acervo_editora_cad_pop.php',[], 'Editora')\" />");
     //-----------------------INCLUI AUTOR------------------------//
     $this->campoQuebra();
     if ($_POST["acervo_autor"]) {
         $this->acervo_autor = unserialize(urldecode($_POST["acervo_autor"]));
     }
     if (is_numeric($this->cod_acervo) && !$_POST) {
         $obj = new clsPmieducarAcervoAcervoAutor();
         $registros = $obj->lista(null, $this->cod_acervo);
         if ($registros) {
             foreach ($registros as $campo) {
                 $aux["ref_cod_acervo_autor_"] = $campo["ref_cod_acervo_autor"];
                 $aux["principal_"] = $campo["principal"];
                 $this->acervo_autor[] = $aux;
             }
             // verifica se ja existe um autor principal
             if (is_array($this->acervo_autor)) {
                 foreach ($this->acervo_autor as $autores) {
                     if ($autores["principal_"] == 1) {
                         $this->checked = 1;
                         $this->campoOculto("checked", $this->checked);
                     }
                 }
             }
         }
     }
     unset($aux);
     if ($_POST["ref_cod_acervo_autor"]) {
         if ($_POST["principal"]) {
             $this->checked = 1;
             $this->campoOculto("checked", $this->checked);
         }
         $aux["ref_cod_acervo_autor_"] = $_POST["ref_cod_acervo_autor"];
         $aux["principal_"] = $_POST["principal"];
         $this->acervo_autor[] = $aux;
         //			echo "<pre>";print_r($this->acervo_autor);
         // verifica se ja existe um autor principal
         if (is_array($this->acervo_autor)) {
             foreach ($this->acervo_autor as $autores) {
                 if ($autores["principal_"] == 'on') {
                     $this->checked = 1;
                     $this->campoOculto("checked", $this->checked);
                 }
             }
         }
         unset($this->ref_cod_acervo_autor);
         unset($this->principal);
     }
     $this->campoOculto("excluir_autor", "");
     unset($aux);
     if ($this->acervo_autor) {
         foreach ($this->acervo_autor as $key => $autor) {
             if ($this->excluir_autor == $autor["ref_cod_acervo_autor_"]) {
                 unset($this->acervo_autor[$key]);
                 unset($this->excluir_autor);
             } else {
                 $obj_acervo_autor = new clsPmieducarAcervoAutor($autor["ref_cod_acervo_autor_"]);
                 $det_acervo_autor = $obj_acervo_autor->detalhe();
                 $nm_autor = $det_acervo_autor["nm_autor"];
                 $this->campoTextoInv("ref_cod_exemplar_tipo_{$autor["ref_cod_acervo_autor_"]}", "", $nm_autor, 30, 255, false, false, true);
                 $this->campoCheck("principal_{$autor["ref_cod_acervo_autor_"]}", "", $autor['principal_'], "<a href='#' onclick=\"getElementById('excluir_autor').value = '{$autor["ref_cod_acervo_autor_"]}'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", false, false, false);
                 $aux["ref_cod_acervo_autor_"] = $autor["ref_cod_acervo_autor_"];
                 $aux["principal_"] = $autor['principal_'];
             }
         }
     }
     $this->campoOculto("acervo_autor", serialize($this->acervo_autor));
     if (class_exists("clsPmieducarAcervoAutor")) {
         $opcoes = array("" => "Selecione");
         $objTemp = new clsPmieducarAcervoAutor();
         $objTemp->setOrderby("nm_autor ASC");
         $lista = $objTemp->lista(null, null, null, null, null, null, null, null, null, 1);
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_acervo_autor']}"] = "{$registro['nm_autor']}";
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmieducarAcervoAutor n&atilde;o encontrada\n-->";
         $opcoes = array("" => "Erro na gera&ccedil;&atilde;o");
     }
     if (is_array($this->acervo_autor)) {
         $qtd_autor = count($this->acervo_autor);
     }
     // não existe um autor principal nem autor
     if ($this->checked != 1 && (!$qtd_autor || $qtd_autor == 0)) {
         //			die("1");
         $this->campoLista("ref_cod_acervo_autor", "Autor", $opcoes, $this->ref_cod_acervo_autor, null, true, "", "", false, true);
         $this->campoCheck("principal", "&nbsp;&nbsp;<img id='img_autor' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"showExpansivelImprimir(500, 250,'educar_acervo_autor_cad_pop.php',[], 'Autor')\" />", $this->principal, "<a href='#' onclick=\"getElementById('incluir_autor').value = 'S'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bot_adiciona.gif' title='Incluir' border=0></a>");
     } else {
         if ($this->checked != 1 && $qtd_autor > 0) {
             $this->campoLista("ref_cod_acervo_autor", "Autor", $opcoes, $this->ref_cod_acervo_autor, null, true, null, null, null, false);
             $this->campoCheck("principal", "&nbsp;&nbsp;<img src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"pesquisa_valores_popless( 'educar_acervo_autor_cad_pop.php' )\" />", $this->principal, "<a href='#' onclick=\"getElementById('incluir_autor').value = 'S'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bot_adiciona.gif' title='Incluir' border=0></a>");
         } else {
             //			die("3");
             $this->campoLista("ref_cod_acervo_autor", "Autor", $opcoes, $this->ref_cod_acervo_autor, "", false, "", "<img src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"pesquisa_valores_popless( 'educar_acervo_autor_cad_pop.php' )\" />&nbsp;&nbsp;<a href='#' onclick=\"getElementById('incluir_autor').value = 'S'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bot_adiciona.gif' title='Incluir' border=0></a>", false, false);
         }
     }
     $this->campoOculto("incluir_autor", "");
     $this->campoQuebra();
     //-----------------------FIM AUTOR------------------------//
     // text
     $this->campoTexto("titulo", "T&iacute;tulo", $this->titulo, 40, 255, true);
     $this->campoTexto("sub_titulo", "Subt&iacute;tulo", $this->sub_titulo, 40, 255, false);
     $this->campoTexto("estante", "Estante", $this->estante, 20, 15, false);
     $helperOptions = array('objectName' => 'assuntos');
     $options = array('label' => 'Assuntos', 'size' => 50, 'required' => false, 'options' => array('value' => null));
     $this->inputsHelper()->multipleSearchAssuntos('', $options, $helperOptions);
     $this->campoTexto("cdd", "CDD", $this->cdd, 20, 15, false);
     $this->campoTexto("cdu", "CDU", $this->cdu, 20, 15, false);
     $this->campoTexto("cutter", "Cutter", $this->cutter, 20, 15, false);
     $this->campoNumero("volume", "Volume", $this->volume, 20, 255, true);
     $this->campoNumero("num_edicao", "N&uacute;mero Edic&atilde;o", $this->num_edicao, 20, 255, true);
     $this->campoNumero("ano", "Ano", $this->ano, 5, 4, true);
     $this->campoNumero("num_paginas", "N&uacute;mero P&aacute;ginas", $this->num_paginas, 5, 255, true);
     $this->campoNumero("isbn", "ISBN", $this->isbn, 20, 13, false);
 }
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Autor - Listagem";
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     //$this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada);
     //	$this->ref_cod_escola = $obj_permissoes->getEscola($this->pessoa_logada);
     foreach ($_GET as $var => $val) {
         // passa todos os valores obtidos no GET para atributos do objeto
         $this->{$var} = $val === "" ? null : $val;
     }
     // Filtros de Foreign Keys
     $get_escola = true;
     $get_biblioteca = true;
     $get_cabecalho = "lista_busca";
     include "include/pmieducar/educar_campo_lista.php";
     switch ($nivel_usuario) {
         case 1:
             $this->addCabecalhos(array("Autor", "Biblioteca", "Escola", "Institui&ccedil;&atilde;o"));
             break;
         case 2:
             $this->addCabecalhos(array("Autor", "Escola"));
             break;
         case 4:
             $this->addCabecalhos(array("Autor"));
             break;
         default:
             $this->addCabecalhos(array("Autor"));
             break;
     }
     // outros Filtros
     $this->campoTexto("nm_autor", "Autor", $this->nm_autor, 30, 255, false);
     // Paginador
     $this->limite = 20;
     $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0;
     $obj_acervo_autor = new clsPmieducarAcervoAutor();
     $obj_acervo_autor->setOrderby("nm_autor ASC");
     $obj_acervo_autor->setLimite($this->limite, $this->offset);
     $lista = $obj_acervo_autor->lista(null, null, null, $this->nm_autor, null, null, null, null, null, 1, $this->ref_cod_biblioteca, $this->ref_cod_instituicao, $this->ref_cod_escola);
     $total = $obj_acervo_autor->_total;
     // monta a lista
     if (is_array($lista) && count($lista)) {
         foreach ($lista as $registro) {
             $obj_biblioteca = new clsPmieducarBiblioteca($registro['ref_cod_biblioteca']);
             $det_biblioteca = $obj_biblioteca->detalhe();
             // pega detalhes de foreign_keys
             if (class_exists("clsPmieducarEscola")) {
                 $obj_ref_cod_escola = new clsPmieducarEscola($det_biblioteca["ref_cod_escola"]);
                 $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
                 $registro["ref_cod_escola"] = $det_ref_cod_escola["nome"];
             } else {
                 $registro["ref_cod_escola"] = "Erro na geracao";
                 echo "<!--\nErro\nClasse nao existente: clsPmieducarEscola\n-->";
             }
             switch ($nivel_usuario) {
                 case 1:
                     if (class_exists("clsPmieducarInstituicao") && class_exists("clsPmieducarEscola")) {
                         $obj_ref_cod_escola = new clsPmieducarEscola($det_biblioteca["ref_cod_escola"]);
                         $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
                         $registro["ref_cod_instituicao"] = $det_ref_cod_escola["ref_cod_instituicao"];
                         $obj_ref_cod_intituicao = new clsPmieducarInstituicao($det_biblioteca["ref_cod_instituicao"]);
                         $det_ref_cod_intituicao = $obj_ref_cod_intituicao->detalhe();
                         $registro["ref_cod_instituicao"] = $det_ref_cod_intituicao["nm_instituicao"];
                     } else {
                         $registro["ref_cod_instituicao"] = "Erro na geracao";
                         echo "<!--\nErro\nClasse nao existente: clsPmieducarIntituicao\n-->";
                     }
                     $this->addLinhas(array("<a href=\"educar_acervo_autor_det.php?cod_acervo_autor={$registro["cod_acervo_autor"]}\">{$registro["nm_autor"]}</a>", "<a href=\"educar_acervo_autor_det.php?cod_acervo_autor={$registro["cod_acervo_autor"]}\">{$det_biblioteca["nm_biblioteca"]}</a>", "<a href=\"educar_acervo_autor_det.php?cod_acervo_autor={$registro["cod_acervo_autor"]}\">{$registro["ref_cod_escola"]}</a>", "<a href=\"educar_acervo_autor_det.php?cod_acervo_autor={$registro["cod_acervo_autor"]}\">{$registro["ref_cod_instituicao"]}</a>"));
                     break;
                 case 2:
                     $this->addLinhas(array("<a href=\"educar_acervo_autor_det.php?cod_acervo_autor={$registro["cod_acervo_autor"]}\">{$registro["nm_autor"]}</a>", "<a href=\"educar_acervo_autor_det.php?cod_acervo_autor={$registro["cod_acervo_autor"]}\">{$registro["ref_cod_escola"]}</a>"));
                     break;
                 case 4:
                 default:
                     $this->addLinhas(array("<a href=\"educar_acervo_autor_det.php?cod_acervo_autor={$registro["cod_acervo_autor"]}\">{$registro["nm_autor"]}</a>"));
                     break;
             }
         }
     }
     $this->addPaginador2("educar_acervo_autor_lst.php", $total, $_GET, $this->nome, $this->limite);
     if ($obj_permissoes->permissao_cadastra(594, $this->pessoa_logada, 11)) {
         $this->acao = "go(\"educar_acervo_autor_cad.php\")";
         $this->nome_acao = "Novo";
     }
     $this->largura = "100%";
     $localizacao = new LocalizacaoSistema();
     $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "In&iacute;cio", "educar_biblioteca_index.php" => "i-Educar - Biblioteca", "" => "Listagem de autores"));
     $this->enviaLocalizacao($localizacao->montar());
 }
Esempio n. 5
0
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Obras - Detalhe";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->cod_acervo = $_GET["cod_acervo"];
     $tmp_obj = new clsPmieducarAcervo($this->cod_acervo);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: educar_acervo_lst.php");
         die;
     }
     if (class_exists("clsPmieducarBiblioteca")) {
         $obj_ref_cod_biblioteca = new clsPmieducarBiblioteca($registro["ref_cod_biblioteca"]);
         $det_ref_cod_biblioteca = $obj_ref_cod_biblioteca->detalhe();
         $registro["ref_cod_biblioteca"] = $det_ref_cod_biblioteca["nm_biblioteca"];
         if (class_exists("clsPmieducarInstituicao")) {
             $registro["ref_cod_instituicao"] = $det_ref_cod_biblioteca["ref_cod_instituicao"];
             $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 (class_exists("clsPmieducarEscola")) {
             $registro["ref_cod_escola"] = $det_ref_cod_biblioteca["ref_cod_escola"];
             $obj_ref_cod_escola = new clsPmieducarEscola($registro["ref_cod_escola"]);
             $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
             $idpes = $det_ref_cod_escola["ref_idpes"];
             if ($idpes) {
                 $obj_escola = new clsPessoaJuridica($idpes);
                 $obj_escola_det = $obj_escola->detalhe();
                 $registro["ref_cod_escola"] = $obj_escola_det["fantasia"];
             } else {
                 $obj_escola = new clsPmieducarEscolaComplemento($registro["ref_cod_escola"]);
                 $obj_escola_det = $obj_escola->detalhe();
                 $registro["ref_cod_escola"] = $obj_escola_det["nm_escola"];
             }
         }
     } else {
         $registro["ref_cod_biblioteca"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarBiblioteca\n-->";
     }
     if (class_exists("clsPmieducarExemplarTipo")) {
         $obj_ref_cod_exemplar_tipo = new clsPmieducarExemplarTipo($registro["ref_cod_exemplar_tipo"]);
         $det_ref_cod_exemplar_tipo = $obj_ref_cod_exemplar_tipo->detalhe();
         $registro["ref_cod_exemplar_tipo"] = $det_ref_cod_exemplar_tipo["nm_tipo"];
     } else {
         $registro["ref_cod_exemplar_tipo"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarExemplarTipo\n-->";
     }
     if (class_exists("clsPmieducarAcervo")) {
         $obj_ref_cod_acervo = new clsPmieducarAcervo($registro["ref_cod_acervo"]);
         $det_ref_cod_acervo = $obj_ref_cod_acervo->detalhe();
         $registro["ref_cod_acervo"] = $det_ref_cod_acervo["titulo"];
     } else {
         $registro["ref_cod_acervo"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarAcervo\n-->";
     }
     if (class_exists("clsPmieducarAcervoColecao")) {
         $obj_ref_cod_acervo_colecao = new clsPmieducarAcervoColecao($registro["ref_cod_acervo_colecao"]);
         $det_ref_cod_acervo_colecao = $obj_ref_cod_acervo_colecao->detalhe();
         $registro["ref_cod_acervo_colecao"] = $det_ref_cod_acervo_colecao["nm_colecao"];
     } else {
         $registro["ref_cod_acervo_colecao"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarAcervoColecao\n-->";
     }
     if (class_exists("clsPmieducarAcervoIdioma")) {
         $obj_ref_cod_acervo_idioma = new clsPmieducarAcervoIdioma($registro["ref_cod_acervo_idioma"]);
         $det_ref_cod_acervo_idioma = $obj_ref_cod_acervo_idioma->detalhe();
         $registro["ref_cod_acervo_idioma"] = $det_ref_cod_acervo_idioma["nm_idioma"];
     } else {
         $registro["ref_cod_acervo_idioma"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarAcervoIdioma\n-->";
     }
     if (class_exists("clsPmieducarAcervoEditora")) {
         $obj_ref_cod_acervo_editora = new clsPmieducarAcervoEditora($registro["ref_cod_acervo_editora"]);
         $det_ref_cod_acervo_editora = $obj_ref_cod_acervo_editora->detalhe();
         $registro["ref_cod_acervo_editora"] = $det_ref_cod_acervo_editora["nm_editora"];
     } else {
         $registro["ref_cod_acervo_editora"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarAcervoEditora\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 ($nivel_usuario == 1 || $nivel_usuario == 2) {
         if ($registro["ref_cod_escola"]) {
             $this->addDetalhe(array("Escola", "{$registro["ref_cod_escola"]}"));
         }
     }
     if ($registro["ref_cod_biblioteca"]) {
         $this->addDetalhe(array("Biblioteca", "{$registro["ref_cod_biblioteca"]}"));
     }
     if ($registro["titulo"]) {
         $this->addDetalhe(array("T&iacute;tulo", "{$registro["titulo"]}"));
     }
     if ($registro["sub_titulo"]) {
         $this->addDetalhe(array("Subt&iacute;tulo", "{$registro["sub_titulo"]}"));
     }
     if ($registro["ref_cod_exemplar_tipo"]) {
         $this->addDetalhe(array("Tipo", "{$registro["ref_cod_exemplar_tipo"]}"));
     }
     if ($registro["ref_cod_acervo"]) {
         $this->addDetalhe(array("Obra Refer&ecirc;ncia", "{$registro["ref_cod_acervo"]}"));
     }
     if ($registro["ref_cod_acervo_colecao"]) {
         $this->addDetalhe(array("Cole&ccedil;&atilde;o", "{$registro["ref_cod_acervo_colecao"]}"));
     }
     if ($registro["ref_cod_acervo_idioma"]) {
         $this->addDetalhe(array("Idioma", "{$registro["ref_cod_acervo_idioma"]}"));
     }
     if ($registro["ref_cod_acervo_editora"]) {
         $this->addDetalhe(array("Editora", "{$registro["ref_cod_acervo_editora"]}"));
     }
     $obj = new clsPmieducarAcervoAcervoAutor();
     $obj->setOrderby("principal DESC");
     $lst = $obj->lista(null, $this->cod_acervo);
     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           <TD bgcolor=#A1B3BD><B>Principal</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 = new clsPmieducarAcervoAutor($valor["ref_cod_acervo_autor"]);
             $det = $obj->detalhe();
             $nm_autor = $det["nm_autor"];
             $principal = $valor["principal"];
             if ($principal == 1) {
                 $principal = "sim";
             } else {
                 $principal = "n&atilde;o";
             }
             $tabela .= "<TR>\n\t\t\t\t\t\t\t    <TD {$color} align=left>{$nm_autor}</TD>\n\t\t\t\t\t\t\t    <TD {$color} align=left>{$principal}</TD>\n\t\t\t\t\t\t\t</TR>";
             $cont++;
         }
         $tabela .= "</TABLE>";
     }
     if ($tabela) {
         $this->addDetalhe(array("Autor", "{$tabela}"));
     }
     if ($registro["cdu"]) {
         $this->addDetalhe(array("Cdu", "{$registro["cdu"]}"));
     }
     if ($registro["cutter"]) {
         $this->addDetalhe(array("Cutter", "{$registro["cutter"]}"));
     }
     if ($registro["volume"]) {
         $this->addDetalhe(array("Volume", "{$registro["volume"]}"));
     }
     if ($registro["num_edicao"]) {
         $this->addDetalhe(array("N&uacute;mero Edic&atilde;o", "{$registro["num_edicao"]}"));
     }
     if ($registro["ano"]) {
         $this->addDetalhe(array("Ano", "{$registro["ano"]}"));
     }
     if ($registro["num_paginas"]) {
         $this->addDetalhe(array("N&uacute;mero P&aacute;ginas", "{$registro["num_paginas"]}"));
     }
     if ($registro["isbn"]) {
         $this->addDetalhe(array("ISBN", "{$registro["isbn"]}"));
     }
     $obj_permissoes = new clsPermissoes();
     if ($obj_permissoes->permissao_cadastra(598, $this->pessoa_logada, 11)) {
         $this->url_novo = "educar_acervo_cad.php";
         $this->url_editar = "educar_acervo_cad.php?cod_acervo={$registro["cod_acervo"]}";
     }
     $this->url_cancelar = "educar_acervo_lst.php";
     $this->largura = "100%";
 }
Esempio n. 6
0
 function Gerar()
 {
     if ($_POST) {
         foreach ($_POST as $campo => $val) {
             $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val;
         }
     }
     if (is_numeric($this->colecao)) {
         $this->ref_cod_acervo_colecao = $this->colecao;
     }
     if (is_numeric($this->editora)) {
         $this->ref_cod_acervo_editora = $this->editora;
     }
     if (is_numeric($this->idioma)) {
         $this->ref_cod_acervo_idioma = $this->idioma;
     }
     if (is_numeric($this->autor)) {
         $this->ref_cod_acervo_autor = $this->autor;
     }
     // primary keys
     $this->campoOculto("cod_acervo", $this->cod_acervo);
     $this->campoOculto("colecao", "");
     $this->campoOculto("editora", "");
     $this->campoOculto("idioma", "");
     $this->campoOculto("autor", "");
     $get_escola = 1;
     $escola_obrigatorio = false;
     $get_biblioteca = 1;
     $instituicao_obrigatorio = true;
     $biblioteca_obrigatorio = true;
     include "include/pmieducar/educar_campo_lista.php";
     // foreign keys
     /*$opcoes = array( "" => "Selecione" );
     		if( class_exists( "clsPmieducarExemplarTipo" ) )
     		{
     			$objTemp = new clsPmieducarExemplarTipo();
     			$lista = $objTemp->lista(null,null);
     			if ( is_array( $lista ) && count( $lista ) )
     			{
     				$tipos = "tipos = new Array();\n";
     				foreach ( $lista as $registro )
     				{
     					$tipos .= "tipos[tipos.length] = new Array( {$registro["cod_exemplar_tipo"]}, '{$registro['nm_tipo']}', {$registro['ref_cod_biblioteca']});\n";
     
     				}
     				echo "<script>{$tipos}</script>";
     			}
     		}
     		else
     		{
     			echo "<!--\nErro\nClasse clsPmieducarExemplarTipo nao encontrada\n-->";
     		}*/
     $opcoes = array("NULL" => "Selecione");
     if ($this->ref_cod_biblioteca) {
         $objTemp = new clsPmieducarExemplarTipo();
         $lista = $objTemp->lista(null, $this->ref_cod_biblioteca);
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_exemplar_tipo']}"] = "{$registro['nm_tipo']}";
             }
         }
     }
     $this->campoLista("ref_cod_exemplar_tipo", "Exemplar Tipo", $opcoes, $this->ref_cod_exemplar_tipo);
     $opcoes = array("NULL" => "Selecione");
     if ($this->ref_cod_acervo && $this->ref_cod_acervo != "NULL") {
         $objTemp = new clsPmieducarAcervo($this->ref_cod_acervo);
         $detalhe = $objTemp->detalhe();
         if ($detalhe) {
             $opcoes["{$detalhe['cod_acervo']}"] = "{$detalhe['titulo']}";
         }
     }
     //campoListaPesq( $nome, $campo, $valor, $default, $caminho="", $acao = "" , $duplo=false, $descricao="", $descricao2="", $flag=null, $pag_cadastro = null, $disabled = "", $div = false, $serializedcampos = false, $obrigatorio = false )
     //		$this->campoListaPesq( "ref_cod_acervo", "Obra Refer&ecirc;ncia", $opcoes, $this->ref_cod_acervo,"educar_pesquisa_acervo_lst.php?campo1=ref_cod_acervo","","","","","","","",true );
     $this->campoLista("ref_cod_acervo", "Obra Refer&ecirc;ncia", $opcoes, $this->ref_cod_acervo, "", false, "", "<img border=\"0\" onclick=\"pesquisa();\" id=\"ref_cod_acervo_lupa\" name=\"ref_cod_acervo_lupa\" src=\"imagens/lupa.png\"\\/>", false, false);
     $opcoes = array("" => "Selecione");
     if (class_exists("clsPmieducarAcervoColecao")) {
         $objTemp = new clsPmieducarAcervoColecao();
         $lista = $objTemp->lista();
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_acervo_colecao']}"] = "{$registro['nm_colecao']}";
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmieducarAcervoColecao nao encontrada\n-->";
         $opcoes = array("" => "Erro na geracao");
     }
     $this->campoLista("ref_cod_acervo_colecao", "Cole&ccedil;&atilde;o", $opcoes, $this->ref_cod_acervo_colecao, "", false, "", "<img id='img_colecao' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"showExpansivelImprimir(500, 200,'educar_acervo_colecao_cad_pop.php',[], 'Coleção')\" />", false, false);
     //"<img id='imgLupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_popless( 'pesquisa_funcionario_lst.php?campos=".$parametros->serializaCampos()."&importa_cpf=true&chave_campo='+/[0-9]+/.exec(this.previousSibling.previousSibling.id)[0], this.previousSibling.previousSibling.id ); \" />
     $opcoes = array("" => "Selecione");
     if (class_exists("clsPmieducarAcervoIdioma")) {
         $objTemp = new clsPmieducarAcervoIdioma();
         $lista = $objTemp->lista();
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_acervo_idioma']}"] = "{$registro['nm_idioma']}";
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmieducarAcervoIdioma nao encontrada\n-->";
         $opcoes = array("" => "Erro na geracao");
     }
     $this->campoLista("ref_cod_acervo_idioma", "Idioma", $opcoes, $this->ref_cod_acervo_idioma, "", false, "", "<img id='img_idioma' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"showExpansivelImprimir(400, 150,'educar_acervo_idioma_cad_pop.php',[], 'Idioma')\" />");
     $opcoes = array("" => "Selecione");
     if (class_exists("clsPmieducarAcervoEditora")) {
         $objTemp = new clsPmieducarAcervoEditora();
         $lista = $objTemp->lista();
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_acervo_editora']}"] = "{$registro['nm_editora']}";
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmieducarAcervoEditora nao encontrada\n-->";
         $opcoes = array("" => "Erro na geracao");
     }
     $this->campoLista("ref_cod_acervo_editora", "Editora", $opcoes, $this->ref_cod_acervo_editora, "", false, "", "<img id='img_editora' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"showExpansivelImprimir(400, 320,'educar_acervo_editora_cad_pop.php',[], 'Editora')\" />");
     //-----------------------INCLUI AUTOR------------------------//
     $this->campoQuebra();
     if ($_POST["acervo_autor"]) {
         $this->acervo_autor = unserialize(urldecode($_POST["acervo_autor"]));
     }
     if (is_numeric($this->cod_acervo) && !$_POST) {
         $obj = new clsPmieducarAcervoAcervoAutor();
         $registros = $obj->lista(null, $this->cod_acervo);
         if ($registros) {
             foreach ($registros as $campo) {
                 $aux["ref_cod_acervo_autor_"] = $campo["ref_cod_acervo_autor"];
                 $aux["principal_"] = $campo["principal"];
                 $this->acervo_autor[] = $aux;
             }
             // verifica se ja existe um autor principal
             if (is_array($this->acervo_autor)) {
                 foreach ($this->acervo_autor as $autores) {
                     if ($autores["principal_"] == 1) {
                         $this->checked = 1;
                         $this->campoOculto("checked", $this->checked);
                     }
                 }
             }
         }
     }
     unset($aux);
     if ($_POST["ref_cod_acervo_autor"]) {
         if ($_POST["principal"]) {
             $this->checked = 1;
             $this->campoOculto("checked", $this->checked);
         }
         $aux["ref_cod_acervo_autor_"] = $_POST["ref_cod_acervo_autor"];
         $aux["principal_"] = $_POST["principal"];
         $this->acervo_autor[] = $aux;
         //			echo "<pre>";print_r($this->acervo_autor);
         // verifica se ja existe um autor principal
         if (is_array($this->acervo_autor)) {
             foreach ($this->acervo_autor as $autores) {
                 if ($autores["principal_"] == 'on') {
                     $this->checked = 1;
                     $this->campoOculto("checked", $this->checked);
                 }
             }
         }
         unset($this->ref_cod_acervo_autor);
         unset($this->principal);
     }
     $this->campoOculto("excluir_autor", "");
     unset($aux);
     if ($this->acervo_autor) {
         foreach ($this->acervo_autor as $key => $autor) {
             if ($this->excluir_autor == $autor["ref_cod_acervo_autor_"]) {
                 unset($this->acervo_autor[$key]);
                 unset($this->excluir_autor);
             } else {
                 $obj_acervo_autor = new clsPmieducarAcervoAutor($autor["ref_cod_acervo_autor_"]);
                 $det_acervo_autor = $obj_acervo_autor->detalhe();
                 $nm_autor = $det_acervo_autor["nm_autor"];
                 $this->campoTextoInv("ref_cod_exemplar_tipo_{$autor["ref_cod_acervo_autor_"]}", "", $nm_autor, 30, 255, false, false, true);
                 $this->campoCheck("principal_{$autor["ref_cod_acervo_autor_"]}", "", $autor['principal_'], "<a href='#' onclick=\"getElementById('excluir_autor').value = '{$autor["ref_cod_acervo_autor_"]}'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", false, false, true);
                 $aux["ref_cod_acervo_autor_"] = $autor["ref_cod_acervo_autor_"];
                 $aux["principal_"] = $autor['principal_'];
             }
         }
     }
     $this->campoOculto("acervo_autor", serialize($this->acervo_autor));
     if (class_exists("clsPmieducarAcervoAutor")) {
         $opcoes = array("" => "Selecione");
         $objTemp = new clsPmieducarAcervoAutor();
         $objTemp->setOrderby("nm_autor ASC");
         $lista = $objTemp->lista(null, null, null, null, null, null, null, null, null, 1);
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_acervo_autor']}"] = "{$registro['nm_autor']}";
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmieducarAcervoAutor n&atilde;o encontrada\n-->";
         $opcoes = array("" => "Erro na gera&ccedil;&atilde;o");
     }
     if (is_array($this->acervo_autor)) {
         $qtd_autor = count($this->acervo_autor);
     }
     // não existe um autor principal nem autor
     if ($this->checked != 1 && (!$qtd_autor || $qtd_autor == 0)) {
         //			die("1");
         $this->campoLista("ref_cod_acervo_autor", "Autor", $opcoes, $this->ref_cod_acervo_autor, null, true, "", "", false, true);
         $this->campoCheck("principal", "&nbsp;&nbsp;<img id='img_autor' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"showExpansivelImprimir(500, 250,'educar_acervo_autor_cad_pop.php',[], 'Autor')\" /> Principal", $this->principal, "<a href='#' onclick=\"getElementById('incluir_autor').value = 'S'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bot_adiciona.gif' title='Incluir' border=0></a>");
     } else {
         if ($this->checked != 1 && $qtd_autor > 0) {
             //			echo "principal ".$this->checked;
             //			echo "is_array($this->acervo_autor)";
             //			print_r($this->acervo_autor);
             //
             //			die("2");
             $this->campoLista("ref_cod_acervo_autor", "Autor", $opcoes, $this->ref_cod_acervo_autor, null, true, null, null, null, false);
             $this->campoCheck("principal", "&nbsp;&nbsp;<img src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"pesquisa_valores_popless( 'educar_acervo_autor_cad_pop.php' )\" /> Principal", $this->principal, "<a href='#' onclick=\"getElementById('incluir_autor').value = 'S'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bot_adiciona.gif' title='Incluir' border=0></a>");
         } else {
             //			die("3");
             $this->campoLista("ref_cod_acervo_autor", "Autor", $opcoes, $this->ref_cod_acervo_autor, "", false, "", "<img src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"pesquisa_valores_popless( 'educar_acervo_autor_cad_pop.php' )\" />&nbsp;&nbsp;<a href='#' onclick=\"getElementById('incluir_autor').value = 'S'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bot_adiciona.gif' title='Incluir' border=0></a>", false, false);
         }
     }
     $this->campoOculto("incluir_autor", "");
     //		$this->campoRotulo( "bt_incluir_autor", "Autor", "<a href='#' onclick=\"getElementById('incluir_autor').value = 'S'; getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bot_incluir2.gif' title='Incluir' border=0></a>" );
     $this->campoQuebra();
     //-----------------------FIM AUTOR------------------------//
     // text
     $this->campoTexto("titulo", "T&iacute;tulo", $this->titulo, 40, 255, true);
     $this->campoTexto("sub_titulo", "Subt&iacute;tulo", $this->sub_titulo, 40, 255, false);
     $this->campoTexto("cdu", "Cdu", $this->cdu, 20, 15, false);
     $this->campoTexto("cutter", "Cutter", $this->cutter, 20, 15, false);
     $this->campoNumero("volume", "Volume", $this->volume, 20, 255, true);
     $this->campoNumero("num_edicao", "N&uacute;mero Edic&atilde;o", $this->num_edicao, 20, 255, true);
     $this->campoNumero("ano", "Ano", $this->ano, 5, 4, true);
     $this->campoNumero("num_paginas", "N&uacute;mero P&aacute;ginas", $this->num_paginas, 5, 255, true);
     $this->campoNumero("isbn", "ISBN", $this->isbn, 20, 255, true);
 }
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Obras - Detalhe";
     $this->cod_acervo = $_GET["cod_acervo"];
     $tmp_obj = new clsPmieducarAcervo($this->cod_acervo);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: educar_acervo_lst.php");
         die;
     }
     if (class_exists("clsPmieducarBiblioteca")) {
         $obj_ref_cod_biblioteca = new clsPmieducarBiblioteca($registro["ref_cod_biblioteca"]);
         $det_ref_cod_biblioteca = $obj_ref_cod_biblioteca->detalhe();
         $registro["ref_cod_biblioteca"] = $det_ref_cod_biblioteca["nm_biblioteca"];
         if (class_exists("clsPmieducarInstituicao")) {
             $registro["ref_cod_instituicao"] = $det_ref_cod_biblioteca["ref_cod_instituicao"];
             $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 (class_exists("clsPmieducarEscola")) {
             $registro["ref_cod_escola"] = $det_ref_cod_biblioteca["ref_cod_escola"];
             $obj_ref_cod_escola = new clsPmieducarEscola($registro["ref_cod_escola"]);
             $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
             $idpes = $det_ref_cod_escola["ref_idpes"];
             if ($idpes) {
                 $obj_escola = new clsPessoaJuridica($idpes);
                 $obj_escola_det = $obj_escola->detalhe();
                 $registro["ref_cod_escola"] = $obj_escola_det["fantasia"];
             } else {
                 $obj_escola = new clsPmieducarEscolaComplemento($registro["ref_cod_escola"]);
                 $obj_escola_det = $obj_escola->detalhe();
                 $registro["ref_cod_escola"] = $obj_escola_det["nm_escola"];
             }
         }
     } else {
         $registro["ref_cod_biblioteca"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarBiblioteca\n-->";
     }
     if (class_exists("clsPmieducarExemplarTipo")) {
         $obj_ref_cod_exemplar_tipo = new clsPmieducarExemplarTipo($registro["ref_cod_exemplar_tipo"]);
         $det_ref_cod_exemplar_tipo = $obj_ref_cod_exemplar_tipo->detalhe();
         $registro["ref_cod_exemplar_tipo"] = $det_ref_cod_exemplar_tipo["nm_tipo"];
     } else {
         $registro["ref_cod_exemplar_tipo"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarExemplarTipo\n-->";
     }
     if (class_exists("clsPmieducarAcervo")) {
         $obj_ref_cod_acervo = new clsPmieducarAcervo($registro["ref_cod_acervo"]);
         $det_ref_cod_acervo = $obj_ref_cod_acervo->detalhe();
         $registro["ref_cod_acervo"] = $det_ref_cod_acervo["titulo"];
     } else {
         $registro["ref_cod_acervo"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarAcervo\n-->";
     }
     if (class_exists("clsPmieducarAcervoColecao")) {
         $obj_ref_cod_acervo_colecao = new clsPmieducarAcervoColecao($registro["ref_cod_acervo_colecao"]);
         $det_ref_cod_acervo_colecao = $obj_ref_cod_acervo_colecao->detalhe();
         $registro["ref_cod_acervo_colecao"] = $det_ref_cod_acervo_colecao["nm_colecao"];
     } else {
         $registro["ref_cod_acervo_colecao"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarAcervoColecao\n-->";
     }
     if (class_exists("clsPmieducarAcervoIdioma")) {
         $obj_ref_cod_acervo_idioma = new clsPmieducarAcervoIdioma($registro["ref_cod_acervo_idioma"]);
         $det_ref_cod_acervo_idioma = $obj_ref_cod_acervo_idioma->detalhe();
         $registro["ref_cod_acervo_idioma"] = $det_ref_cod_acervo_idioma["nm_idioma"];
     } else {
         $registro["ref_cod_acervo_idioma"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarAcervoIdioma\n-->";
     }
     if (class_exists("clsPmieducarAcervoEditora")) {
         $obj_ref_cod_acervo_editora = new clsPmieducarAcervoEditora($registro["ref_cod_acervo_editora"]);
         $det_ref_cod_acervo_editora = $obj_ref_cod_acervo_editora->detalhe();
         $registro["ref_cod_acervo_editora"] = $det_ref_cod_acervo_editora["nm_editora"];
     } else {
         $registro["ref_cod_acervo_editora"] = "Erro na geracao";
         echo "<!--\nErro\nClasse nao existente: clsPmieducarAcervoEditora\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 ($nivel_usuario == 1 || $nivel_usuario == 2) {
         if ($registro["ref_cod_escola"]) {
             $this->addDetalhe(array("Escola", "{$registro["ref_cod_escola"]}"));
         }
     }
     if ($registro["ref_cod_biblioteca"]) {
         $this->addDetalhe(array("Biblioteca", "{$registro["ref_cod_biblioteca"]}"));
     }
     if ($registro["titulo"]) {
         $this->addDetalhe(array("T&iacute;tulo", "{$registro["titulo"]}"));
     }
     if ($registro["sub_titulo"]) {
         $this->addDetalhe(array("Subt&iacute;tulo", "{$registro["sub_titulo"]}"));
     }
     if ($registro["ref_cod_exemplar_tipo"]) {
         $this->addDetalhe(array("Tipo", "{$registro["ref_cod_exemplar_tipo"]}"));
     }
     if ($registro["ref_cod_acervo"]) {
         $this->addDetalhe(array("Obra Refer&ecirc;ncia", "{$registro["ref_cod_acervo"]}"));
     }
     if ($registro["ref_cod_acervo_colecao"]) {
         $this->addDetalhe(array("Cole&ccedil;&atilde;o", "{$registro["ref_cod_acervo_colecao"]}"));
     }
     if ($registro["ref_cod_acervo_idioma"]) {
         $this->addDetalhe(array("Idioma", "{$registro["ref_cod_acervo_idioma"]}"));
     }
     if ($registro["ref_cod_acervo_editora"]) {
         $this->addDetalhe(array("Editora", "{$registro["ref_cod_acervo_editora"]}"));
     }
     $obj = new clsPmieducarAcervoAcervoAutor();
     $obj->setOrderby("principal DESC");
     $lst = $obj->lista(null, $this->cod_acervo);
     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           <TD bgcolor=#A1B3BD><B>Principal</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 = new clsPmieducarAcervoAutor($valor["ref_cod_acervo_autor"]);
             $det = $obj->detalhe();
             $nm_autor = $det["nm_autor"];
             $principal = $valor["principal"];
             if ($principal == 1) {
                 $principal = "sim";
             } else {
                 $principal = "n&atilde;o";
             }
             $tabela .= "<TR>\n\t\t\t\t\t\t\t    <TD {$color} align=left>{$nm_autor}</TD>\n\t\t\t\t\t\t\t    <TD {$color} align=left>{$principal}</TD>\n\t\t\t\t\t\t\t</TR>";
             $cont++;
         }
         $tabela .= "</TABLE>";
     }
     if ($tabela) {
         $this->addDetalhe(array("Autor", "{$tabela}"));
     }
     if ($registro["estante"]) {
         $this->addDetalhe(array("Estante", "{$registro["estante"]}"));
     }
     if ($registro["cdd"]) {
         $this->addDetalhe(array("Cdd", "{$registro["cdd"]}"));
     }
     if ($registro["cdu"]) {
         $this->addDetalhe(array("Cdu", "{$registro["cdu"]}"));
     }
     if ($registro["cutter"]) {
         $this->addDetalhe(array("Cutter", "{$registro["cutter"]}"));
     }
     if ($registro["volume"]) {
         $this->addDetalhe(array("Volume", "{$registro["volume"]}"));
     }
     if ($registro["num_edicao"]) {
         $this->addDetalhe(array("N&uacute;mero Edic&atilde;o", "{$registro["num_edicao"]}"));
     }
     if ($registro["ano"]) {
         $this->addDetalhe(array("Ano", "{$registro["ano"]}"));
     }
     if ($registro["num_paginas"]) {
         $this->addDetalhe(array("N&uacute;mero P&aacute;ginas", "{$registro["num_paginas"]}"));
     }
     if ($registro["isbn"]) {
         $this->addDetalhe(array("ISBN", "{$registro["isbn"]}"));
     }
     $obj = new clsPmieducarAcervoAssunto();
     $obj = $obj->listaAssuntosPorObra($this->cod_acervo);
     if (count($obj)) {
         foreach ($obj as $reg) {
             $assuntos .= '<span style="background-color: #A1B3BD; padding: 2px;"><b>' . $reg['nome'] . '</b></span>&nbsp; ';
         }
         if (!empty($assuntos)) {
             $this->addDetalhe(array("Assuntos", "{$assuntos}"));
         }
     }
     $obj_permissoes = new clsPermissoes();
     if ($obj_permissoes->permissao_cadastra(598, $this->pessoa_logada, 11)) {
         $this->url_novo = "educar_acervo_cad.php";
         $this->url_editar = "educar_acervo_cad.php?cod_acervo={$registro["cod_acervo"]}";
     }
     $this->url_cancelar = "educar_acervo_lst.php";
     $this->largura = "100%";
     $localizacao = new LocalizacaoSistema();
     $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "In&iacute;cio", "educar_biblioteca_index.php" => "i-Educar - Biblioteca", "" => "Detalhe da obra"));
     $this->enviaLocalizacao($localizacao->montar());
 }
 function Gerar()
 {
     foreach ($_GET as $campo => $valor) {
         $this->{$campo} = $valor;
     }
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     $_SESSION["campo1"] = $_GET["campo1"] ? $_GET["campo1"] : $_SESSION["campo1"];
     $_SESSION["campo2"] = $_GET["campo2"] ? $_GET["campo2"] : $_SESSION["campo2"];
     $_SESSION["campo3"] = $_GET["campo3"] ? $_GET["campo3"] : $_SESSION["campo3"];
     session_write_close();
     $this->titulo = "Obra - Listagem";
     $this->addCabecalhos(array("Obra", "Autor", "ISBN"));
     $this->campoTexto("titulo_obra", "Obra", $this->nm_obra, 30, 255, false);
     $this->campoTexto("ref_acervo_autor", "Autor", $this->ref_acervo_autor, 30, 255, false);
     $this->campoNumero("isbn", "ISBN", $this->isbn, 15, 15, false);
     $this->ref_cod_biblioteca = $_SESSION["campo3"];
     // Paginador
     $this->limite = 20;
     $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0;
     $obj_acervo = new clsPmieducarAcervo();
     $obj_acervo->setOrderby("titulo ASC");
     $obj_acervo->setLimite($this->limite, $this->offset);
     $lista = $obj_acervo->lista(null, null, null, null, null, null, null, null, $this->titulo_obra, null, null, null, null, null, null, null, $this->isbn, null, null, null, null, 1, $this->ref_cod_biblioteca, null, null, $this->ref_acervo_autor);
     $total = $obj_acervo->_total;
     // monta a lista
     if (is_array($lista) && count($lista)) {
         foreach ($lista as $registro) {
             //				echo $registro["cod_acervo_auto"];die;
             $obj_acervo_autor = new clsPmieducarAcervoAutor($registro["cod_acervo_autor"]);
             $det_acervo_autor = $obj_acervo_autor->detalhe();
             $registro["cod_acervo_autor"] = $det_acervo_autor["nm_autor"];
             $script = " onclick=\"addVal1('{$_SESSION['campo1']}',{$registro['cod_acervo']}); addVal1('{$_SESSION['campo2']}','{$registro['titulo']}'); addVal1('cod_biblioteca','{$this->ref_cod_biblioteca}'); fecha();\"";
             $this->addLinhas(array("<a href=\"javascript:void(0);\" {$script}>{$registro["titulo"]}</a>", "<a href=\"javascript:void(0);\" {$script}>{$registro["cod_acervo_autor"]}</a>", "<a href=\"javascript:void(0);\" {$script}>{$registro["isbn"]}</a>"));
         }
     }
     $this->addPaginador2("educar_pesquisa_obra_lst.php", $total, $_GET, $this->nome, $this->limite);
     $this->largura = "100%";
 }
 function Novo()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     $obj_permissoes = new clsPermissoes();
     $obj_permissoes->permissao_cadastra(594, $this->pessoa_logada, 11, "educar_acervo_autor_lst.php");
     $obj = new clsPmieducarAcervoAutor(null, null, $this->pessoa_logada, $this->nm_autor, $this->descricao, null, null, 1, $this->ref_cod_biblioteca);
     $cadastrou = $obj->cadastra();
     if ($cadastrou) {
         $this->mensagem .= "Cadastro efetuado com sucesso.<br>";
         echo "<script>\n\t\t\t\t\tparent.document.getElementById('autor').value = '{$cadastrou}';\n\t\t\t\t\tparent.document.getElementById('tipoacao').value = '';\n\t\t\t\t\tparent.document.getElementById('formcadastro').submit();\n\t\t\t     </script>";
         die;
         return true;
     }
     $this->mensagem = "Cadastro n&atilde;o realizado.<br>";
     echo "<!--\nErro ao cadastrar clsPmieducarAcervoAutor\nvalores obrigat&oacute;rios\nis_numeric( {$this->pessoa_logada} ) && is_string( {$this->nm_autor} )\n-->";
     return false;
 }