[5307] | 1 | <?php |
---|
| 2 | |
---|
| 3 | $form = new Formulario("FrmCadListagem"); |
---|
| 4 | |
---|
| 5 | $acao = $_POST['FrmCadListagem_acao']; |
---|
| 6 | if ($acao == "") { $acao = $_GET['acao']; } |
---|
| 7 | $lstoid = $_POST['lstoid']; |
---|
| 8 | if ($lstoid == "") { $lstoid = $_GET['lstoid']; } |
---|
| 9 | |
---|
| 10 | $lstnome = $_POST['lstnome']; |
---|
| 11 | |
---|
| 12 | //FORMULï¿œRIO DE PESQUISA |
---|
| 13 | $form->setAction($BASE_URL); |
---|
| 14 | $form->adicionarCampo("lstnome","lstnome","Procurar por:","Procurar Por",$lstnome,false); |
---|
| 15 | $form->adicionarQuadro("quadro1","Pesquisa"); |
---|
| 16 | $form->adicionarSubmit("quadro1","btn_pesquisar","Pesquisar","pesquisar"); |
---|
| 17 | $form->adicionarSubmit("quadro1","btn_novo","Novo","editar"); |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | if ($form->isSubmit("pesquisar")) { |
---|
| 21 | //LISTAGEM |
---|
| 22 | $sql = "select |
---|
| 23 | lstoid, |
---|
| 24 | lstidlistagem, |
---|
| 25 | lstnome, |
---|
| 26 | lstdescricao, |
---|
| 27 | lstexclusao |
---|
| 28 | from |
---|
| 29 | listagem.listagem |
---|
| 30 | where |
---|
| 31 | lstnome ilike '%$lstnome%' or |
---|
| 32 | lstdescricao ilike '%$lstnome%' or |
---|
| 33 | lstidlistagem ilike '%$lstnome%' |
---|
| 34 | order by |
---|
| 35 | lstidlistagem"; |
---|
| 36 | |
---|
| 37 | $res = pg_query($conn,$sql); |
---|
| 38 | |
---|
| 39 | if ($habilitasincronizacao) { |
---|
| 40 | $addcol = "<td align='center' colspan=2><h3>Sincronizado</h3></td>"; |
---|
| 41 | $addcol .= "<td align='center'><h3>Status</h3></td>"; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | $tr .= "<table class='tableMoldura'> |
---|
| 45 | <tr class='tableSubTitulo'><td colspan=6><h2>Listagens</h2></td></tr> |
---|
| 46 | <tr class='tableTituloColunas'> |
---|
| 47 | <td><h3>ID Listagem</h3></td> |
---|
| 48 | <td><h3>Nome</h3></td> |
---|
| 49 | <td><h3>Descricao</h3></td> |
---|
| 50 | <td><h3>Visualizar</h3></td> |
---|
| 51 | $addcol |
---|
| 52 | </tr>"; |
---|
| 53 | |
---|
| 54 | $qtd = pg_num_rows($res); |
---|
| 55 | if ($qtd == 0) { $msgres = "Nenhum Resultado Encontrado."; } else { $msgres = "$qtd resultado(s) encontrado(s)."; } |
---|
| 56 | while ($listagen = pg_fetch_object($res)) { |
---|
| 57 | |
---|
| 58 | if ($habilitasincronizacao) { |
---|
| 59 | |
---|
| 60 | $xmlversao = verificaVersao(array( "$listagen->lstidlistagem" )); |
---|
| 61 | $versao = new SimpleXMLElement($xmlversao); |
---|
| 62 | |
---|
| 63 | $sincronizado = $versao->listagem[0]->sincronizado; |
---|
| 64 | |
---|
| 65 | if ($sincronizado == "1") { |
---|
| 66 | $iconsincronizado = "<img src='./images/indicadores/redondos/apf/ap01.jpg'>"; |
---|
| 67 | $linksincronizado = ""; |
---|
| 68 | } else { |
---|
| 69 | $iconsincronizado = "<img src='./images/indicadores/redondos/apf/ap03.jpg'>"; |
---|
| 70 | $linksincronizado = "<a href='" . $BASE_URL . "&acao=editar&abaMenu=sincronizar&lstoid=" . $listagen->lstoid . "'>[ Sincronizar ]</a>"; |
---|
| 71 | } |
---|
| 72 | $exclusao = $listagen->lstexclusao; |
---|
| 73 | |
---|
| 74 | if ($exclusao) { |
---|
| 75 | $iconstatus = "<span style='color:#990000;'>Inativo</span>"; |
---|
| 76 | } else { |
---|
| 77 | $iconstatus = "Ativo"; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | $addcoluna = "<td align='center'>" . $iconsincronizado . "</td><td align='center' nowrap>$linksincronizado</td>"; |
---|
| 82 | |
---|
| 83 | $addcoluna .= "<td align='center'>" . $iconstatus . "</td>"; |
---|
| 84 | |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | $class = ( $class == "tdc" ) ? "tde" : "tdc"; |
---|
| 88 | $tr .= "<tr class='$class'>"; |
---|
| 89 | $tr .= "<td><a href='" . $BASE_URL . "&acao=editar&abaMenu=cadastro&lstoid=" . $listagen->lstoid . "'>" . $listagen->lstidlistagem . "</a></td>"; |
---|
| 90 | $tr .= "<td>" . $listagen->lstnome . "</td>"; |
---|
| 91 | $tr .= "<td>" . $listagen->lstdescricao . "</td><td align='center'><a href='$BASE_URL_VIEW&idlistagem=" . $listagen->lstidlistagem . "'>[Visualizar]</a></td>$addcoluna"; |
---|
| 92 | |
---|
| 93 | $tr .= "</tr>"; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | $tr .= "<tr class='tableRodapeModelo1'><td colspan=6 align='center'><h3>$msgres</h3></td></tr>"; |
---|
| 97 | $tr .= "</table>"; |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | } |
---|
| 101 | $form->desenhar(); |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | echo $tr; |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | ?> |
---|