public function albumPhotoDeleteAction() { $this->_helper->layout()->disableLayout(); $objModelAlbumPhotoTag = new Album_Model_AlbumPhotoTag(); $objModelAlbumPhoto = new Album_Model_AlbumPhoto(); $objModelVote = new Application_Model_Vote(); $objModelComment = new Application_Model_Comment(); $arrPostVal = $this->getRequest()->getParams(); $photoId = $arrPostVal['photoId']; $albumId = !empty($arrPostVal['id']) ? $arrPostVal['id'] : ""; $page = !empty($arrPostVal['page']) ? $arrPostVal['page'] : ""; /*----------------- GET PHOTO NAME --------------------------------*/ $valPhoto = $objModelAlbumPhoto->find($photoId); $photoName = $valPhoto->getName(); /*----------------- REMOVE PHOTO DETAIL ---------------------------*/ $whereAlbumPhotoTag = "photo_id='{$photoId}'"; $whereComment = "item_type='photo_comment' AND item_id='{$photoId}'"; $whereVote = "item_type='album_photo' AND item_id='{$photoId}'"; $whereAlbumPhoto = "id='{$photoId}'"; $objModelAlbumPhotoTag->delete($whereAlbumPhotoTag); $objModelComment->delete($whereComment); $objModelVote->delete($whereVote); $objModelAlbumPhoto->delete($whereAlbumPhoto); /*---------------------- REMOVE PHOTO FROM FILE --------------------------------*/ unlink(PUBLIC_PATH . "/media/album/thumb/{$photoName}"); // Remove thumb image unlink(PUBLIC_PATH . "/media/album/custom/{$photoName}"); // Remove resized image unlink(PUBLIC_PATH . "/media/album/default/{$photoName}"); // Remove default image /*----------------------- CHECK PHOTO EXIST IN ALBUM ----------------------------*/ $whereAlbumPhotoCheck = "album_id='" . $albumId . "'"; $arrAlbumPhotoCheck = $objModelAlbumPhoto->fetchAll($whereAlbumPhotoCheck); if (count($arrAlbumPhotoCheck) > 0) { echo 'yes'; } else { echo 'no'; } /*-------------------------------------------------------------------------------*/ if ($albumId != "" && $page != "") { header("location:/album/my-photos/review-edit-image/id/{$albumId}/page/{$page}"); } exit; }
public function removeTravelWallPostCommentAction() { $this->_helper->layout->disableLayout(); $params = $this->getRequest()->getParams(); $postId = $params['postId']; $objModelVote = new Application_Model_Vote(); $objModelComment = new Application_Model_Comment(); $whereVote = "item_id='{$postId}' AND item_type='status_comment'"; $whereComment = "id='{$postId}'"; $objModelVote->delete($whereVote); $objModelComment->delete($whereComment); exit; }