<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Menus extends CI_Controller {
	
	public function __construct()
    {
	    parent::__construct();
		 
	}
	  
	public function index(){
		
		$data['page_title']='Menus';
		$data['page_descri'] ='Our Menus';
		$cate_query=$this->Data_access_model->select_data('*','hs_category',array( 'category_status' =>1,));
		   
		if($cate_query->num_rows() > 0){
			$data['all_category']  = $cate_query->result();
		}else{ 
			$data['all_category'] = "";
		}
		$prod_query=$this->Data_access_model->select_data('*','hs_products',array( 'prod_status' =>1,));
		   
		if($prod_query->num_rows() > 0){
			$data['all_products']  = $prod_query->result();
		}else{ 
			$data['all_products'] = "";
		}
		
		$opening_time_query =$this->Data_access_model->select_all('hs_opening_schedule');
		if($opening_time_query->num_rows() > 0){
			   
		    $setting_data['opening_time'] =$opening_time_query->result();
			 
		}else{ 
			 $setting_data['opening_time'] = "";
		}
		
		$partner_query=$this->Data_access_model->select_data('*','hs_partners',array( 'partner_status' =>1,));
		if($partner_query->num_rows() > 0){
			   
		    $setting_data['all_partners'] =$partner_query->result();
			 
		}else{ 
			$setting_data['all_partners'] = "";
		}
		
		$occasion_query=$this->Data_access_model->select_data('*','hs_occasions',array( 'occasion_status' =>1,));
		if($occasion_query->num_rows() > 0){
			   
		    $data['all_occasion'] =$occasion_query->result();
			 
		}else{ 
			$data['all_occasion'] = "";
			  
		}
		
		$offer_query=$this->Data_access_model->select_data('*','hs_offers',array( 'offer_status' =>1,));
		if($offer_query->num_rows() > 0){
			   
		    $data['all_offer'] =$offer_query->result();
			 
		}else{ 
			$data['all_offer'] = "";
			  
		}
		
		$data['add_active'] = 3;
		$this->load->view('theme/common/header',$data);
		$this->load->view('theme/menu',$data);
		$this->load->view('theme/common/footer',$setting_data);
		
	}
	
	
	
	public function category(){
		 
		 if($this->uri->segment(3)){
			$singlecate_slug = $this->uri->segment(3);
			 
			$catedetail_query=$this->Data_access_model->select_data('*','hs_category',array('category_status' =>1, 'category_slug'=>$singlecate_slug));
			if($catedetail_query->num_rows() > 0){
				
				$data['singlecate_name']  = $catedetail_query->row_array();
				$singlecate_id = $data['singlecate_name']['category_id'];
				$cateprod_query=$this->Data_access_model->select_data('*','hs_products',array('prod_status' =>1, 'prod_cateid'=>$singlecate_id));
				if($cateprod_query->num_rows() > 0){
					$data['all_singlecate_products']  = $cateprod_query->result();
				}else{ 
					$data['all_singlecate_products'] = "";
				}
		  
			}else{ 
				$data['singlecate_name'] = "";
			} 
		}
		 
		$opening_time_query =$this->Data_access_model->select_all('hs_opening_schedule');
		if($opening_time_query->num_rows() > 0){
			$setting_data['opening_time'] =$opening_time_query->result();
		}else{ 
			$setting_data['opening_time'] = "";
		}
			
		$partner_query=$this->Data_access_model->select_data('*','hs_partners',array( 'partner_status' =>1,));
		if($partner_query->num_rows() > 0){
			
			$setting_data['all_partners'] =$partner_query->result();
			 
		}else{ 
			$setting_data['all_partners'] = "";
			  
		}
		
		$occasion_query=$this->Data_access_model->select_data('*','hs_occasions',array( 'occasion_status' =>1,));
		if($occasion_query->num_rows() > 0){
			   
		    $data['all_occasion'] =$occasion_query->result();
			 
		}else{ 
			$data['all_occasion'] = "";
		}
		
		$prod_query=$this->Data_access_model->select_data('*','hs_products',array( 'prod_status' =>1,));
		if($prod_query->num_rows() > 0){
			$data['all_products']  = $prod_query->result();
		}
		else{ 
			$data['all_products'] = "";
		}
		
		$offer_query=$this->Data_access_model->select_data('*','hs_offers',array( 'offer_status' =>1,));
		if($offer_query->num_rows() > 0){
			   
		    $data['all_offer'] =$offer_query->result();
			 
		}else{ 
			$data['all_offer'] = "";
		}
		$data['page_title']='Menus - Category';
		$data['page_descri'] ='Menus Category';
		$data['add_active'] = 3;
		$this->load->view('theme/common/header',$data);
		$this->load->view('theme/singlecate_products',$data);
		$this->load->view('theme/common/footer',$setting_data);
	}
	
}