| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/www/lrsys_projetos/sopizzas/application/models/ |
Upload File : |
<?php
Class coupon_model extends CI_Model {
function get_coupon_list_for_restaurant($params = array(), $action = '',$action2 =0,$get_category_list=0)
{
$today = date('Y-m-d');
$data_up = array('status' => '0');
$this->db->where('offer_valid_from >', $today);
$this->db->or_where('offer_valid_to <', $today);
$this->db->update('rt_restaurant_offer', $data_up);
if($this->session->userdata('logged_in_restaurant')){
$session_data = $this->session->userdata('logged_in_restaurant');
$restaurant_id = $session_data['id'];
}else{
$restaurant_id = 0;
}
$this->db->select('*');
$this->db->from('rt_restaurant_offer');
$this->db->where('restaurant_id', $restaurant_id);
if ($action == '1' || $action == '0') {
$this->db->where('status', $action);
}
$this->db->order_by('offer_id', 'DESC');
if(array_key_exists("start",$params) && array_key_exists("limit",$params)){
$this->db->limit($params['limit'],$params['start']);
}elseif(!array_key_exists("start",$params) && array_key_exists("limit",$params)){
$this->db->limit($params['limit']);
}
$query = $this->db->get();
return ($query->num_rows() > 0)?$query->result_array():FALSE;
}
function isCouponExist($offer_id = 0, $coupon_code, $restaurant_id) {
$this->db->select('*');
$this->db->from('rt_restaurant_offer');
if ($offer_id > 0) {
$this->db->where('offer_id !=', $offer_id);
}
$this->db->where('restaurant_id', $restaurant_id);
$this->db->where('coupon_code', $coupon_code);
$query = $this->db->get();
return ($query->num_rows() > 0)?TRUE:FALSE;
}
}