public function deletar(ProdutoOpcaoValor $obj) { $where = "WHERE " . self::ID . " = '" . $obj->getId() . "'"; $lPOV = new ListaProdutoOpcaoValores(); $lPOG = new ListaProdutoOpcaoGerados(); $lPOG->condicoes('', $obj->getId(), ListaProdutoOpcaoGerados::VALOR); if ($lPOG->getTotal() == 0) { Arquivos::__DeleteArquivo(Sistema::$caminhoDiretorio . Sistema::$caminhoDataProdutoOpcoes . $m->getImagem()->nome . '.' . $m->getImagem()->extensao); $this->con->deletar(Sistema::$BDPrefixo . $this->tabela, $where); $this->con->deletar(Sistema::$BDPrefixo . $lPOV->getTabela(), "WHERE " . ListProdutoOpcaoValores::OPCAO . " = '" . $obj->getId() . "'"); } else { throw new Exception('Produtos cadastrados com este valor'); } }
$t->setTabelaConteudo($lPOV->getTabela()); $i->addTraducao($t); } } $lI->setParametros(0); $javaScript .= Aviso::criar("Valor salvo com sucesso!"); } else { $javaScript .= Aviso::criar($erro); } } $lPOV = new ListaProdutoOpcaoValores(); $pOV = $lPOV->condicoes('', $_GET['valor'], ListaProdutoOpcaoValores::ID)->listar(); $iAPOV->trocar("valor", $pOV->valor); $iAPOV->condicao('condicao->Cor', $pO->tipo == 2); $iAPOV->trocar("cor", $pOV->cor); $iAPOV->condicao('condicao->Imagem', $pO->tipo == 1); if ($pOV->getImagem()->nome != '') { $iAPOV->trocar("imagem", $pOV->getImagem()->showHTML(200, 200)); } $sub = "repetir->valor.ProdutoOpcaoValores.Idiomas"; $iAPOV->createRepeticao($sub); while ($i = $lI->listar()) { $iAPOV->repetir($sub); $iAPOV->enterRepeticao($sub)->trocar("valor.Idioma", $i->valor); $iAPOV->enterRepeticao($sub)->trocar("id.Idioma", $i->getId()); $iAPOV->enterRepeticao($sub)->trocar("valor.ProdutoOpcaoValor.Idioma", $i->getTraducaoById(ListaProdutoOpcaoValores::VALOR, $lPOV->getTabela(), $pOV->getId())->traducao); } $iAPOV->trocar("linkVoltar", "?p=" . $_GET['p'] . "&a=listarProdutoOpcaoValores&opcao=" . $_GET['opcao']); $iAPOV->createJavaScript(); $javaScript .= $iAPOV->javaScript->concluir(); $includePagina = $iAPOV->concluir();
if (empty($_POST['valor'])) { $erro = "<b>Valor</b> não preenchido!<br><br>"; } if (empty($erro)) { $pOV = new ProdutoOpcaoValor(); $pOV->valor = addslashes(str_replace("\"", "'", $_POST['valor'])); $pOV->cor = $_POST['cor']; if (!empty($_FILES['imagem']['name'])) { $pOV->setImagem(new Image(Arquivos::__OpenArquivoByTEMP($_FILES['imagem']))); } $lPOV->inserir($pOV, $pO); while ($i = $lI->listar()) { $t = new Traducao(); $t->setIdConteudo($pOV->getId()); $t->setCampoConteudo(ListaProdutoOpcaoValores::VALOR); $t->setTabelaConteudo($lPOV->getTabela()); $t->conteudo = $pOV->valor; $t->traducao = $_POST['ivalor'][$i->getId()]; $i->addTraducao($t); } $lI->resetCondicoes(); $lI->setParametros(0); $_POST = ''; $javaScript .= Aviso::criar("Valor salvo com sucesso!"); } else { $javaScript .= Aviso::criar($erro); } } $iCPOV->trocar("linkVoltar", "?p=" . $_GET['p'] . "&a=listarProdutoOpcaoValores&opcao=" . $_GET['opcao']); $iCPOV->trocar("valor", $_POST['valor']); $iCPOV->condicao('condicao->Cor', $pO->tipo == 2);