AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.103
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/public_html/lrsys_projetos/sopizzas/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/models/reward_model.php
<?php
Class reward_model extends CI_Model {

function get_reward_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_rewards', $data_up);

        if($this->session->userdata('logged_in_restaurant')){
            $session_data = $this->session->userdata('logged_in_restaurant');
            $partner_id = $session_data['id'];
        }else{
            $partner_id = 0; 
        }
        

        $this->db->select('*');
        $this->db->from('rt_rewards');
        $this->db->where('partner_id', $partner_id);
        if ($action == '1' || $action == '0') {
        	$this->db->where('status', $action);
        }
        $this->db->order_by('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 isRewardExist($id = 0, $redemption_code, $partner_id) {
        $this->db->select('*');
        $this->db->from('rt_rewards');
        if ($id > 0) {
            $this->db->where('id !=', $id);
        }
        $this->db->where('partner_id', $partner_id);
        $this->db->where('redemption_code', $redemption_code);
        $query = $this->db->get();
        return ($query->num_rows() > 0)?TRUE:FALSE;
    }
    function isPartnerNameExist($id = 0, $partner_name) {
        $this->db->select('*');
        $this->db->from('rt_reward_partner');
        if ($id > 0) {
            $this->db->where('id !=', $id);
        }
        $this->db->where('partner_name', $partner_name);
        $query = $this->db->get();
        return ($query->num_rows() > 0)?TRUE:FALSE;
    }
    function get_rewards_list($params = array(), $action = '',$action2 =0)
    {
        /*1 =>Active
        0=>Deactive<
        2=>Addons Name A to Z
        3=>Addons Name Z to A
        4=>Category Name A to Z
        5=>Category Name Z to A  */
        $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_rewards', $data_up);

        $this->db->select('rt_reward_partner.partner_name,   rt_rewards.*');
        $this->db->from('rt_rewards');
        $this->db->join('rt_reward_partner','rt_reward_partner.id=rt_rewards.partner_id', "LEFT");

        if ($action == '1' || $action == '0') {
            $this->db->where('rt_rewards.status', $action);
        }
        else if ($action == '2') {
            $this->db->order_by('rt_reward_partner.partner_name', 'ASC');
        }
        else if ($action == '3') {
            $this->db->order_by('rt_reward_partner.partner_name', 'DESC');
        }
        else {
            $this->db->order_by('id', 'DESC');
        }

        if($action2>0){
            $this->db->where('rt_rewards.partner_id', $action2);
        }

        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();
        //echo $this->db->last_query();
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }
    function get_partner_list($params = array(), $action = '',$action2 =0)
    {
        /*1 =>Active
        0=>Deactive<
        2=>Addons Name A to Z
        3=>Addons Name Z to A
        4=>Category Name A to Z
        5=>Category Name Z to A*/
        $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_rewards', $data_up);

        $this->db->select('*');
        $this->db->from('rt_reward_partner');

        if ($action == '1' || $action == '0') {
            $this->db->where('status', $action);
        }
        else if ($action == '2') {
            $this->db->order_by('partner_name', 'ASC');
        }
        else if ($action == '3') {
            $this->db->order_by('partner_name', 'DESC');
        }
        else {
            $this->db->order_by('id', 'DESC');
        }

        if($action2 > 0){
            $this->db->where('id', $action2);
        }

        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();
        //echo $this->db->last_query();
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }
    function RewardsStatistics($status='')
    {
        $this -> db -> select('*');
        $this -> db -> from('rt_rewards');
        if($status!='') { $this -> db -> where('status',$status);  }
        $query = $this -> db -> get();
        return $query->num_rows();
    }
    function PartnerStatistics($status='')
    {
        $this -> db -> select('*');
        $this -> db -> from('rt_reward_partner');
        if($status!='') { $this -> db -> where('status',$status);  }
        $query = $this -> db -> get();
        return $query->num_rows();
    }
    function RewardPartnerList($condition = '')
    {
        $is_active = 1;
        $this->db->select('*');
        $this->db->from('rt_reward_partner');
        if ($condition == 'all') {
            $this->db->where(' order by partner_name ASC');
        }
        else {
            $this->db->where('status = ' . "'" . $is_active . "'".' order by partner_name ASC');
        }
        $query = $this->db->get();
        //print_r($query->result());

        if ($query->num_rows() > 0)
        {
            return $query->result();
        }
        return false;
    }
    function get_reward_partner_list($params = array(), $action = '',$action2='')
    {
        $this->db->select('*');
        $this->db->from('rt_cuisine');
        if ($action == '1' || $action == '0') {
            $this->db->where('cuisine_status', $action);
        }
        else if ($action == '19') {
            $this->db->order_by('cuisine_name', 'ASC');
        }
        else if ($action == '91') {
            $this->db->order_by('cuisine_name', 'DESC');
        }
        else {
            $this->db->order_by('cuisine_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;
    }

}

Anon7 - 2022
AnonSec Team