public function listar($ordem = "ASC", $campo = self::ID) { $info = parent::listar($ordem, $campo); if (!empty($info)) { $temp = new Slide($info[self::ID]); parent::resgatarObjetos($info); $temp->titulo = $info[self::TITULO]; $temp->legenda = $info[self::LEGENDA]; $temp->enderecoURL = $info[self::ENDERECOURL]; $temp->ativo = $info[self::ATIVO] == self::VALOR_ATIVO_TRUE ? true : false; $temp->tipo = $info[self::TIPO]; $temp->segundos = $info[self::SEGUNDOS]; $temp->corfundo = $info[self::CORFUNDO]; $temp->ordem = $info[self::ORDEM]; if (!empty($info[self::IMAGEM])) { $temp->setImagem(new Image(new Arquivos(Sistema::$caminhoURL . Sistema::$caminhoDataSlides . $info[self::IMAGEM]))); } $temp->setFlash($info[self::FLASH]); return $temp; } }
$s = new Slide(); $s->titulo = $_POST['titulo']; $s->enderecoURL = $_POST['enderecoURL']; $s->tipo = $_POST['tipo']; $s->legenda = $_POST['legenda']; $s->segundos = $_POST['segundos']; $s->corfundo = $_POST['corfundo']; $s->ordem = $_POST['ordem']; $s->ativo = $_POST['ativo'] == ListaSlides::VALOR_ATIVO_TRUE ? true : false; if (!empty($_FILES['flash']['name'])) { $arq = Arquivos::__OpenArquivoByTEMP($_FILES['flash']); $arq->saveArquivo(Sistema::$caminhoDiretorio . Sistema::$caminhoDataSlides); $s->setFlash($_FILES['flash']['name']); } if (!empty($_FILES['imagem']['name'])) { $s->setImagem(new Image(Arquivos::__OpenArquivoByTEMP($_FILES['imagem']))); } $lS = new ListaSlides(); $lS->inserir($s); while ($i = $lI->listar()) { $t = new Traducao(); $t->setIdConteudo($s->getId()); $t->setCampoConteudo(ListaSlides::TITULO); $t->setTabelaConteudo($lS->getTabela()); $t->conteudo = $s->titulo; $t->traducao = $_POST['ititulo'][$i->getId()]; $i->addTraducao($t); $t->setCampoConteudo(ListaSlides::LEGENDA); $t->conteudo = $s->legenda; $t->traducao = $_POST['ilegenda'][$i->getId()]; $i->addTraducao($t);