function delete() { $image_id = DataHandler::getValueByArrayIndex($_POST, "id"); $ReturnResultVO = new ReturnResultVO(); if ($image_id > 0) { //vai deletar $ImageVO = new ImageVO(); $ImageVO->setId($image_id, TRUE); $ImageVO->delete(); $LinkDAO = LinkDAO::getInstance(); if (FALSE) { $LinkDAO = new LinkDAO(); } $ReturnDataVO = $LinkDAO->deleteAllFromLinkedTableAndLinkedTableId("image", $image_id); $ReturnResultVO->success = $ReturnDataVO->success; if ($ReturnResultVO->success) { $ReturnResultVO->addMessage(Translation::text("Image deleted successfully.")); } else { $ReturnResultVO->addMessage(Translation::text("Error when deleting image.")); } } echo $ReturnResultVO->toJson(); exit; }
/** * * Usar: backend/client/delete_image/id.N/type.TYPE/ */ public function deleteImage() { $ReturnResultVO = new ReturnResultVO(); $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id")); $product_id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "product_id")); $galleryType = $this->getGalleryType(); if ($id > 0) { $LinkDAO = new LinkDAO(); $ReturnDataVO = $LinkDAO->deleteAllFromLinkedTableAndLinkedTableId($galleryType, $id); $ReturnResultVO->success = $ReturnDataVO->success; //n√£o est√° tratando o tipo de erro } else { $ReturnResultVO->addMessage(Translation::text("id?")); } $this->updatePdf($product_id); Navigation::redirect("backend/client/gallery/type.{$galleryType}/id.{$product_id}/#listview"); exit; }
/** * * Usar: backend/product/delete_file/id.N/type.TYPE/ */ public function deleteFile() { $ReturnResultVO = new ReturnResultVO(); $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id")); $product_id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "product_id")); if ($id > 0) { $LinkDAO = new LinkDAO(); $ReturnDataVO = $LinkDAO->deleteAllFromLinkedTableAndLinkedTableId("file", $id); $ReturnResultVO->success = $ReturnDataVO->success; //n√£o est√° tratando o tipo de erro } else { $ReturnResultVO->addMessage(Translation::text("id?")); } Navigation::redirect("backend/product/file/id.{$product_id}/"); //echo $ReturnResultVO->toJson(); exit; }