importar("Utilidades.FAQ.Lista.ListaPerguntaCategorias"); $tituloPagina = 'Utilidades > FAQ > Perguntas > Cadastrar'; $iTP = new IFAdmin(new Arquivos(Sistema::$adminLayoutCaminhoDiretorio . "/SistemaUtilidades/pergunta.html")); $lI = new ListaIdiomas(); if (!empty($_POST)) { $erro = ''; if (empty($_POST['titulo'])) { $erro = "<b>Titulo</b> não preenchido!<br><br>"; } if (empty($erro)) { $p = new Pergunta(); $p->titulo = $_POST['titulo']; $p->ordem = $_POST['ordem']; $p->texto = $_POST['texto']; if (!empty($_FILES['imagem']['name'])) { $p->getImagem()->setImage(new Image(Arquivos::__OpenArquivoByTEMP($_FILES['imagem']))); } $lPC = new ListaPerguntaCategorias(); $pC = $lPC->condicoes('', $_POST['categoria'], ListaPerguntaCategorias::ID)->listar(); $pC->setPergunta($p); $p->getURL()->setURL($_POST['url'] ? $_POST['url'] : $p->getId() . "-" . strtolower(Strings::__RemoveAcentos(str_replace("\"", "", str_replace("'", "", str_replace(" ", "-", $_POST['titulo'])))))); $lP = new ListaPerguntas(); $lP->alterar($p); while ($i = $lI->listar()) { $t = new Traducao(); $t->setIdConteudo($p->getId()); $t->setCampoConteudo(ListaPerguntas::TITULO); $t->setTabelaConteudo($pC->getPerguntas()->getTabela()); $t->conteudo = $p->titulo; $t->traducao = $_POST['ititulo'][$i->getId()]; $i->addTraducao($t);