$noiDungBL = $_REQUEST['noiDungBL']; $nguoiBL = NguoiDungDAO::LayThongTinNguoiDungTheoMa($_REQUEST['user']); // tạo đối tượng $maBL = DoiTuongDAO::ThemDoiTuong('Binh luan'); if ($maBL > 0) { // nếu tạo tối tượng thành công --> thêm bình luận $binhLuan = new BinhLuanDTO(); $binhLuan->MaBL = $maBL; $binhLuan->NoiDungBL = $noiDungBL; $binhLuan->NguoiBL = $nguoiBL->MaNguoiDung; $binhLuan->DaXoa = 0; $binhLuan->DoiTuongBL = $maDoiTuong; $binhLuan->NgayBL = date('Y-m-d'); if (BinhLuanDAO::ThemBL($binhLuan)) { // nếu thêm thành công $binhLuanDto = BinhLuanDAO::LayBinhLuanTheoMaBL($maBL); $thoiGianBL = date_create($binhLuanDto->NgayBL); $gioBL = $thoiGianBL->format('H:i'); $ngayBL = $thoiGianBL->format('d-m-Y'); $soNguoiLike = 0; if ($_REQUEST['page'] == "BinhLuan_SP") { $idKQ_Like_BL = "kq_like_binhluan_sp_" . $binhLuanDto->MaBL; $funcLikeBL = "funcLike('" . $binhLuanDto->MaBL . "','" . $nguoiBL->MaNguoiDung . "','" . $idKQ_Like_BL . "','BinhLuanSP')"; } if ($_REQUEST['page'] == "BinhLuan_SK") { $idKQ_Like_BL = "kq_like_binhluan_sk_" . $binhLuanDto->MaBL; $funcLikeBL = "funcLike('" . $binhLuanDto->MaBL . "','" . $nguoiBL->MaNguoiDung . "','" . $idKQ_Like_BL . "','BinhLuanSP')"; } echo "\t\t\t\t\r\n\t\t\t\t<div class='comment-wrapper'> \t \t\r\n\t\t\t\t\t<div class='avatar'><img src='{$nguoiBL->AnhDaiDien}' width='1280' height='1024' /></div>\r\n\t\t\t\t\t<div class='content'>\r\n\t\t\t\t\t\t <div class='title-comment'>\r\n\t\t\t\t\t\t\t<span class='text-color-normal-1'>\r\n\t\t\t\t\t\t\t\t<a href='trang_ca_nhan.php?id={$nguoiBL->MaNguoiDung}'>" . $nguoiBL->UserName . "</a>\r\n\t\t\t\t\t\t\t</span> bình luận lúc {$gioBL} ngày {$ngayBL}.\r\n\t\t\t\t\t\t </div>\r\n\t\t\t\t\t\t <div class='primary-comment'>\r\n\t\t\t\t\t\t\t\t{$binhLuanDto->NoiDungBL}\r\n\t\t\t\t\t\t </div>\r\n\t\t\t\t\t\t <div class='action' id='{$idKQ_Like_BL}'>\r\n\t\t\t\t\t\t\t0 người thích <span class='text-color-normal-1 likes' onclick={$funcLikeBL} > Like </span>\r\n\t\t\t\t\t\t </div>\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t</div> \r\n\t\t\t\t\t<!--end .content-->\r\n\t\t\t\t\t<div class='button'>\r\n\t\t\t\t\t\t<span class='remove ui-icon ui-icon-close' title='Xóa'> </span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<!--end .comment-wrapper-->"; } }
<?php require_once '../class/BinhLuanDAO.php'; $maBL = $_REQUEST['maBinhLuan']; $bl = BinhLuanDAO::LayBinhLuanTheoMaBL($maBL); $res = BinhLuanDAO::XoaBL($maBL); if (!$res) { return; } else { $lstBL = BinhLuanDAO::LayDSBL_TheoMaDoiTuong($bl->DoiTuongBL); $soluong = count($lstBL); echo $soluong; }