function delete_on_list($id = 0) { $productcomments = new Productcomment($id); if (!$productcomments->exists()) { show_404(); } $productcomments->delete(); redirect($this->admin . 'productcomments/list_all/'); }
function getProductComment($productId) { $comment = new Productcomment(); $comment->where('product_id', $productId); $comment->order_by('creationDate', "asc"); $comment->get_iterated(); $dis3['comment'] = $comment; $dis3['base_url'] = base_url(); return $this->load->view('front/product/product_comment', $dis3, TRUE); }
function addComment($id) { $this->load->library("securimage"); $comment = new Productcomment(); $comment->title = $this->input->post('title'); $comment->content = $this->input->post('content'); $comment->email = $this->input->post('commentEmail'); $comment->name = $this->input->post('name'); $comment->creationDate = date("Y-m-d H:i:s"); $comment->likes = 0; $comment->dislikes = 0; $comment->product_id = $id; $dis['status'] = true; if ($this->securimage->check($_POST['captcha_code']) == false) { $dis['status'] = false; $dis['message'] = "Vui lòng nhập hình ảnh xác nhận"; } else { $comment->save(); } header('Content-Type: application/json'); echo json_encode($dis); //$this->firephp->log( json_encode($dis)); exit; }