<?php 

class orders extends CI_Controller {

	function orders()	 

	{  

    parent::__construct();	

    $this->load->library('session');		

    $this->load->Model('functions', 'fun');  //function in model 

    $this->load->library('pagination');

    $this->load->library('DX_Auth');	

	$this->dx_auth->check_uri_permissions();



    } 

    

	

		

	function index()

	{   

	    $this->load->model('orders_model');  /// model file name

	    	

	   //////pagination styl and config

	    $config['base_url'] = base_url().'orders/index/';

		$config['total_rows'] = $this->orders_model->get_num_orders();

		$config['per_page'] = 25;

		$config['num_links'] = 3; 

		$config['uri_segment'] = 3;	

		$config['full_tag_open']='<div class="pagination">';

		$config['full_tag_close'] = '</div>';

		$config['next_link'] = 'Next';

		$config['prev_link'] = 'Prev';

		$config['cur_tag_open'] = '<span class="current">';

		$config['cur_tag_close'] = '</span>';		

		$offset = $this->uri->segment(4,0);

		$this->session->set_userdata('offset',$offset);

		$this->pagination->initialize($config); 

		

		$this->load->view('header');

		

		//// load left and send query to creat menu

		$status='all';

		

		$menu=array();

		$menu_q= $this->fun->get_modules();

		$menu['mods']=$menu_q;

		$menu['status']=$status;

		$menu['type']='cat';

		$this->load->view('left',$menu);

		

		////// load content send query to get post 

		$data=array();

		$q=$this->orders_model->get_orders($config['per_page']);   ///////model class --->model func		

		$data['records']=$q;

	

		$data['status']=$status;

		$this->load->view('orders',$data);

		

		//$this->load->view('footer');

	}

	

	

	function view_order($id)

	{

	$this->load->model('orders_model');   

	$status='all';

	    $data=array();

	    $this->load->view('header');

	    

	    $menu=array();

		$menu_q= $this->fun->get_modules();

		$menu['mods']=$menu_q;

		$menu['status']=$status;

		$menu['type']='cat';

		$this->load->view('left',$menu);

		

		$data['status']=$status;

		$data['uid']=$id;



		

		//// get admin lang

		$lang_q= $this->fun->get_lang();

		$data['lang']=$lang_q;

		

		$this->load->view('view_order',$data);

		//$this->load->view('footer');



	}







	

	

	function delete_order($id)

	{ 	

	   // $q= $this->fun->delete_one("contact_us", $id); 

	    $q= $this->fun->delete_order("orders", $id); 

	    if($q)

	    {

	     echo "<script type=\"text/javascript\"> alert(\" Deleted successfully \") ;window.location.href= \"".base_url()."index.php/orders/\";</script>";

	    }

	    else

	    {

	    echo "<script type=\"text/javascript\"> alert(\" Dont Deleted Please Try Again \") ;window.location.href= \"".base_url()."index.php/orders/\";</script>";

	    }
	}
	
	
	
	
	
function change_status($st,$id)

	{ 	

	   // $q= $this->fun->delete_one("contact_us", $id); 
		$data=array('open'=>$st);
	    $q= $this->fun->status($data, $id); 

	    
	     echo "<script type=\"text/javascript\">window.location.href= \"".base_url()."index.php/orders/\";</script>";

	  

	   

	

	}

	

}

/* End of file welcome.php */

/* Location: ./application/controllers/welcome.php */