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/kanvakanva.com/public_html/application/controllers/ |
Upload File : |
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Review extends Public_Controller { public function __construct() { parent::__construct(); $this->load->model('customer_m'); } public function index() { if ($this->input->get('post_rating') == null) { show_404(); } $orders_id = $this->input->get("orders_id"); $item_id = $this->input->get("item_id"); $data = array( 'orders_id' => $this->input->get("orders_id"), 'item_id' => $this->input->get("item_id"), 'rating' => $this->input->get("rating"), 'ulasan' => $this->input->get("ulasan"), ); $this->db->select('id_rating')->from('rating') ->where('orders_id', (int) $orders_id) ->where('item_id', (int) $item_id); $cek = $this->db->get()->num_rows(); if($cek == 0){ $this->db->insert('rating', $data); $this->db->select('customer_id'); $this->db->from('orders'); $this->db->where('id_orders', $orders_id); $id_customer = $this->db->get()->row('customer_id'); /* ------- GET POINT ------- */ $this->db->select('review'); $this->db->from('reward_config'); $this->db->where('id_reward_config', '1'); $reward = $this->db->get()->row(); $review_reward = $reward->review; /* ------ SIGN UP REWARD ------- */ if($review_reward > 0){ $data_point = array( 'orders_id' => $orders_id, 'item_id' => $item_id, 'id_customers' => $id_customer, 'title' => "Review Product Reward", 'point' => $review_reward, 'created_at' => date("Y-m-d H:i:s") ); $this->db->insert('get_point', $data_point); $point = $this->customer_m->get_point($id_customer); $data_cust = array( 'point' => $point + $review_reward ); $this->db->where('id_customers', $id_customer); $this->db->update('customers', $data_cust); } }else{ $this->db->where('orders_id', (int) $orders_id); $this->db->where('item_id', (int) $item_id); $this->db->update('rating', $data); } redirect(base_url().'review/success_review'); } function success_review(){ $this->db->select('browser_title, meta_description, meta_keywords')->from('configuration')->where('id_configuration', 1); $website_name = $this->db->get()->row(); $this->data_header['browser_title'] = $website_name->browser_title; $this->data_header['meta_description'] = $website_name->meta_description; $this->data_header['meta_keywords'] = $website_name->meta_keywords; $this->load->view('template/header', $this->data_header); $this->load->view('review_success'); $this->load->view('template/footer', $this->data_footer); } }