public function resgatarObjetos(&$a) { if (!empty($a[self::URL])) { $lU = new ListaURLs(); $lU->condicoes('', $a[self::URL], ListaURLs::ID); if ($lU->getTotal() > 0) { $a[self::URL] = $lU->listar(); } else { $a[self::URL] = new URL(); } } else { $a[self::URL] = new URL(); } $valor = !empty($a[self::TEXTO]) ? (int) $a[self::TEXTO] : 0; if (!empty($valor)) { $lT = new ListaTextos(); $lT->condicoes('', $a[self::TEXTO], ListaTextos::ID); if ($lT->getTotal() > 0) { $a[self::TEXTO] = $lT->listar(); } else { $a[self::TEXTO] = new Texto(); } } elseif (!empty($a[self::TEXTO]) && is_int($a[self::TEXTO])) { $a[self::TEXTO] = new Texto(); } }
<?php importar("Geral.Lista.ListaTextos"); $tituloPagina = 'Utilidades > Textos'; $ILT = new IFAdmin(new Arquivos(Sistema::$adminLayoutCaminhoDiretorio . "/SistemaUtilidades/listarTextos.html")); $ILT->trocar("linkDeletar.Texto", "?p=" . $_GET['p'] . "&a=" . $_GET['a'] . "&"); $ILT->trocar("linkBuscar.Texto", "?p=" . $_GET['p'] . "&"); if (!empty($_GET['deletar'])) { $lT = new ListaTextos(); $lT->condicoes('', $_GET['deletar'], ListaTextos::ID); if ($lT->getTotal() > 0) { try { $lT->deletar($lT->listar()); $javaScript .= Aviso::criar("Texto removido com sucesso!"); } catch (Exception $e) { $javaScript .= Aviso::criar($e->getMessage()); } } } $lT = new ListaTextos(); $ILT->createRepeticao("repetir->Textos"); if (!empty($_GET['busca'])) { $lT->condicoes('', "%" . $_GET['busca'] . "%", 'empresa', 'LIKE'); } $ILT->condicao("condicaoBusca", !empty($_SESSION['nivel'])); $ILT->trocar("linkCadastrar.Texto", "?p=" . $_GET['p'] . "&a=cadastrarTexto"); $a[1] = array('campo' => Lista::URL, 'valor' => '', 'operador' => '<>'); $lT->condicoes($a); while ($tx = $lT->listar("ASC", ListaTextos::TITULO)) { $ILT->repetir(); $ILT->enterRepeticao()->condicao("condicaoRemover", !empty($_SESSION['nivel']));