$erro = ''; if (empty($_POST['titulo'])) { $erro = "<b>Titulo</b> não preenchido!<br><br>"; } if (empty($erro)) { $lGC = new ListaNoticiaCategorias(); $lGC->condicoes('', $_GET['categoria'], ListaNoticiaCategorias::ID); $gC = $lGC->listar(); $gC->ordem = $_POST['ordem']; $gC->getTexto()->titulo = $_POST['titulo']; $gC->getURL()->setURL($_POST['url'] ? $_POST['url'] : $gC->getId() . "-" . strtolower(Strings::__RemoveAcentos(str_replace(" ", "-", $_POST['titulo'])))); $gC->getTexto()->texto = $_POST['descricao']; if (!empty($_FILES['imagem']['name'])) { $gC->getTexto()->getImagem()->setImage(new Image(Arquivos::__OpenArquivoByTEMP($_FILES['imagem']))); } $lGC->alterar($gC); $lT = new ListaTextos(); while ($i = $lI->listar()) { $t = $i->getTraducaoById(ListaTextos::TITULO, $lGC->getTabela(), $gC->getId()); if ($t->getId()) { $t->conteudo = $gC->titulo; $t->traducao = $_POST['ititulo'][$i->getId()]; $i->getTraducoes()->alterar($t); } else { $t = new Traducao(); $t->conteudo = $gC->titulo; $t->traducao = $_POST['ititulo'][$i->getId()]; $t->setIdConteudo($gC->getId()); $t->setCampoConteudo(ListaTextos::TITULO); $t->setTabelaConteudo($lGC->getTabela()); $i->addTraducao($t);
$erro = ''; if (empty($_POST['titulo'])) { $erro = "<b>Titulo</b> não preenchido!<br><br>"; } if (empty($erro)) { $gC = new NoticiaCategoria(); $gC->ordem = $_POST['ordem']; $gC->getTexto()->titulo = $_POST['titulo']; $gC->getTexto()->texto = $_POST['descricao']; if (!empty($_FILES['imagem']['name'])) { $gC->getTexto()->getImagem()->setImage(new Image(Arquivos::__OpenArquivoByTEMP($_FILES['imagem']))); } $lB = new ListaNoticiaCategorias(); $lB->inserir($gC); $gC->getURL()->setURL($_POST['url'] ? $_POST['url'] : $gC->getId() . "-" . URL::cleanURL($_POST['titulo'])); $lB->alterar($gC); $lT = new ListaTextos(); while ($i = $lI->listar()) { $t = new Traducao(); $t->setIdConteudo($gC->getTexto()->getId()); $t->setCampoConteudo(ListaTextos::TITULO); $t->setTabelaConteudo($lT->getTabela()); $t->conteudo = $gC->getTexto()->titulo; $t->traducao = $_POST['ititulo'][$i->getId()]; $i->addTraducao($t); $t = new Traducao(); $t->setIdConteudo($gC->getTexto()->getId()); $t->setCampoConteudo(ListaTextos::TEXTO); $t->setTabelaConteudo($lT->getTabela()); $t->conteudo = $gC->getTexto()->texto; $t->traducao = $_POST['idescricao'][$i->getId()];