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/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/menumanagement_model(ETPL).php
<?php
Class menumanagement_model extends CI_Model {

function CategoryStatistics($status='')
{
    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_category_main');
    if($restaurant_id>0)
    {
        $this->db->where('restaurant_id', $restaurant_id);
    }

	if($status!='') { $this -> db -> where('status',$status);  }
	$query = $this -> db -> get();
	return $query->num_rows();
}

function MenuStatistics($status='',$menu_popular_dish='',$menu_type='')
{
    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_menu');
    if($restaurant_id>0)
    {
        $this->db->where('restaurant_id', $restaurant_id);
    }
        
    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='')
{
    $parentid=0;
    $this -> db -> select('*');
    $this -> db -> from('rt_restaurant_addons');
    $this->db->where('rt_restaurant_addons.parentid',$parentid);
    if($status!='') { $this -> db -> where('status',$status);  }
    $query = $this -> db -> get();
    return $query->num_rows();
}



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

        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_category_main');

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

        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');
        }

       
        
           

        
        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() 
	{
	  	$is_active = 1;
		$this->db->select('*');
		$this->db->from('rt_restaurant');
		$this->db->where('restaurant_status = ' . "'" . $is_active . "'".' 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           */    
        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('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);
        }

        /*** only restaurant start ***/
        if ($restaurant_id != 0) {
            //$idArray = array(0, $restaurant_id);
            $this->db->where('rt_restaurant_menu.restaurant_id', $restaurant_id);
        }
        /*** only restaurant end ***/

        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();

        $array  =$query->result();
        ////foreach ($query as &$arrayItem)
        //{
          foreach ($array as &$object)
          {
                $is_menu_slice =  $object->sizeoption;
               if($is_menu_slice=='size'){
                    $restaurant_id = $object->restaurant_id;
                    $menu_slice_menuid= $object->id;
                    $menu_price = $this->menu_slice_price($restaurant_id,$menu_slice_menuid); 

                    $object->menu_price = $menu_price;
               }
          }
       // }
        return $array;
          ///$array1 = $array->result_object();   
        //print_r($array);
        //return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }

    function menu_slice_price($restaurant_id,$menu_slice_id) 
        {  
            $this->db->select('*');
            $this->db->from('rt_restaurant_menu_slice');
            $this->db->where('menu_slice_restaurantid',$restaurant_id);
            $this->db->where('menu_slice_menuid',$menu_slice_id);
            $query = $this->db->get();
            if ($query->num_rows() > 0) 
            {
                $price = $query->row_array();
            return $price['menu_slice_price'];
            }
            return 0;
        }

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

        $parentid=0;
        $this->db->select('rt_category_main.maincatename,rt_restaurant.restaurant_name,rt_restaurant_addons.*');
        $this->db->from('rt_restaurant_addons');
        $this->db->join('rt_category_main','rt_category_main.maincateid=rt_restaurant_addons.category_id');
        $this->db->join('rt_restaurant','rt_restaurant.restaurant_id=rt_restaurant_addons.restaurant_id');
        $this->db->where('rt_restaurant_addons.parentid',$parentid);

        if ($action == '1' || $action == '0') {
            $this->db->where('rt_restaurant_addons.status', $action);
        }
        else if ($action == '2') {
            $this->db->order_by('rt_restaurant_addons.addonsname', 'ASC');
        }
        else if ($action == '3') {
            $this->db->order_by('rt_restaurant_addons.addonsname', 'DESC');
        }
        else if ($action == '4') {
            $this->db->order_by('rt_category_main.maincatename', 'ASC');
        }
        else if ($action == '5') {
            $this->db->order_by('rt_category_main.maincatename', 'DESC');
        }
        
        else {
            $this->db->order_by('id', 'DESC');
        }

        if($action2>0){
            $this->db->where('rt_restaurant_addons.restaurant_id', $action2);
        }
        $this->db->where('rt_restaurant_addons.parentid', '0');
        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_order_list($params = array(), $action = '', $action2 =0, $action3 ='',$action4 =0)
    {
        /*1 =>Pending
        2=>In Preparation                              
        3=>Out for delivery
        4=>Delivered                               
        5=>Cancelled                           
        6=>Rejected
        7=>Missed
        8=>Restaurant Name A to Z
        9=>Restaurant Name Z to A
        10=>Email A to Z
        11=>Email Z to A
        12=>Total Price 0 to 9
        13=>Total Price 9 to 0
        14=>Order Type A to Z
        15=>Order Type Z to A
        16=>Order Number 0 to 9
        17=>Order Number 0 to 9
        18=>Order At A to Z
        19=>Order At Z to A
          */     


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

	if($action3!=''){
             $this->db->where('rt_order.usertype', $action3);
        }

        if($action4>0){
             $this->db->where('rt_order.restaurant_id', $action4);
        }


        if ($action == '1') {
            $this->db->where('rt_order.status', 'Pending');
        }
        else if ($action == '2') {
            $this->db->where('rt_order.status', 'In Preparation');
        }
        else if ($action == '3') {
            $this->db->where('rt_order.status', 'Out for delivery');
        }
        else if ($action == '4') {
            $this->db->where('rt_order.status', 'Delivered');
        }
        else if ($action == '5') {
            $this->db->where('rt_order.status', 'Cancelled');
        }
        else if ($action == '6') {
            $this->db->where('rt_order.status', 'Rejected');
        }
        else if ($action == '7') {
            $this->db->where('rt_order.status', 'Missed');
        }

        if ($action == '8') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'ASC');
        }else if($action == '9'){
            $this->db->order_by('rt_restaurant.restaurant_name', 'DESC');
        }else if($action == '10'){
            $this->db->order_by('rt_order.customeremail', 'ASC');
        }else if($action == '11'){
            $this->db->order_by('rt_order.customeremail', 'DESC');
        }else if($action == '12'){
            $this->db->order_by('rt_order.ordertotalprice', 'ASC');
        }else if($action == '13'){
            $this->db->order_by('rt_order.ordertotalprice', 'DESC');
        }else if($action == '14'){
            $this->db->order_by('rt_order.deliverytype', 'ASC');
        }else if($action == '15'){
            $this->db->order_by('rt_order.deliverytype', 'DESC');
        }else if($action == '16'){
            $this->db->order_by('rt_order.orderid', 'ASC');
        }else if($action == '17'){
            $this->db->order_by('rt_order.orderid', 'DESC');
        }else if($action == '18'){
            $this->db->order_by('rt_order.orderdate', 'ASC');
        }else if($action == '19'){
            $this->db->order_by('rt_order.orderdate', 'DESC');
        }


        if($action2>0){
            $this->db->where('rt_order.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 isCategoryExist($maincateid, $maincatename) {
        $this->db->select('*');
        $this->db->from('rt_category_main');
        $this->db->where('maincateid !=', $maincateid);
        $this->db->where('maincatename', $maincatename);
        $query = $this->db->get();
        return ($query->num_rows() > 0)?TRUE:FALSE;
    }
    function CategoryList() {
        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_category_main');
        #$this->db->where('restaurant_status', '1');
        if ($restaurant_id != 0) {
            $idArray = array(0, $restaurant_id);
            $this->db->where_in('restaurant_id', $idArray);
        }
        $query = $this->db->get();
        if ($query->num_rows() > 0) {
            return $query->result();
        }
        else {
            return false;
        }
    }
    function showEditMainAddons($id) {
        $this->db->select('*');
        $this->db->from('rt_restaurant_addons');
        $this->db->where('id', $id);
        $query = $this->db->get();
        return ($query->num_rows() > 0)?$query->row_array():FALSE;
    }
    function showEditSubAddons($id) {
        $this->db->select('*');
        $this->db->from('rt_restaurant_addons');
        $this->db->where('parentid', $id);
        $query = $this->db->get();
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }
    function deleteAddons($id) {
        $this->db->where('id', $id);
        $query = $this->db->delete('rt_restaurant_addons');
        return $query;
    }

function get_order_details($orderid)
    {
        $this->db->select('*');
        $this->db->from('rt_order');
        $this->db->where('orderid',$orderid);
        $query = $this->db->get();

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


    function get_order_kart($orderid)
    {
        $this->db->select('*');
        $this->db->from('rt_restaurant_cart');
        $this->db->where('orderid',$orderid);
        $query = $this->db->get();

        if ($query->num_rows() > 0) 
        {
        return $query->result();
        }
        return false;
    }
    function CuisineList() {
        $is_active = 1;
        $this->db->select('*');
        $this->db->from('rt_cuisine');
        $this->db->where('cuisine_status = ' . "'" . $is_active . "'".' order by cuisine_name ASC');
        $query = $this->db->get();

        if ($query->num_rows() > 0) 
        {
        return $query->result();
        }
        return false;
    }
    function fetchCatParentAddons($catid) {
        $is_active = '1';
        $this->db->select('*');
        $this->db->from('rt_restaurant_addons');
        $this->db->where('status', $is_active);
        $this->db->where('category_id', $catid);
        $this->db->where('parentid', '0');
        $this->db->order_by('addonsname', 'ASC');
        $query = $this->db->get();
        //return $query;
        if ($query->num_rows() > 0) {
            return $query->result_array();
        }
        else {
            return false;
        }
    }
    function fetchCatChildAddons($parentid) {
        $is_active = '1';
        $this->db->select('*');
        $this->db->from('rt_restaurant_addons');
        $this->db->where('status', $is_active);
        $this->db->where('parentid', $parentid);
        $this->db->order_by('addonsname', 'ASC');
        $query = $this->db->get();
        //return $query;
        if ($query->num_rows() > 0) {
            return $query->result_array();
        }
        else {
            return false;
        }
    }
    function showEditMenu($menuid) {
        $is_active = '1';
        $this->db->select('*');
        $this->db->from('rt_restaurant_menu');
        $this->db->where('id', $menuid);
        $query = $this->db->get();
        if ($query->num_rows() > 0) {
            return $query->row_array();
        }
        else {
            return false;
        }
    }
    function showEditMenuSize($menuid) {
        $is_active = '1';
        $this->db->select('*');
        $this->db->from('rt_restaurant_menu_slice');
        $this->db->where('menu_slice_menuid', $menuid);
        $this->db->order_by('menu_slice_id', 'ASC');
        $query = $this->db->get();
        if ($query->num_rows() > 0) {
            return $query->result_array();
        }
        else {
            return false;
        }
    }
    function showEditMenuParentAddon($menuid) {
        $is_active = '1';
        $this->db->select('*');
        $this->db->from('rt_restaurant_menuaddons');
        $this->db->where('menuaddons_menuid', $menuid);
        $this->db->where('addonparentid', '0');
        $this->db->order_by('menuaddons_id', 'ASC');
        $query = $this->db->get();
        if ($query->num_rows() > 0) {
            return $query->result_array();
        }
        else {
            return false;
        }
    }
    function showEditMenuChildAddon($parentid) {
        $is_active = '1';
        $this->db->select('*');
        $this->db->from('rt_restaurant_menuaddons');
        $this->db->where('addonparentid', $parentid);
        $this->db->order_by('menuaddons_id', 'ASC');
        $query = $this->db->get();
        if ($query->num_rows() > 0) {
            return $query->result_array();
        }
        else {
            return false;
        }
    }
    function deleteMenuAddons($id) {
        $this->db->where('menuaddons_id', $id);
        $query = $this->db->delete('rt_restaurant_menuaddons');
        return $query;
    }
    function deleteMenuSize($id) {
        $this->db->where('menu_slice_id', $id);
        $query = $this->db->delete('rt_restaurant_menu_slice');
        return $query;
    }

}

Anon7 - 2022
AnonSec Team