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çã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ício", "educar_biblioteca_index.php" => "i-Educar - Biblioteca", "" => "Listagem de autores")); $this->enviaLocalizacao($localizacao->montar()); }
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ê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çã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ão encontrada\n-->"; $opcoes = array("" => "Erro na geraçã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", " <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", " <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' )\" /> <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ítulo", $this->titulo, 40, 255, true); $this->campoTexto("sub_titulo", "Subtí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úmero Edicão", $this->num_edicao, 20, 255, true); $this->campoNumero("ano", "Ano", $this->ano, 5, 4, true); $this->campoNumero("num_paginas", "Número Páginas", $this->num_paginas, 5, 255, true); $this->campoNumero("isbn", "ISBN", $this->isbn, 20, 13, false); }
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ência", $opcoes, $this->ref_cod_acervo,"educar_pesquisa_acervo_lst.php?campo1=ref_cod_acervo","","","","","","","",true ); $this->campoLista("ref_cod_acervo", "Obra Referê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çã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ão encontrada\n-->"; $opcoes = array("" => "Erro na geraçã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", " <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", " <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' )\" /> <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ítulo", $this->titulo, 40, 255, true); $this->campoTexto("sub_titulo", "Subtí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úmero Edicão", $this->num_edicao, 20, 255, true); $this->campoNumero("ano", "Ano", $this->ano, 5, 4, true); $this->campoNumero("num_paginas", "Número Páginas", $this->num_paginas, 5, 255, true); $this->campoNumero("isbn", "ISBN", $this->isbn, 20, 255, true); }