|
Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/mesinpolesshinemate.com/application/controllers/admin/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Product_review extends Admin_Controller {
function __construct() {
parent::__construct();
}
//this is to list all product_review
public function index() {
//pagination in action. 50 results per page
$this->load->library('pagination');
$config['base_url'] = base_url() . 'admin/product_review/index';
$this->db->select('id_product_review')->from('product_review');
$review_count = $this->db->get()->num_rows();
$config['total_rows'] = $review_count;
$config['per_page'] = 50;
$config["uri_segment"] = 4;
$config['num_tag_open'] = '<span style="padding-left:10px; padding-right:10px">';
$config['num_tag_close'] = '</span>';
$this->pagination->initialize($config);
$this->db->select('*')->from('product_review')->order_by('review_date', 'DESC')->limit($config["per_page"], $this->uri->segment(4));
$this->data['product_review'] = $this->db->get()->result();
//load view
$this->data['subview'] = 'admin/product_review/index';
$this->load->view('admin/templates/header', $this->data_header);
$this->load->view('admin/_layout_main', $this->data);
$this->load->view('admin/templates/footer');
}
//to delete a product review
public function delete($id = NULL) {
if ($id == NULL) { show_404(); }
//check if id exist. If not exist, show 404.
$this->db->select('id_product_review')->from('product_review')->where('id_product_review', $id);
$count = $this->db->get()->num_rows();
if ($count == 0) { show_404(); }
//delete product review
$this->db->delete('product_review', array('id_product_review' => $id));
$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Product Review Delete Successful</p>');
redirect('admin/product_review');
}
}